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
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
ba47fee67b69812a638d8e87212c98725aaa657e
[ "cnt = collections.Counter(arr)\nif cnt[0] % 2 != 0:\n return False\nfor num in sorted(set(arr)):\n if cnt[num] <= 0:\n continue\n if num == 0:\n del cnt[num]\n elif num < 0:\n if num % 2 != 0 or cnt[num // 2] < cnt[num]:\n return False\n cnt[num // 2] -= cnt[num]\...
<|body_start_0|> cnt = collections.Counter(arr) if cnt[0] % 2 != 0: return False for num in sorted(set(arr)): if cnt[num] <= 0: continue if num == 0: del cnt[num] elif num < 0: if num % 2 != 0 or cnt[...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canReorderDoubled2(self, arr: List[int]) -> bool: """Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= 3 * 10^4 arr.length is even. -10^5 <= arr[i] <= 10^5 :return:""" <|body_0|> def canR...
stack_v2_sparse_classes_10k_train_001400
3,036
permissive
[ { "docstring": "Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= 3 * 10^4 arr.length is even. -10^5 <= arr[i] <= 10^5 :return:", "name": "canReorderDoubled2", "signature": "def canReorderDoubled2(self, arr: List[int]) -> bool" ...
2
stack_v2_sparse_classes_30k_train_003601
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canReorderDoubled2(self, arr: List[int]) -> bool: Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canReorderDoubled2(self, arr: List[int]) -> bool: Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def canReorderDoubled2(self, arr: List[int]) -> bool: """Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= 3 * 10^4 arr.length is even. -10^5 <= arr[i] <= 10^5 :return:""" <|body_0|> def canR...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canReorderDoubled2(self, arr: List[int]) -> bool: """Update: 20220401 Runtime: 596 ms, faster than 97.28% Memory Usage: 16.6 MB, less than 62.22% :param arr: 2 <= arr.length <= 3 * 10^4 arr.length is even. -10^5 <= arr[i] <= 10^5 :return:""" cnt = collections.Counter(arr) ...
the_stack_v2_python_sparse
src/954-ArrayofDoubledPairs.py
Jiezhi/myleetcode
train
1
d1bd666538526a5164051b8e37846b8b62aadc79
[ "if 'modifier' in kwargs:\n self.modifier = kwargs['modifier']\nelif len(args) > 2:\n self.modifier = args[2]\n args = args[:2]\nelse:\n self.modifier = lambda x: x\nif not callable(self.modifier):\n raise TypeError('modify_iter(o, modifier): modifier must be callable')\nsuper().__init__(*args)", "...
<|body_start_0|> if 'modifier' in kwargs: self.modifier = kwargs['modifier'] elif len(args) > 2: self.modifier = args[2] args = args[:2] else: self.modifier = lambda x: x if not callable(self.modifier): raise TypeError('modify_i...
An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either the iteration protocol or the sequence...
modify_iter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either...
stack_v2_sparse_classes_10k_train_001401
22,562
permissive
[ { "docstring": "__init__(o, sentinel=None, modifier=lambda x: x)", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Cache `n` modified items. If `n` is 0 or None, 1 item is cached. Each item returned by the iterator is passed through the `modify_iter.modi...
2
stack_v2_sparse_classes_30k_train_006758
Implement the Python class `modify_iter` described below. Class description: An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a ...
Implement the Python class `modify_iter` described below. Class description: An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a ...
59e1ca2f4b15ca3d1bc814330ab8ef0beb8d9af0
<|skeleton|> class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either the iteratio...
the_stack_v2_python_sparse
moldesign/utils/docparsers/google.py
maxbates/molecular-design-toolkit
train
1
530891ce0e430c68f51c74ca3a736cbc18339c37
[ "self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End')\ncollection = collection_domain.Collection.from_yaml('cid', self.YAML_CONTENT_V1)\nself.assertEqual(collection.to_yaml(), self._LATEST_YAML_CONTENT)", "self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End...
<|body_start_0|> self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End') collection = collection_domain.Collection.from_yaml('cid', self.YAML_CONTENT_V1) self.assertEqual(collection.to_yaml(), self._LATEST_YAML_CONTENT) <|end_body_0|> <|body_start_1|> self.save...
Test migration methods for yaml content.
SchemaMigrationUnitTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" <|body_0|> def test_load_from_v2(self) -> None: """Test direct loading from a v2 yaml file.""" <|b...
stack_v2_sparse_classes_10k_train_001402
48,157
permissive
[ { "docstring": "Test direct loading from a v1 yaml file.", "name": "test_load_from_v1", "signature": "def test_load_from_v1(self) -> None" }, { "docstring": "Test direct loading from a v2 yaml file.", "name": "test_load_from_v2", "signature": "def test_load_from_v2(self) -> None" }, ...
6
stack_v2_sparse_classes_30k_train_001896
Implement the Python class `SchemaMigrationUnitTests` described below. Class description: Test migration methods for yaml content. Method signatures and docstrings: - def test_load_from_v1(self) -> None: Test direct loading from a v1 yaml file. - def test_load_from_v2(self) -> None: Test direct loading from a v2 yaml...
Implement the Python class `SchemaMigrationUnitTests` described below. Class description: Test migration methods for yaml content. Method signatures and docstrings: - def test_load_from_v1(self) -> None: Test direct loading from a v1 yaml file. - def test_load_from_v2(self) -> None: Test direct loading from a v2 yaml...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" <|body_0|> def test_load_from_v2(self) -> None: """Test direct loading from a v2 yaml file.""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End') collection = collection_domain.Collection....
the_stack_v2_python_sparse
core/domain/collection_domain_test.py
oppia/oppia
train
6,172
bf066cbc17a32102c3bb2eea848caf82c68e5a8b
[ "ans = defaultdict(list)\nfor string in strs:\n count = [0] * 26\n for char in string:\n count[ord(char) - ord('a')] += 1\n ans[tuple(count)].append(string)\nreturn ans.values()", "ans = defaultdict(list)\nfor string in strs:\n ans[tuple(sorted(string))].append(string)\nreturn ans.values()" ]
<|body_start_0|> ans = defaultdict(list) for string in strs: count = [0] * 26 for char in string: count[ord(char) - ord('a')] += 1 ans[tuple(count)].append(string) return ans.values() <|end_body_0|> <|body_start_1|> ans = defaultdict(l...
Anagrams
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" <|body_0|> def group_(self, strs: List[str]) -> List[str]: """Approach: Categorize by sorted string Time ...
stack_v2_sparse_classes_10k_train_001403
1,103
no_license
[ { "docstring": "Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:", "name": "group", "signature": "def group(self, strs: List[str]) -> List[str]" }, { "docstring": "Approach: Categorize by sorted string Time Complexity: O(N log K) Space Complexity...
2
stack_v2_sparse_classes_30k_train_002208
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group(self, strs: List[str]) -> List[str]: Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return: - def group_(self, strs: List[st...
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group(self, strs: List[str]) -> List[str]: Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return: - def group_(self, strs: List[st...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" <|body_0|> def group_(self, strs: List[str]) -> List[str]: """Approach: Categorize by sorted string Time ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Anagrams: def group(self, strs: List[str]) -> List[str]: """Approach: Categorize by count Time Complexity: O(NK) Space Complexity: O(NK) :param strs: :return:""" ans = defaultdict(list) for string in strs: count = [0] * 26 for char in string: cou...
the_stack_v2_python_sparse
revisited_2021/math_and_string/group_anagrams.py
Shiv2157k/leet_code
train
1
2190faf1dba8c9a34582b93824a41e8f7d5c099b
[ "self.nodes = nodes\nself.dist = dist\nself.size = size\nself.blacklist = blacklist", "for node in self.nodes:\n if self.blacklist and node.is_in(self.blacklist):\n continue\n yield node", "candidates = deque()\nprev = None\nnode_count = 0\nfor node in self.filter_nodes():\n node_count += 1\n ...
<|body_start_0|> self.nodes = nodes self.dist = dist self.size = size self.blacklist = blacklist <|end_body_0|> <|body_start_1|> for node in self.nodes: if self.blacklist and node.is_in(self.blacklist): continue yield node <|end_body_1|> ...
GenomeSLINK
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenomeSLINK: def __init__(self, nodes, dist, size=1, blacklist=None): """Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNodes sorted by chrA, posA dist : int Maximum clustering distance. size : int Minimum cluster size. Re...
stack_v2_sparse_classes_10k_train_001404
8,944
no_license
[ { "docstring": "Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNodes sorted by chrA, posA dist : int Maximum clustering distance. size : int Minimum cluster size. Recommended to use 1 for call/variant clustering, scale up for read pair clustering...
5
stack_v2_sparse_classes_30k_train_004990
Implement the Python class `GenomeSLINK` described below. Class description: Implement the GenomeSLINK class. Method signatures and docstrings: - def __init__(self, nodes, dist, size=1, blacklist=None): Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNo...
Implement the Python class `GenomeSLINK` described below. Class description: Implement the GenomeSLINK class. Method signatures and docstrings: - def __init__(self, nodes, dist, size=1, blacklist=None): Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNo...
3214cac465ee46e531c3cf5d78258b7aba4319a4
<|skeleton|> class GenomeSLINK: def __init__(self, nodes, dist, size=1, blacklist=None): """Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNodes sorted by chrA, posA dist : int Maximum clustering distance. size : int Minimum cluster size. Re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GenomeSLINK: def __init__(self, nodes, dist, size=1, blacklist=None): """Graph-based single-linkage clustering of genomic coordinates. Parameters ---------- nodes : iterable of GSNode GSNodes sorted by chrA, posA dist : int Maximum clustering distance. size : int Minimum cluster size. Recommended to u...
the_stack_v2_python_sparse
svtk/genomeslink.py
xuefzhao/svtk
train
2
3344af935d4a3683b121094c5159c21cbc1d51bb
[ "super().__init__()\nif json is None:\n json = {}\nself._manager: 'SideBarManager' = side_bar_manager\nself.align = json.get('align', alignment)\nself.minimum_access_level = json.get('minimumAccessLevel', minimum_access_level)\nself.maximum_access_level = json.get('maximumAccessLevel', maximum_access_level)\nsel...
<|body_start_0|> super().__init__() if json is None: json = {} self._manager: 'SideBarManager' = side_bar_manager self.align = json.get('align', alignment) self.minimum_access_level = json.get('minimumAccessLevel', minimum_access_level) self.maximum_access_lev...
Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type: the item type of this class. Defaults to a BUTTON.
SideBarCard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SideBarCard: """Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type: the item type of this class. Defaults ...
stack_v2_sparse_classes_10k_train_001405
6,308
permissive
[ { "docstring": "Create a side-bar card. :param side_bar_manager: Manager object to which the button is linked. :param json: the json response to construct the :class:`SideBarButton` from :param title: visible label of the button :param icon: FontAwesome icon of the button :param uri: Uniform Resource Identifier...
2
stack_v2_sparse_classes_30k_train_004604
Implement the Python class `SideBarCard` described below. Class description: Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type:...
Implement the Python class `SideBarCard` described below. Class description: Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type:...
e8352e4d434bd5d0a5d76f7351f100d0b63f6fa8
<|skeleton|> class SideBarCard: """Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type: the item type of this class. Defaults ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SideBarCard: """Side-bar card class. Every side-bar can have one or more cards and is maintained as an object of this class. :cvar allowed_attributes: allowed additional attributed provided as options alongside the specifically allowed ones. :cvar item_type: the item type of this class. Defaults to a BUTTON."...
the_stack_v2_python_sparse
pykechain/models/sidebar/sidebar_card.py
KE-works/pykechain
train
7
401ae408ef9ecfbd03b7d9820b54d215e86c10cc
[ "tokens = SocialToken.objects.filter(app__provider=Provider.github.name).select_related('account__user')\nfor token in tokens:\n user = token.account.user\n try:\n GithubRepo.refresh_for_user(user, token)\n except Exception:\n logger.warning('Exception while refreshing GitHub repos for user',...
<|body_start_0|> tokens = SocialToken.objects.filter(app__provider=Provider.github.name).select_related('account__user') for token in tokens: user = token.account.user try: GithubRepo.refresh_for_user(user, token) except Exception: logg...
A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a project.
GithubRepo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GithubRepo: """A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a project.""" def refresh_for_all_users():...
stack_v2_sparse_classes_10k_train_001406
4,620
permissive
[ { "docstring": "Refresh the list of repos for all users with a GitHub token.", "name": "refresh_for_all_users", "signature": "def refresh_for_all_users()" }, { "docstring": "Refresh the list of repos for the user.", "name": "refresh_for_user", "signature": "def refresh_for_user(user: Use...
2
null
Implement the Python class `GithubRepo` described below. Class description: A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a projec...
Implement the Python class `GithubRepo` described below. Class description: A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a projec...
b0edf060f4cc5494eef81fce62a563bd5b4e8e31
<|skeleton|> class GithubRepo: """A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a project.""" def refresh_for_all_users():...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GithubRepo: """A GitHub repository that a user has access to. A list of GitHub repos is maintained for each user that has a linked GitHub account. This makes it much faster for users to be able to search through a list when adding a GitHub source to a project.""" def refresh_for_all_users(): """R...
the_stack_v2_python_sparse
manager/projects/models/providers.py
stencila/hub
train
31
3a9492317c2cbd0cda515731be12781491f48c79
[ "self.device = device\nself.alpha = alpha\nself.model = model.to(self.device)\nself.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad}\nself._means = {}\nself._precision_matrices = {}\nfor n, p in deepcopy(self.params).items():\n p.data.zero_()\n self._precision_matrices[n] = p.data....
<|body_start_0|> self.device = device self.alpha = alpha self.model = model.to(self.device) self.params = {n: p for n, p in self.model.named_parameters() if p.requires_grad} self._means = {} self._precision_matrices = {} for n, p in deepcopy(self.params).items(): ...
MAS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MAS: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5, n_slices=50): """MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M. and Tuytelaars, T., 2018. Memory aware synapses: Learning what (not) to forget. In P...
stack_v2_sparse_classes_10k_train_001407
3,545
no_license
[ { "docstring": "MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M. and Tuytelaars, T., 2018. Memory aware synapses: Learning what (not) to forget. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 139-154). Inputs: model : ...
3
stack_v2_sparse_classes_30k_train_006540
Implement the Python class `MAS` described below. Class description: Implement the MAS class. Method signatures and docstrings: - def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5, n_slices=50): MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrb...
Implement the Python class `MAS` described below. Class description: Implement the MAS class. Method signatures and docstrings: - def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5, n_slices=50): MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrb...
f1f9e9f4f85c7eb076e3c15e2390c9d612adabdf
<|skeleton|> class MAS: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5, n_slices=50): """MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M. and Tuytelaars, T., 2018. Memory aware synapses: Learning what (not) to forget. In P...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MAS: def __init__(self, model: nn.Module, device='cuda:0', alpha=0.5, n_slices=50): """MAS is the class for implementing the Memory-Aware-Synapses * Aljundi, R., Babiloni, F., Elhoseiny, M., Rohrbach, M. and Tuytelaars, T., 2018. Memory aware synapses: Learning what (not) to forget. In Proceedings of ...
the_stack_v2_python_sparse
utils/mas_utils/mas.py
lihr04/corel2m
train
0
c5993e3b091914994612ba76aee13b6bd3a73d8b
[ "self.assertIsNotNone(model_utils.get_weight_parameter(MaskConv2d(32, 32, 3)))\nweight_groups = model_utils.get_weight_parameter(GroupConv2d(32, 64, 3, groups=2))\nself.assertIsNotNone(weight_groups)\nself.assertIsInstance(weight_groups, torch.Tensor)\nself.assertEqual(weight_groups.shape[0], 64)\nself.assertEqual(...
<|body_start_0|> self.assertIsNotNone(model_utils.get_weight_parameter(MaskConv2d(32, 32, 3))) weight_groups = model_utils.get_weight_parameter(GroupConv2d(32, 64, 3, groups=2)) self.assertIsNotNone(weight_groups) self.assertIsInstance(weight_groups, torch.Tensor) self.assertEqua...
TestModelUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestModelUtils: def test_get_weight_parameter(self): """Check whether parameters can be get from Module.""" <|body_0|> def test_get_group_allocation(self): """Test GSP based group allocation.""" <|body_1|> def test_is_gsp_satisfied(self): """Test...
stack_v2_sparse_classes_10k_train_001408
3,864
permissive
[ { "docstring": "Check whether parameters can be get from Module.", "name": "test_get_weight_parameter", "signature": "def test_get_weight_parameter(self)" }, { "docstring": "Test GSP based group allocation.", "name": "test_get_group_allocation", "signature": "def test_get_group_allocatio...
5
stack_v2_sparse_classes_30k_train_007261
Implement the Python class `TestModelUtils` described below. Class description: Implement the TestModelUtils class. Method signatures and docstrings: - def test_get_weight_parameter(self): Check whether parameters can be get from Module. - def test_get_group_allocation(self): Test GSP based group allocation. - def te...
Implement the Python class `TestModelUtils` described below. Class description: Implement the TestModelUtils class. Method signatures and docstrings: - def test_get_weight_parameter(self): Check whether parameters can be get from Module. - def test_get_group_allocation(self): Test GSP based group allocation. - def te...
f81c417d3754102c902bd153809130e12607bd7d
<|skeleton|> class TestModelUtils: def test_get_weight_parameter(self): """Check whether parameters can be get from Module.""" <|body_0|> def test_get_group_allocation(self): """Test GSP based group allocation.""" <|body_1|> def test_is_gsp_satisfied(self): """Test...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestModelUtils: def test_get_weight_parameter(self): """Check whether parameters can be get from Module.""" self.assertIsNotNone(model_utils.get_weight_parameter(MaskConv2d(32, 32, 3))) weight_groups = model_utils.get_weight_parameter(GroupConv2d(32, 64, 3, groups=2)) self.asse...
the_stack_v2_python_sparse
gumi/model_utils_test.py
kumasento/gconv-prune
train
10
36689514b90c50c01e5ba943d41560a44b93c2d6
[ "self.current = 0\nself.accumToIndex = {}\nself.accum = []\nfor i, num in enumerate(w):\n self.current += num\n self.accum.append(self.current)\n self.accumToIndex[self.current] = i", "randomNum = random.randint(1, self.current)\nl, r = (0, len(self.accum) - 1)\nwhile l < r:\n m = (l + r) / 2\n if ...
<|body_start_0|> self.current = 0 self.accumToIndex = {} self.accum = [] for i, num in enumerate(w): self.current += num self.accum.append(self.current) self.accumToIndex[self.current] = i <|end_body_0|> <|body_start_1|> randomNum = random.ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.current = 0 self.accumToIndex = {} self.accum = [] for i, num in en...
stack_v2_sparse_classes_10k_train_001409
1,254
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
76d767ec001649b2df07aac211ac4b43b415ebdd
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.current = 0 self.accumToIndex = {} self.accum = [] for i, num in enumerate(w): self.current += num self.accum.append(self.current) self.accumToIndex[self.current] = i ...
the_stack_v2_python_sparse
leetcode528 Random Pick with Weight.py
whglamrock/leetcode_series
train
2
50d98101dde7ef8c3e746f6611041c3134fcc7d8
[ "if isinstance(tag, six.integer_types):\n try:\n tag = Tag.objects.get(pk=tag, owner=self.owner)\n except Tag.DoesNotExist:\n return\nif isinstance(tag, six.string_types):\n tname = tag\n try:\n tag = Tag(owner=self.owner, name=tag)\n tag.save()\n except IntegrityError:\n ...
<|body_start_0|> if isinstance(tag, six.integer_types): try: tag = Tag.objects.get(pk=tag, owner=self.owner) except Tag.DoesNotExist: return if isinstance(tag, six.string_types): tname = tag try: tag = Tag(ow...
Base class for taggable models; anything taggable must extend this
Taggable
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Taggable: """Base class for taggable models; anything taggable must extend this""" def tag(self, tag): """Tags this object with a tag specified by a tag name, primary key or Tag model instance""" <|body_0|> def untag(self, tag): """Untags this object from a tag s...
stack_v2_sparse_classes_10k_train_001410
10,108
permissive
[ { "docstring": "Tags this object with a tag specified by a tag name, primary key or Tag model instance", "name": "tag", "signature": "def tag(self, tag)" }, { "docstring": "Untags this object from a tag specified by a tag name, primary key or Tag model instance", "name": "untag", "signat...
3
stack_v2_sparse_classes_30k_train_004224
Implement the Python class `Taggable` described below. Class description: Base class for taggable models; anything taggable must extend this Method signatures and docstrings: - def tag(self, tag): Tags this object with a tag specified by a tag name, primary key or Tag model instance - def untag(self, tag): Untags thi...
Implement the Python class `Taggable` described below. Class description: Base class for taggable models; anything taggable must extend this Method signatures and docstrings: - def tag(self, tag): Tags this object with a tag specified by a tag name, primary key or Tag model instance - def untag(self, tag): Untags thi...
5e102935cc6166f4d8ea13051769787c47303153
<|skeleton|> class Taggable: """Base class for taggable models; anything taggable must extend this""" def tag(self, tag): """Tags this object with a tag specified by a tag name, primary key or Tag model instance""" <|body_0|> def untag(self, tag): """Untags this object from a tag s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Taggable: """Base class for taggable models; anything taggable must extend this""" def tag(self, tag): """Tags this object with a tag specified by a tag name, primary key or Tag model instance""" if isinstance(tag, six.integer_types): try: tag = Tag.objects.get...
the_stack_v2_python_sparse
tags/models.py
RossBrunton/BMAT
train
0
dc3bc04babbd05cc7879e90a99281c58e54fba3d
[ "if id is None:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects\nelif id <= 0:\n raise ValueError('id must be positive integer')\nelse:\n self.id = id\n Base.__nb_objects += 1", "if list_dictionaries is None or list_dictionaries is []:\n return '[]'\nreturn json.dumps(list_dictionaries)",...
<|body_start_0|> if id is None: Base.__nb_objects += 1 self.id = Base.__nb_objects elif id <= 0: raise ValueError('id must be positive integer') else: self.id = id Base.__nb_objects += 1 <|end_body_0|> <|body_start_1|> if list_...
This class will be the base of all other classes in project
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """This class will be the base of all other classes in project""" def __init__(self, id=None): """Assign obj id""" <|body_0|> def to_json_string(list_dictionaries): """json string rep of for instances of dicts""" <|body_1|> def save_to_file(cls...
stack_v2_sparse_classes_10k_train_001411
2,141
no_license
[ { "docstring": "Assign obj id", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "json string rep of for instances of dicts", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "writes the JSON string r...
6
stack_v2_sparse_classes_30k_train_000267
Implement the Python class `Base` described below. Class description: This class will be the base of all other classes in project Method signatures and docstrings: - def __init__(self, id=None): Assign obj id - def to_json_string(list_dictionaries): json string rep of for instances of dicts - def save_to_file(cls, li...
Implement the Python class `Base` described below. Class description: This class will be the base of all other classes in project Method signatures and docstrings: - def __init__(self, id=None): Assign obj id - def to_json_string(list_dictionaries): json string rep of for instances of dicts - def save_to_file(cls, li...
75bedbbd249be2536da5a77f6337b14c8363f1b8
<|skeleton|> class Base: """This class will be the base of all other classes in project""" def __init__(self, id=None): """Assign obj id""" <|body_0|> def to_json_string(list_dictionaries): """json string rep of for instances of dicts""" <|body_1|> def save_to_file(cls...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Base: """This class will be the base of all other classes in project""" def __init__(self, id=None): """Assign obj id""" if id is None: Base.__nb_objects += 1 self.id = Base.__nb_objects elif id <= 0: raise ValueError('id must be positive intege...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
Sainterman/holbertonschool-higher_level_programming
train
0
5f3f187ddf31b186bbf5170a857490adf1d2370a
[ "bootstrap_exp_count = 1000\nresample_count = 1000\nbound_limits = list()\nfor N in xrange(2, self.N + 1):\n samples = self.sample_generator.generate_samples(N, self.T)\n for T in range(self.T):\n m_l, m_u = self.compute_boostrap_experiment(N, samples[:, T], resample_count, bootstrap_exp_count)\n ...
<|body_start_0|> bootstrap_exp_count = 1000 resample_count = 1000 bound_limits = list() for N in xrange(2, self.N + 1): samples = self.sample_generator.generate_samples(N, self.T) for T in range(self.T): m_l, m_u = self.compute_boostrap_experiment(...
Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.
Bootstrap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experi...
stack_v2_sparse_classes_10k_train_001412
2,348
no_license
[ { "docstring": "Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experiment.", "name": "compute_mean", "signature": "def compute_mean(self)" }, { "docstring": "Performs one Bootstrap experiment. :param N: Number of samples, ...
2
stack_v2_sparse_classes_30k_train_006306
Implement the Python class `Bootstrap` described below. Class description: Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future. Method signatures and docstrings: - def compute_mean(self): Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(...
Implement the Python class `Bootstrap` described below. Class description: Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future. Method signatures and docstrings: - def compute_mean(self): Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(...
582db28c4f3251486f940f4054418cc7290f4d45
<|skeleton|> class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experiment.""" ...
the_stack_v2_python_sparse
src/main/algorithm/bootstrap.py
abhinavshaw1993/SampleBounds
train
4
6b39ff9c53a979931ce7bf0c667a608b44034da3
[ "super(CnnFnn, self).__init__()\nself.num_var = num_var\nself.kernel_size = kernel_size\nself.stride = stride\nself.cnns = nn.ModuleList([nn.Sequential(nn.Conv3d(1, 1, (1, self.kernel_size, self.kernel_size), (1, self.stride, self.stride)), nn.ReLU(inplace=True)) for i in range(self.num_var)])\nself.input_dim = inp...
<|body_start_0|> super(CnnFnn, self).__init__() self.num_var = num_var self.kernel_size = kernel_size self.stride = stride self.cnns = nn.ModuleList([nn.Sequential(nn.Conv3d(1, 1, (1, self.kernel_size, self.kernel_size), (1, self.stride, self.stride)), nn.ReLU(inplace=True)) for ...
Class for CNN model
CnnFnn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CnnFnn: """Class for CNN model""" def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): """Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate inp...
stack_v2_sparse_classes_10k_train_001413
6,027
no_license
[ { "docstring": "Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate input_dim: int -- dimension of the input for fully connected layers after apply cnn output_dim: int -- dimension of the output feature kernel_size: int -- Size of the convolving kernel srtide: int...
5
stack_v2_sparse_classes_30k_train_003338
Implement the Python class `CnnFnn` described below. Class description: Class for CNN model Method signatures and docstrings: - def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): Initilize CNN model Args: num_var: int -- numb...
Implement the Python class `CnnFnn` described below. Class description: Class for CNN model Method signatures and docstrings: - def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): Initilize CNN model Args: num_var: int -- numb...
d7e651024b07587b46497183d90934561a4839e2
<|skeleton|> class CnnFnn: """Class for CNN model""" def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): """Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate inp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CnnFnn: """Class for CNN model""" def __init__(self, num_var, input_dim, output_dim, kernel_size=9, stride=5, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001): """Initilize CNN model Args: num_var: int -- number of covariates as input, one CNN for each covariate input_dim: int -...
the_stack_v2_python_sparse
model/cnn_fnn.py
SSF-climate/SSF
train
7
d6dd6abb164353a62df9a490a4abc97dcd949888
[ "pg = getToolByName(self, 'portal_groups')\ngroup = pg.getGroupById('Programacao')\nmembers = group.getGroupMembers()\nlist = DisplayList()\nfor member in members:\n memberId = member.getMemberId()\n fullname = member.getProperty('fullname', memberId)\n list.add(memberId, fullname)\nreturn list", "list =...
<|body_start_0|> pg = getToolByName(self, 'portal_groups') group = pg.getGroupById('Programacao') members = group.getGroupMembers() list = DisplayList() for member in members: memberId = member.getMemberId() fullname = member.getProperty('fullname', member...
''
Chamada
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chamada: """''""" def getListaProgramacao(self): """Retorna a lista de usuários do grupo programacao""" <|body_0|> def getStatusOff(self): """Retorna a lista de status de Off""" <|body_1|> def getStatusCabeca(self): """Retorna a lista de stat...
stack_v2_sparse_classes_10k_train_001414
5,729
permissive
[ { "docstring": "Retorna a lista de usuários do grupo programacao", "name": "getListaProgramacao", "signature": "def getListaProgramacao(self)" }, { "docstring": "Retorna a lista de status de Off", "name": "getStatusOff", "signature": "def getStatusOff(self)" }, { "docstring": "Re...
3
stack_v2_sparse_classes_30k_train_001607
Implement the Python class `Chamada` described below. Class description: '' Method signatures and docstrings: - def getListaProgramacao(self): Retorna a lista de usuários do grupo programacao - def getStatusOff(self): Retorna a lista de status de Off - def getStatusCabeca(self): Retorna a lista de status de Cabecas
Implement the Python class `Chamada` described below. Class description: '' Method signatures and docstrings: - def getListaProgramacao(self): Retorna a lista de usuários do grupo programacao - def getStatusOff(self): Retorna a lista de status de Off - def getStatusCabeca(self): Retorna a lista de status de Cabecas ...
1a77e9f47e22b60af88cf23f492a8b47ddfd27b6
<|skeleton|> class Chamada: """''""" def getListaProgramacao(self): """Retorna a lista de usuários do grupo programacao""" <|body_0|> def getStatusOff(self): """Retorna a lista de status de Off""" <|body_1|> def getStatusCabeca(self): """Retorna a lista de stat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Chamada: """''""" def getListaProgramacao(self): """Retorna a lista de usuários do grupo programacao""" pg = getToolByName(self, 'portal_groups') group = pg.getGroupById('Programacao') members = group.getGroupMembers() list = DisplayList() for member in mem...
the_stack_v2_python_sparse
ebc/pauta/content/chamada.py
lflrocha/ebc.pauta
train
0
cc7468515370e4a4845ed45bba1746e7a3b83941
[ "super().__init__()\nsys.stdout.flush()\ntry:\n self.my_device = params['my_device']\nexcept:\n self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')\nself.config = params\nif not self.config['include_metadata']:\n self.config['other_features_size'] = 0\nif params['activation'] ==...
<|body_start_0|> super().__init__() sys.stdout.flush() try: self.my_device = params['my_device'] except: self.my_device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') self.config = params if not self.config['include_metadata']: ...
myLSTMOutputHidden
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu"...
stack_v2_sparse_classes_10k_train_001415
34,560
no_license
[ { "docstring": "IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: \"relu\", \"elu\", or \"selu\" to be applied to all dense activations vo...
2
stack_v2_sparse_classes_30k_train_003296
Implement the Python class `myLSTMOutputHidden` described below. Class description: Implement the myLSTMOutputHidden class. Method signatures and docstrings: - def __init__(self, params): IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Shoul...
Implement the Python class `myLSTMOutputHidden` described below. Class description: Implement the myLSTMOutputHidden class. Method signatures and docstrings: - def __init__(self, params): IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Shoul...
b850f7c91e16e3dacca4d3b6377c77502960dd19
<|skeleton|> class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class myLSTMOutputHidden: def __init__(self, params): """IGNORES THE INCLUDE METADATA PARAM TO FINETUNE Params are: dropout_layers: a list of dropout probabilities after each layer. Should be the same size as linear_layer_sizes. If zero or None, no dropout is applied. activation: "relu", "elu", or "selu" to...
the_stack_v2_python_sparse
common/mytorch.py
altLabs/attrib
train
1
2aee99df7590ac9a3497af616c93d882ecadc554
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
service
ImageServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageServiceServicer: """service""" def GetImageStream(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetShm(self, request, context): """Missing associated documentation comment in .proto file.""" <|...
stack_v2_sparse_classes_10k_train_001416
10,385
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetImageStream", "signature": "def GetImageStream(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetShm", "signature": "def GetShm(self, re...
2
stack_v2_sparse_classes_30k_train_006076
Implement the Python class `ImageServiceServicer` described below. Class description: service Method signatures and docstrings: - def GetImageStream(self, request, context): Missing associated documentation comment in .proto file. - def GetShm(self, request, context): Missing associated documentation comment in .prot...
Implement the Python class `ImageServiceServicer` described below. Class description: service Method signatures and docstrings: - def GetImageStream(self, request, context): Missing associated documentation comment in .proto file. - def GetShm(self, request, context): Missing associated documentation comment in .prot...
a83a60c40eda7051a73363f67cb806ad73637e7a
<|skeleton|> class ImageServiceServicer: """service""" def GetImageStream(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetShm(self, request, context): """Missing associated documentation comment in .proto file.""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImageServiceServicer: """service""" def GetImageStream(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method n...
the_stack_v2_python_sparse
sap-toolkit/sap_toolkit/generated/eval_server_pb2_grpc.py
jelasus/sap-starterkit
train
0
4d3c99df3922cb7b43e3519b589fbfc8b92bb5c7
[ "if self.step_type not in _STEP_TYPES:\n raise TypeError(f'Invalid step type {self.step_type}')\nmp_func = _STEP_TYPES[self.step_type]\naccessor = mp_func\nparams = self.params\nfunc_text = f'.{mp_func}({self._get_param_string()})'\nif self.step_type == 'pivot':\n _, func = _get_entity_and_pivot(self.entity, ...
<|body_start_0|> if self.step_type not in _STEP_TYPES: raise TypeError(f'Invalid step type {self.step_type}') mp_func = _STEP_TYPES[self.step_type] accessor = mp_func params = self.params func_text = f'.{mp_func}({self._get_param_string()})' if self.step_type ...
Pivot pipeline step class.
PipelineStep
[ "LicenseRef-scancode-generic-cla", "LGPL-3.0-only", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "ISC", "LGPL-2.0-or-later", "PSF-2.0", "Apache-2.0", "BSD-2-Clause", "LGPL-2.1-only", "Unlicense", "Python-2.0", "LicenseRef-scancode-python-cwi", "MIT", "LGPL-2.1-or-later", "GPL-2....
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineStep: """Pivot pipeline step class.""" def get_exec_step(self) -> PipelineExecStep: """Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of the pandas DataFrame accessor function params - parameters ...
stack_v2_sparse_classes_10k_train_001417
10,245
permissive
[ { "docstring": "Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of the pandas DataFrame accessor function params - parameters to be passed to the function text - the text representation of the accessor + params comment - optional com...
2
stack_v2_sparse_classes_30k_train_005308
Implement the Python class `PipelineStep` described below. Class description: Pivot pipeline step class. Method signatures and docstrings: - def get_exec_step(self) -> PipelineExecStep: Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of th...
Implement the Python class `PipelineStep` described below. Class description: Pivot pipeline step class. Method signatures and docstrings: - def get_exec_step(self) -> PipelineExecStep: Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of th...
44b1a390510f9be2772ec62cb95d0fc67dfc234b
<|skeleton|> class PipelineStep: """Pivot pipeline step class.""" def get_exec_step(self) -> PipelineExecStep: """Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of the pandas DataFrame accessor function params - parameters ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PipelineStep: """Pivot pipeline step class.""" def get_exec_step(self) -> PipelineExecStep: """Return the executable step details. Returns ------- PipelineExecStep Named tuple with the following fields accessor - the name of the pandas DataFrame accessor function params - parameters to be passed ...
the_stack_v2_python_sparse
msticpy/datamodel/pivot_pipeline.py
RiskIQ/msticpy
train
1
150526e2268e028666be9eed2338ff75ac2e6966
[ "expected_obj = self.resize_prep_start_obj\nactual_json = json.dumps(self.base_resize_prep_dict)\nactual_obj = InstanceResizePrepStart.deserialize(actual_json, 'json')\nself.assertEqual(expected_obj, actual_obj)\nself.assertFalse(actual_obj.is_empty())", "modified_dict = self.base_resize_prep_dict.copy()\nmodifie...
<|body_start_0|> expected_obj = self.resize_prep_start_obj actual_json = json.dumps(self.base_resize_prep_dict) actual_obj = InstanceResizePrepStart.deserialize(actual_json, 'json') self.assertEqual(expected_obj, actual_obj) self.assertFalse(actual_obj.is_empty()) <|end_body_0|> ...
InstanceResizePrepStartTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceResizePrepStartTest: def test_instance_resize_prep_start_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_start_missing_attribute_json(self): """Verify event missing expected attribute does no...
stack_v2_sparse_classes_10k_train_001418
5,720
permissive
[ { "docstring": "Verify that the valid event deserialized correctly", "name": "test_instance_resize_prep_start_valid_json", "signature": "def test_instance_resize_prep_start_valid_json(self)" }, { "docstring": "Verify event missing expected attribute does not deserialize", "name": "test_insta...
3
null
Implement the Python class `InstanceResizePrepStartTest` described below. Class description: Implement the InstanceResizePrepStartTest class. Method signatures and docstrings: - def test_instance_resize_prep_start_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_sta...
Implement the Python class `InstanceResizePrepStartTest` described below. Class description: Implement the InstanceResizePrepStartTest class. Method signatures and docstrings: - def test_instance_resize_prep_start_valid_json(self): Verify that the valid event deserialized correctly - def test_instance_resize_prep_sta...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class InstanceResizePrepStartTest: def test_instance_resize_prep_start_valid_json(self): """Verify that the valid event deserialized correctly""" <|body_0|> def test_instance_resize_prep_start_missing_attribute_json(self): """Verify event missing expected attribute does no...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceResizePrepStartTest: def test_instance_resize_prep_start_valid_json(self): """Verify that the valid event deserialized correctly""" expected_obj = self.resize_prep_start_obj actual_json = json.dumps(self.base_resize_prep_dict) actual_obj = InstanceResizePrepStart.deseri...
the_stack_v2_python_sparse
metatests/events/models/compute/test_instance_resize_prep.py
kurhula/cloudcafe
train
0
a8f271199e7fcc4144c26d9aa4a616c2fb8803fe
[ "super(ValidateCommitForm, self).__init__(*args, **kwargs)\nself.repository = repository\nself.request = request", "super(ValidateCommitForm, self).clean()\nvalidation_info = self.cleaned_data.get('validation_info')\nif validation_info:\n errors = []\n parent_id = self.cleaned_data.get('parent_id')\n com...
<|body_start_0|> super(ValidateCommitForm, self).__init__(*args, **kwargs) self.repository = repository self.request = request <|end_body_0|> <|body_start_1|> super(ValidateCommitForm, self).clean() validation_info = self.cleaned_data.get('validation_info') if validation...
A form for validating of DiffCommits.
ValidateCommitForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidateCommitForm: """A form for validating of DiffCommits.""" def __init__(self, repository, request=None, *args, **kwargs): """Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django....
stack_v2_sparse_classes_10k_train_001419
16,962
permissive
[ { "docstring": "Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.http.HttpRequest, optional): The HTTP request from the client. *args (tuple): Additional positional arguments to pass to the base class initia...
3
null
Implement the Python class `ValidateCommitForm` described below. Class description: A form for validating of DiffCommits. Method signatures and docstrings: - def __init__(self, repository, request=None, *args, **kwargs): Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository ag...
Implement the Python class `ValidateCommitForm` described below. Class description: A form for validating of DiffCommits. Method signatures and docstrings: - def __init__(self, repository, request=None, *args, **kwargs): Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository ag...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class ValidateCommitForm: """A form for validating of DiffCommits.""" def __init__(self, repository, request=None, *args, **kwargs): """Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ValidateCommitForm: """A form for validating of DiffCommits.""" def __init__(self, repository, request=None, *args, **kwargs): """Initialize the form. Args: repository (reviewboard.scmtools.models.Repository): The repository against which the diff is being validated. request (django.http.HttpRequ...
the_stack_v2_python_sparse
reviewboard/diffviewer/forms.py
reviewboard/reviewboard
train
1,141
03a92d81b28c99b16053ed2b71e9553298fb6e52
[ "super().__init__(data, batch_size=batch_size, epochs=epochs, input_size=input_size, blacklist=blacklist)\nself.rnd_pool_ = []\nself.rnd = RandomState(seed=random_seed)", "if not self.rnd_pool_:\n self.rnd_pool_ = self.rnd.randint(0, self.input_size - 1, self.batch_size * 10).tolist()\nreturn self.rnd_pool_.po...
<|body_start_0|> super().__init__(data, batch_size=batch_size, epochs=epochs, input_size=input_size, blacklist=blacklist) self.rnd_pool_ = [] self.rnd = RandomState(seed=random_seed) <|end_body_0|> <|body_start_1|> if not self.rnd_pool_: self.rnd_pool_ = self.rnd.randint(0, ...
Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is no different than `OrderedSampler`: ```python sampler = RandomSampler(dataset) ba...
RandomSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomSampler: """Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is no different than `OrderedSampler`: ```p...
stack_v2_sparse_classes_10k_train_001420
2,026
permissive
[ { "docstring": "Parameters ---------- data TODO batch_size : int TODO epochs : int TODO input_size : int TODO blacklist : set TODO random_seed : int TODO", "name": "__init__", "signature": "def __init__(self, data, batch_size: int=128, epochs: int=None, input_size: int=None, blacklist: set=None, random_...
2
stack_v2_sparse_classes_30k_train_006348
Implement the Python class `RandomSampler` described below. Class description: Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is n...
Implement the Python class `RandomSampler` described below. Class description: Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is n...
4d37af1713b7f166ead3459a7004748f954d336e
<|skeleton|> class RandomSampler: """Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is no different than `OrderedSampler`: ```p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomSampler: """Random sampling produces samples uniformly distributed from the input data. Individual samples are not guaranteed to be unique in the output, they can be repeated by the process of random sampling. The simplest usage of `RandomSampler` is no different than `OrderedSampler`: ```python sampler...
the_stack_v2_python_sparse
bananas/sampling/random.py
owahltinez/bananas
train
0
7b77dfe44cf236d66bcdfdb131c39d1d53c4a811
[ "opens = '([{'\ncloses = ')]}'\nparstack = Stack()\nbalance = True\nfor each in s:\n if each in '([{':\n parstack.push(each)\n elif parstack.isEmpty():\n balance = False\n else:\n top = parstack.pop()\n if opens.index(top) != closes.index(each):\n balance = False\nif ...
<|body_start_0|> opens = '([{' closes = ')]}' parstack = Stack() balance = True for each in s: if each in '([{': parstack.push(each) elif parstack.isEmpty(): balance = False else: top = parstack.p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid_stack(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> opens = '([{' closes = ')]}' parstack = Stack() ...
stack_v2_sparse_classes_10k_train_001421
1,433
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid_stack", "signature": "def isValid_stack(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid_stack(self, s): :type s: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid_stack(self, s): :type s: str :rtype: bool - def isValid(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isValid_stack(self, s): """...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def isValid_stack(self, s): """:type s: str :rtype: bool""" <|body_0|> def isValid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isValid_stack(self, s): """:type s: str :rtype: bool""" opens = '([{' closes = ')]}' parstack = Stack() balance = True for each in s: if each in '([{': parstack.push(each) elif parstack.isEmpty(): ...
the_stack_v2_python_sparse
LeetCode/String/20_Stack_valid_parentheses.py
XyK0907/for_work
train
0
cc19112ee95a9d2bf915268c7a0c35acca1869c1
[ "roman = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}\nz = 0\nfor i in range(0, len(s) - 1):\n if roman[s[i]] < roman[s[i + 1]]:\n z -= roman[s[i]]\n else:\n z += roman[s[i]]\nreturn z + roman[s[-1]]", "from __builtin__ import xrange\nroman = {'M': 1000, 'D': 500, 'C': 100...
<|body_start_0|> roman = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1} z = 0 for i in range(0, len(s) - 1): if roman[s[i]] < roman[s[i + 1]]: z -= roman[s[i]] else: z += roman[s[i]] return z + roman[s[-1]] <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def romanToInt(self, s): """:type s: str :rtype: int""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> roman = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1} ...
stack_v2_sparse_classes_10k_train_001422
1,507
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "romanToInt", "signature": "def romanToInt(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "rewrite", "signature": "def rewrite(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_005474
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def romanToInt(self, s): :type s: str :rtype: int - def rewrite(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 romanToInt(self, s): :type s: str :rtype: int - def rewrite(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def romanToInt(self, s): """:type s:...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def romanToInt(self, s): """:type s: str :rtype: int""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def romanToInt(self, s): """:type s: str :rtype: int""" roman = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1} z = 0 for i in range(0, len(s) - 1): if roman[s[i]] < roman[s[i + 1]]: z -= roman[s[i]] else: ...
the_stack_v2_python_sparse
co_ms/13_Roman_to_Integer.py
vsdrun/lc_public
train
6
03afe29e16b9302b0d6cc6f65ff195993467f874
[ "n = len(nums)\ndp = [1] * n\nfor i in range(n):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\n if dp[i] == 3:\n return True\nreturn False", "smallest = second_smallest = float('inf')\nfor num in nums:\n if num < smallest:\n ...
<|body_start_0|> n = len(nums) dp = [1] * n for i in range(n): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) if dp[i] == 3: return True return False <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) dp = [1] ...
stack_v2_sparse_classes_10k_train_001423
873
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "increasingTriplet", "signature": "def increasingTriplet(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "increasingTriplet", "signature": "def increasingTriplet(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool - def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: d...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def increasingTriplet(self, nums): """:type nums: List[int] :rtype: bool""" n = len(nums) dp = [1] * n for i in range(n): for j in range(i): if nums[i] > nums[j]: dp[i] = max(dp[i], dp[j] + 1) if dp[i...
the_stack_v2_python_sparse
0334_Increasing_Triplet_Subsequence.py
bingli8802/leetcode
train
0
84ca6ffd7994517b9735b1b6b3844aa37c67c2c6
[ "l, r = (0, len(nums) - 1)\nwhile l <= r:\n m = (l + r) // 2\n if nums[m] < target:\n l = m + 1\n else:\n r = m - 1\nif l == len(nums) or nums[l] != target:\n return [-1, -1]\nretl = l\nl, r = (0, len(nums) - 1)\nwhile l <= r:\n m = (l + r) // 2\n if nums[m] <= target:\n l = m...
<|body_start_0|> l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 if nums[m] < target: l = m + 1 else: r = m - 1 if l == len(nums) or nums[l] != target: return [-1, -1] retl = l l, r = (0, len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchRange_lowerandupperboundbinarysearch(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange_myself(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" ...
stack_v2_sparse_classes_10k_train_001424
1,649
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "searchRange_lowerandupperboundbinarysearch", "signature": "def searchRange_lowerandupperboundbinarysearch(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "...
2
stack_v2_sparse_classes_30k_train_004792
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange_lowerandupperboundbinarysearch(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange_myself(self, nums, target): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchRange_lowerandupperboundbinarysearch(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def searchRange_myself(self, nums, target): :type ...
a7916e0818b0853ec75e24724bde94c49234c7dc
<|skeleton|> class Solution: def searchRange_lowerandupperboundbinarysearch(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def searchRange_myself(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchRange_lowerandupperboundbinarysearch(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 if nums[m] < target: l = m + 1 else...
the_stack_v2_python_sparse
34.py
KevinWangTHU/LeetCode
train
0
600b474162e535fa590fe388601d73e476261085
[ "super().__init__()\nself.n_patches = int(np.prod([i / patch_size for i in img_size]))\nself.pos_embed = nn.Parameter(torch.zeros(1, self.n_patches, embed_size))\nself.patch_embed = Conv(in_channels=in_feats, out_channels=embed_size, kernel_size=patch_size, stride=patch_size)", "x = self.patch_embed(x)\nx = x.fla...
<|body_start_0|> super().__init__() self.n_patches = int(np.prod([i / patch_size for i in img_size])) self.pos_embed = nn.Parameter(torch.zeros(1, self.n_patches, embed_size)) self.patch_embed = Conv(in_channels=in_feats, out_channels=embed_size, kernel_size=patch_size, stride=patch_size...
_Embedding
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Embedding: def __init__(self, img_size, patch_size, in_feats, embed_size, Conv): """A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the input image tensor (H, W, C). patch_size (int): The size of each square patch that the image is divided...
stack_v2_sparse_classes_10k_train_001425
24,719
permissive
[ { "docstring": "A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the input image tensor (H, W, C). patch_size (int): The size of each square patch that the image is divided into. in_feats (int): The number of input channels in the image tensor. embed_size (int): Th...
2
stack_v2_sparse_classes_30k_train_003224
Implement the Python class `_Embedding` described below. Class description: Implement the _Embedding class. Method signatures and docstrings: - def __init__(self, img_size, patch_size, in_feats, embed_size, Conv): A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the inpu...
Implement the Python class `_Embedding` described below. Class description: Implement the _Embedding class. Method signatures and docstrings: - def __init__(self, img_size, patch_size, in_feats, embed_size, Conv): A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the inpu...
72eb99f68205afd5f8d49a3bb6cfc08cfd467582
<|skeleton|> class _Embedding: def __init__(self, img_size, patch_size, in_feats, embed_size, Conv): """A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the input image tensor (H, W, C). patch_size (int): The size of each square patch that the image is divided...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Embedding: def __init__(self, img_size, patch_size, in_feats, embed_size, Conv): """A module that creates embeddings from an image tensor. Args: img_size (tuple[int]): The size of the input image tensor (H, W, C). patch_size (int): The size of each square patch that the image is divided into. in_feat...
the_stack_v2_python_sparse
GANDLF/models/unetr.py
mlcommons/GaNDLF
train
45
2c9ef78662ec0b05a092d3da18ec6ae627a784da
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IPv6Range()", "from .ip_range import IpRange\nfrom .ip_range import IpRange\nfields: Dict[str, Callable[[Any], None]] = {'lowerAddress': lambda n: setattr(self, 'lower_address', n.get_str_value()), 'upperAddress': lambda n: setattr(sel...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IPv6Range() <|end_body_0|> <|body_start_1|> from .ip_range import IpRange from .ip_range import IpRange fields: Dict[str, Callable[[Any], None]] = {'lowerAddress': lambda n: seta...
IPv6 Range definition.
IPv6Range
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPv6Range: """IPv6 Range definition.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IPv6Range: """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 ...
stack_v2_sparse_classes_10k_train_001426
2,237
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: IPv6Range", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(par...
3
null
Implement the Python class `IPv6Range` described below. Class description: IPv6 Range definition. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IPv6Range: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: T...
Implement the Python class `IPv6Range` described below. Class description: IPv6 Range definition. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IPv6Range: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: T...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IPv6Range: """IPv6 Range definition.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IPv6Range: """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 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IPv6Range: """IPv6 Range definition.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IPv6Range: """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 ob...
the_stack_v2_python_sparse
msgraph/generated/models/i_pv6_range.py
microsoftgraph/msgraph-sdk-python
train
135
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Tray {number}'\nself._number = number\nself._id_suffix = f'_tray_{number}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.input_tray_status().get(self._number, {})\n self._state = self._attributes.get('newError')\n if self._sta...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Tray {number}' self._number = number self._id_suffix = f'_tray_{number}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attributes = self.syncthru.input_tray_status().get(sel...
Implementation of a Samsung Printer input tray sensor platform.
SyncThruInputTraySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruInputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_10k_train_001427
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, number)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `SyncThruInputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upda...
Implement the Python class `SyncThruInputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upda...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruInputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyncThruInputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Tray {number}' self._number = number self....
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
32782efa9947842511be3bc886cf221e7372ca55
[ "json_dict = json.loads(request.body.decode())\nsku_id = json_dict.get('sku_id')\ntry:\n SKU.objects.get(id=sku_id)\nexcept SKU.DoesNotExist:\n return http.HttpResponseForbidden('sku不存在')\nredis_conn = get_redis_connection('history')\npl = redis_conn.pipeline()\nuser_id = request.user.id\npl.lrem('history_{}'...
<|body_start_0|> json_dict = json.loads(request.body.decode()) sku_id = json_dict.get('sku_id') try: SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return http.HttpResponseForbidden('sku不存在') redis_conn = get_redis_connection('history') pl = r...
用户浏览记录
UserBrowseHistory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def post(self, request): """保存用户浏览记录""" <|body_0|> def get(self, request): """获取用户浏览记录""" <|body_1|> <|end_skeleton|> <|body_start_0|> json_dict = json.loads(request.body.decode()) sku_id = json_dict.get('...
stack_v2_sparse_classes_10k_train_001428
26,474
no_license
[ { "docstring": "保存用户浏览记录", "name": "post", "signature": "def post(self, request)" }, { "docstring": "获取用户浏览记录", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_002743
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def post(self, request): 保存用户浏览记录 - def get(self, request): 获取用户浏览记录
Implement the Python class `UserBrowseHistory` described below. Class description: 用户浏览记录 Method signatures and docstrings: - def post(self, request): 保存用户浏览记录 - def get(self, request): 获取用户浏览记录 <|skeleton|> class UserBrowseHistory: """用户浏览记录""" def post(self, request): """保存用户浏览记录""" <|body...
e3976cbb9e96a1558f4e00abed1c61d887f915b1
<|skeleton|> class UserBrowseHistory: """用户浏览记录""" def post(self, request): """保存用户浏览记录""" <|body_0|> def get(self, request): """获取用户浏览记录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserBrowseHistory: """用户浏览记录""" def post(self, request): """保存用户浏览记录""" json_dict = json.loads(request.body.decode()) sku_id = json_dict.get('sku_id') try: SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return http.HttpResponseForbidden...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
yi0506/meiduo
train
0
4df5eb94212597bef293f643dc197a4fe86c3856
[ "if name == 'quiet':\n return self.level >= VERB_QUIET\nelif name == 'low':\n return self.level >= VERB_LOW\nelif name == 'medium':\n return self.level >= VERB_MEDIUM\nelif name == 'high':\n return self.level >= VERB_HIGH\nelif name == 'debug':\n return self.level >= VERB_DEBUG\nelif name == 'trace':...
<|body_start_0|> if name == 'quiet': return self.level >= VERB_QUIET elif name == 'low': return self.level >= VERB_LOW elif name == 'medium': return self.level >= VERB_MEDIUM elif name == 'high': return self.level >= VERB_HIGH elif ...
Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print.
Verbosity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Verbosity: """Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print.""" def __getattr__(self, name): """Determines whether a certain verbosity level is less than or greater than the stored value. Used to decide whether o...
stack_v2_sparse_classes_10k_train_001429
4,128
no_license
[ { "docstring": "Determines whether a certain verbosity level is less than or greater than the stored value. Used to decide whether or not a certain info or warning string should be output. Args: name: The verbosity level at which the info/warning string will be output.", "name": "__getattr__", "signatur...
2
stack_v2_sparse_classes_30k_train_000776
Implement the Python class `Verbosity` described below. Class description: Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print. Method signatures and docstrings: - def __getattr__(self, name): Determines whether a certain verbosity level is less than o...
Implement the Python class `Verbosity` described below. Class description: Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print. Method signatures and docstrings: - def __getattr__(self, name): Determines whether a certain verbosity level is less than o...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class Verbosity: """Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print.""" def __getattr__(self, name): """Determines whether a certain verbosity level is less than or greater than the stored value. Used to decide whether o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Verbosity: """Class used to determine what to print to standard output. Attributes: level: Determines what level of output to print.""" def __getattr__(self, name): """Determines whether a certain verbosity level is less than or greater than the stored value. Used to decide whether or not a certa...
the_stack_v2_python_sparse
ipi/utils/messages.py
i-pi/i-pi
train
170
d1e9dbd1e6b4fbba3f1b7dd198695b9e7c2537e0
[ "number_validation_result = super().validate(value)\nif not number_validation_result.is_valid:\n return number_validation_result\nis_integer = float(value).is_integer()\nif not is_integer:\n return ValidationResult.failure([Integer.NotAnInteger(self, value)])\nreturn self.success()", "if isinstance(failure,...
<|body_start_0|> number_validation_result = super().validate(value) if not number_validation_result.is_valid: return number_validation_result is_integer = float(value).is_integer() if not is_integer: return ValidationResult.failure([Integer.NotAnInteger(self, valu...
Validator which ensures the value is an integer which falls within a range.
Integer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Integer: """Validator which ensures the value is an integer which falls within a range.""" def validate(self, value: str) -> ValidationResult: """Ensure that `value` is an integer, optionally within a range. Args: value: The value to validate. Returns: The result of the validation.""...
stack_v2_sparse_classes_10k_train_001430
18,238
permissive
[ { "docstring": "Ensure that `value` is an integer, optionally within a range. Args: value: The value to validate. Returns: The result of the validation.", "name": "validate", "signature": "def validate(self, value: str) -> ValidationResult" }, { "docstring": "Describes why the validator failed. ...
2
stack_v2_sparse_classes_30k_test_000256
Implement the Python class `Integer` described below. Class description: Validator which ensures the value is an integer which falls within a range. Method signatures and docstrings: - def validate(self, value: str) -> ValidationResult: Ensure that `value` is an integer, optionally within a range. Args: value: The va...
Implement the Python class `Integer` described below. Class description: Validator which ensures the value is an integer which falls within a range. Method signatures and docstrings: - def validate(self, value: str) -> ValidationResult: Ensure that `value` is an integer, optionally within a range. Args: value: The va...
b74ac1e47fdd16133ca567390c99ea19de278c5a
<|skeleton|> class Integer: """Validator which ensures the value is an integer which falls within a range.""" def validate(self, value: str) -> ValidationResult: """Ensure that `value` is an integer, optionally within a range. Args: value: The value to validate. Returns: The result of the validation.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Integer: """Validator which ensures the value is an integer which falls within a range.""" def validate(self, value: str) -> ValidationResult: """Ensure that `value` is an integer, optionally within a range. Args: value: The value to validate. Returns: The result of the validation.""" num...
the_stack_v2_python_sparse
src/textual/validation.py
Textualize/textual
train
14,818
bf41c967b967706fb6036d15e571318c69bd34ae
[ "if 'QI' not in params:\n params['QI'] = 'IE'\nif 'QE' not in params:\n params['QE'] = 'EE'\nsuper(verlet, self).__init__(params)\n[self.QT, self.Qx, self.QQ] = self.__get_Qd()\nself.qQ = np.dot(self.coll.weights, self.coll.Qmat[1:, 1:])", "QI = self.get_Qdelta_implicit(self.coll, self.params.QI)\nQE = self...
<|body_start_0|> if 'QI' not in params: params['QI'] = 'IE' if 'QE' not in params: params['QE'] = 'EE' super(verlet, self).__init__(params) [self.QT, self.Qx, self.QQ] = self.__get_Qd() self.qQ = np.dot(self.coll.weights, self.coll.Qmat[1:, 1:]) <|end_body...
Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position update qQ: update rule for final value (if needed)
verlet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class verlet: """Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position update qQ: update rule for final value (if n...
stack_v2_sparse_classes_10k_train_001431
7,247
permissive
[ { "docstring": "Initialization routine for the custom sweeper Args: params: parameters for the sweeper", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Get integration matrices for 2nd-order SDC Returns: S: node-to-node collocation matrix (first order) SQ: node-...
5
null
Implement the Python class `verlet` described below. Class description: Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position updat...
Implement the Python class `verlet` described below. Class description: Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position updat...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class verlet: """Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position update qQ: update rule for final value (if n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class verlet: """Custom sweeper class, implements Sweeper.py Second-order sweeper using velocity-Verlet as base integrator Attributes: QQ: 0-to-node collocation matrix (second order) QT: 0-to-node trapezoidal matrix Qx: 0-to-node Euler half-step for position update qQ: update rule for final value (if needed)""" ...
the_stack_v2_python_sparse
pySDC/implementations/sweeper_classes/verlet.py
Parallel-in-Time/pySDC
train
30
20b41ef161ada47f25a02d82a5561b3fc3044a74
[ "self.filepath = filepath\nxls_file = pd.ExcelFile(filepath)\nself.book = xls_file", "sheet = self.book.parse('Final QC Results', skiprows=1, index_col=[0, 1])\nnew_column_names = ['VerifyBam_Omni_Free', 'VerifyBam_Affy_Free', 'VerifyBam_Omni_Chip', 'VerifyBam_Affy_Chip', 'Indel_Ratio', 'Passed_QC']\ndf = ''\nif ...
<|body_start_0|> self.filepath = filepath xls_file = pd.ExcelFile(filepath) self.book = xls_file <|end_body_0|> <|body_start_1|> sheet = self.book.parse('Final QC Results', skiprows=1, index_col=[0, 1]) new_column_names = ['VerifyBam_Omni_Free', 'VerifyBam_Affy_Free', 'VerifyBam...
Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3
p3BAMQC
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables -----...
stack_v2_sparse_classes_10k_train_001432
1,566
permissive
[ { "docstring": "Constructor Class variables --------------- filepath: str Path to the spreadsheet book: ExcelFile object", "name": "__init__", "signature": "def __init__(self, filepath)" }, { "docstring": "Method to get the sheet corresponding to 'Final QC Results' Parameters ---------- group: s...
2
stack_v2_sparse_classes_30k_train_002672
Implement the Python class `p3BAMQC` described below. Class description: Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3 Method signatures and docstrings: - def __...
Implement the Python class `p3BAMQC` described below. Class description: Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3 Method signatures and docstrings: - def __...
3926e2713fd5bce8fe7de71a30a1c067b6d7cb0b
<|skeleton|> class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables -----...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class p3BAMQC: """Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_info.xlsx containing information on the BAM QC done for the p3""" def __init__(self, filepath): """Constructor Class variables --------------- fi...
the_stack_v2_python_sparse
build/lib/p3/p3BAMQC.py
vj573/igsr_analysis
train
0
70269cadb84db8f8ef8a2abeb63c03ad728f0d79
[ "parser.add_argument('--variantset-id', type=str, required=True, help='The ID of the destination variant set.')\nparser.add_argument('--source-uris', type=arg_parsers.ArgList(min_length=1), required=True, help='A comma-delimited list of URI patterns referencing existing VCF or MasterVar files in Google Cloud Storag...
<|body_start_0|> parser.add_argument('--variantset-id', type=str, required=True, help='The ID of the destination variant set.') parser.add_argument('--source-uris', type=arg_parsers.ArgList(min_length=1), required=True, help='A comma-delimited list of URI patterns referencing existing VCF or MasterVar f...
Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage.
Import
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Import: """Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user r...
stack_v2_sparse_classes_10k_train_001433
5,489
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace, All the arguments that were provided to this command invocation. Returns: an ImportVa...
2
stack_v2_sparse_classes_30k_train_006933
Implement the Python class `Import` described below. Class description: Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets c...
Implement the Python class `Import` described below. Class description: Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets c...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class Import: """Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Import: """Imports variants into Google Genomics. Import variants from VCF or MasterVar files that are in Google Cloud Storage.""" def Args(parser): """Register flags for this command.""" parser.add_argument('--variantset-id', type=str, required=True, help='The ID of the destination varia...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/surface/genomics/variants/import.py
KaranToor/MA450
train
1
e186e7e45f3df5b77b37ab2b274296cc904ad2af
[ "if not arr1 or not arr2 or (not arr3):\n return []\narr1 = set(arr1)\narr2 = set(arr2)\narr3 = set(arr3)\narr1 = arr1.intersection(arr2)\narr1 = arr1.intersection(arr3)\nreturn sorted(list(arr1))", "res = []\napperance = {}\nfor i in arr1:\n if i in apperance.keys():\n continue\n else:\n a...
<|body_start_0|> if not arr1 or not arr2 or (not arr3): return [] arr1 = set(arr1) arr2 = set(arr2) arr3 = set(arr3) arr1 = arr1.intersection(arr2) arr1 = arr1.intersection(arr3) return sorted(list(arr1)) <|end_body_0|> <|body_start_1|> res = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def arraysIntersection(self, arr1, arr2, arr3): """思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return:""" <|body_0|> def arraysIntersection1(self, arr1, arr2, arr3): """思路二:统计各个数字在三个列表中出现的次数,次数为3的为相交...
stack_v2_sparse_classes_10k_train_001434
1,888
no_license
[ { "docstring": "思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return:", "name": "arraysIntersection", "signature": "def arraysIntersection(self, arr1, arr2, arr3)" }, { "docstring": "思路二:统计各个数字在三个列表中出现的次数,次数为3的为相交的数字", "name": "arraysIn...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def arraysIntersection(self, arr1, arr2, arr3): 思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return: - def arraysIntersec...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def arraysIntersection(self, arr1, arr2, arr3): 思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return: - def arraysIntersec...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def arraysIntersection(self, arr1, arr2, arr3): """思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return:""" <|body_0|> def arraysIntersection1(self, arr1, arr2, arr3): """思路二:统计各个数字在三个列表中出现的次数,次数为3的为相交...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def arraysIntersection(self, arr1, arr2, arr3): """思路一:利用集合的交操作 因为set无序,所以顺序会变,需要最后排个序 利用内置数据结构,时间空间都消耗极低,战胜100% :param arr1: :param arr2: :param arr3: :return:""" if not arr1 or not arr2 or (not arr3): return [] arr1 = set(arr1) arr2 = set(arr2) a...
the_stack_v2_python_sparse
ArrayOperation/arraysIntersection.py
Philex5/codingPractice
train
0
d14182bd98980cea1160d087347ce243390bc388
[ "response = self.client.get(reverse('cocktail_list'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'There are no cocktails in the database.')\nself.assertQuerysetEqual(response.context['cocktail_list'], [])", "add_cocktail('test', 1)\nadd_cocktail('temp', 1)\nadd_cocktail('tmp', 1)\...
<|body_start_0|> response = self.client.get(reverse('cocktail_list')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no cocktails in the database.') self.assertQuerysetEqual(response.context['cocktail_list'], []) <|end_body_0|> <|body_start_1|> ...
ListViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_categories(self): """If some cocktails are created, they should be displayed""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001435
1,595
no_license
[ { "docstring": "If no cocktails exist, an appropriate message should be displayed.", "name": "test_list_view_with_no_cocktails", "signature": "def test_list_view_with_no_cocktails(self)" }, { "docstring": "If some cocktails are created, they should be displayed", "name": "test_index_view_wit...
2
stack_v2_sparse_classes_30k_train_005754
Implement the Python class `ListViewTests` described below. Class description: Implement the ListViewTests class. Method signatures and docstrings: - def test_list_view_with_no_cocktails(self): If no cocktails exist, an appropriate message should be displayed. - def test_index_view_with_categories(self): If some cock...
Implement the Python class `ListViewTests` described below. Class description: Implement the ListViewTests class. Method signatures and docstrings: - def test_list_view_with_no_cocktails(self): If no cocktails exist, an appropriate message should be displayed. - def test_index_view_with_categories(self): If some cock...
18abb27ffd9824b9673be6aef0fa4d0a20c78fb4
<|skeleton|> class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" <|body_0|> def test_index_view_with_categories(self): """If some cocktails are created, they should be displayed""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ListViewTests: def test_list_view_with_no_cocktails(self): """If no cocktails exist, an appropriate message should be displayed.""" response = self.client.get(reverse('cocktail_list')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no cockt...
the_stack_v2_python_sparse
apps/cocktails/tests.py
Carlosedo/mixees
train
1
34b946d9f4373fa25d7394b081ddaee87c81c99c
[ "expanded_groups = []\nfor group in match_object.groups():\n try:\n place_holder_number = int(group, 10) - 1\n expanded_group = '{{{0:d}:s}}'.format(place_holder_number)\n except ValueError:\n expanded_group = group\n expanded_groups.append(expanded_group)\nreturn ''.join(expanded_grou...
<|body_start_0|> expanded_groups = [] for group in match_object.groups(): try: place_holder_number = int(group, 10) - 1 expanded_group = '{{{0:d}:s}}'.format(place_holder_number) except ValueError: expanded_group = group ...
Windows PE/COFF resource file helper.
WindowsResourceFileHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsResourceFileHelper: """Windows PE/COFF resource file helper.""" def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): """Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str:...
stack_v2_sparse_classes_10k_train_001436
2,148
permissive
[ { "docstring": "Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str: message string with Python format() style place holders.", "name": "_MessageStringPlaceHolderSpecifierReplacer", "signature": "def _MessageStrin...
2
null
Implement the Python class `WindowsResourceFileHelper` described below. Class description: Windows PE/COFF resource file helper. Method signatures and docstrings: - def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): Replaces message string place holders into Python format() style. Args: match_object (...
Implement the Python class `WindowsResourceFileHelper` described below. Class description: Windows PE/COFF resource file helper. Method signatures and docstrings: - def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): Replaces message string place holders into Python format() style. Args: match_object (...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class WindowsResourceFileHelper: """Windows PE/COFF resource file helper.""" def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): """Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WindowsResourceFileHelper: """Windows PE/COFF resource file helper.""" def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): """Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str: message stri...
the_stack_v2_python_sparse
plaso/helpers/windows/resource_files.py
log2timeline/plaso
train
1,506
66c1032ec50d8353cc3b2814d70f4a22a4a40a28
[ "super(Cd, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.path = path\nself.ret_required = False\nself._re_expected_prompt = None\nif expected_prompt:\n self._re_expected_prompt = CommandTextualGeneric._calculate_prompt(expected_prompt)", "cmd = 'cd'\nif ...
<|body_start_0|> super(Cd, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.path = path self.ret_required = False self._re_expected_prompt = None if expected_prompt: self._re_expected_prompt = CommandTextualGeneric....
Cd
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cd: def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None, expected_prompt=None): """:param connection: moler connection to device :param prompt: start prompt (on system where command cd starts) :param path: path to directory :param expected_prompt: Promp...
stack_v2_sparse_classes_10k_train_001437
3,352
permissive
[ { "docstring": ":param connection: moler connection to device :param prompt: start prompt (on system where command cd starts) :param path: path to directory :param expected_prompt: Prompt after change directory :param newline_chars: Characters to split lines :param runner: Runner to run command", "name": "_...
4
null
Implement the Python class `Cd` described below. Class description: Implement the Cd class. Method signatures and docstrings: - def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None, expected_prompt=None): :param connection: moler connection to device :param prompt: start prompt (on s...
Implement the Python class `Cd` described below. Class description: Implement the Cd class. Method signatures and docstrings: - def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None, expected_prompt=None): :param connection: moler connection to device :param prompt: start prompt (on s...
5a7bb06807b6e0124c77040367d0c20f42849a4c
<|skeleton|> class Cd: def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None, expected_prompt=None): """:param connection: moler connection to device :param prompt: start prompt (on system where command cd starts) :param path: path to directory :param expected_prompt: Promp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cd: def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None, expected_prompt=None): """:param connection: moler connection to device :param prompt: start prompt (on system where command cd starts) :param path: path to directory :param expected_prompt: Prompt after change...
the_stack_v2_python_sparse
moler/cmd/unix/cd.py
nokia/moler
train
60
7f2afa923309d8e0e28db397392ca0a3239cdf3b
[ "if p.val < root.val and q.val < root.val:\n return self.lowestCommonAncestor(root.left, p, q)\nif p.val > root.val and q.val > root.val:\n return self.lowestCommonAncestor(root.right, p, q)\nreturn root", "if max(p.val, q.val) < root.val:\n return self.lowestCommonAncestor(root.left, p, q)\nif root.val ...
<|body_start_0|> if p.val < root.val and q.val < root.val: return self.lowestCommonAncestor(root.left, p, q) if p.val > root.val and q.val > root.val: return self.lowestCommonAncestor(root.right, p, q) return root <|end_body_0|> <|body_start_1|> if max(p.val, q.v...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """08/16/2021 00:06""" <|body_0|> def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """08/21/2022 15:00""" <|bo...
stack_v2_sparse_classes_10k_train_001438
2,517
no_license
[ { "docstring": "08/16/2021 00:06", "name": "lowestCommonAncestor", "signature": "def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'" }, { "docstring": "08/21/2022 15:00", "name": "lowestCommonAncestor", "signature": "def lowestCommonAncestor(self...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 08/16/2021 00:06 - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 08/16/2021 00:06 - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """08/16/2021 00:06""" <|body_0|> def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """08/21/2022 15:00""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """08/16/2021 00:06""" if p.val < root.val and q.val < root.val: return self.lowestCommonAncestor(root.left, p, q) if p.val > root.val and q.val > root.val: r...
the_stack_v2_python_sparse
leetcode/solved/235_Lowest_Common_Ancestor_of_a_Binary_Search_Tree/solution.py
sungminoh/algorithms
train
0
184a439cb9211ffe1c6a0a9cbd78e290bb067ddb
[ "self.defaultElementWidth, self.defaultElementHeight = (50, 50)\nself.defaultLabelWidth, self.defaultLabelHeight = (30, 10)\nself.context = context\nself.context.new_path()", "if alpha is None:\n context.set_source_rgb(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0)\nelse:\n context.set_source_rgba(fl...
<|body_start_0|> self.defaultElementWidth, self.defaultElementHeight = (50, 50) self.defaultLabelWidth, self.defaultLabelHeight = (30, 10) self.context = context self.context.new_path() <|end_body_0|> <|body_start_1|> if alpha is None: context.set_source_rgb(float(r)...
Base class for drawing objects
CBaseDrawing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" <|body_0|> def ChangeColor(self, context, r, g, b, alpha=None): """Change ...
stack_v2_sparse_classes_10k_train_001439
1,264
no_license
[ { "docstring": "Constructor @type context: CairoContext @param context: cairo context, will be painted on this context", "name": "__init__", "signature": "def __init__(self, context)" }, { "docstring": "Change color on given context @type context: CairoContext @param context: cairo context on wh...
2
stack_v2_sparse_classes_30k_train_002378
Implement the Python class `CBaseDrawing` described below. Class description: Base class for drawing objects Method signatures and docstrings: - def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context - def ChangeColor(self, context, r, g, b,...
Implement the Python class `CBaseDrawing` described below. Class description: Base class for drawing objects Method signatures and docstrings: - def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context - def ChangeColor(self, context, r, g, b,...
eb050a93ef955b8fbc184a437cb0e6fae54264cd
<|skeleton|> class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" <|body_0|> def ChangeColor(self, context, r, g, b, alpha=None): """Change ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CBaseDrawing: """Base class for drawing objects""" def __init__(self, context): """Constructor @type context: CairoContext @param context: cairo context, will be painted on this context""" self.defaultElementWidth, self.defaultElementHeight = (50, 50) self.defaultLabelWidth, self....
the_stack_v2_python_sparse
plugin/gui/BaseDrawing.py
umlfri-old/addon_team
train
0
6d50eec95ab9d007acff606ca3fb77acac5ec6bf
[ "if self._errors:\n return\nuser = authenticate(username=self.cleaned_data['username'].lower(), password=self.cleaned_data['password'])\nif user:\n if user.is_active:\n self.user = user\n else:\n raise forms.ValidationError('This account is currently inactive.')\nelse:\n raise forms.Valida...
<|body_start_0|> if self._errors: return user = authenticate(username=self.cleaned_data['username'].lower(), password=self.cleaned_data['password']) if user: if user.is_active: self.user = user else: raise forms.ValidationError(...
Django-backed login form for normal authentication.
LoginForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginForm: """Django-backed login form for normal authentication.""" def clean(self): """Validates the login form.""" <|body_0|> def login(self, request): """Logs the user in.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self._errors: ...
stack_v2_sparse_classes_10k_train_001440
1,209
permissive
[ { "docstring": "Validates the login form.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Logs the user in.", "name": "login", "signature": "def login(self, request)" } ]
2
null
Implement the Python class `LoginForm` described below. Class description: Django-backed login form for normal authentication. Method signatures and docstrings: - def clean(self): Validates the login form. - def login(self, request): Logs the user in.
Implement the Python class `LoginForm` described below. Class description: Django-backed login form for normal authentication. Method signatures and docstrings: - def clean(self): Validates the login form. - def login(self, request): Logs the user in. <|skeleton|> class LoginForm: """Django-backed login form for...
4b7dd685012ec64758affe0ecee3103596d16aa7
<|skeleton|> class LoginForm: """Django-backed login form for normal authentication.""" def clean(self): """Validates the login form.""" <|body_0|> def login(self, request): """Logs the user in.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LoginForm: """Django-backed login form for normal authentication.""" def clean(self): """Validates the login form.""" if self._errors: return user = authenticate(username=self.cleaned_data['username'].lower(), password=self.cleaned_data['password']) if user: ...
the_stack_v2_python_sparse
makahiki/apps/managers/auth_mgr/forms.py
justinslee/Wai-Not-Makahiki
train
1
0d5c616df16683eb0cf1c6cdfd1569980a81ae8f
[ "try:\n return self._list(self._PROJECTS_URL, 'projects', obj_class=Project)\nexcept exceptions.EndpointNotFound:\n endpoint_filter = {'interface': plugin.AUTH_INTERFACE}\n return self._list(self._PROJECTS_URL, 'projects', obj_class=Project, endpoint_filter=endpoint_filter)", "try:\n return self._list...
<|body_start_0|> try: return self._list(self._PROJECTS_URL, 'projects', obj_class=Project) except exceptions.EndpointNotFound: endpoint_filter = {'interface': plugin.AUTH_INTERFACE} return self._list(self._PROJECTS_URL, 'projects', obj_class=Project, endpoint_filter=e...
Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user.
AuthManager
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthManager: """Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user.""" def projects(self): """List projects that the specified token can be rescoped to. :returns: a list ...
stack_v2_sparse_classes_10k_train_001441
3,252
permissive
[ { "docstring": "List projects that the specified token can be rescoped to. :returns: a list of projects. :rtype: list of :class:`keystoneclient.v3.projects.Project`", "name": "projects", "signature": "def projects(self)" }, { "docstring": "List Domains that the specified token can be rescoped to...
3
stack_v2_sparse_classes_30k_train_006508
Implement the Python class `AuthManager` described below. Class description: Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user. Method signatures and docstrings: - def projects(self): List projects that ...
Implement the Python class `AuthManager` described below. Class description: Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user. Method signatures and docstrings: - def projects(self): List projects that ...
141787ae8b0db7ac4dffce915e033a78d145d54e
<|skeleton|> class AuthManager: """Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user.""" def projects(self): """List projects that the specified token can be rescoped to. :returns: a list ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthManager: """Retrieve auth context specific information. The information returned by the auth routes is entirely dependent on the authentication information provided by the user.""" def projects(self): """List projects that the specified token can be rescoped to. :returns: a list of projects. ...
the_stack_v2_python_sparse
keystoneclient/v3/auth.py
openstack/python-keystoneclient
train
118
ca5c1fd0a53a01b92dd10826b1d38bc50fdfbd62
[ "from stock.models import StockItem\nlogger.info(f'SampleLocatePlugin attempting to locate item ID {item_pk}')\ntry:\n item = StockItem.objects.get(pk=item_pk)\n logger.info(f'StockItem {item_pk} located!')\n item.set_metadata('located', True)\nexcept (ValueError, StockItem.DoesNotExist):\n logger.error...
<|body_start_0|> from stock.models import StockItem logger.info(f'SampleLocatePlugin attempting to locate item ID {item_pk}') try: item = StockItem.objects.get(pk=item_pk) logger.info(f'StockItem {item_pk} located!') item.set_metadata('located', True) ...
A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.
SampleLocatePlugin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" <|body_0|> def locate_stock_loc...
stack_v2_sparse_classes_10k_train_001442
1,854
permissive
[ { "docstring": "Locate a StockItem. Args: item_pk: primary key for item", "name": "locate_stock_item", "signature": "def locate_stock_item(self, item_pk)" }, { "docstring": "Locate a StockLocation. Args: location_pk: primary key for location", "name": "locate_stock_location", "signature"...
2
stack_v2_sparse_classes_30k_train_002006
Implement the Python class `SampleLocatePlugin` described below. Class description: A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger. Method signatures and docstrings: - def locate_stock_item(self, item_pk): Locate a StockItem. Args: item_pk: primary key...
Implement the Python class `SampleLocatePlugin` described below. Class description: A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger. Method signatures and docstrings: - def locate_stock_item(self, item_pk): Locate a StockItem. Args: item_pk: primary key...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" <|body_0|> def locate_stock_loc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SampleLocatePlugin: """A very simple example of the 'locate' plugin. This plugin class simply prints location information to the logger.""" def locate_stock_item(self, item_pk): """Locate a StockItem. Args: item_pk: primary key for item""" from stock.models import StockItem logger...
the_stack_v2_python_sparse
InvenTree/plugin/samples/locate/locate_sample.py
inventree/InvenTree
train
3,077
da2c6ea2117d2ec77f4a60748315d23c80dfafc8
[ "def swap(i, j):\n tmp = nums[i]\n nums[i] = nums[j]\n nums[j] = tmp\npivot = self.findKthLargest(nums, len(nums) // 2)\nwiggleTable = [0 for _ in range(len(nums))]\nfor i in range(len(nums)):\n if i % 2 == 1:\n wiggleTable[i // 2] = i\n else:\n wiggleTable[-i // 2 - 1] = i\nleft = 0\nr...
<|body_start_0|> def swap(i, j): tmp = nums[i] nums[i] = nums[j] nums[j] = tmp pivot = self.findKthLargest(nums, len(nums) // 2) wiggleTable = [0 for _ in range(len(nums))] for i in range(len(nums)): if i % 2 == 1: wiggleTab...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wiggleSort(self, nums): """O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body...
stack_v2_sparse_classes_10k_train_001443
4,011
no_license
[ { "docstring": "O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "wiggleSort", "signature": "def wiggleSort(self, nums)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findKthLargest", "s...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleSort(self, nums): O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def findKthLargest(self, nums, k): :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleSort(self, nums): O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def findKthLargest(self, nums, k): :ty...
e16702d2b3ec4e5054baad56f4320bc3b31676ad
<|skeleton|> class Solution: def wiggleSort(self, nums): """O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def wiggleSort(self, nums): """O(n) time O(n) space :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" def swap(i, j): tmp = nums[i] nums[i] = nums[j] nums[j] = tmp pivot = self.findKthLargest(nums, ...
the_stack_v2_python_sparse
leetcode/medium/wiggle_sort2.py
SuperMartinYang/learning_algorithm
train
0
7832d6c9eda8448515dcca08029e2f8e73b792dc
[ "end = len(numbers) - 1\nstart = 1\nfor index, num in enumerate(numbers):\n find_index = self.find_num(numbers, target - num, index + 1, end)\n if find_index != -1:\n return [index + 1, find_index + 1]", "if end - start < 2:\n if numbers[start] == target:\n return start\n elif numbers[en...
<|body_start_0|> end = len(numbers) - 1 start = 1 for index, num in enumerate(numbers): find_index = self.find_num(numbers, target - num, index + 1, end) if find_index != -1: return [index + 1, find_index + 1] <|end_body_0|> <|body_start_1|> if en...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def find_num(self, numbers, target, start, end): """return index if target was find, else return -1""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_001444
2,289
no_license
[ { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": "return index if target was find, else return -1", "name": "find_num", "signature": "def find_num(self, numbers, target, sta...
2
null
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def find_num(self, numbers, target, start, end): return index if target was ...
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def find_num(self, numbers, target, start, end): return index if target was ...
f96a2273c6831a8035e1adacfa452f73c599ae16
<|skeleton|> class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def find_num(self, numbers, target, start, end): """return index if target was find, else return -1""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" end = len(numbers) - 1 start = 1 for index, num in enumerate(numbers): find_index = self.find_num(numbers, target - num, index + 1, end) if ...
the_stack_v2_python_sparse
Python/TwoSumIIInputarrayissorted.py
here0009/LeetCode
train
1
4b653de11fba1d6aa8bfc0f0e14ea998358939b0
[ "super(NormalizeImage, self).__init__()\nself.mean = mean\nself.std = std\nself.is_scale = is_scale\nself.is_channel_first = is_channel_first\nif not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)):\n raise TypeError('{}: input type is invalid.'.format(self))\nfro...
<|body_start_0|> super(NormalizeImage, self).__init__() self.mean = mean self.std = std self.is_scale = is_scale self.is_channel_first = is_channel_first if not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)): r...
NormalizeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize ...
stack_v2_sparse_classes_10k_train_001445
19,057
permissive
[ { "docstring": "Args: mean (list): the pixel mean std (list): the pixel variance", "name": "__init__", "signature": "def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False)" }, { "docstring": "Normalize the image. Operators: 1.(optional) S...
2
stack_v2_sparse_classes_30k_train_005124
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): Args: mean (list): the pixel mean std (list): the pi...
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): Args: mean (list): the pixel mean std (list): the pi...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" super(NormalizeImage, self).__init__() self.mean = mean self.std = std ...
the_stack_v2_python_sparse
CV/PaddleReid/reid/data/transform/operators.py
sserdoubleh/Research
train
10
79f5ad33c3b213df679c819b41c060746b18252e
[ "if not root:\n return '[]'\nqueue = collections.deque()\nqueue.append(root)\nres = []\nwhile queue:\n node = queue.popleft()\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) +...
<|body_start_0|> if not root: return '[]' queue = collections.deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: res.append(str(node.val)) queue.append(node.left) que...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_001446
1,977
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004577
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
809424acee0e63b795a46fdc51c5aef6e669d547
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '[]' queue = collections.deque() queue.append(root) res = [] while queue: node = queue.popleft() i...
the_stack_v2_python_sparse
python_offer/37_序列化二叉树.py
Madanfeng/JianZhiOffer
train
0
51568a7b64c68d881b2f996f67197c8c127f8789
[ "self.rank = rank\nself.ls_solve = ls_solve\nself.n_iter_max = n_iter_max\nself.tol = tol\nself.random_state = random_state\nself.verbose = verbose\nself.callback = callback", "tr_decomp = tensor_ring_als(tensor, rank=self.rank, ls_solve=self.ls_solve, n_iter_max=self.n_iter_max, tol=self.tol, random_state=self.r...
<|body_start_0|> self.rank = rank self.ls_solve = ls_solve self.n_iter_max = n_iter_max self.tol = tol self.random_state = random_state self.verbose = verbose self.callback = callback <|end_body_0|> <|body_start_1|> tr_decomp = tensor_ring_als(tensor, ran...
A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dim...
TensorRingALS
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i...
stack_v2_sparse_classes_10k_train_001447
16,136
permissive
[ { "docstring": "Parameters ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dimension of the i-th mode o...
2
stack_v2_sparse_classes_30k_val_000253
Implement the Python class `TensorRingALS` described below. Class description: A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th ...
Implement the Python class `TensorRingALS` described below. Class description: A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th ...
de05e178850eb2abe43ec1a40f80624ca606807d
<|skeleton|> class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TensorRingALS: """A class wrapper for the tensor_ring_als function Attributes ---------- rank : Union[int, List[int]] The rank of the decomposition. If `rank` is an int, then all ranks will be the same and equal to `rank`. If `rank` is a list, then the i-th core will be of size rank[i]-by-shape[i]-by-rank[i+1...
the_stack_v2_python_sparse
tensorly/decomposition/_tr.py
tensorly/tensorly
train
1,533
a98e03c1f3cc30278fad3213d0176d2991df7f8a
[ "self.paths = module_paths\nself.module_append_string = '\\n'.join(('module.paths.push(\"%s\")\\n' % p for p in self.paths))\ncommand_string = 'var babel = require(\"babel-core\")'\nself.babel = execjs.compile(self.module_append_string + command_string)", "if options is None:\n options = {'ast': False, 'preset...
<|body_start_0|> self.paths = module_paths self.module_append_string = '\n'.join(('module.paths.push("%s")\n' % p for p in self.paths)) command_string = 'var babel = require("babel-core")' self.babel = execjs.compile(self.module_append_string + command_string) <|end_body_0|> <|body_star...
Babel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Babel: def __init__(self, *module_paths): """Constructor :param module_paths: Paths to node_modules""" <|body_0|> def transpile(self, code, options=None): """Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: pyth...
stack_v2_sparse_classes_10k_train_001448
2,713
permissive
[ { "docstring": "Constructor :param module_paths: Paths to node_modules", "name": "__init__", "signature": "def __init__(self, *module_paths)" }, { "docstring": "Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: python {'ast': false, 'presets...
2
stack_v2_sparse_classes_30k_train_005106
Implement the Python class `Babel` described below. Class description: Implement the Babel class. Method signatures and docstrings: - def __init__(self, *module_paths): Constructor :param module_paths: Paths to node_modules - def transpile(self, code, options=None): Takes code and runs it through babel.js if ``option...
Implement the Python class `Babel` described below. Class description: Implement the Babel class. Method signatures and docstrings: - def __init__(self, *module_paths): Constructor :param module_paths: Paths to node_modules - def transpile(self, code, options=None): Takes code and runs it through babel.js if ``option...
408f3fa3d36542d8fc1236ba1cac804de6f14b0c
<|skeleton|> class Babel: def __init__(self, *module_paths): """Constructor :param module_paths: Paths to node_modules""" <|body_0|> def transpile(self, code, options=None): """Takes code and runs it through babel.js if ``options`` is not provided it'll default to: .. code-block:: pyth...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Babel: def __init__(self, *module_paths): """Constructor :param module_paths: Paths to node_modules""" self.paths = module_paths self.module_append_string = '\n'.join(('module.paths.push("%s")\n' % p for p in self.paths)) command_string = 'var babel = require("babel-core")' ...
the_stack_v2_python_sparse
hard-gists/19a4b105d1dff9a591b8/snippet.py
dockerizeme/dockerizeme
train
24
abd5c1a29f7f6d7625c832f7e1b9434b41a5d1dd
[ "self.aliyunrequest.set_action_name('DescribeLoadBalancers')\nif not isinstance(config, list):\n return self.MResponse(code=20001, msg='config不是列表', status=False)\nself.Mconfig(config)\nresponse = self.aliyunapiclient.do_action_with_exception(self.aliyunrequest)\nreturn response", "self.aliyunrequest.set_actio...
<|body_start_0|> self.aliyunrequest.set_action_name('DescribeLoadBalancers') if not isinstance(config, list): return self.MResponse(code=20001, msg='config不是列表', status=False) self.Mconfig(config) response = self.aliyunapiclient.do_action_with_exception(self.aliyunrequest) ...
实例API
ALiYunApiSLB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" <|body_0|> def DescribeLoadBalancerAttribute(self, config): """查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" ...
stack_v2_sparse_classes_10k_train_001449
7,651
no_license
[ { "docstring": "查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式", "name": "DescribeLoadBalancers", "signature": "def DescribeLoadBalancers(self, config)" }, { "docstring": "查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式", "name": "DescribeLoadBalancerAttribute", "...
5
stack_v2_sparse_classes_30k_train_004463
Implement the Python class `ALiYunApiSLB` described below. Class description: 实例API Method signatures and docstrings: - def DescribeLoadBalancers(self, config): 查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式 - def DescribeLoadBalancerAttribute(self, config): 查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return...
Implement the Python class `ALiYunApiSLB` described below. Class description: 实例API Method signatures and docstrings: - def DescribeLoadBalancers(self, config): 查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式 - def DescribeLoadBalancerAttribute(self, config): 查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return...
401ad869298d55a6cb2f78442385f67f40b9db52
<|skeleton|> class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" <|body_0|> def DescribeLoadBalancerAttribute(self, config): """查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" self.aliyunrequest.set_action_name('DescribeLoadBalancers') if not isinstance(config, list): return self.MResponse(code=20001, msg='config...
the_stack_v2_python_sparse
utils/maliyun/aliyunapi.py
Alotofwater/cookcmdb
train
8
dbb50fd1ea93ee7b5d369d25c3eb98016d8c1d5b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CalendarSharingMessageAction()", "from .calendar_sharing_action import CalendarSharingAction\nfrom .calendar_sharing_action_importance import CalendarSharingActionImportance\nfrom .calendar_sharing_action_type import CalendarSharingAct...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CalendarSharingMessageAction() <|end_body_0|> <|body_start_1|> from .calendar_sharing_action import CalendarSharingAction from .calendar_sharing_action_importance import CalendarSharingA...
CalendarSharingMessageAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """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...
stack_v2_sparse_classes_10k_train_001450
3,763
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: CalendarSharingMessageAction", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
null
Implement the Python class `CalendarSharingMessageAction` described below. Class description: Implement the CalendarSharingMessageAction class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: Creates a new instance of the a...
Implement the Python class `CalendarSharingMessageAction` described below. Class description: Implement the CalendarSharingMessageAction class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """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...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CalendarSharingMessageAction: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessageAction: """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...
the_stack_v2_python_sparse
msgraph/generated/models/calendar_sharing_message_action.py
microsoftgraph/msgraph-sdk-python
train
135
dc640536bba212964069ff5476d89dbbe1f6673e
[ "if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n if p >= 1 or p <= 0:\n raise ValueError('p must be greater than 0 and less than 1')\n else:\n self.n = int(n)\n self.p = float(p)\nelif not isinstance(data, list):\n raise TypeError('data must b...
<|body_start_0|> if data is None: if n <= 0: raise ValueError('n must be a positive value') if p >= 1 or p <= 0: raise ValueError('p must be greater than 0 and less than 1') else: self.n = int(n) self.p = float(p...
Class Binomial
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" <|body_0|> def pmf(self, k): """Definition of probability density function""" <|body_1|> def factor(number): """Factor...
stack_v2_sparse_classes_10k_train_001451
2,018
no_license
[ { "docstring": "Contructor of class binomial and definition", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "Definition of probability density function", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "Factorial o...
4
stack_v2_sparse_classes_30k_train_005216
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Contructor of class binomial and definition - def pmf(self, k): Definition of probability density function - def factor(number): Factorial outside of ...
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Contructor of class binomial and definition - def pmf(self, k): Definition of probability density function - def factor(number): Factorial outside of ...
74213384b0998f65e123adc146ea5e91c4d77b37
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" <|body_0|> def pmf(self, k): """Definition of probability density function""" <|body_1|> def factor(number): """Factor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Contructor of class binomial and definition""" if data is None: if n <= 0: raise ValueError('n must be a positive value') if p >= 1 or p <= 0: raise ValueEr...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
PilarPinto/holbertonschool-machine_learning
train
0
500f450bbf8526904ca0447b2b2ec1f819f9d6aa
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Service for configuring sinks used to export log entries outside of Stackdriver Logging.
ConfigServiceV2Servicer
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigServiceV2Servicer: """Service for configuring sinks used to export log entries outside of Stackdriver Logging.""" def ListSinks(self, request, context): """Lists sinks.""" <|body_0|> def GetSink(self, request, context): """Gets a sink.""" <|body_1|>...
stack_v2_sparse_classes_10k_train_001452
6,663
permissive
[ { "docstring": "Lists sinks.", "name": "ListSinks", "signature": "def ListSinks(self, request, context)" }, { "docstring": "Gets a sink.", "name": "GetSink", "signature": "def GetSink(self, request, context)" }, { "docstring": "Creates a sink that exports specified log entries to...
5
stack_v2_sparse_classes_30k_train_006740
Implement the Python class `ConfigServiceV2Servicer` described below. Class description: Service for configuring sinks used to export log entries outside of Stackdriver Logging. Method signatures and docstrings: - def ListSinks(self, request, context): Lists sinks. - def GetSink(self, request, context): Gets a sink. ...
Implement the Python class `ConfigServiceV2Servicer` described below. Class description: Service for configuring sinks used to export log entries outside of Stackdriver Logging. Method signatures and docstrings: - def ListSinks(self, request, context): Lists sinks. - def GetSink(self, request, context): Gets a sink. ...
86977c0e2e97011359b619c88db47168181908ea
<|skeleton|> class ConfigServiceV2Servicer: """Service for configuring sinks used to export log entries outside of Stackdriver Logging.""" def ListSinks(self, request, context): """Lists sinks.""" <|body_0|> def GetSink(self, request, context): """Gets a sink.""" <|body_1|>...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigServiceV2Servicer: """Service for configuring sinks used to export log entries outside of Stackdriver Logging.""" def ListSinks(self, request, context): """Lists sinks.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') ...
the_stack_v2_python_sparse
generated/python/proto-google-cloud-logging-v2/google/cloud/proto/logging/v2/logging_config_pb2_grpc.py
QPC-github/api-client-staging
train
1
e89ef6f86e716dba631971f85e881459eb8d18a2
[ "super().__init__('custom_unitary', children, None)\nself.id = children[0]\nself.name = self.id.name\nif len(children) == 3:\n self.arguments = children[1]\n self.bitlist = children[2]\nelse:\n self.arguments = None\n self.bitlist = children[1]", "string = self.name\nif self.arguments is not None:\n ...
<|body_start_0|> super().__init__('custom_unitary', children, None) self.id = children[0] self.name = self.id.name if len(children) == 3: self.arguments = children[1] self.bitlist = children[2] else: self.arguments = None self.bitli...
Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = None or exp_list node .bitlist = primary_list node
CustomUnitary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUnitary: """Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = None or exp_list node .bitlist = primary...
stack_v2_sparse_classes_10k_train_001453
1,663
permissive
[ { "docstring": "Create the custom gate node.", "name": "__init__", "signature": "def __init__(self, children)" }, { "docstring": "Return the corresponding OPENQASM string.", "name": "qasm", "signature": "def qasm(self, prec=15)" } ]
2
null
Implement the Python class `CustomUnitary` described below. Class description: Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = N...
Implement the Python class `CustomUnitary` described below. Class description: Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = N...
abf6c23d4ab6c63f9c01c7434fb46321e6a69200
<|skeleton|> class CustomUnitary: """Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = None or exp_list node .bitlist = primary...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomUnitary: """Node for an OPENQASM custom gate statement. children[0] is an id node. children[1] is an exp_list (if len==3) or primary_list. children[2], if present, is a primary_list. Has properties: .id = id node .name = gate name string .arguments = None or exp_list node .bitlist = primary_list node"""...
the_stack_v2_python_sparse
qiskit/qasm/node/customunitary.py
indian-institute-of-science-qc/qiskit-aakash
train
37
89eada8540f136577f80e6c2e797c3d17d958a9c
[ "self.switch_profiles = switch_profiles\nself.switches = switches\nself.stacks = stacks\nself.stp_priority = stp_priority", "if dictionary is None:\n return None\nstp_priority = dictionary.get('stpPriority')\nswitch_profiles = dictionary.get('switchProfiles')\nswitches = dictionary.get('switches')\nstacks = di...
<|body_start_0|> self.switch_profiles = switch_profiles self.switches = switches self.stacks = stacks self.stp_priority = stp_priority <|end_body_0|> <|body_start_1|> if dictionary is None: return None stp_priority = dictionary.get('stpPriority') swit...
Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority (int): STP priority for switch, stacks, or switch ...
StpBridgePriorityModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority ...
stack_v2_sparse_classes_10k_train_001454
2,255
permissive
[ { "docstring": "Constructor for the StpBridgePriorityModel class", "name": "__init__", "signature": "def __init__(self, stp_priority=None, switch_profiles=None, switches=None, stacks=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A di...
2
stack_v2_sparse_classes_30k_val_000338
Implement the Python class `StpBridgePriorityModel` described below. Class description: Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of s...
Implement the Python class `StpBridgePriorityModel` described below. Class description: Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of s...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority (int): STP pr...
the_stack_v2_python_sparse
meraki/models/stp_bridge_priority_model.py
RaulCatalano/meraki-python-sdk
train
1
6d5836acff36cf8f9e8590779c9a76a3134a8782
[ "mock_class_node_1 = create_mock_java_class(pkg=self.TEST_PKG_1)\nmock_class_node_2 = create_mock_java_class(pkg=self.TEST_PKG_1)\nmock_class_node_3 = create_mock_java_class(pkg=self.TEST_PKG_2)\nmock_class_graph = unittest.mock.Mock()\nmock_class_graph.nodes = [mock_class_node_1, mock_class_node_2, mock_class_node...
<|body_start_0|> mock_class_node_1 = create_mock_java_class(pkg=self.TEST_PKG_1) mock_class_node_2 = create_mock_java_class(pkg=self.TEST_PKG_1) mock_class_node_3 = create_mock_java_class(pkg=self.TEST_PKG_2) mock_class_graph = unittest.mock.Mock() mock_class_graph.nodes = [mock_...
Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph.
TestJavaPackageDependencyGraph
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJavaPackageDependencyGraph: """Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_001455
4,704
permissive
[ { "docstring": "Tests that initialization collapses a class dependency graph.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Tests that a package with no external dependencies is included.", "name": "test_initialization_no_dependencies", ...
4
null
Implement the Python class `TestJavaPackageDependencyGraph` described below. Class description: Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph. Method signatures and docstrings: - def test_initialization(self): Tests that initialization collapses ...
Implement the Python class `TestJavaPackageDependencyGraph` described below. Class description: Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph. Method signatures and docstrings: - def test_initialization(self): Tests that initialization collapses ...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class TestJavaPackageDependencyGraph: """Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestJavaPackageDependencyGraph: """Unit tests for JavaPackageDependencyGraph. Full name: dependency_analysis.class_dependency.JavaPackageDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" mock_class_node_1 = create_mock_j...
the_stack_v2_python_sparse
tools/android/dependency_analysis/package_dependency_unittest.py
chromium/chromium
train
17,408
04c9c86a051476ad7a66e8bf453a8a7abccce607
[ "if not self.session.cookies:\n try:\n self.session.cookies = cookies.load()\n except MissingCookiesError:\n return False\n except Exception as exc:\n import traceback\n LOG.error('Failed to load stored cookies: {}', type(exc).__name__)\n LOG.error(traceback.format_exc())...
<|body_start_0|> if not self.session.cookies: try: self.session.cookies = cookies.load() except MissingCookiesError: return False except Exception as exc: import traceback LOG.error('Failed to load stored cookies...
Handle the cookies
SessionCookie
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionCookie: """Handle the cookies""" def _load_cookies(self): """Load stored cookies from disk""" <|body_0|> def _verify_session_cookies(self): """Verify that the session cookies have not expired""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001456
1,950
permissive
[ { "docstring": "Load stored cookies from disk", "name": "_load_cookies", "signature": "def _load_cookies(self)" }, { "docstring": "Verify that the session cookies have not expired", "name": "_verify_session_cookies", "signature": "def _verify_session_cookies(self)" } ]
2
stack_v2_sparse_classes_30k_train_003671
Implement the Python class `SessionCookie` described below. Class description: Handle the cookies Method signatures and docstrings: - def _load_cookies(self): Load stored cookies from disk - def _verify_session_cookies(self): Verify that the session cookies have not expired
Implement the Python class `SessionCookie` described below. Class description: Handle the cookies Method signatures and docstrings: - def _load_cookies(self): Load stored cookies from disk - def _verify_session_cookies(self): Verify that the session cookies have not expired <|skeleton|> class SessionCookie: """H...
ece10d24449faaccd7d65a4093c6b5679ee0b383
<|skeleton|> class SessionCookie: """Handle the cookies""" def _load_cookies(self): """Load stored cookies from disk""" <|body_0|> def _verify_session_cookies(self): """Verify that the session cookies have not expired""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SessionCookie: """Handle the cookies""" def _load_cookies(self): """Load stored cookies from disk""" if not self.session.cookies: try: self.session.cookies = cookies.load() except MissingCookiesError: return False except ...
the_stack_v2_python_sparse
resources/lib/services/nfsession/session/cookie.py
CastagnaIT/plugin.video.netflix
train
2,019
c9609a40c4a9a4913b961d70967237983afb7a9d
[ "if state.func_ir is None:\n pm.add_pass(TranslateByteCode, 'analyzing bytecode')\n pm.add_pass(FixupArgs, 'fix up args')\npm.add_pass(IRProcessing, 'processing IR')\npm.add_pass(WithLifting, 'Handle with contexts')\npm.add_pass(DPPYRewriteOverloadedNumPyFunctions, 'Rewrite name of Numpy functions to overload...
<|body_start_0|> if state.func_ir is None: pm.add_pass(TranslateByteCode, 'analyzing bytecode') pm.add_pass(FixupArgs, 'fix up args') pm.add_pass(IRProcessing, 'processing IR') pm.add_pass(WithLifting, 'Handle with contexts') pm.add_pass(DPPYRewriteOverloadedNumPy...
This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.
DPPYPassBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to t...
stack_v2_sparse_classes_10k_train_001457
5,412
permissive
[ { "docstring": "Adds the default set of NUMBA passes to the pass manager", "name": "default_numba_nopython_pipeline", "signature": "def default_numba_nopython_pipeline(state, pm)" }, { "docstring": "Returns an nopython mode pipeline based PassManager", "name": "define_nopython_pipeline", ...
2
stack_v2_sparse_classes_30k_train_003544
Implement the Python class `DPPYPassBuilder` described below. Class description: This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes. Method signatures and docstrings: - def default_numba_nopython_pipel...
Implement the Python class `DPPYPassBuilder` described below. Class description: This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes. Method signatures and docstrings: - def default_numba_nopython_pipel...
f8b3cc81b65ba75d126c8b3cb603d752eb681c7e
<|skeleton|> class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to the pass manag...
the_stack_v2_python_sparse
numba_dppy/dppy_passbuilder.py
FermiQ/numba-dppy
train
0
f0913172965055a60aae137c7a7a38428a172554
[ "self.pipe = pipe\nself.cache_file_path = cache_file_path\nself.lang_orig = lang_orig\nself.lang_dest = lang_dest\nif not cache_file_path.exists():\n self.cached_tran = {}\n return\nself.cached_tran = json.loads(cache_file_path.read_text())", "if str_orig not in self.cached_tran:\n if self.pipe is None:\...
<|body_start_0|> self.pipe = pipe self.cache_file_path = cache_file_path self.lang_orig = lang_orig self.lang_dest = lang_dest if not cache_file_path.exists(): self.cached_tran = {} return self.cached_tran = json.loads(cache_file_path.read_text()) ...
A cached translation pipeline.
TranslationPipelineCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" <|body_0|> def __call__(self, str_orig: str): ...
stack_v2_sparse_classes_10k_train_001458
1,437
no_license
[ { "docstring": "Initialize a cached TranslationPipeline.", "name": "__init__", "signature": "def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str)" }, { "docstring": "Call an instance of the class with a string to return the translation.",...
2
stack_v2_sparse_classes_30k_train_002790
Implement the Python class `TranslationPipelineCache` described below. Class description: A cached translation pipeline. Method signatures and docstrings: - def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): Initialize a cached TranslationPipeline. - def __...
Implement the Python class `TranslationPipelineCache` described below. Class description: A cached translation pipeline. Method signatures and docstrings: - def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): Initialize a cached TranslationPipeline. - def __...
1d7e5657014b00612cde87b78d5506a9e8b6adfc
<|skeleton|> class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" <|body_0|> def __call__(self, str_orig: str): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TranslationPipelineCache: """A cached translation pipeline.""" def __init__(self, pipe: Optional[TranslationPipeline], cache_file_path: Path, lang_orig: str, lang_dest: str): """Initialize a cached TranslationPipeline.""" self.pipe = pipe self.cache_file_path = cache_file_path ...
the_stack_v2_python_sparse
python/streamlit-sample/align-epub/cached_pipe.py
Pitrified/snippet
train
2
5d6140fb5fe74bccb0c6bb45abe46be604b0c16e
[ "if filter_name is None or filter_name == '':\n self.include = []\n self.exclude = []\nelif filter_name == 'uncategorized':\n exclude = []\n for f in self.filters:\n exclude += self.filters[f].get('include', [])\n self.exclude = exclude\n self.include = []\nelse:\n self.include = self.fi...
<|body_start_0|> if filter_name is None or filter_name == '': self.include = [] self.exclude = [] elif filter_name == 'uncategorized': exclude = [] for f in self.filters: exclude += self.filters[f].get('include', []) self.exclud...
Class to assist in filtering jobs which are in error, based on their last log message.
JSAProcErrorFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSAProcErrorFilter: """Class to assist in filtering jobs which are in error, based on their last log message.""" def __init__(self, filter_name, extrafilter=None, state_prev=None): """Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the valu...
stack_v2_sparse_classes_10k_train_001459
4,160
no_license
[ { "docstring": "Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the values of the JSAProcErrorFilter.filter_names list.", "name": "__init__", "signature": "def __init__(self, filter_name, extrafilter=None, state_prev=None)" }, { "docstring": "Apply fil...
2
stack_v2_sparse_classes_30k_train_005924
Implement the Python class `JSAProcErrorFilter` described below. Class description: Class to assist in filtering jobs which are in error, based on their last log message. Method signatures and docstrings: - def __init__(self, filter_name, extrafilter=None, state_prev=None): Create error filter object. Parameters: fil...
Implement the Python class `JSAProcErrorFilter` described below. Class description: Class to assist in filtering jobs which are in error, based on their last log message. Method signatures and docstrings: - def __init__(self, filter_name, extrafilter=None, state_prev=None): Create error filter object. Parameters: fil...
8b8ef99700108dec85c6a14613181eef2d8d311e
<|skeleton|> class JSAProcErrorFilter: """Class to assist in filtering jobs which are in error, based on their last log message.""" def __init__(self, filter_name, extrafilter=None, state_prev=None): """Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the valu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JSAProcErrorFilter: """Class to assist in filtering jobs which are in error, based on their last log message.""" def __init__(self, filter_name, extrafilter=None, state_prev=None): """Create error filter object. Parameters: filter_name: the name of the filter. Must be one of the values of the JSA...
the_stack_v2_python_sparse
lib/jsa_proc/action/error_filter.py
eaobservatory/jsa_proc
train
0
4570a96598f5e57f6d8d66e24b426fdb8382f5ce
[ "batch = batch.to(self.device)\nchars, char_lens = batch.grapheme_encoded\nphn_bos, phn_lens = batch.phn_encoded_bos\nemb_char = self.hparams.encoder_emb(chars)\nx, _ = self.modules.enc(emb_char)\ne_in = self.modules.emb(phn_bos)\nh, w = self.modules.dec(e_in, x, char_lens)\nlogits = self.modules.lin(h)\np_seq = se...
<|body_start_0|> batch = batch.to(self.device) chars, char_lens = batch.grapheme_encoded phn_bos, phn_lens = batch.phn_encoded_bos emb_char = self.hparams.encoder_emb(chars) x, _ = self.modules.enc(emb_char) e_in = self.modules.emb(phn_bos) h, w = self.modules.dec...
ASR
[ "GPL-1.0-or-later", "LicenseRef-scancode-other-permissive", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ASR: def compute_forward(self, batch, stage): """Forward computations from the char batches to the output probabilities.""" <|body_0|> def compute_objectives(self, predictions, batch, stage): """Computes the loss (CTC+NLL) given predictions and targets.""" <|...
stack_v2_sparse_classes_10k_train_001460
10,934
permissive
[ { "docstring": "Forward computations from the char batches to the output probabilities.", "name": "compute_forward", "signature": "def compute_forward(self, batch, stage)" }, { "docstring": "Computes the loss (CTC+NLL) given predictions and targets.", "name": "compute_objectives", "signa...
6
stack_v2_sparse_classes_30k_train_000061
Implement the Python class `ASR` described below. Class description: Implement the ASR class. Method signatures and docstrings: - def compute_forward(self, batch, stage): Forward computations from the char batches to the output probabilities. - def compute_objectives(self, predictions, batch, stage): Computes the los...
Implement the Python class `ASR` described below. Class description: Implement the ASR class. Method signatures and docstrings: - def compute_forward(self, batch, stage): Forward computations from the char batches to the output probabilities. - def compute_objectives(self, predictions, batch, stage): Computes the los...
d4c9a53773f13d5a2843f25bc7f89482936e2f17
<|skeleton|> class ASR: def compute_forward(self, batch, stage): """Forward computations from the char batches to the output probabilities.""" <|body_0|> def compute_objectives(self, predictions, batch, stage): """Computes the loss (CTC+NLL) given predictions and targets.""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ASR: def compute_forward(self, batch, stage): """Forward computations from the char batches to the output probabilities.""" batch = batch.to(self.device) chars, char_lens = batch.grapheme_encoded phn_bos, phn_lens = batch.phn_encoded_bos emb_char = self.hparams.encoder_...
the_stack_v2_python_sparse
recipes/LibriSpeech/G2P/train.py
zycv/speechbrain
train
2
89e28e49b5385f7d8edb59509235eeac2487684f
[ "super(InputManager_Radix, self).__init__(config, is_inference)\nc = self.config\nmax_word_len = len(ops.number_to_base(len(c.wtoi), c.radix_base))\nself.buckets = [b * max_word_len for b in self.buckets]\nself.radix_wtoi = {}\nassert c.wtoi['<PAD>'] == -1\nfor k in c.wtoi:\n if k == '<GO>':\n idx = [c.ra...
<|body_start_0|> super(InputManager_Radix, self).__init__(config, is_inference) c = self.config max_word_len = len(ops.number_to_base(len(c.wtoi), c.radix_base)) self.buckets = [b * max_word_len for b in self.buckets] self.radix_wtoi = {} assert c.wtoi['<PAD>'] == -1 ...
Input Manager object for Radix-token models.
InputManager_Radix
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputManager_Radix: """Input Manager object for Radix-token models.""" def __init__(self, config, is_inference=False): """Loads the h5 file containing caption data and corresponding image paths.""" <|body_0|> def _gen(self, data, is_training=True): """Generator f...
stack_v2_sparse_classes_10k_train_001461
19,609
permissive
[ { "docstring": "Loads the h5 file containing caption data and corresponding image paths.", "name": "__init__", "signature": "def __init__(self, config, is_inference=False)" }, { "docstring": "Generator fn, yields the image filepath and word IDs. Handles dataset shuffling.", "name": "_gen", ...
2
stack_v2_sparse_classes_30k_test_000126
Implement the Python class `InputManager_Radix` described below. Class description: Input Manager object for Radix-token models. Method signatures and docstrings: - def __init__(self, config, is_inference=False): Loads the h5 file containing caption data and corresponding image paths. - def _gen(self, data, is_traini...
Implement the Python class `InputManager_Radix` described below. Class description: Input Manager object for Radix-token models. Method signatures and docstrings: - def __init__(self, config, is_inference=False): Loads the h5 file containing caption data and corresponding image paths. - def _gen(self, data, is_traini...
73165e0aac2816e89732571814f978801958e1ac
<|skeleton|> class InputManager_Radix: """Input Manager object for Radix-token models.""" def __init__(self, config, is_inference=False): """Loads the h5 file containing caption data and corresponding image paths.""" <|body_0|> def _gen(self, data, is_training=True): """Generator f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InputManager_Radix: """Input Manager object for Radix-token models.""" def __init__(self, config, is_inference=False): """Loads the h5 file containing caption data and corresponding image paths.""" super(InputManager_Radix, self).__init__(config, is_inference) c = self.config ...
the_stack_v2_python_sparse
common/inputs/manager_image_caption.py
jiahuei/COMIC-Compact-Image-Captioning-with-Attention
train
10
6632c6b6b8e14c40a7a79ca64b051a26d327a9a5
[ "if request.user.is_authenticated and request.user.is_administrator_of_search_pages:\n return True\nreturn super().has_add_permission(request, obj)", "if request.user.is_authenticated and request.user.is_administrator_of_search_pages:\n return True\nreturn super().has_delete_permission(request, obj)" ]
<|body_start_0|> if request.user.is_authenticated and request.user.is_administrator_of_search_pages: return True return super().has_add_permission(request, obj) <|end_body_0|> <|body_start_1|> if request.user.is_authenticated and request.user.is_administrator_of_search_pages: ...
WithFullPermission
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WithFullPermission: def has_add_permission(self, request, obj=None): """Grant permission to authenticated users that are administrator of search pages.""" <|body_0|> def has_delete_permission(self, request, obj=None): """Grant permission to authenticated users that a...
stack_v2_sparse_classes_10k_train_001462
1,718
permissive
[ { "docstring": "Grant permission to authenticated users that are administrator of search pages.", "name": "has_add_permission", "signature": "def has_add_permission(self, request, obj=None)" }, { "docstring": "Grant permission to authenticated users that are administrator of search pages.", ...
2
null
Implement the Python class `WithFullPermission` described below. Class description: Implement the WithFullPermission class. Method signatures and docstrings: - def has_add_permission(self, request, obj=None): Grant permission to authenticated users that are administrator of search pages. - def has_delete_permission(s...
Implement the Python class `WithFullPermission` described below. Class description: Implement the WithFullPermission class. Method signatures and docstrings: - def has_add_permission(self, request, obj=None): Grant permission to authenticated users that are administrator of search pages. - def has_delete_permission(s...
af9f6e6e8b1918363793fbf291f3518ef1454169
<|skeleton|> class WithFullPermission: def has_add_permission(self, request, obj=None): """Grant permission to authenticated users that are administrator of search pages.""" <|body_0|> def has_delete_permission(self, request, obj=None): """Grant permission to authenticated users that a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WithFullPermission: def has_add_permission(self, request, obj=None): """Grant permission to authenticated users that are administrator of search pages.""" if request.user.is_authenticated and request.user.is_administrator_of_search_pages: return True return super().has_add_...
the_stack_v2_python_sparse
src/admin_lite/mixins.py
MTES-MCT/aides-territoires
train
21
bf0fcf389638ae57744b106e826e41758ad0b8a9
[ "argument = lab04.eratosthenes(1)\nexpected = []\nself.assertEqual(expected, argument, 'There are no prime numbers in the list.')", "argument = lab04.eratosthenes(2)\nexpected = [2]\nself.assertEqual(expected, argument, 'The list contains one prime number.')", "argument = lab04.eratosthenes(31)\nexpected = [2, ...
<|body_start_0|> argument = lab04.eratosthenes(1) expected = [] self.assertEqual(expected, argument, 'There are no prime numbers in the list.') <|end_body_0|> <|body_start_1|> argument = lab04.eratosthenes(2) expected = [2] self.assertEqual(expected, argument, 'The list ...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_smallest_bound(self): """Test the upper bound of one.""" <|body_0|> def test_list_of_one(self): """Test the upper bound of two.""" <|body_1|> def test_list_of_several(self): """Test an upper bound that returns a list of many intege...
stack_v2_sparse_classes_10k_train_001463
1,187
no_license
[ { "docstring": "Test the upper bound of one.", "name": "test_smallest_bound", "signature": "def test_smallest_bound(self)" }, { "docstring": "Test the upper bound of two.", "name": "test_list_of_one", "signature": "def test_list_of_one(self)" }, { "docstring": "Test an upper boun...
4
stack_v2_sparse_classes_30k_train_003967
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_smallest_bound(self): Test the upper bound of one. - def test_list_of_one(self): Test the upper bound of two. - def test_list_of_several(self): Test an upper bound that returns ...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_smallest_bound(self): Test the upper bound of one. - def test_list_of_one(self): Test the upper bound of two. - def test_list_of_several(self): Test an upper bound that returns ...
a7014be9881ec4a2d0b332fef353a29f5dbb05de
<|skeleton|> class Test: def test_smallest_bound(self): """Test the upper bound of one.""" <|body_0|> def test_list_of_one(self): """Test the upper bound of two.""" <|body_1|> def test_list_of_several(self): """Test an upper bound that returns a list of many intege...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test: def test_smallest_bound(self): """Test the upper bound of one.""" argument = lab04.eratosthenes(1) expected = [] self.assertEqual(expected, argument, 'There are no prime numbers in the list.') def test_list_of_one(self): """Test the upper bound of two.""" ...
the_stack_v2_python_sparse
Lab04/test_eratosthenes.py
ronliang6/A01199458_1510
train
0
e39d095d412449dda0330fe53d079656088c9ea5
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DetectedApp()", "from .detected_app_platform_type import DetectedAppPlatformType\nfrom .entity import Entity\nfrom .managed_device import ManagedDevice\nfrom .detected_app_platform_type import DetectedAppPlatformType\nfrom .entity impo...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DetectedApp() <|end_body_0|> <|body_start_1|> from .detected_app_platform_type import DetectedAppPlatformType from .entity import Entity from .managed_device import ManagedDevice...
A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.
DetectedApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appro...
stack_v2_sparse_classes_10k_train_001464
4,234
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: DetectedApp", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(p...
3
null
Implement the Python class `DetectedApp` described below. Class description: A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=...
Implement the Python class `DetectedApp` described below. Class description: A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appropriate class ...
the_stack_v2_python_sparse
msgraph/generated/models/detected_app.py
microsoftgraph/msgraph-sdk-python
train
135
eb38ee0b3754ba5cbda846192e86317722f13909
[ "self.match_labels = match_labels\nself.name = name\nself.service_name = service_name", "if dictionary is None:\n return None\nmatch_labels = None\nif dictionary.get('matchLabels') != None:\n match_labels = list()\n for structure in dictionary.get('matchLabels'):\n match_labels.append(cohesity_man...
<|body_start_0|> self.match_labels = match_labels self.name = name self.service_name = service_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None match_labels = None if dictionary.get('matchLabels') != None: match_labels = lis...
Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the selector name (string): Select all objects which have a label with key : "name"...
LabelSelector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelSelector: """Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the selector name (string): Select all obj...
stack_v2_sparse_classes_10k_train_001465
2,409
permissive
[ { "docstring": "Constructor for the LabelSelector class", "name": "__init__", "signature": "def __init__(self, match_labels=None, name=None, service_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th...
2
stack_v2_sparse_classes_30k_train_000013
Implement the Python class `LabelSelector` described below. Class description: Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the...
Implement the Python class `LabelSelector` described below. Class description: Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class LabelSelector: """Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the selector name (string): Select all obj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabelSelector: """Implementation of the 'LabelSelector' model. TODO: type description here. Attributes: match_labels (list of LabelSelector_MatchLabelsEntry): This field is an object which consists of key-value pairs of all labels that must be matched by the selector name (string): Select all objects which ha...
the_stack_v2_python_sparse
cohesity_management_sdk/models/label_selector.py
cohesity/management-sdk-python
train
24
e39bfbcf338391d9bfdc489a0db6ac063155827d
[ "super(ActionTypeHead, self).__init__()\nself.cfg = cfg\nself.act = build_activation(cfg.activation)\nself.project = fc_block(cfg.input_dim, cfg.res_dim)\nblocks = [ResFCBlock(cfg.res_dim, self.act, cfg.norm_type) for _ in range(cfg.res_num)]\nself.res = nn.Sequential(*blocks)\nself.weight_norm = cfg.get('weight_no...
<|body_start_0|> super(ActionTypeHead, self).__init__() self.cfg = cfg self.act = build_activation(cfg.activation) self.project = fc_block(cfg.input_dim, cfg.res_dim) blocks = [ResFCBlock(cfg.res_dim, self.act, cfg.norm_type) for _ in range(cfg.res_num)] self.res = nn.Seq...
Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward
ActionTypeHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionTypeHead: """Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward""" def __init__(self, cfg): """Overview: initialize architect. Arguments: - cfg (:obj:`dict`): h...
stack_v2_sparse_classes_10k_train_001466
5,506
permissive
[ { "docstring": "Overview: initialize architect. Arguments: - cfg (:obj:`dict`): head architecture definition", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": "Overview: This head embeds lstm_output into a 1D tensor of size 256, passes it through 16 ResBlocks with la...
2
stack_v2_sparse_classes_30k_train_006344
Implement the Python class `ActionTypeHead` described below. Class description: Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, cfg): Overview...
Implement the Python class `ActionTypeHead` described below. Class description: Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward Method signatures and docstrings: - def __init__(self, cfg): Overview...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class ActionTypeHead: """Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward""" def __init__(self, cfg): """Overview: initialize architect. Arguments: - cfg (:obj:`dict`): h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActionTypeHead: """Overview: The action type head uses lstm_output and scalar_context to get action_type_logits, action_type and its autoregressive_embedding. Interface: __init__, forward""" def __init__(self, cfg): """Overview: initialize architect. Arguments: - cfg (:obj:`dict`): head architect...
the_stack_v2_python_sparse
distar/model/alphastar/head/action_type_head.py
LFhase/DI-star
train
1
f8867f2d69751f84fa1d61451ca1d884430197ea
[ "self.fn = ''\nself.pt_id = 'X X X X' + ' ' * 73\nself.rec_info = 'Startdate X X X X' + ' ' * 63\nself.start_date = '01.01.01'\nself.start_time = '01.01.01'\nself.py_h = 2\nself.pyedf_header = {'technician': '002', 'recording_additional': '', 'patientname': '', 'patient_additional': '', 'patientcode': '', 'equipmen...
<|body_start_0|> self.fn = '' self.pt_id = 'X X X X' + ' ' * 73 self.rec_info = 'Startdate X X X X' + ' ' * 63 self.start_date = '01.01.01' self.start_time = '01.01.01' self.py_h = 2 self.pyedf_header = {'technician': '002', 'recording_additional': '', 'patientnam...
Data structure for holding information for saving to edf namely the anonymized header
SaveEdfInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" <|body_0|> def convert_to_header(self): """Converts from native EDF format: self.data.pt_id ...
stack_v2_sparse_classes_10k_train_001467
3,114
no_license
[ { "docstring": "Header parameters set to default values", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Converts from native EDF format: self.data.pt_id = file[8:88].decode(\"utf-8\") self.data.rec_info = file[88:168].decode(\"utf-8\") self.data.start_date = file[168:1...
2
stack_v2_sparse_classes_30k_train_003348
Implement the Python class `SaveEdfInfo` described below. Class description: Data structure for holding information for saving to edf namely the anonymized header Method signatures and docstrings: - def __init__(self): Header parameters set to default values - def convert_to_header(self): Converts from native EDF for...
Implement the Python class `SaveEdfInfo` described below. Class description: Data structure for holding information for saving to edf namely the anonymized header Method signatures and docstrings: - def __init__(self): Header parameters set to default values - def convert_to_header(self): Converts from native EDF for...
099920716fdab891592ccc7f324445f088827298
<|skeleton|> class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" <|body_0|> def convert_to_header(self): """Converts from native EDF format: self.data.pt_id ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" self.fn = '' self.pt_id = 'X X X X' + ' ' * 73 self.rec_info = 'Startdate X X X X' + ' ' * 63 ...
the_stack_v2_python_sparse
visualization/edf_saving/saveEdf_info.py
jcraley/jhu-eeg
train
2
a82b954550123140dc0dab113db482e303d3ecf6
[ "self.maxEpochs = maxEpochs\nself.initAlpha = initAlpha\nself.power = power\npass", "decay = (1 - epoch / float(self.maxEpochs)) ** self.power\nalpha = self.initAlpha * decay\nreturn float(alpha)" ]
<|body_start_0|> self.maxEpochs = maxEpochs self.initAlpha = initAlpha self.power = power pass <|end_body_0|> <|body_start_1|> decay = (1 - epoch / float(self.maxEpochs)) ** self.power alpha = self.initAlpha * decay return float(alpha) <|end_body_1|>
PolynomialDecay
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolynomialDecay: def __init__(self, maxEpochs=100, initAlpha=0.01, power=1.0): """- initialize polynomial learning rate decay schedule with 3 args" - maxEpochs = # of training epochs; - initAlpha = initial learning rate; - power = power/exponent of the polynomial; linear if power=1.0, qu...
stack_v2_sparse_classes_10k_train_001468
2,358
no_license
[ { "docstring": "- initialize polynomial learning rate decay schedule with 3 args\" - maxEpochs = # of training epochs; - initAlpha = initial learning rate; - power = power/exponent of the polynomial; linear if power=1.0, quadratic if power=2.0, etc.", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_004356
Implement the Python class `PolynomialDecay` described below. Class description: Implement the PolynomialDecay class. Method signatures and docstrings: - def __init__(self, maxEpochs=100, initAlpha=0.01, power=1.0): - initialize polynomial learning rate decay schedule with 3 args" - maxEpochs = # of training epochs; ...
Implement the Python class `PolynomialDecay` described below. Class description: Implement the PolynomialDecay class. Method signatures and docstrings: - def __init__(self, maxEpochs=100, initAlpha=0.01, power=1.0): - initialize polynomial learning rate decay schedule with 3 args" - maxEpochs = # of training epochs; ...
ebf5edb4d71f81dd9d8478c6251e97c097d189c3
<|skeleton|> class PolynomialDecay: def __init__(self, maxEpochs=100, initAlpha=0.01, power=1.0): """- initialize polynomial learning rate decay schedule with 3 args" - maxEpochs = # of training epochs; - initAlpha = initial learning rate; - power = power/exponent of the polynomial; linear if power=1.0, qu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PolynomialDecay: def __init__(self, maxEpochs=100, initAlpha=0.01, power=1.0): """- initialize polynomial learning rate decay schedule with 3 args" - maxEpochs = # of training epochs; - initAlpha = initial learning rate; - power = power/exponent of the polynomial; linear if power=1.0, quadratic if pow...
the_stack_v2_python_sparse
callbacks/learning_rate_scheduler.py
zlyin/Orca
train
0
43a91a5f9ccf7006d4cbbc4cf9333c00e92d4cac
[ "self.bands = []\nself.r95 = []\nfor bandlike in roi.selected:\n band = bandlike.band\n if band.emin < emin[band.event_type]:\n continue\n self.r95.append(np.radians(band.psf.inverse_integral(95, on_axis=False)))\n self.bands.append(band)", "sd = skydir or SkyDir(Hep3Vector(v[0], v[1], v[2]))\n...
<|body_start_0|> self.bands = [] self.r95 = [] for bandlike in roi.selected: band = bandlike.band if band.emin < emin[band.event_type]: continue self.r95.append(np.radians(band.psf.inverse_integral(95, on_axis=False))) self.bands.ap...
Implement a SkyFunction that returns KDE data for a given ROI
KdeMap
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KdeMap: """Implement a SkyFunction that returns KDE data for a given ROI""" def __init__(self, roi, emin=[500, 1000], **kwargs): """roi: an ROIstat object emin: list of two minimum energies""" <|body_0|> def __call__(self, v, skydir=None): """copied from roi_tsma...
stack_v2_sparse_classes_10k_train_001469
24,274
permissive
[ { "docstring": "roi: an ROIstat object emin: list of two minimum energies", "name": "__init__", "signature": "def __init__(self, roi, emin=[500, 1000], **kwargs)" }, { "docstring": "copied from roi_tsmap.HealpixKDEMap", "name": "__call__", "signature": "def __call__(self, v, skydir=None)...
2
stack_v2_sparse_classes_30k_train_002648
Implement the Python class `KdeMap` described below. Class description: Implement a SkyFunction that returns KDE data for a given ROI Method signatures and docstrings: - def __init__(self, roi, emin=[500, 1000], **kwargs): roi: an ROIstat object emin: list of two minimum energies - def __call__(self, v, skydir=None):...
Implement the Python class `KdeMap` described below. Class description: Implement a SkyFunction that returns KDE data for a given ROI Method signatures and docstrings: - def __init__(self, roi, emin=[500, 1000], **kwargs): roi: an ROIstat object emin: list of two minimum energies - def __call__(self, v, skydir=None):...
edcdc696c3300e2f26ff3efa92a1bd9790074247
<|skeleton|> class KdeMap: """Implement a SkyFunction that returns KDE data for a given ROI""" def __init__(self, roi, emin=[500, 1000], **kwargs): """roi: an ROIstat object emin: list of two minimum energies""" <|body_0|> def __call__(self, v, skydir=None): """copied from roi_tsma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KdeMap: """Implement a SkyFunction that returns KDE data for a given ROI""" def __init__(self, roi, emin=[500, 1000], **kwargs): """roi: an ROIstat object emin: list of two minimum energies""" self.bands = [] self.r95 = [] for bandlike in roi.selected: band = b...
the_stack_v2_python_sparse
python/uw/like2/maps.py
fermi-lat/pointlike
train
1
968b1b0349ce74e58af2193d7743ea3b4aafa6a4
[ "def reverse(nl: ListNode):\n if nl is None or nl.next is None:\n return (nl, nl)\n hnode, tnode = reverse(nl.next)\n nl.next = None\n tnode.next = nl\n return (hnode, nl)\nret, _ = reverse(head)\nreturn ret", "pre = None\nwhile head:\n pre, head.next, head = (head, pre, head.next)\nretur...
<|body_start_0|> def reverse(nl: ListNode): if nl is None or nl.next is None: return (nl, nl) hnode, tnode = reverse(nl.next) nl.next = None tnode.next = nl return (hnode, nl) ret, _ = reverse(head) return ret <|end_body...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" <|body_0|> def reverseList(self, head: ListNode) -...
stack_v2_sparse_classes_10k_train_001470
1,605
permissive
[ { "docstring": "20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:", "name": "reverseList2", "signature": "def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]" }, { "docstring": "2022-08-23 :...
2
stack_v2_sparse_classes_30k_train_005584
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" <|body_0|> def reverseList(self, head: ListNode) -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" def reverse(nl: ListNode): if nl is None or nl.next is No...
the_stack_v2_python_sparse
src/206-ReverseLinkedList.py
Jiezhi/myleetcode
train
1
8dcb13c4188770ec1f8a0cfb4ca8f75fba1a67cb
[ "next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_section_from_library(path, material_id)\nsetattr(self, str(next_index), new_section)\nreturn next_index", "next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_custom_from_library(name, material_id)\nsetattr(se...
<|body_start_0|> next_index = next_object_key(self) new_section = Section() new_section.load_section_from_library(path, material_id) setattr(self, str(next_index), new_section) return next_index <|end_body_0|> <|body_start_1|> next_index = next_object_key(self) n...
Creates an instance of the SkyCiv Sections class.
Sections
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o...
stack_v2_sparse_classes_10k_train_001471
2,588
permissive
[ { "docstring": "Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section in the section library, obtained by inspection from within SkyCiv Section Builder or by attaining the library tree via S3D.SB.getLibraryTree...
3
stack_v2_sparse_classes_30k_train_007027
Implement the Python class `Sections` described below. Class description: Creates an instance of the SkyCiv Sections class. Method signatures and docstrings: - def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an...
Implement the Python class `Sections` described below. Class description: Creates an instance of the SkyCiv Sections class. Method signatures and docstrings: - def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an...
1cf3dad7f8d451760df02886df41684add72a4eb
<|skeleton|> class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Sections: """Creates an instance of the SkyCiv Sections class.""" def add_library_section(self, path: list[str], material_id: int) -> int: """Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section...
the_stack_v2_python_sparse
src/skyciv/classes/model/components/sections/sections.py
osasanchezme/skyciv-pip
train
0
4d733c4aefc460de5b36fbc0fb046509e030af71
[ "alloy_type = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False, id=alloy_type_id)\nif alloy_type:\n data = {'alloy_type': alloy_type}\n return render(request, 'admin/alloy/alloy_type_edit.html', context=data)\nelse:\n logger.info('id为<{}>合金类型不存在'.format(alloy_type_id))\n return to...
<|body_start_0|> alloy_type = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False, id=alloy_type_id) if alloy_type: data = {'alloy_type': alloy_type} return render(request, 'admin/alloy/alloy_type_edit.html', context=data) else: logger.info...
合金类型修改
AlloyTypeEdit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlloyTypeEdit: """合金类型修改""" def get(self, request, alloy_type_id): """指定合金类型查询展示 :param request: :param alloy_type_id: :return:""" <|body_0|> def put(self, request, alloy_type_id): """指定合金类型修改 :param request: :param alloy_type_id: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001472
11,849
no_license
[ { "docstring": "指定合金类型查询展示 :param request: :param alloy_type_id: :return:", "name": "get", "signature": "def get(self, request, alloy_type_id)" }, { "docstring": "指定合金类型修改 :param request: :param alloy_type_id: :return:", "name": "put", "signature": "def put(self, request, alloy_type_id)"...
3
stack_v2_sparse_classes_30k_train_003481
Implement the Python class `AlloyTypeEdit` described below. Class description: 合金类型修改 Method signatures and docstrings: - def get(self, request, alloy_type_id): 指定合金类型查询展示 :param request: :param alloy_type_id: :return: - def put(self, request, alloy_type_id): 指定合金类型修改 :param request: :param alloy_type_id: :return: - ...
Implement the Python class `AlloyTypeEdit` described below. Class description: 合金类型修改 Method signatures and docstrings: - def get(self, request, alloy_type_id): 指定合金类型查询展示 :param request: :param alloy_type_id: :return: - def put(self, request, alloy_type_id): 指定合金类型修改 :param request: :param alloy_type_id: :return: - ...
063332d2a5e2ddabf800817f02074b4f5c162ade
<|skeleton|> class AlloyTypeEdit: """合金类型修改""" def get(self, request, alloy_type_id): """指定合金类型查询展示 :param request: :param alloy_type_id: :return:""" <|body_0|> def put(self, request, alloy_type_id): """指定合金类型修改 :param request: :param alloy_type_id: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlloyTypeEdit: """合金类型修改""" def get(self, request, alloy_type_id): """指定合金类型查询展示 :param request: :param alloy_type_id: :return:""" alloy_type = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False, id=alloy_type_id) if alloy_type: data = {'alloy_type...
the_stack_v2_python_sparse
sfs/apps/alloy/views.py
Hx-someone/sfs-1
train
0
0949634a1477577fdaf6639bf57aa9672c1c9116
[ "if not isinstance(config, KubeflowV2DagRunnerConfig):\n raise TypeError('config must be type of KubeflowV2DagRunnerConfig.')\nsuper().__init__()\nself._config = config\nself._output_dir = output_dir or os.getcwd()\nself._output_filename = output_filename or 'pipeline.json'\nself._exit_handler = None", "if not...
<|body_start_0|> if not isinstance(config, KubeflowV2DagRunnerConfig): raise TypeError('config must be type of KubeflowV2DagRunnerConfig.') super().__init__() self._config = config self._output_dir = output_dir or os.getcwd() self._output_filename = output_filename or...
Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object.
KubeflowV2DagRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KubeflowV2DagRunner: """Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object.""" def __init__(self, config: KubeflowV2DagRunnerConfig, output_dir: Optional[str]=None, output_filename: Optional[str]=None): ...
stack_v2_sparse_classes_10k_train_001473
8,534
permissive
[ { "docstring": "Constructs an KubeflowV2DagRunner for compiling pipelines. Args: config: An KubeflowV2DagRunnerConfig object to specify runtime configuration when running the pipeline in Kubeflow. output_dir: An optional output directory into which to output the pipeline definition files. Defaults to the curren...
3
null
Implement the Python class `KubeflowV2DagRunner` described below. Class description: Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object. Method signatures and docstrings: - def __init__(self, config: KubeflowV2DagRunnerConfig, outp...
Implement the Python class `KubeflowV2DagRunner` described below. Class description: Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object. Method signatures and docstrings: - def __init__(self, config: KubeflowV2DagRunnerConfig, outp...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class KubeflowV2DagRunner: """Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object.""" def __init__(self, config: KubeflowV2DagRunnerConfig, output_dir: Optional[str]=None, output_filename: Optional[str]=None): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KubeflowV2DagRunner: """Kubeflow V2 pipeline runner (currently for managed pipelines). Builds a pipeline job spec in json format based on TFX pipeline DSL object.""" def __init__(self, config: KubeflowV2DagRunnerConfig, output_dir: Optional[str]=None, output_filename: Optional[str]=None): """Cons...
the_stack_v2_python_sparse
tfx/orchestration/kubeflow/v2/kubeflow_v2_dag_runner.py
tensorflow/tfx
train
2,116
ba055b1214ab013bece7d277b8c7ae461caac1e1
[ "Node.__init__(self)\nself.dim = dim\nif init:\n self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1)))\nself.trainable = trainable", "assert isinstance(value, np.matrix) and value.shape == (self.dim, 1)\nself.reset_value()\nself.value = value" ]
<|body_start_0|> Node.__init__(self) self.dim = dim if init: self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1))) self.trainable = trainable <|end_body_0|> <|body_start_1|> assert isinstance(value, np.matrix) and value.shape == (self.dim, 1) self.re...
变(向)量节点
Variable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" <|body_0|> def set_value(self, value): """为变量赋值""" <|body_1|> <|end_skeleton|> <|body_start_0|> Node.__init__(self) se...
stack_v2_sparse_classes_10k_train_001474
6,904
permissive
[ { "docstring": "变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识", "name": "__init__", "signature": "def __init__(self, dim, init=False, trainable=True)" }, { "docstring": "为变量赋值", "name": "set_value", "signature": "def set_value(self, value)" } ]
2
null
Implement the Python class `Variable` described below. Class description: 变(向)量节点 Method signatures and docstrings: - def __init__(self, dim, init=False, trainable=True): 变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识 - def set_value(self, value): 为变量赋值
Implement the Python class `Variable` described below. Class description: 变(向)量节点 Method signatures and docstrings: - def __init__(self, dim, init=False, trainable=True): 变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识 - def set_value(self, value): 为变量赋值 <|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim...
b4a9ddcc2820fd0e3c9bbd81c26a8fa35f348c23
<|skeleton|> class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" <|body_0|> def set_value(self, value): """为变量赋值""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Variable: """变(向)量节点""" def __init__(self, dim, init=False, trainable=True): """变量节点没有父节点,构造函数接受变量的维数,以及变量是否参与训练的标识""" Node.__init__(self) self.dim = dim if init: self.value = np.mat(np.random.normal(0, 0.001, (self.dim, 1))) self.trainable = trainable ...
the_stack_v2_python_sparse
lang/programming/python/深入理解神经网络:从逻辑回归到CNN/neural_network-neural_network_code-master/neural_network_code/第 8 章 计算图/node.py
dlxj/doc
train
10
d954c4a82d03bb04604e78b48e43504363c6d5d6
[ "slow = 0\nwhile slow < len(nums) and nums[slow] != 0:\n slow += 1\nfast = slow + 1\nwhile fast < len(nums):\n if nums[fast]:\n nums[slow], nums[fast] = (nums[fast], 0)\n slow += 1\n fast += 1\nreturn nums", "tail = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[tail], nu...
<|body_start_0|> slow = 0 while slow < len(nums) and nums[slow] != 0: slow += 1 fast = slow + 1 while fast < len(nums): if nums[fast]: nums[slow], nums[fast] = (nums[fast], 0) slow += 1 fast += 1 return nums <|en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes_precisetomine(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None D...
stack_v2_sparse_classes_10k_train_001475
1,563
no_license
[ { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def moveZeroes(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modif...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def moveZeroes_precisetomine(self, num...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def moveZeroes_precisetomine(self, num...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes_precisetomine(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None D...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" slow = 0 while slow < len(nums) and nums[slow] != 0: slow += 1 fast = slow + 1 while fast < len(nums): ...
the_stack_v2_python_sparse
LeetCode/Array/283_move_zeros.py
XyK0907/for_work
train
0
5b3d31405bf7e32431b5a43d8a6822a0bc4d0007
[ "request = self.context.get('request')\ndata['poster'] = request.user\nreturn validate_complete_address(data)", "response = super().to_representation(instance)\nresponse['poster'] = {'id': instance.poster.id}\nreturn response" ]
<|body_start_0|> request = self.context.get('request') data['poster'] = request.user return validate_complete_address(data) <|end_body_0|> <|body_start_1|> response = super().to_representation(instance) response['poster'] = {'id': instance.poster.id} return response <|en...
Serializer handles creation of a new listing
CreateListingSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateListingSerializer: """Serializer handles creation of a new listing""" def validate(self, data): """Validate creation of new listing - Check complete address listing is valid""" <|body_0|> def to_representation(self, instance): """Return only id of poster wh...
stack_v2_sparse_classes_10k_train_001476
3,983
no_license
[ { "docstring": "Validate creation of new listing - Check complete address listing is valid", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Return only id of poster when creating listing", "name": "to_representation", "signature": "def to_representation(se...
2
stack_v2_sparse_classes_30k_train_000471
Implement the Python class `CreateListingSerializer` described below. Class description: Serializer handles creation of a new listing Method signatures and docstrings: - def validate(self, data): Validate creation of new listing - Check complete address listing is valid - def to_representation(self, instance): Return...
Implement the Python class `CreateListingSerializer` described below. Class description: Serializer handles creation of a new listing Method signatures and docstrings: - def validate(self, data): Validate creation of new listing - Check complete address listing is valid - def to_representation(self, instance): Return...
1f2c8c232372de6a40089c8b867ce1798d2296c7
<|skeleton|> class CreateListingSerializer: """Serializer handles creation of a new listing""" def validate(self, data): """Validate creation of new listing - Check complete address listing is valid""" <|body_0|> def to_representation(self, instance): """Return only id of poster wh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateListingSerializer: """Serializer handles creation of a new listing""" def validate(self, data): """Validate creation of new listing - Check complete address listing is valid""" request = self.context.get('request') data['poster'] = request.user return validate_comple...
the_stack_v2_python_sparse
core/roommates_api/serializers/listing_serializers.py
harmanT23/yournextroommates
train
1
a59b3e9bdad38206fb724febb069a86cf5cc96ae
[ "i, j, n = (0, len(A) - 1, len(A))\nwhile i + 1 < n and A[i] < A[i + 1]:\n i += 1\nwhile j > 0 and A[j - 1] > A[j]:\n j -= 1\nreturn 0 < i == j < n - 1", "if len(A) < 3:\n return False\nif A[0] >= A[1]:\n return False\nclimb = True\nfor a, b in zip(A, A[1:]):\n if climb:\n if a < b:\n ...
<|body_start_0|> i, j, n = (0, len(A) - 1, len(A)) while i + 1 < n and A[i] < A[i + 1]: i += 1 while j > 0 and A[j - 1] > A[j]: j -= 1 return 0 < i == j < n - 1 <|end_body_0|> <|body_start_1|> if len(A) < 3: return False if A[0] >= A[1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validMountainArray(self, A): """:type A: List[int] :rtype: bool""" <|body_0|> def validMountainArray(self, A): """:type A: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> i, j, n = (0, len(A) - 1, len(A)) ...
stack_v2_sparse_classes_10k_train_001477
839
no_license
[ { "docstring": ":type A: List[int] :rtype: bool", "name": "validMountainArray", "signature": "def validMountainArray(self, A)" }, { "docstring": ":type A: List[int] :rtype: bool", "name": "validMountainArray", "signature": "def validMountainArray(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validMountainArray(self, A): :type A: List[int] :rtype: bool - def validMountainArray(self, A): :type A: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validMountainArray(self, A): :type A: List[int] :rtype: bool - def validMountainArray(self, A): :type A: List[int] :rtype: bool <|skeleton|> class Solution: def validMo...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def validMountainArray(self, A): """:type A: List[int] :rtype: bool""" <|body_0|> def validMountainArray(self, A): """:type A: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def validMountainArray(self, A): """:type A: List[int] :rtype: bool""" i, j, n = (0, len(A) - 1, len(A)) while i + 1 < n and A[i] < A[i + 1]: i += 1 while j > 0 and A[j - 1] > A[j]: j -= 1 return 0 < i == j < n - 1 def validMountai...
the_stack_v2_python_sparse
code/941#Valid Mountain Array.py
EachenKuang/LeetCode
train
28
8b58ce2f1b5a01d3200561af10721fad1b1b04cc
[ "super().__init__()\nself._pokemon = pokemon\nself._name = Text(pokemon.nickname)\nself._name.position = (-self._name.width, 0)\nself.add(self._name, z=1)\nself._level_txt = cocos.sprite.Sprite(pyglet.image.load(PATH + '/assets/img/battle/hud/level.png'))\nself._level_txt.position = (5, -2)\nself.add(self._level_tx...
<|body_start_0|> super().__init__() self._pokemon = pokemon self._name = Text(pokemon.nickname) self._name.position = (-self._name.width, 0) self.add(self._name, z=1) self._level_txt = cocos.sprite.Sprite(pyglet.image.load(PATH + '/assets/img/battle/hud/level.png')) ...
The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update.
OpponentHUDLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpponentHUDLayer: """The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update.""" def __init__(self, pokemon: PokemonModel) -> None: """Create a new HUD sh...
stack_v2_sparse_classes_10k_train_001478
4,187
no_license
[ { "docstring": "Create a new HUD showing the opponent pokemon's information. :param pokemon: The opponent pokemon.", "name": "__init__", "signature": "def __init__(self, pokemon: PokemonModel) -> None" }, { "docstring": "Update the size and the color of the HP bar.", "name": "update_hp", ...
3
stack_v2_sparse_classes_30k_train_000456
Implement the Python class `OpponentHUDLayer` described below. Class description: The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update. Method signatures and docstrings: - def __init__(...
Implement the Python class `OpponentHUDLayer` described below. Class description: The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update. Method signatures and docstrings: - def __init__(...
dfff995e3e50a8cfa56af73d93de82c427bfa2f5
<|skeleton|> class OpponentHUDLayer: """The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update.""" def __init__(self, pokemon: PokemonModel) -> None: """Create a new HUD sh...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OpponentHUDLayer: """The information about the opponent pokemon: name, level, HP Attributes: - HP_BAR_SIZE: The size in pixels of the HP bar. - HP_UPDATE_DURATION: The time it takes for the HP bar to update.""" def __init__(self, pokemon: PokemonModel) -> None: """Create a new HUD showing the opp...
the_stack_v2_python_sparse
src/views/battle/opponent_hud_layer.py
J-GG/Pymon
train
0
16e509d461bbcd8e35e1a729109b639bad08f2db
[ "self.method = method\nself.url = url\nself.params = params[:]\nself.body = body\nself.headers = headers.copy()\nself.timeout = timeout\nself.stream = stream\nself.follow_redirects = follow_redirects\nself._cookies = None", "if self._cookies is None:\n self._cookies = http.cookiejar.CookieJar()\nreturn self._c...
<|body_start_0|> self.method = method self.url = url self.params = params[:] self.body = body self.headers = headers.copy() self.timeout = timeout self.stream = stream self.follow_redirects = follow_redirects self._cookies = None <|end_body_0|> <|...
Request to HttpService.
HttpRequest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_10k_train_001479
31,532
permissive
[ { "docstring": "Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET parameters |body| - encoded body of the request (None or str) |headers| - dict with request headers |timeout| - socket read timeout (None ...
3
stack_v2_sparse_classes_30k_test_000312
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
Implement the Python class `HttpRequest` described below. Class description: Request to HttpService. Method signatures and docstrings: - def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without que...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to pu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HttpRequest: """Request to HttpService.""" def __init__(self, method, url, params, body, headers, timeout, stream, follow_redirects): """Arguments: |method| - HTTP method to use |url| - relative URL to the resource, without query parameters |params| - list of (key, value) pairs to put into GET pa...
the_stack_v2_python_sparse
client/utils/net.py
luci/luci-py
train
84
7178540ea4ce038e1ecca25ea90e3846dc79ddd9
[ "self.config = config\nself.regs = config['model']['regs']\nself.decay = self.regs[0]\nself.norm_adj = config['model']['norm_adj']\nself.model = LightGCN(config['model'], self.norm_adj)\nsuper(LightGCNEngine, self).__init__(config)\nself.model.to(self.device)", "assert hasattr(self, 'model'), 'Please specify the ...
<|body_start_0|> self.config = config self.regs = config['model']['regs'] self.decay = self.regs[0] self.norm_adj = config['model']['norm_adj'] self.model = LightGCN(config['model'], self.norm_adj) super(LightGCNEngine, self).__init__(config) self.model.to(self.de...
LightGCNEngine Class.
LightGCNEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightGCNEngine: """LightGCNEngine Class.""" def __init__(self, config): """Initialize LightGCNEngine Class.""" <|body_0|> def train_single_batch(self, batch_data): """Train the model in a single batch. Args: batch_data (list): batch users, positive items and nega...
stack_v2_sparse_classes_10k_train_001480
6,800
permissive
[ { "docstring": "Initialize LightGCNEngine Class.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Train the model in a single batch. Args: batch_data (list): batch users, positive items and negative items. Return: loss (float): batch loss.", "name": "train_s...
4
stack_v2_sparse_classes_30k_train_004263
Implement the Python class `LightGCNEngine` described below. Class description: LightGCNEngine Class. Method signatures and docstrings: - def __init__(self, config): Initialize LightGCNEngine Class. - def train_single_batch(self, batch_data): Train the model in a single batch. Args: batch_data (list): batch users, po...
Implement the Python class `LightGCNEngine` described below. Class description: LightGCNEngine Class. Method signatures and docstrings: - def __init__(self, config): Initialize LightGCNEngine Class. - def train_single_batch(self, batch_data): Train the model in a single batch. Args: batch_data (list): batch users, po...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class LightGCNEngine: """LightGCNEngine Class.""" def __init__(self, config): """Initialize LightGCNEngine Class.""" <|body_0|> def train_single_batch(self, batch_data): """Train the model in a single batch. Args: batch_data (list): batch users, positive items and nega...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LightGCNEngine: """LightGCNEngine Class.""" def __init__(self, config): """Initialize LightGCNEngine Class.""" self.config = config self.regs = config['model']['regs'] self.decay = self.regs[0] self.norm_adj = config['model']['norm_adj'] self.model = LightG...
the_stack_v2_python_sparse
beta_rec/models/lightgcn.py
beta-team/beta-recsys
train
156
22a154805b4573d46b8ca66397ca40cd28d8ff32
[ "if len(digits) == 0:\n digits = [1]\nelif digits[-1] == 9:\n print('aaa')\n print(digits[:-1])\n digits = self.plusOne(digits[:-1])\n print('xxxxx')\n print(digits)\n digits.append(0)\nelse:\n digits[-1] += 1\nreturn digits", "n = len(digits)\nif digits[-1] != 9:\n digits[-1] += 1\nels...
<|body_start_0|> if len(digits) == 0: digits = [1] elif digits[-1] == 9: print('aaa') print(digits[:-1]) digits = self.plusOne(digits[:-1]) print('xxxxx') print(digits) digits.append(0) else: digits[-...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne2(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(digits) == 0: ...
stack_v2_sparse_classes_10k_train_001481
2,031
no_license
[ { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne", "signature": "def plusOne(self, digits)" }, { "docstring": ":type digits: List[int] :rtype: List[int]", "name": "plusOne2", "signature": "def plusOne2(self, digits)" } ]
2
stack_v2_sparse_classes_30k_train_000449
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne2(self, digits): :type digits: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, digits): :type digits: List[int] :rtype: List[int] - def plusOne2(self, digits): :type digits: List[int] :rtype: List[int] <|skeleton|> class Solution: de...
f022677c042db3598003df1a320a70f0edc4f870
<|skeleton|> class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_0|> def plusOne2(self, digits): """:type digits: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, digits): """:type digits: List[int] :rtype: List[int]""" if len(digits) == 0: digits = [1] elif digits[-1] == 9: print('aaa') print(digits[:-1]) digits = self.plusOne(digits[:-1]) print('xxxxx') ...
the_stack_v2_python_sparse
ArrayDeal/jiayi.py
daisyzl/program-exercise-python
train
0
0cd01d4da8a9e28c5896a1e2b072fcace47bc687
[ "lst = []\nQ = [root] if root else []\nwhile len(Q) > 0:\n p = Q.pop()\n if not p:\n lst.append(None)\n continue\n Q.append(p.left)\n Q.append(p.right)\nwhile len(lst) > 0 and lst[-1] == None:\n lst.pop()\nreturn str(lst)", "data = data[1:-1]\nif len(data) == 0:\n return None\nlst ...
<|body_start_0|> lst = [] Q = [root] if root else [] while len(Q) > 0: p = Q.pop() if not p: lst.append(None) continue Q.append(p.left) Q.append(p.right) while len(lst) > 0 and lst[-1] == None: ls...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_001482
1,480
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
a95b871578aae0103066962c33b8c0f4ec22d0f2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" lst = [] Q = [root] if root else [] while len(Q) > 0: p = Q.pop() if not p: lst.append(None) continue ...
the_stack_v2_python_sparse
Offer037.py
Jane11111/Leetcode2021
train
2
a23199544234ac2152a5052c3010a5e60b590cf1
[ "leaf_nodes1 = self.getLeafNodes(root1)\nleaf_nodes2 = self.getLeafNodes(root2)\nif leaf_nodes1 == leaf_nodes2:\n return True\nreturn False", "if root.left == None and root.right == None:\n res.append(root)\nelif root.left != None:\n self.getLeafNodes(root.left, res)\nelif root.right != None:\n self.g...
<|body_start_0|> leaf_nodes1 = self.getLeafNodes(root1) leaf_nodes2 = self.getLeafNodes(root2) if leaf_nodes1 == leaf_nodes2: return True return False <|end_body_0|> <|body_start_1|> if root.left == None and root.right == None: res.append(root) el...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def getLeafNodes(self, root, res): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001483
1,562
no_license
[ { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "leafSimilar", "signature": "def leafSimilar(self, root1, root2)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "getLeafNodes", "signature": "def getLeafNodes(self, root, res)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def getLeafNodes(self, root, res): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool - def getLeafNodes(self, root, res): :type root: TreeNode :rtype: List[List[int]] <...
1211eac167f33084f536007468ea10c1a0ceab08
<|skeleton|> class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_0|> def getLeafNodes(self, root, res): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" leaf_nodes1 = self.getLeafNodes(root1) leaf_nodes2 = self.getLeafNodes(root2) if leaf_nodes1 == leaf_nodes2: return True return False def getLe...
the_stack_v2_python_sparse
872_LeafSimilarTrees.py
renukadeshmukh/Leetcode_Solutions
train
3
ceeff7b250ac1858f1286342b799ac0c9968b8ec
[ "if not matrix:\n self.M, self.N = (0, -1)\n return\nself.M, self.N = (len(matrix), len(matrix[0]))\nfor i in xrange(1, self.M):\n matrix[i][0] += matrix[i - 1][0]\nfor j in xrange(1, self.N):\n matrix[0][j] += matrix[0][j - 1]\nfor i in xrange(1, self.M):\n for j in xrange(1, self.N):\n matri...
<|body_start_0|> if not matrix: self.M, self.N = (0, -1) return self.M, self.N = (len(matrix), len(matrix[0])) for i in xrange(1, self.M): matrix[i][0] += matrix[i - 1][0] for j in xrange(1, self.N): matrix[0][j] += matrix[0][j - 1] ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_001484
1,750
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_train_000930
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
00196f836d4bc226ddcb745b17e247c2ed4e9b4b
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix: self.M, self.N = (0, -1) return self.M, self.N = (len(matrix), len(matrix[0])) for i in xrange(1, self.M): matrix[i][0] += matrix[i - 1][0] for ...
the_stack_v2_python_sparse
Facebook习题/面经/304. Range Sum Query 2D - Immutable.py
signalwolf/Leetcode_by_type
train
0
0d638be1356d8d56ed9720c241a5f8cc401c2b40
[ "self._session = requests.Session()\nself._adapter = requests.adapters.HTTPAdapter(max_retries=2)\nself._session.mount('https://', self._adapter)\nif not endpoint[-1] == '/':\n endpoint += '/'\nself.endpoint = endpoint", "if not document_id:\n raise ValueError('Invalid value for document_id')\ntry:\n res...
<|body_start_0|> self._session = requests.Session() self._adapter = requests.adapters.HTTPAdapter(max_retries=2) self._session.mount('https://', self._adapter) if not endpoint[-1] == '/': endpoint += '/' self.endpoint = endpoint <|end_body_0|> <|body_start_1|> ...
An HTTP session with the fulltext endpoint.
FulltextSession
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" <|body_0|> def retrieve(self, document_id: str) -> Fulltext: """Retrieve fulltext content for an arXiv paper. Parameter...
stack_v2_sparse_classes_10k_train_001485
3,414
permissive
[ { "docstring": "Initialize an HTTP session.", "name": "__init__", "signature": "def __init__(self, endpoint: str) -> None" }, { "docstring": "Retrieve fulltext content for an arXiv paper. Parameters ---------- document_id : str arXiv identifier, including version tag. E.g. ``\"1234.56787v3\"``. ...
2
stack_v2_sparse_classes_30k_test_000261
Implement the Python class `FulltextSession` described below. Class description: An HTTP session with the fulltext endpoint. Method signatures and docstrings: - def __init__(self, endpoint: str) -> None: Initialize an HTTP session. - def retrieve(self, document_id: str) -> Fulltext: Retrieve fulltext content for an a...
Implement the Python class `FulltextSession` described below. Class description: An HTTP session with the fulltext endpoint. Method signatures and docstrings: - def __init__(self, endpoint: str) -> None: Initialize an HTTP session. - def retrieve(self, document_id: str) -> Fulltext: Retrieve fulltext content for an a...
e48f74bb2a858ae7bcf19d68f80cb6dcaa1f4761
<|skeleton|> class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" <|body_0|> def retrieve(self, document_id: str) -> Fulltext: """Retrieve fulltext content for an arXiv paper. Parameter...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" self._session = requests.Session() self._adapter = requests.adapters.HTTPAdapter(max_retries=2) self._session.mount('https://', s...
the_stack_v2_python_sparse
search/services/fulltext.py
arXiv/arxiv-search
train
54
081699249fde3244c0fdfff328bba4b73cd4a53f
[ "if n == 1:\n return True\ndic = {}\nkey = n\nwhile True:\n key = list(map(int, str(key)))\n tmp = [i ** 2 for i in key]\n key = sum(tmp)\n if key == 1:\n return True\n elif key not in dic:\n dic[key] = 1\n else:\n return False", "dic = {}\nwhile n:\n if n == 1:\n ...
<|body_start_0|> if n == 1: return True dic = {} key = n while True: key = list(map(int, str(key))) tmp = [i ** 2 for i in key] key = sum(tmp) if key == 1: return True elif key not in dic: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy_1(self, n): """:type n: int :rtype: bool""" <|body_1|> def isHappy_2(self, n): """:type n: int :rtype: bool""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_001486
2,193
no_license
[ { "docstring": ":type n: int :rtype: bool", "name": "isHappy", "signature": "def isHappy(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isHappy_1", "signature": "def isHappy_1(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isHappy_2", ...
3
stack_v2_sparse_classes_30k_train_004472
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy_1(self, n): :type n: int :rtype: bool - def isHappy_2(self, n): :type n: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy_1(self, n): :type n: int :rtype: bool - def isHappy_2(self, n): :type n: int :rtype: bool <|skeleton|> class Soluti...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy_1(self, n): """:type n: int :rtype: bool""" <|body_1|> def isHappy_2(self, n): """:type n: int :rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" if n == 1: return True dic = {} key = n while True: key = list(map(int, str(key))) tmp = [i ** 2 for i in key] key = sum(tmp) if key == 1: ...
the_stack_v2_python_sparse
Solutions/0202_isHappy.py
YoupengLi/leetcode-sorting
train
3
24b8fedff852ed30439b772a21d8802eaa222d89
[ "dp = [[[0] * n for _ in range(m)] for _ in range(N + 1)]\nfor s in range(1, N + 1):\n for x in range(m):\n for y in range(n):\n v1 = 1 if x == 0 else dp[s - 1][x - 1][y]\n v2 = 1 if x == m - 1 else dp[s - 1][x + 1][y]\n v3 = 1 if y == 0 else dp[s - 1][x][y - 1]\n ...
<|body_start_0|> dp = [[[0] * n for _ in range(m)] for _ in range(N + 1)] for s in range(1, N + 1): for x in range(m): for y in range(n): v1 = 1 if x == 0 else dp[s - 1][x - 1][y] v2 = 1 if x == m - 1 else dp[s - 1][x + 1][y] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" <|body_0|> def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" ...
stack_v2_sparse_classes_10k_train_001487
4,620
no_license
[ { "docstring": ":type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int", "name": "findPaths", "signature": "def findPaths(self, m, n, N, i, j)" }, { "docstring": ":type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int", "name": "findPaths", "si...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPaths(self, m, n, N, i, j): :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int - def findPaths(self, m, n, N, i, j): :type m: int :type n: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPaths(self, m, n, N, i, j): :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int - def findPaths(self, m, n, N, i, j): :type m: int :type n: int :...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class Solution: def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" <|body_0|> def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" dp = [[[0] * n for _ in range(m)] for _ in range(N + 1)] for s in range(1, N + 1): for x in range(m): for y in range(n): ...
the_stack_v2_python_sparse
leetcode_python/Dynamic_Programming/out-of-boundary-paths.py
yennanliu/CS_basics
train
64
7888c2b1eb20ff56234bb05f494a8abc41294b8a
[ "search = ['أ', 'إ', 'آ', 'ة', '_', '-', '/', '.', '،', ' و ', ' يا ', '\"', 'ـ', \"'\", 'ى', '\\\\', '\\n', '\\t', '&quot;', '?', '؟', '!', ':', '(', ')', '\\x02']\nreplace = ['ا', 'ا', 'ا', 'ه', ' ', ' ', '', '', '', ' و', ' يا', '', '', '', 'ي', '', ' ', ' ', ' ', ' ? ', ' ؟ ', ' ! ', '', '', '', '']\np_tashkeel...
<|body_start_0|> search = ['أ', 'إ', 'آ', 'ة', '_', '-', '/', '.', '،', ' و ', ' يا ', '"', 'ـ', "'", 'ى', '\\', '\n', '\t', '&quot;', '?', '؟', '!', ':', '(', ')', '\x02'] replace = ['ا', 'ا', 'ا', 'ه', ' ', ' ', '', '', '', ' و', ' يا', '', '', '', 'ي', '', ' ', ' ', ' ', ' ? ', ' ؟ ', ' ! ', '', '', ...
Procces the data and embed them using AraVec OR ELMo
Embedding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_001488
5,959
no_license
[ { "docstring": "Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book", "name": "clean_str", "signature": "def clean_str(text: str) -> str" }, { "docstring": "Embed each word in the book into a Vector in...
3
stack_v2_sparse_classes_30k_train_002304
Implement the Python class `Embedding` described below. Class description: Procces the data and embed them using AraVec OR ELMo Method signatures and docstrings: - def clean_str(text: str) -> str: Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns s...
Implement the Python class `Embedding` described below. Class description: Procces the data and embed them using AraVec OR ELMo Method signatures and docstrings: - def clean_str(text: str) -> str: Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns s...
c7349dd0501e9a0d47a8f1024762ee15b225c6e0
<|skeleton|> class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Embedding: """Procces the data and embed them using AraVec OR ELMo""" def clean_str(text: str) -> str: """Removing any additional characters found in the TEXT, Based on AraVec. :parameter text in str format as a book :returns str as a preprocessed book""" search = ['أ', 'إ', 'آ', 'ة', '_'...
the_stack_v2_python_sparse
Algs/Embedding.py
saleems11/Final_Project_B
train
0
0386f5ec419b6208473417122e44d6727a148020
[ "repository = self.object\ngh = self.gh\nif not gh:\n return\nrepository.check_hook(gh)\nreturn repository.hook_set", "if not result:\n CheckRepositoryEvents.add_job(self.identifier.hget())\nelse:\n for j in CheckRepositoryEvents.collection(queued=1, identifier=self.identifier.hget()).instances():\n ...
<|body_start_0|> repository = self.object gh = self.gh if not gh: return repository.check_hook(gh) return repository.hook_set <|end_body_0|> <|body_start_1|> if not result: CheckRepositoryEvents.add_job(self.identifier.hget()) else: ...
Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one.
CheckRepositoryHook
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckRepositoryHook: """Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one.""" def run(self, queue): """Check if the hook exist for this modele. If not, try to add a job to start checking events every minute ...
stack_v2_sparse_classes_10k_train_001489
3,018
no_license
[ { "docstring": "Check if the hook exist for this modele. If not, try to add a job to start checking events every minute (if one already exists, no new one will be added)", "name": "run", "signature": "def run(self, queue)" }, { "docstring": "If the repository hook is not set, add a job to fetch ...
2
stack_v2_sparse_classes_30k_train_007053
Implement the Python class `CheckRepositoryHook` described below. Class description: Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one. Method signatures and docstrings: - def run(self, queue): Check if the hook exist for this modele. If not...
Implement the Python class `CheckRepositoryHook` described below. Class description: Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one. Method signatures and docstrings: - def run(self, queue): Check if the hook exist for this modele. If not...
63a405b993e77f10b9c2b6d9790aae7576d9d84f
<|skeleton|> class CheckRepositoryHook: """Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one.""" def run(self, queue): """Check if the hook exist for this modele. If not, try to add a job to start checking events every minute ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckRepositoryHook: """Every 15 minutes (+-2mn), check if the hook is set and if None and if there is no job to fetch events every minute, create one.""" def run(self, queue): """Check if the hook exist for this modele. If not, try to add a job to start checking events every minute (if one alrea...
the_stack_v2_python_sparse
gim/hooks/tasks.py
derekey/github-issues-manager
train
1
a2f7482fb19af0064e301bf6263ce26267abdd38
[ "pairs = []\nfor i, num1 in enumerate(nums1):\n for j, num2 in enumerate(nums2):\n if i + j >= k:\n break\n pairs.append((num1 + num2, num1, num2))\nreturn map(lambda x: [x[1], x[2]], heapq.nsmallest(k, pairs))", "if not nums1 or not nums2:\n return []\nlength1, length2 = (len(nums1...
<|body_start_0|> pairs = [] for i, num1 in enumerate(nums1): for j, num2 in enumerate(nums2): if i + j >= k: break pairs.append((num1 + num2, num1, num2)) return map(lambda x: [x[1], x[2]], heapq.nsmallest(k, pairs)) <|end_body_0|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kSmallestPairs(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" <|body_0|> def kSmallestPairs2(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ...
stack_v2_sparse_classes_10k_train_001490
1,286
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]", "name": "kSmallestPairs", "signature": "def kSmallestPairs(self, nums1, nums2, k)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]", "nam...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] - def kSmallestPairs2(self, nums1, nums2, k): :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] - def kSmallestPairs2(self, nums1, nums2, k): :type ...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def kSmallestPairs(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" <|body_0|> def kSmallestPairs2(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kSmallestPairs(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" pairs = [] for i, num1 in enumerate(nums1): for j, num2 in enumerate(nums2): if i + j >= k: brea...
the_stack_v2_python_sparse
301-400/371-380/373-findKPairsWithSmallestSums/findKPairsWithSmallestSums.py
xuychen/Leetcode
train
0
4c55b67c7884e1406e3bc9158c8e6848de2b910a
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Geo target constant service. Service to fetch geo target constants.
GeoTargetConstantServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeoTargetConstantServiceServicer: """Proto file describing the Geo target constant service. Service to fetch geo target constants.""" def GetGeoTargetConstant(self, request, context): """Returns the requested geo target constant in full detail.""" <|body_0|> def SuggestG...
stack_v2_sparse_classes_10k_train_001491
3,645
permissive
[ { "docstring": "Returns the requested geo target constant in full detail.", "name": "GetGeoTargetConstant", "signature": "def GetGeoTargetConstant(self, request, context)" }, { "docstring": "Returns GeoTargetConstant suggestions by location name or by resource name.", "name": "SuggestGeoTarg...
2
stack_v2_sparse_classes_30k_train_000687
Implement the Python class `GeoTargetConstantServiceServicer` described below. Class description: Proto file describing the Geo target constant service. Service to fetch geo target constants. Method signatures and docstrings: - def GetGeoTargetConstant(self, request, context): Returns the requested geo target constan...
Implement the Python class `GeoTargetConstantServiceServicer` described below. Class description: Proto file describing the Geo target constant service. Service to fetch geo target constants. Method signatures and docstrings: - def GetGeoTargetConstant(self, request, context): Returns the requested geo target constan...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class GeoTargetConstantServiceServicer: """Proto file describing the Geo target constant service. Service to fetch geo target constants.""" def GetGeoTargetConstant(self, request, context): """Returns the requested geo target constant in full detail.""" <|body_0|> def SuggestG...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeoTargetConstantServiceServicer: """Proto file describing the Geo target constant service. Service to fetch geo target constants.""" def GetGeoTargetConstant(self, request, context): """Returns the requested geo target constant in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEM...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/geo_target_constant_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
45495d78dc570079e39a7f66c7581619565bd988
[ "self.var_dict = self.get_raw_dict()\npuller_params = default_config.DEFAULT_PULLER_CONF.copy()\ndb_params = default_config.DEFAULT_DB_CONF.copy()\ntry:\n puller_params.update(self.get_dict('puller'))\n db_params.update(self.get_dict('database'))\nexcept ValueError as error_info:\n sys.stderr.write(error_i...
<|body_start_0|> self.var_dict = self.get_raw_dict() puller_params = default_config.DEFAULT_PULLER_CONF.copy() db_params = default_config.DEFAULT_DB_CONF.copy() try: puller_params.update(self.get_dict('puller')) db_params.update(self.get_dict('database')) ...
StorageConfigParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageConfigParser: def config_parse(self): """parse configuration from config file and default config""" <|body_0|> def get_db_from_config(self): """get database connection instance from config""" <|body_1|> def get_puller_from_config(self): ""...
stack_v2_sparse_classes_10k_train_001492
1,624
no_license
[ { "docstring": "parse configuration from config file and default config", "name": "config_parse", "signature": "def config_parse(self)" }, { "docstring": "get database connection instance from config", "name": "get_db_from_config", "signature": "def get_db_from_config(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_002690
Implement the Python class `StorageConfigParser` described below. Class description: Implement the StorageConfigParser class. Method signatures and docstrings: - def config_parse(self): parse configuration from config file and default config - def get_db_from_config(self): get database connection instance from config...
Implement the Python class `StorageConfigParser` described below. Class description: Implement the StorageConfigParser class. Method signatures and docstrings: - def config_parse(self): parse configuration from config file and default config - def get_db_from_config(self): get database connection instance from config...
8819fc30456b4bb8576a4c78798ec91cdc8ac062
<|skeleton|> class StorageConfigParser: def config_parse(self): """parse configuration from config file and default config""" <|body_0|> def get_db_from_config(self): """get database connection instance from config""" <|body_1|> def get_puller_from_config(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StorageConfigParser: def config_parse(self): """parse configuration from config file and default config""" self.var_dict = self.get_raw_dict() puller_params = default_config.DEFAULT_PULLER_CONF.copy() db_params = default_config.DEFAULT_DB_CONF.copy() try: pu...
the_stack_v2_python_sparse
storage/config/config_parser.py
zhxfei/monitor
train
1
a184c10bc5a33f14401a45ca96bc88c0ee033b86
[ "try:\n resp = Node().get_data_by_id(uid)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')", "try:\n json_data = api.payload\n resp = Node().update_data_by_id(uid, json_data)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecogni...
<|body_start_0|> try: resp = Node().get_data_by_id(uid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') <|end_body_0|> <|body_start_1|> try: json_data = api.payload resp = Node().update_data_by_id(uid...
DroneIDFindRoute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DroneIDFindRoute: def get(self, uid): """Get data by ID""" <|body_0|> def put(self, uid): """Update data by ID""" <|body_1|> def delete(self, uid): """Delete data by ID""" <|body_2|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_10k_train_001493
4,218
permissive
[ { "docstring": "Get data by ID", "name": "get", "signature": "def get(self, uid)" }, { "docstring": "Update data by ID", "name": "put", "signature": "def put(self, uid)" }, { "docstring": "Delete data by ID", "name": "delete", "signature": "def delete(self, uid)" } ]
3
stack_v2_sparse_classes_30k_train_004893
Implement the Python class `DroneIDFindRoute` described below. Class description: Implement the DroneIDFindRoute class. Method signatures and docstrings: - def get(self, uid): Get data by ID - def put(self, uid): Update data by ID - def delete(self, uid): Delete data by ID
Implement the Python class `DroneIDFindRoute` described below. Class description: Implement the DroneIDFindRoute class. Method signatures and docstrings: - def get(self, uid): Get data by ID - def put(self, uid): Update data by ID - def delete(self, uid): Delete data by ID <|skeleton|> class DroneIDFindRoute: d...
100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1
<|skeleton|> class DroneIDFindRoute: def get(self, uid): """Get data by ID""" <|body_0|> def put(self, uid): """Update data by ID""" <|body_1|> def delete(self, uid): """Delete data by ID""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DroneIDFindRoute: def get(self, uid): """Get data by ID""" try: resp = Node().get_data_by_id(uid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') def put(self, uid): """Update data by ID""" try:...
the_stack_v2_python_sparse
app/controllers/api/node/node.py
ardihikaru/api-dashboard-5g-dive
train
0
33503f923c891efbc5642917745ee32465f3430d
[ "vocab_size = 100\nsequence_length = 512\nd_model = 64\nd_latents = 48\nnum_layers = 2\nencoder_cfg = cfg.EncoderConfig(v_last_dim=d_latents, num_self_attends_per_block=num_layers)\nsequence_encoder_cfg = cfg.SequenceEncoderConfig(d_model=d_model, d_latents=d_latents, vocab_size=vocab_size, encoder=encoder_cfg)\nte...
<|body_start_0|> vocab_size = 100 sequence_length = 512 d_model = 64 d_latents = 48 num_layers = 2 encoder_cfg = cfg.EncoderConfig(v_last_dim=d_latents, num_self_attends_per_block=num_layers) sequence_encoder_cfg = cfg.SequenceEncoderConfig(d_model=d_model, d_late...
ClassifierTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifierTest: def test_perceiver_trainer(self, num_classes): """Validate that the Keras object can be created.""" <|body_0|> def test_perceiver_trainer_tensor_call(self, num_classes, use_custom_head): """Validate that the Keras object can be invoked.""" <|b...
stack_v2_sparse_classes_10k_train_001494
8,478
permissive
[ { "docstring": "Validate that the Keras object can be created.", "name": "test_perceiver_trainer", "signature": "def test_perceiver_trainer(self, num_classes)" }, { "docstring": "Validate that the Keras object can be invoked.", "name": "test_perceiver_trainer_tensor_call", "signature": "...
3
null
Implement the Python class `ClassifierTest` described below. Class description: Implement the ClassifierTest class. Method signatures and docstrings: - def test_perceiver_trainer(self, num_classes): Validate that the Keras object can be created. - def test_perceiver_trainer_tensor_call(self, num_classes, use_custom_h...
Implement the Python class `ClassifierTest` described below. Class description: Implement the ClassifierTest class. Method signatures and docstrings: - def test_perceiver_trainer(self, num_classes): Validate that the Keras object can be created. - def test_perceiver_trainer_tensor_call(self, num_classes, use_custom_h...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class ClassifierTest: def test_perceiver_trainer(self, num_classes): """Validate that the Keras object can be created.""" <|body_0|> def test_perceiver_trainer_tensor_call(self, num_classes, use_custom_head): """Validate that the Keras object can be invoked.""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassifierTest: def test_perceiver_trainer(self, num_classes): """Validate that the Keras object can be created.""" vocab_size = 100 sequence_length = 512 d_model = 64 d_latents = 48 num_layers = 2 encoder_cfg = cfg.EncoderConfig(v_last_dim=d_latents, nu...
the_stack_v2_python_sparse
official/projects/perceiver/modeling/models/classifier_test.py
jianzhnie/models
train
2
e378688782bc4d1f01ce5456f1b8ee24cb8c919f
[ "if not isinstance(actionspace, Dict):\n raise ValueError('actionspace must be Dict but found ' + str(actionspace))\nif len(agentComponentList) == 0:\n raise ValueError('There must be at least 1 agent in the list')\nfor agent in agentComponentList:\n if not isinstance(agent, QAgentComponent):\n rais...
<|body_start_0|> if not isinstance(actionspace, Dict): raise ValueError('actionspace must be Dict but found ' + str(actionspace)) if len(agentComponentList) == 0: raise ValueError('There must be at least 1 agent in the list') for agent in agentComponentList: i...
A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "entitityId2": Discrete(n2) "entityId3": Di...
QCoordinator
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "en...
stack_v2_sparse_classes_10k_train_001495
4,795
no_license
[ { "docstring": "@param AgentComponentList: a list of QAgentComponent. Size must be >=1. The agent environments should be equal to our environment, or to a Packed version of it. We can't check this because environments do not implement equals at this moment. @param environment the openAI Gym Env. Must have actio...
2
stack_v2_sparse_classes_30k_val_000101
Implement the Python class `QCoordinator` described below. Class description: A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the ...
Implement the Python class `QCoordinator` described below. Class description: A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the ...
e7d052c6a01e0470bfd011d9dc5ba95247466494
<|skeleton|> class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QCoordinator: """A QCoordinator is an agent that can coordinate a set of sub-agents in such a way that the sum of their actions is optimal. See #step for more details. The QCoordinator should work with environments that have a dictionary action space of the form: A={ "entityId1": Discrete(n1) "entitityId2": D...
the_stack_v2_python_sparse
aiagents/multi/QCoordinator.py
INFLUENCEorg/aiagents
train
0
3a78e1890bf78f99afbf3bf71165c55257b51ded
[ "if not nums:\n return 0\nfirst = self.find_first(nums, target, 0, len(nums) - 1)\nif first == -1:\n return 0\nlast = self.find_last(nums, target, 0, len(nums) - 1)\nreturn last - first + 1", "if begin > end:\n return -1\nmid = begin + (end - begin) // 2\nif nums[mid] == target:\n if mid > 0 and nums[...
<|body_start_0|> if not nums: return 0 first = self.find_first(nums, target, 0, len(nums) - 1) if first == -1: return 0 last = self.find_last(nums, target, 0, len(nums) - 1) return last - first + 1 <|end_body_0|> <|body_start_1|> if begin > end: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" <|body_0|> def find_first(self, nums, target, begin, end): """binary search, find first target""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001496
1,589
no_license
[ { "docstring": "binary search, find first and last target in list. O(logn) time complexity.", "name": "search", "signature": "def search(self, nums: List[int], target: int) -> int" }, { "docstring": "binary search, find first target", "name": "find_first", "signature": "def find_first(se...
3
stack_v2_sparse_classes_30k_train_005193
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: binary search, find first and last target in list. O(logn) time complexity. - def find_first(self, nums, target, begin, end...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: binary search, find first and last target in list. O(logn) time complexity. - def find_first(self, nums, target, begin, end...
0f16635de49dc63a207d34f7e612546977a5753e
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" <|body_0|> def find_first(self, nums, target, begin, end): """binary search, find first target""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" if not nums: return 0 first = self.find_first(nums, target, 0, len(nums) - 1) if first == -1: return 0 ...
the_stack_v2_python_sparse
jianzhioffer/53-1findElementInOrderedList.py
bycxw/coder
train
0
66a652ff07569da696c0478841487379c5943f8c
[ "super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nnew_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob)})\nself.down_sample_layers = nn.ModuleList([new_downsample_block])\n...
<|body_start_0|> super().__init__() self.in_chans = in_chans self.out_chans = out_chans self.chans = chans self.num_pool_layers = num_pool_layers self.drop_prob = drop_prob new_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob)}) ...
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.
UnetModelAssistLatentDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnetModelAssistLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventio...
stack_v2_sparse_classes_10k_train_001497
15,577
no_license
[ { "docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ...
2
stack_v2_sparse_classes_30k_train_003672
Implement the Python class `UnetModelAssistLatentDecoder` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image comp...
Implement the Python class `UnetModelAssistLatentDecoder` described below. Class description: PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image comp...
219652c8a08c4f2f682acd9f95a4e1b3fd36b70b
<|skeleton|> class UnetModelAssistLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnetModelAssistLatentDecoder: """PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–...
the_stack_v2_python_sparse
lemawarersn_unet_conv_redundancy_removed/unetmodels.py
Bala93/Holistic-MRI-Reconstruction
train
1
24332902d67fda29df625c5dc9db93a6c3971397
[ "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ntry:\n s.connect((host, int(port)))\n s.shutdown(2)\n print('port %s is uesd !' % port)\n return False\nexcept:\n print('port %s is available!' % port)\n return True", "erromessage = ''\nappium_server_url = ''\nbootstrap_port = str(port + 1...
<|body_start_0|> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, int(port))) s.shutdown(2) print('port %s is uesd !' % port) return False except: print('port %s is available!' % port) return True ...
AppiumServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" <|body_0|> def start_appium(self, host, port): """启动appium 服务""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: ...
stack_v2_sparse_classes_10k_train_001498
2,400
no_license
[ { "docstring": "检测端口是否被占用", "name": "check_port", "signature": "def check_port(self, host, port)" }, { "docstring": "启动appium 服务", "name": "start_appium", "signature": "def start_appium(self, host, port)" } ]
2
stack_v2_sparse_classes_30k_train_001915
Implement the Python class `AppiumServer` described below. Class description: Implement the AppiumServer class. Method signatures and docstrings: - def check_port(self, host, port): 检测端口是否被占用 - def start_appium(self, host, port): 启动appium 服务
Implement the Python class `AppiumServer` described below. Class description: Implement the AppiumServer class. Method signatures and docstrings: - def check_port(self, host, port): 检测端口是否被占用 - def start_appium(self, host, port): 启动appium 服务 <|skeleton|> class AppiumServer: def check_port(self, host, port): ...
4df8ce960721407a20d89de47faad0df0de063a1
<|skeleton|> class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" <|body_0|> def start_appium(self, host, port): """启动appium 服务""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, int(port))) s.shutdown(2) print('port %s is uesd !' % port) return False except: ...
the_stack_v2_python_sparse
DispatcherMobile/appiumServer.py
namexiaohuihui/operating
train
0
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return ScanDetailsSerializerV6\nelif self.request.version == 'v7':\n return ScanDetailsSerializerV6", "if request.version == 'v6':\n return self._post_v6(request, scan_id)\nelif request.version == 'v7':\n return self._post_v6(request, scan_id)\nraise Http404()", "...
<|body_start_0|> if self.request.version == 'v6': return ScanDetailsSerializerV6 elif self.request.version == 'v7': return ScanDetailsSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6': return self._post_v6(request, scan_id) elif ...
This view is the endpoint for launching a scan execution to ingest
ScansProcessView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScansProcessView: """This view is the endpoint for launching a scan execution to ingest""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def post(self, request, scan_id=None): "...
stack_v2_sparse_classes_10k_train_001499
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Launches a scan to ingest from an existing scan model instance :param request: the HTTP POST reque...
3
null
Implement the Python class `ScansProcessView` described below. Class description: This view is the endpoint for launching a scan execution to ingest Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def post(self, r...
Implement the Python class `ScansProcessView` described below. Class description: This view is the endpoint for launching a scan execution to ingest Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def post(self, r...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class ScansProcessView: """This view is the endpoint for launching a scan execution to ingest""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def post(self, request, scan_id=None): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScansProcessView: """This view is the endpoint for launching a scan execution to ingest""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" if self.request.version == 'v6': return ScanDetailsSerializerV6 ...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0