blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
80f5a77968ea5c61e014e8f40ac3af82747a416f | [
"if stimulus == True and key_yes == True:\n self.answer = 1\nif stimulus == False and key_yes == True:\n self.answer = 2\nif stimulus == False and key_yes == False:\n self.answer = 3\nif stimulus == True and key_yes == False:\n self.answer = 4\nreturn self.answer",
"if stimulus == True:\n self.answ... | <|body_start_0|>
if stimulus == True and key_yes == True:
self.answer = 1
if stimulus == False and key_yes == True:
self.answer = 2
if stimulus == False and key_yes == False:
self.answer = 3
if stimulus == True and key_yes == False:
self.an... | TrialFunctions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrialFunctions:
def getAnswerYesNo(self, key_yes, stimulus):
"""where "key_yes" and "stimulus" have to be a boolean this function evaluate the given answer of the tested person it returns a number from 1-4 1 = Hit, 2 = False alarm, 3 = Correct rejection, 4 = Miss"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_003300 | 3,814 | no_license | [
{
"docstring": "where \"key_yes\" and \"stimulus\" have to be a boolean this function evaluate the given answer of the tested person it returns a number from 1-4 1 = Hit, 2 = False alarm, 3 = Correct rejection, 4 = Miss",
"name": "getAnswerYesNo",
"signature": "def getAnswerYesNo(self, key_yes, stimulus... | 4 | null | Implement the Python class `TrialFunctions` described below.
Class description:
Implement the TrialFunctions class.
Method signatures and docstrings:
- def getAnswerYesNo(self, key_yes, stimulus): where "key_yes" and "stimulus" have to be a boolean this function evaluate the given answer of the tested person it retur... | Implement the Python class `TrialFunctions` described below.
Class description:
Implement the TrialFunctions class.
Method signatures and docstrings:
- def getAnswerYesNo(self, key_yes, stimulus): where "key_yes" and "stimulus" have to be a boolean this function evaluate the given answer of the tested person it retur... | 58cb7428011217db78f3cf7519b1cc297f756186 | <|skeleton|>
class TrialFunctions:
def getAnswerYesNo(self, key_yes, stimulus):
"""where "key_yes" and "stimulus" have to be a boolean this function evaluate the given answer of the tested person it returns a number from 1-4 1 = Hit, 2 = False alarm, 3 = Correct rejection, 4 = Miss"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrialFunctions:
def getAnswerYesNo(self, key_yes, stimulus):
"""where "key_yes" and "stimulus" have to be a boolean this function evaluate the given answer of the tested person it returns a number from 1-4 1 = Hit, 2 = False alarm, 3 = Correct rejection, 4 = Miss"""
if stimulus == True and key... | the_stack_v2_python_sparse | TrialFunctions.py | ItCrewTu/Batchelorprojekt | train | 0 | |
273439adcc3c0711bbfc7f8f1e701d23eb679b71 | [
"stack = [c for c in senate][::-1]\nR = stack.count('R')\nD = stack.count('D')\nr, d = (0, 0)\nwhile len(stack) > 1:\n if R == len(stack):\n return 'Radiant'\n if D == len(stack):\n return 'Dire'\n t = stack.pop()\n while t == 'R' and r > 0:\n t = stack.pop()\n r -= 1\n ... | <|body_start_0|>
stack = [c for c in senate][::-1]
R = stack.count('R')
D = stack.count('D')
r, d = (0, 0)
while len(stack) > 1:
if R == len(stack):
return 'Radiant'
if D == len(stack):
return 'Dire'
t = stack.po... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def predictPartyVictory1(self, senate):
""":type senate: str :rtype: str"""
<|body_0|>
def predictPartyVictory(self, senate):
""":type senate: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stack = [c for c in senate][::-1... | stack_v2_sparse_classes_75kplus_train_003301 | 1,424 | no_license | [
{
"docstring": ":type senate: str :rtype: str",
"name": "predictPartyVictory1",
"signature": "def predictPartyVictory1(self, senate)"
},
{
"docstring": ":type senate: str :rtype: str",
"name": "predictPartyVictory",
"signature": "def predictPartyVictory(self, senate)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def predictPartyVictory1(self, senate): :type senate: str :rtype: str
- def predictPartyVictory(self, senate): :type senate: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def predictPartyVictory1(self, senate): :type senate: str :rtype: str
- def predictPartyVictory(self, senate): :type senate: str :rtype: str
<|skeleton|>
class Solution:
de... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def predictPartyVictory1(self, senate):
""":type senate: str :rtype: str"""
<|body_0|>
def predictPartyVictory(self, senate):
""":type senate: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def predictPartyVictory1(self, senate):
""":type senate: str :rtype: str"""
stack = [c for c in senate][::-1]
R = stack.count('R')
D = stack.count('D')
r, d = (0, 0)
while len(stack) > 1:
if R == len(stack):
return 'Radiant'... | the_stack_v2_python_sparse | py/leetcode/649.py | wfeng1991/learnpy | train | 0 | |
02cb8a1ccb545ffa79f4897aadfcb0abf21bb7ac | [
"area = 0\nfor i in range(len(height)):\n if i == len(height) - 1:\n break\n for j in range(i + 1, len(height)):\n area = max(area, (j - i) * min(height[i], height[j]))\nreturn area",
"a, b, c, d = [[] for i in range(4)]\nlmax = rmax = 0\nfor i in range(len(height)):\n if height[i] < lmax:\... | <|body_start_0|>
area = 0
for i in range(len(height)):
if i == len(height) - 1:
break
for j in range(i + 1, len(height)):
area = max(area, (j - i) * min(height[i], height[j]))
return area
<|end_body_0|>
<|body_start_1|>
a, b, c, d ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
area = 0
for i in range(len(height))... | stack_v2_sparse_classes_75kplus_train_003302 | 1,273 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea1",
"signature": "def maxArea1(self, height)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea(se... | 0fddcc61923d760faa5fc60311861cbe89a54ba9 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
area = 0
for i in range(len(height)):
if i == len(height) - 1:
break
for j in range(i + 1, len(height)):
area = max(area, (j - i) * min(height[i], heig... | the_stack_v2_python_sparse | 11.py | zenmeder/leetcode | train | 0 | |
b41ac4610f28f45088ba8ce584e8c2d8b10393f1 | [
"try:\n if 'created' in kwargs:\n extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {})\n self.translator.provider_instance.driver.create_zone(domain=self.name, type=self.type, ttl=self.ttl, extra=extra)\n else:\n LOGGER.warning('libcloud Zone updating not implemented'... | <|body_start_0|>
try:
if 'created' in kwargs:
extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {})
self.translator.provider_instance.driver.create_zone(domain=self.name, type=self.type, ttl=self.ttl, extra=extra)
else:
... | LCloud intermediate Zone object | LCloudZoneObject | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LCloudZoneObject:
"""LCloud intermediate Zone object"""
def save(self, **kwargs) -> ProviderResult:
"""Save this instance"""
<|body_0|>
def delete(self, **kwargs) -> ProviderResult:
"""Delete this instance"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_003303 | 2,645 | permissive | [
{
"docstring": "Save this instance",
"name": "save",
"signature": "def save(self, **kwargs) -> ProviderResult"
},
{
"docstring": "Delete this instance",
"name": "delete",
"signature": "def delete(self, **kwargs) -> ProviderResult"
}
] | 2 | stack_v2_sparse_classes_30k_train_016873 | Implement the Python class `LCloudZoneObject` described below.
Class description:
LCloud intermediate Zone object
Method signatures and docstrings:
- def save(self, **kwargs) -> ProviderResult: Save this instance
- def delete(self, **kwargs) -> ProviderResult: Delete this instance | Implement the Python class `LCloudZoneObject` described below.
Class description:
LCloud intermediate Zone object
Method signatures and docstrings:
- def save(self, **kwargs) -> ProviderResult: Save this instance
- def delete(self, **kwargs) -> ProviderResult: Delete this instance
<|skeleton|>
class LCloudZoneObject... | 2305b1e27abb0bfe9fcee93b79e012c62cba712e | <|skeleton|>
class LCloudZoneObject:
"""LCloud intermediate Zone object"""
def save(self, **kwargs) -> ProviderResult:
"""Save this instance"""
<|body_0|>
def delete(self, **kwargs) -> ProviderResult:
"""Delete this instance"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LCloudZoneObject:
"""LCloud intermediate Zone object"""
def save(self, **kwargs) -> ProviderResult:
"""Save this instance"""
try:
if 'created' in kwargs:
extra = TYPE_FIXES.get(self.translator.provider_instance.driver.type, {})
self.translator.p... | the_stack_v2_python_sparse | supervisr/provider/libcloud/providers/translators/zone.py | BeryJu/supervisr | train | 1 |
5264359fa07e9fc8ffe23e5f0d7da1dc1c2c3cd3 | [
"for i, r in enumerate(A):\n r = A[i] = map(int, r)\n for j, c in enumerate(r):\n if i * j * c:\n r[j] = min(A[i - 1][j], r[j - 1], A[i - 1][j - 1]) + 1\nprint(A)\nreturn max(map(max, A + [[0]])) ** 2",
"for ri, r in enumerate(A):\n for ci, c in enumerate(r):\n A[ri][ci] = int(c)... | <|body_start_0|>
for i, r in enumerate(A):
r = A[i] = map(int, r)
for j, c in enumerate(r):
if i * j * c:
r[j] = min(A[i - 1][j], r[j - 1], A[i - 1][j - 1]) + 1
print(A)
return max(map(max, A + [[0]])) ** 2
<|end_body_0|>
<|body_start_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximalSquare(self, A):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def rewrite(self, A):
""":type matrix: List[List[str]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for i, r in enumerate(A):
... | stack_v2_sparse_classes_75kplus_train_003304 | 2,267 | no_license | [
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "maximalSquare",
"signature": "def maximalSquare(self, A)"
},
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "rewrite",
"signature": "def rewrite(self, A)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000731 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalSquare(self, A): :type matrix: List[List[str]] :rtype: int
- def rewrite(self, A): :type matrix: List[List[str]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalSquare(self, A): :type matrix: List[List[str]] :rtype: int
- def rewrite(self, A): :type matrix: List[List[str]] :rtype: int
<|skeleton|>
class Solution:
def max... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def maximalSquare(self, A):
""":type matrix: List[List[str]] :rtype: int"""
<|body_0|>
def rewrite(self, A):
""":type matrix: List[List[str]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximalSquare(self, A):
""":type matrix: List[List[str]] :rtype: int"""
for i, r in enumerate(A):
r = A[i] = map(int, r)
for j, c in enumerate(r):
if i * j * c:
r[j] = min(A[i - 1][j], r[j - 1], A[i - 1][j - 1]) + 1
... | the_stack_v2_python_sparse | dp/221_Maximal_Square.py | vsdrun/lc_public | train | 6 | |
a377d334d12ea365f5ccedc0d921e787d2d69b5b | [
"a = []\nb = 0\nwhile head:\n a.append(head.val)\n head = head.next\n b += 1\nfor i in range(b // 2):\n if a[i] != a[-1 - i]:\n return False\nreturn True",
"a = []\nwhile head:\n a.append(head.val)\n head = head.next\nreturn a[:] == a[::-1]"
] | <|body_start_0|>
a = []
b = 0
while head:
a.append(head.val)
head = head.next
b += 1
for i in range(b // 2):
if a[i] != a[-1 - i]:
return False
return True
<|end_body_0|>
<|body_start_1|>
a = []
whil... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def isPalindrome1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
a = []
b = 0
while head:
... | stack_v2_sparse_classes_75kplus_train_003305 | 952 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "isPalindrome1",
"signature": "def isPalindrome1(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037663 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def isPalindrome1(self, head): :type head: ListNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def isPalindrome1(self, head): :type head: ListNode :rtype: bool
<|skeleton|>
class Solution:
def isPalind... | 40bca64cf3ed2fbc670b9e2cdf4f88d6c7b68134 | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def isPalindrome1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
a = []
b = 0
while head:
a.append(head.val)
head = head.next
b += 1
for i in range(b // 2):
if a[i] != a[-1 - i]:
return False... | the_stack_v2_python_sparse | Linked List/Palindrome Linked List (five).py | okliou/lcode | train | 0 | |
b18cfd722ad1b63ca0af342fa0a2596fe91cc2f3 | [
"self.menu = Menu('Menu de rapport des joueurs du tournoi courant:')\nself.view = MenuView(self.menu)\nself.gamecontroller = gamecontroller\nself.nb_rounds = nb_rounds",
"self.menu.add('auto', 'Joueurs par nom', DislplayNameController)\nself.menu.add('auto', 'Joueurs par classement ELO décroissant', DisplayRankin... | <|body_start_0|>
self.menu = Menu('Menu de rapport des joueurs du tournoi courant:')
self.view = MenuView(self.menu)
self.gamecontroller = gamecontroller
self.nb_rounds = nb_rounds
<|end_body_0|>
<|body_start_1|>
self.menu.add('auto', 'Joueurs par nom', DislplayNameController)
... | DispalyPlayersController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DispalyPlayersController:
def __init__(self, gamecontroller, nb_rounds):
"""Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameController) -- contrôleur général du tournoi. Permet d'accéder à tous les objets et méthodes du tournoi courant."""... | stack_v2_sparse_classes_75kplus_train_003306 | 40,289 | no_license | [
{
"docstring": "Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameController) -- contrôleur général du tournoi. Permet d'accéder à tous les objets et méthodes du tournoi courant.",
"name": "__init__",
"signature": "def __init__(self, gamecontroller, nb_roun... | 2 | stack_v2_sparse_classes_30k_test_000048 | Implement the Python class `DispalyPlayersController` described below.
Class description:
Implement the DispalyPlayersController class.
Method signatures and docstrings:
- def __init__(self, gamecontroller, nb_rounds): Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameCo... | Implement the Python class `DispalyPlayersController` described below.
Class description:
Implement the DispalyPlayersController class.
Method signatures and docstrings:
- def __init__(self, gamecontroller, nb_rounds): Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameCo... | bd0edae5773d464e30ce40f72be8f8f7d1711f66 | <|skeleton|>
class DispalyPlayersController:
def __init__(self, gamecontroller, nb_rounds):
"""Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameController) -- contrôleur général du tournoi. Permet d'accéder à tous les objets et méthodes du tournoi courant."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DispalyPlayersController:
def __init__(self, gamecontroller, nb_rounds):
"""Construit le Menu de la classe et la vue pour ce menu Arguments: gamecontroller (instance de GameController) -- contrôleur général du tournoi. Permet d'accéder à tous les objets et méthodes du tournoi courant."""
self.... | the_stack_v2_python_sparse | application/controllers/applicationcontroller.py | ChardonBleu/Echecs | train | 0 | |
fc3e4913e8f2d05649856566be00f4403dff2940 | [
"super().__init__(lr, weight_decay)\noffdef_dim = self.n_player_emb * 2\ntp_dim = self.n_team_emb + offdef_dim\nself.off = nn.Linear(self.n_player_emb * 2, self.n_player_emb * 2)\nself.deff = nn.Linear(self.n_player_emb * 2, self.n_player_emb * 2)\nself.offtp = nn.Linear(tp_dim, tp_dim)\nself.deftp = nn.Linear(tp_d... | <|body_start_0|>
super().__init__(lr, weight_decay)
offdef_dim = self.n_player_emb * 2
tp_dim = self.n_team_emb + offdef_dim
self.off = nn.Linear(self.n_player_emb * 2, self.n_player_emb * 2)
self.deff = nn.Linear(self.n_player_emb * 2, self.n_player_emb * 2)
self.offtp =... | mixed logistic regression | NBAResNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NBAResNet:
"""mixed logistic regression"""
def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs):
"""init method"""
<|body_0|>
def forward(self, x, return_embedding=True):
"""representations"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sup... | stack_v2_sparse_classes_75kplus_train_003307 | 4,755 | no_license | [
{
"docstring": "init method",
"name": "__init__",
"signature": "def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs)"
},
{
"docstring": "representations",
"name": "forward",
"signature": "def forward(self, x, return_embedding=True)"
}
] | 2 | null | Implement the Python class `NBAResNet` described below.
Class description:
mixed logistic regression
Method signatures and docstrings:
- def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs): init method
- def forward(self, x, return_embedding=True): representations | Implement the Python class `NBAResNet` described below.
Class description:
mixed logistic regression
Method signatures and docstrings:
- def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs): init method
- def forward(self, x, return_embedding=True): representations
<|skeleton|>
class NBAResNet:
"""mixed logi... | 2fd0fe7cff486bb13af2432f81e90a7df8e9e3d1 | <|skeleton|>
class NBAResNet:
"""mixed logistic regression"""
def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs):
"""init method"""
<|body_0|>
def forward(self, x, return_embedding=True):
"""representations"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NBAResNet:
"""mixed logistic regression"""
def __init__(self, lr=0.1, weight_decay=[0.0], **kwargs):
"""init method"""
super().__init__(lr, weight_decay)
offdef_dim = self.n_player_emb * 2
tp_dim = self.n_team_emb + offdef_dim
self.off = nn.Linear(self.n_player_emb... | the_stack_v2_python_sparse | player-rl/models/resnet.py | jensqin/exercise | train | 1 |
c568ca0b3b343d9f9dde8a578009d3c08b4bc0ba | [
"self.data_governance = data_governance\nself.data_protect = data_protect\nself.ransomware = ransomware\nself.site_continuity = site_continuity",
"if dictionary is None:\n return None\ndata_governance = cohesity_management_sdk.models.data_governance_info.DataGovernanceInfo.from_dictionary(dictionary.get('dataG... | <|body_start_0|>
self.data_governance = data_governance
self.data_protect = data_protect
self.ransomware = ransomware
self.site_continuity = site_continuity
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
data_governance = cohesity_manageme... | Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data protect subscription was subscribed for accoun... | SubscriptionInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubscriptionInfo:
"""Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data pr... | stack_v2_sparse_classes_75kplus_train_003308 | 3,159 | permissive | [
{
"docstring": "Constructor for the SubscriptionInfo class",
"name": "__init__",
"signature": "def __init__(self, data_governance=None, data_protect=None, ransomware=None, site_continuity=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary):... | 2 | stack_v2_sparse_classes_30k_train_017530 | Implement the Python class `SubscriptionInfo` described below.
Class description:
Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (Data... | Implement the Python class `SubscriptionInfo` described below.
Class description:
Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (Data... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SubscriptionInfo:
"""Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubscriptionInfo:
"""Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data protect subscri... | the_stack_v2_python_sparse | cohesity_management_sdk/models/subscription_info.py | cohesity/management-sdk-python | train | 24 |
802bc94dc04fb5a7941a69b05148ec61dee9a8e5 | [
"url = self.build_url('/security-groups', limit=limit, marker=marker)\nif response_key:\n return self._get(url, 'security_groups', **kwargs)\nelse:\n return self._get(url, **kwargs)",
"if response_key:\n return self._get('/security-groups/%s' % security_group, 'security_group', **kwargs)\nelse:\n retu... | <|body_start_0|>
url = self.build_url('/security-groups', limit=limit, marker=marker)
if response_key:
return self._get(url, 'security_groups', **kwargs)
else:
return self._get(url, **kwargs)
<|end_body_0|>
<|body_start_1|>
if response_key:
return sel... | SecurityGroupManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecurityGroupManager:
def list(self, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all security groups. :rtype: list of :class:`SecurityGroup`."""
<|body_0|>
def get(self, security_group, response_key=True, **kwargs):
"""Get a specific secur... | stack_v2_sparse_classes_75kplus_train_003309 | 982 | no_license | [
{
"docstring": "Get a list of all security groups. :rtype: list of :class:`SecurityGroup`.",
"name": "list",
"signature": "def list(self, limit=None, marker=None, response_key=True, **kwargs)"
},
{
"docstring": "Get a specific security group. :rtype: :class:`SecurityGroup`",
"name": "get",
... | 2 | null | Implement the Python class `SecurityGroupManager` described below.
Class description:
Implement the SecurityGroupManager class.
Method signatures and docstrings:
- def list(self, limit=None, marker=None, response_key=True, **kwargs): Get a list of all security groups. :rtype: list of :class:`SecurityGroup`.
- def get... | Implement the Python class `SecurityGroupManager` described below.
Class description:
Implement the SecurityGroupManager class.
Method signatures and docstrings:
- def list(self, limit=None, marker=None, response_key=True, **kwargs): Get a list of all security groups. :rtype: list of :class:`SecurityGroup`.
- def get... | 42f9197ba26ffb6b9dd336a524639ecbbf194365 | <|skeleton|>
class SecurityGroupManager:
def list(self, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all security groups. :rtype: list of :class:`SecurityGroup`."""
<|body_0|>
def get(self, security_group, response_key=True, **kwargs):
"""Get a specific secur... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecurityGroupManager:
def list(self, limit=None, marker=None, response_key=True, **kwargs):
"""Get a list of all security groups. :rtype: list of :class:`SecurityGroup`."""
url = self.build_url('/security-groups', limit=limit, marker=marker)
if response_key:
return self._ge... | the_stack_v2_python_sparse | ops_client/project/trove/security_groups.py | tokuzfunpi/ops_client | train | 0 | |
01e9945c7eb5afb802f16e686e7f7616ac9ede0e | [
"self.useLaplaceSmoothing = useLaplaceSmoothing\nself.classes = None\nself.class_count = None\nself.class_probabilities = None\nself.cond_probabilities = None",
"n, d = X.shape\nn_correction = 0.0\nd_correction = 0.0\nif self.useLaplaceSmoothing:\n n_correction = 1.0\n d_correction = d\nself.classes = np.un... | <|body_start_0|>
self.useLaplaceSmoothing = useLaplaceSmoothing
self.classes = None
self.class_count = None
self.class_probabilities = None
self.cond_probabilities = None
<|end_body_0|>
<|body_start_1|>
n, d = X.shape
n_correction = 0.0
d_correction = 0.0... | NaiveBayes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NaiveBayes:
def __init__(self, useLaplaceSmoothing=True):
"""Constructor"""
<|body_0|>
def fit(self, X, y):
"""Trains the model Arguments: X is a n-by-d numpy array y is an n-dimensional numpy array"""
<|body_1|>
def predict(self, X):
"""Used the... | stack_v2_sparse_classes_75kplus_train_003310 | 4,462 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, useLaplaceSmoothing=True)"
},
{
"docstring": "Trains the model Arguments: X is a n-by-d numpy array y is an n-dimensional numpy array",
"name": "fit",
"signature": "def fit(self, X, y)"
},
{
"docst... | 4 | stack_v2_sparse_classes_30k_test_001374 | Implement the Python class `NaiveBayes` described below.
Class description:
Implement the NaiveBayes class.
Method signatures and docstrings:
- def __init__(self, useLaplaceSmoothing=True): Constructor
- def fit(self, X, y): Trains the model Arguments: X is a n-by-d numpy array y is an n-dimensional numpy array
- def... | Implement the Python class `NaiveBayes` described below.
Class description:
Implement the NaiveBayes class.
Method signatures and docstrings:
- def __init__(self, useLaplaceSmoothing=True): Constructor
- def fit(self, X, y): Trains the model Arguments: X is a n-by-d numpy array y is an n-dimensional numpy array
- def... | 19df820d78d74e1ffb7a8fc3df5990b1d65d7fdc | <|skeleton|>
class NaiveBayes:
def __init__(self, useLaplaceSmoothing=True):
"""Constructor"""
<|body_0|>
def fit(self, X, y):
"""Trains the model Arguments: X is a n-by-d numpy array y is an n-dimensional numpy array"""
<|body_1|>
def predict(self, X):
"""Used the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NaiveBayes:
def __init__(self, useLaplaceSmoothing=True):
"""Constructor"""
self.useLaplaceSmoothing = useLaplaceSmoothing
self.classes = None
self.class_count = None
self.class_probabilities = None
self.cond_probabilities = None
def fit(self, X, y):
... | the_stack_v2_python_sparse | HW3/hw3_skeleton/hw3_skeleton/naiveBayes.py | banisadr/ML | train | 0 | |
95cf464069ed778b512f13bd687183449b7b1609 | [
"with Environment.manage():\n proc_obj = self.pool.get('procurement.order')\n new_cr = self.pool.cursor()\n user_obj = self.pool.get('res.users')\n company_id = user_obj.browse(new_cr, uid, uid, context=context).company_id.id\n proc_obj._procure_orderpoint_confirm(new_cr, uid, use_new_cursor=new_cr.d... | <|body_start_0|>
with Environment.manage():
proc_obj = self.pool.get('procurement.order')
new_cr = self.pool.cursor()
user_obj = self.pool.get('res.users')
company_id = user_obj.browse(new_cr, uid, uid, context=context).company_id.id
proc_obj._procure_... | procurement_compute | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class procurement_compute:
def _procure_calculation_orderpoint(self, cr, uid, ids, context=None):
"""@param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary"""
<|... | stack_v2_sparse_classes_75kplus_train_003311 | 1,906 | no_license | [
{
"docstring": "@param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary",
"name": "_procure_calculation_orderpoint",
"signature": "def _procure_calculation_orderpoint(self, cr, uid... | 2 | stack_v2_sparse_classes_30k_train_024839 | Implement the Python class `procurement_compute` described below.
Class description:
Implement the procurement_compute class.
Method signatures and docstrings:
- def _procure_calculation_orderpoint(self, cr, uid, ids, context=None): @param self: The object pointer. @param cr: A database cursor @param uid: ID of the u... | Implement the Python class `procurement_compute` described below.
Class description:
Implement the procurement_compute class.
Method signatures and docstrings:
- def _procure_calculation_orderpoint(self, cr, uid, ids, context=None): @param self: The object pointer. @param cr: A database cursor @param uid: ID of the u... | 5a4fd72991c846d5cb7c5082f6bdfef5b2bca572 | <|skeleton|>
class procurement_compute:
def _procure_calculation_orderpoint(self, cr, uid, ids, context=None):
"""@param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class procurement_compute:
def _procure_calculation_orderpoint(self, cr, uid, ids, context=None):
"""@param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary"""
with Environment... | the_stack_v2_python_sparse | yuancloud/addons/stock/wizard/orderpoint_procurement.py | cash2one/yuancloud | train | 0 | |
dd4e8dd9fe073747786f729ea5d57c32bbcb92ad | [
"super(ResourcesAPITestCase, cls).setUpTestData()\nfor name, _definition in utils.get_user_limit_templates():\n cls.localconfig.parameters.set_value('deflt_user_{0}_limit'.format(name), 2)\ncls.localconfig.save()\npopulate_database()\ncls.user = User.objects.get(username='admin@test.com')\ncls.da_token = Token.o... | <|body_start_0|>
super(ResourcesAPITestCase, cls).setUpTestData()
for name, _definition in utils.get_user_limit_templates():
cls.localconfig.parameters.set_value('deflt_user_{0}_limit'.format(name), 2)
cls.localconfig.save()
populate_database()
cls.user = User.objects... | Check resources API. | ResourcesAPITestCase | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourcesAPITestCase:
"""Check resources API."""
def setUpTestData(cls):
"""Create test data."""
<|body_0|>
def test_get_admin_resources(self):
"""Retrieve admin resources."""
<|body_1|>
def test_update_resources(self):
"""Update resources.""... | stack_v2_sparse_classes_75kplus_train_003312 | 13,614 | permissive | [
{
"docstring": "Create test data.",
"name": "setUpTestData",
"signature": "def setUpTestData(cls)"
},
{
"docstring": "Retrieve admin resources.",
"name": "test_get_admin_resources",
"signature": "def test_get_admin_resources(self)"
},
{
"docstring": "Update resources.",
"name... | 3 | stack_v2_sparse_classes_30k_train_022456 | Implement the Python class `ResourcesAPITestCase` described below.
Class description:
Check resources API.
Method signatures and docstrings:
- def setUpTestData(cls): Create test data.
- def test_get_admin_resources(self): Retrieve admin resources.
- def test_update_resources(self): Update resources. | Implement the Python class `ResourcesAPITestCase` described below.
Class description:
Check resources API.
Method signatures and docstrings:
- def setUpTestData(cls): Create test data.
- def test_get_admin_resources(self): Retrieve admin resources.
- def test_update_resources(self): Update resources.
<|skeleton|>
cl... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class ResourcesAPITestCase:
"""Check resources API."""
def setUpTestData(cls):
"""Create test data."""
<|body_0|>
def test_get_admin_resources(self):
"""Retrieve admin resources."""
<|body_1|>
def test_update_resources(self):
"""Update resources.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResourcesAPITestCase:
"""Check resources API."""
def setUpTestData(cls):
"""Create test data."""
super(ResourcesAPITestCase, cls).setUpTestData()
for name, _definition in utils.get_user_limit_templates():
cls.localconfig.parameters.set_value('deflt_user_{0}_limit'.form... | the_stack_v2_python_sparse | modoboa/limits/api/v1/tests.py | modoboa/modoboa | train | 2,201 |
4a00d243368af43c7e476824c9395a1f59ebc5bf | [
"self._fM = fManager\nif not os.path.isdir(self._fM.absLoc):\n print('CREATING ABSOLUTE LOCATION: ' + self._fM.absLoc)\nos.makedirs(self._fM.absLoc, exist_ok=True)\ntry:\n self._fOut = open(self._fM.absPath, 'w', newline='\\n')\nexcept:\n print('ERROR: COULD NOT OPEN FILE FOR OUTPUT')\n print(' ROOT:... | <|body_start_0|>
self._fM = fManager
if not os.path.isdir(self._fM.absLoc):
print('CREATING ABSOLUTE LOCATION: ' + self._fM.absLoc)
os.makedirs(self._fM.absLoc, exist_ok=True)
try:
self._fOut = open(self._fM.absPath, 'w', newline='\n')
except:
... | Base class to manage file output -- meant to be attached to 'fManager' class objects | fWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class fWriter:
"""Base class to manage file output -- meant to be attached to 'fManager' class objects"""
def __init__(self, fManager):
"""Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager object"""
<|body_0|>
def write(self, str_ou... | stack_v2_sparse_classes_75kplus_train_003313 | 6,714 | no_license | [
{
"docstring": "Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager object",
"name": "__init__",
"signature": "def __init__(self, fManager)"
},
{
"docstring": "Output method for 'fWriter' class objects Arguments --------- *args: fManager() Parent fManag... | 2 | stack_v2_sparse_classes_30k_train_043519 | Implement the Python class `fWriter` described below.
Class description:
Base class to manage file output -- meant to be attached to 'fManager' class objects
Method signatures and docstrings:
- def __init__(self, fManager): Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager... | Implement the Python class `fWriter` described below.
Class description:
Base class to manage file output -- meant to be attached to 'fManager' class objects
Method signatures and docstrings:
- def __init__(self, fManager): Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager... | 8fd8e9a08185aa95371e6d7c121d17c6aab59987 | <|skeleton|>
class fWriter:
"""Base class to manage file output -- meant to be attached to 'fManager' class objects"""
def __init__(self, fManager):
"""Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager object"""
<|body_0|>
def write(self, str_ou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class fWriter:
"""Base class to manage file output -- meant to be attached to 'fManager' class objects"""
def __init__(self, fManager):
"""Constructor for fWriter class objects Arguments --------- fManager: fManager() Parent fManager object"""
self._fM = fManager
if not os.path.isdir(se... | the_stack_v2_python_sparse | py_file/file_manager.py | FluencyMedia/py_util | train | 0 |
4733cceed5f5e562b2c330358c115c8da883b44e | [
"similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float)\noccurred_seqs = sequence_occurrences > 0\nif not occurred_seqs.any():\n return similarities\nsequences = sequences[occurred_seqs]\nsequence_occurrences = sequence_occurrences[occurred_seqs]\nsimilarities_flat ... | <|body_start_0|>
similarities = sequences.new_zeros((cluster_centers_count, cluster_centers_count), dtype=torch.float)
occurred_seqs = sequence_occurrences > 0
if not occurred_seqs.any():
return similarities
sequences = sequences[occurred_seqs]
sequence_occurrences = ... | ClusterUtils | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterUtils:
def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor:
"""Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len... | stack_v2_sparse_classes_75kplus_train_003314 | 38,858 | permissive | [
{
"docstring": "Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster_center_id sequence_occurrences: tensor[sequences_count] = number_of_occurrences Returns: tensor[cluster_centers_count, cluster_centers_count]... | 2 | stack_v2_sparse_classes_30k_train_045194 | Implement the Python class `ClusterUtils` described below.
Class description:
Implement the ClusterUtils class.
Method signatures and docstrings:
- def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A... | Implement the Python class `ClusterUtils` described below.
Class description:
Implement the ClusterUtils class.
Method signatures and docstrings:
- def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor: Compute cluster centers similarities. A... | 81d72b82ec96948c26d292d709f18c9c77a17ba4 | <|skeleton|>
class ClusterUtils:
def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor:
"""Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_len... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClusterUtils:
def compute_similarities(cluster_centers_count: int, sequences: torch.Tensor, sequence_occurrences: torch.Tensor) -> torch.Tensor:
"""Compute cluster centers similarities. Args: cluster_centers_count: number of cluster centers sequences: tensor[sequences_count, sequence_length] = cluster... | the_stack_v2_python_sparse | torchsim/gui/observers/cluster_observer.py | andreofner/torchsim | train | 0 | |
ad1da260043b271c280758ac2da1cf6c9916728a | [
"base_dir_path = SETTINGS['VIEWS']['DEFAULT_TEMPLATES_DIR']\napp_path = os.path.abspath(base_dir_path)\ntemplates = PageTemplateLoader(app_path)\ntemplate = templates[SETTINGS['VIEWS'][template_type]]\nreturn template",
"found = True\nfor app_route in routes:\n if route not in app_route['url'] and 'assets' not... | <|body_start_0|>
base_dir_path = SETTINGS['VIEWS']['DEFAULT_TEMPLATES_DIR']
app_path = os.path.abspath(base_dir_path)
templates = PageTemplateLoader(app_path)
template = templates[SETTINGS['VIEWS'][template_type]]
return template
<|end_body_0|>
<|body_start_1|>
found = T... | Error handling middleware | ErrorMiddleware | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ErrorMiddleware:
"""Error handling middleware"""
def __load_error_template__(template_type='DEFAULT_404_TEMPLATE'):
"""Loads the specified templates Args: template_type: string Returns:"""
<|body_0|>
def __check_if_route_exists(route):
"""Check if route exists in... | stack_v2_sparse_classes_75kplus_train_003315 | 1,581 | permissive | [
{
"docstring": "Loads the specified templates Args: template_type: string Returns:",
"name": "__load_error_template__",
"signature": "def __load_error_template__(template_type='DEFAULT_404_TEMPLATE')"
},
{
"docstring": "Check if route exists in the URL map Args: route: Returns: boolean",
"na... | 3 | stack_v2_sparse_classes_30k_val_000554 | Implement the Python class `ErrorMiddleware` described below.
Class description:
Error handling middleware
Method signatures and docstrings:
- def __load_error_template__(template_type='DEFAULT_404_TEMPLATE'): Loads the specified templates Args: template_type: string Returns:
- def __check_if_route_exists(route): Che... | Implement the Python class `ErrorMiddleware` described below.
Class description:
Error handling middleware
Method signatures and docstrings:
- def __load_error_template__(template_type='DEFAULT_404_TEMPLATE'): Loads the specified templates Args: template_type: string Returns:
- def __check_if_route_exists(route): Che... | 893cfd44ba86c2d0ef51afed5a0a91e8714e9a5d | <|skeleton|>
class ErrorMiddleware:
"""Error handling middleware"""
def __load_error_template__(template_type='DEFAULT_404_TEMPLATE'):
"""Loads the specified templates Args: template_type: string Returns:"""
<|body_0|>
def __check_if_route_exists(route):
"""Check if route exists in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ErrorMiddleware:
"""Error handling middleware"""
def __load_error_template__(template_type='DEFAULT_404_TEMPLATE'):
"""Loads the specified templates Args: template_type: string Returns:"""
base_dir_path = SETTINGS['VIEWS']['DEFAULT_TEMPLATES_DIR']
app_path = os.path.abspath(base_d... | the_stack_v2_python_sparse | middlewares/Error_middleware.py | zoltancsontos/pystack-framework | train | 0 |
5bf3a626ae092b2fe0d1c2d8623b2609f9d3e34d | [
"if not head:\n return None\nself.reverse_iter(head)\nreturn self.head",
"if not node.next:\n self.head = node\n return node\nelse:\n parent = self.reverse_iter(node.next)\n parent.next = ListNode(node.val)\n parent = parent.next\n return parent"
] | <|body_start_0|>
if not head:
return None
self.reverse_iter(head)
return self.head
<|end_body_0|>
<|body_start_1|>
if not node.next:
self.head = node
return node
else:
parent = self.reverse_iter(node.next)
parent.next =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_iter(self, node):
""":type node: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return None... | stack_v2_sparse_classes_75kplus_train_003316 | 1,997 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type node: ListNode :rtype: ListNode",
"name": "reverse_iter",
"signature": "def reverse_iter(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031559 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_iter(self, node): :type node: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_iter(self, node): :type node: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
def re... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_iter(self, node):
""":type node: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
if not head:
return None
self.reverse_iter(head)
return self.head
def reverse_iter(self, node):
""":type node: ListNode :rtype: ListNode"""
if not node.next:
... | the_stack_v2_python_sparse | 206.py | Gackle/leetcode_practice | train | 0 | |
d03ee669190088afdd6989a640d3c5450b48c37e | [
"if not isinstance(cath_id, CathID):\n cath_id = CathID(cath_id)\ndepth = cath_id.depth\nfiltered_entries = [c for c in self.entries if c.cath_id_to_depth(depth) == cath_id]\nreturn self.__class__(entries=filtered_entries)",
"sorted_entries = sorted(self.entries)\nreps = {}\nfor entry in sorted_entries:\n r... | <|body_start_0|>
if not isinstance(cath_id, CathID):
cath_id = CathID(cath_id)
depth = cath_id.depth
filtered_entries = [c for c in self.entries if c.cath_id_to_depth(depth) == cath_id]
return self.__class__(entries=filtered_entries)
<|end_body_0|>
<|body_start_1|>
s... | Mixin for container classes that have entries with :class:`HasCathIDMixin` | HasEntriesWithCathIDMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HasEntriesWithCathIDMixin:
"""Mixin for container classes that have entries with :class:`HasCathIDMixin`"""
def filter_cath_id(self, cath_id):
"""Returns a new container after filtering to only include entries within a given CATH ID"""
<|body_0|>
def filter_reps(self, de... | stack_v2_sparse_classes_75kplus_train_003317 | 14,116 | permissive | [
{
"docstring": "Returns a new container after filtering to only include entries within a given CATH ID",
"name": "filter_cath_id",
"signature": "def filter_cath_id(self, cath_id)"
},
{
"docstring": "Returns a new container after filtering to only include one rep at a given depth",
"name": "f... | 2 | stack_v2_sparse_classes_30k_train_015736 | Implement the Python class `HasEntriesWithCathIDMixin` described below.
Class description:
Mixin for container classes that have entries with :class:`HasCathIDMixin`
Method signatures and docstrings:
- def filter_cath_id(self, cath_id): Returns a new container after filtering to only include entries within a given CA... | Implement the Python class `HasEntriesWithCathIDMixin` described below.
Class description:
Mixin for container classes that have entries with :class:`HasCathIDMixin`
Method signatures and docstrings:
- def filter_cath_id(self, cath_id): Returns a new container after filtering to only include entries within a given CA... | 39de100ebc18eac2c4da10e4b5fd22b6926b69a4 | <|skeleton|>
class HasEntriesWithCathIDMixin:
"""Mixin for container classes that have entries with :class:`HasCathIDMixin`"""
def filter_cath_id(self, cath_id):
"""Returns a new container after filtering to only include entries within a given CATH ID"""
<|body_0|>
def filter_reps(self, de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HasEntriesWithCathIDMixin:
"""Mixin for container classes that have entries with :class:`HasCathIDMixin`"""
def filter_cath_id(self, cath_id):
"""Returns a new container after filtering to only include entries within a given CATH ID"""
if not isinstance(cath_id, CathID):
cath_... | the_stack_v2_python_sparse | cathpy/core/release.py | UCL/cathpy | train | 12 |
3b953875149dd9710aca7dac868373a618172a95 | [
"self.bounds = (min(x), max(x))\nself.fill_value = fill_value\nsuper(ExtrapolatingUnivariateSpline, self).__init__(x, y, w=w, bbox=bbox, k=k, ext=ext)",
"x = np.atleast_1d(x)\nretval = super(ExtrapolatingUnivariateSpline, self).__call__(x, nu=nu, ext=ext)\nidx = ~((x > self.bounds[0]) & (x < self.bounds[1]))\nret... | <|body_start_0|>
self.bounds = (min(x), max(x))
self.fill_value = fill_value
super(ExtrapolatingUnivariateSpline, self).__init__(x, y, w=w, bbox=bbox, k=k, ext=ext)
<|end_body_0|>
<|body_start_1|>
x = np.atleast_1d(x)
retval = super(ExtrapolatingUnivariateSpline, self).__call__(... | Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN. | ExtrapolatingUnivariateSpline | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtrapolatingUnivariateSpline:
"""Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN."""
def __init__(self, x, y, w=None, bbox=[None] * 2, k=3, ext=0, fill_value=np.nan... | stack_v2_sparse_classes_75kplus_train_003318 | 47,749 | permissive | [
{
"docstring": "See docstring for InterpolatedUnivariateSpline.",
"name": "__init__",
"signature": "def __init__(self, x, y, w=None, bbox=[None] * 2, k=3, ext=0, fill_value=np.nan)"
},
{
"docstring": "See docstring for InterpolatedUnivariateSpline.__call__",
"name": "__call__",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_003731 | Implement the Python class `ExtrapolatingUnivariateSpline` described below.
Class description:
Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN.
Method signatures and docstrings:
- def __init_... | Implement the Python class `ExtrapolatingUnivariateSpline` described below.
Class description:
Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN.
Method signatures and docstrings:
- def __init_... | 8a9f00a6977dad8d4477eef1d664fd62e9ecab75 | <|skeleton|>
class ExtrapolatingUnivariateSpline:
"""Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN."""
def __init__(self, x, y, w=None, bbox=[None] * 2, k=3, ext=0, fill_value=np.nan... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExtrapolatingUnivariateSpline:
"""Does the same thing as InterpolatedUnivariateSpline, but keeps track of if it is extrapolating. When extrapolating, this will just return the fill value which defaults to NaN."""
def __init__(self, x, y, w=None, bbox=[None] * 2, k=3, ext=0, fill_value=np.nan):
""... | the_stack_v2_python_sparse | kglib/utils/HelperFunctions.py | kgullikson88/gullikson-scripts | train | 4 |
c18ac3c9db7b9e5724c1f3c01ea7bbe476b9fb4c | [
"if context is None:\n context = {}\nreturn [(obj.id, obj.agent_id.name) for obj in self.browse(cr, uid, ids, context=context)]",
"if context is None:\n context = {}\nagent_pool = self.pool.get('res.partner.agent')\nagent_obj_ids = [agent_obj_id.id for agent_obj_id in self.browse(cr, uid, ids, context=conte... | <|body_start_0|>
if context is None:
context = {}
return [(obj.id, obj.agent_id.name) for obj in self.browse(cr, uid, ids, context=context)]
<|end_body_0|>
<|body_start_1|>
if context is None:
context = {}
agent_pool = self.pool.get('res.partner.agent')
a... | objeto de comportamiento many2many que relaciona agentes o comerciales con partners | res_partner_agent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class res_partner_agent:
"""objeto de comportamiento many2many que relaciona agentes o comerciales con partners"""
def name_get(self, cr, uid, ids, context=None):
"""devuelve como nombre del agente del partner el nombre del agente"""
<|body_0|>
def _get_partner_agents_to_updat... | stack_v2_sparse_classes_75kplus_train_003319 | 4,442 | no_license | [
{
"docstring": "devuelve como nombre del agente del partner el nombre del agente",
"name": "name_get",
"signature": "def name_get(self, cr, uid, ids, context=None)"
},
{
"docstring": "devuelve los ids de partner agents a actualizar desde el lanzamiento de un evento de actualización en agentes de... | 4 | stack_v2_sparse_classes_30k_train_025452 | Implement the Python class `res_partner_agent` described below.
Class description:
objeto de comportamiento many2many que relaciona agentes o comerciales con partners
Method signatures and docstrings:
- def name_get(self, cr, uid, ids, context=None): devuelve como nombre del agente del partner el nombre del agente
- ... | Implement the Python class `res_partner_agent` described below.
Class description:
objeto de comportamiento many2many que relaciona agentes o comerciales con partners
Method signatures and docstrings:
- def name_get(self, cr, uid, ids, context=None): devuelve como nombre del agente del partner el nombre del agente
- ... | eb1cadd446851da94cd4be764ae6350d9284b708 | <|skeleton|>
class res_partner_agent:
"""objeto de comportamiento many2many que relaciona agentes o comerciales con partners"""
def name_get(self, cr, uid, ids, context=None):
"""devuelve como nombre del agente del partner el nombre del agente"""
<|body_0|>
def _get_partner_agents_to_updat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class res_partner_agent:
"""objeto de comportamiento many2many que relaciona agentes o comerciales con partners"""
def name_get(self, cr, uid, ids, context=None):
"""devuelve como nombre del agente del partner el nombre del agente"""
if context is None:
context = {}
return [... | the_stack_v2_python_sparse | sale_commission/partner_agent.py | TRESCLOUD/odoo-modulos-comunidad | train | 1 |
ec576643d01ec9fd2b2a07744fd6cfe2d02843d3 | [
"result = []\nfor i in range(numRows):\n temp = [0] * (i + 1)\n temp[0], temp[-1] = (1, 1)\n for j in range(1, i):\n temp[j] = result[i - 1][j - 1] + result[i - 1][j]\n result.append(temp)\nreturn result",
"result = []\nfor i in range(numRows):\n temp = [0] * (i + 1)\n temp[0], temp[-1] =... | <|body_start_0|>
result = []
for i in range(numRows):
temp = [0] * (i + 1)
temp[0], temp[-1] = (1, 1)
for j in range(1, i):
temp[j] = result[i - 1][j - 1] + result[i - 1][j]
result.append(temp)
return result
<|end_body_0|>
<|body_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate1(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
for i ... | stack_v2_sparse_classes_75kplus_train_003320 | 1,494 | no_license | [
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
},
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate1",
"signature": "def generate1(self, numRows)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate1(self, numRows): :type numRows: int :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate1(self, numRows): :type numRows: int :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | f022677c042db3598003df1a320a70f0edc4f870 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate1(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
result = []
for i in range(numRows):
temp = [0] * (i + 1)
temp[0], temp[-1] = (1, 1)
for j in range(1, i):
temp[j] = result[i - 1][j - 1] + result... | the_stack_v2_python_sparse | TwoDimension/yanghuisanjiao.py | daisyzl/program-exercise-python | train | 0 | |
590556093194380743e3196dc9fa0411bc83f519 | [
"UserModel = User\nemail = self.cleaned_data['email']\nself.users_cache = UserModel._default_manager.filter(email__iexact=email)\nif not len(self.users_cache):\n raise forms.ValidationError(self.error_messages['unknown'])\nif not any((user.is_active for user in self.users_cache)):\n raise forms.ValidationErro... | <|body_start_0|>
UserModel = User
email = self.cleaned_data['email']
self.users_cache = UserModel._default_manager.filter(email__iexact=email)
if not len(self.users_cache):
raise forms.ValidationError(self.error_messages['unknown'])
if not any((user.is_active for user... | PasswordResetForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PasswordResetForm:
def clean_email(self):
"""Validates that an active user exists with the given email address."""
<|body_0|>
def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_rese... | stack_v2_sparse_classes_75kplus_train_003321 | 8,089 | permissive | [
{
"docstring": "Validates that an active user exists with the given email address.",
"name": "clean_email",
"signature": "def clean_email(self)"
},
{
"docstring": "Generates a one-use only link for resetting password and sends to the user.",
"name": "save",
"signature": "def save(self, d... | 2 | stack_v2_sparse_classes_30k_train_032287 | Implement the Python class `PasswordResetForm` described below.
Class description:
Implement the PasswordResetForm class.
Method signatures and docstrings:
- def clean_email(self): Validates that an active user exists with the given email address.
- def save(self, domain_override=None, subject_template_name='registra... | Implement the Python class `PasswordResetForm` described below.
Class description:
Implement the PasswordResetForm class.
Method signatures and docstrings:
- def clean_email(self): Validates that an active user exists with the given email address.
- def save(self, domain_override=None, subject_template_name='registra... | a867892274831c6795b199212a9b1726321d10bf | <|skeleton|>
class PasswordResetForm:
def clean_email(self):
"""Validates that an active user exists with the given email address."""
<|body_0|>
def save(self, domain_override=None, subject_template_name='registration/password_reset_subject.txt', email_template_name='registration/password_rese... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PasswordResetForm:
def clean_email(self):
"""Validates that an active user exists with the given email address."""
UserModel = User
email = self.cleaned_data['email']
self.users_cache = UserModel._default_manager.filter(email__iexact=email)
if not len(self.users_cache):... | the_stack_v2_python_sparse | pahchina/apps/accounts/forms.py | sdutlinux/pahchina | train | 1 | |
2ddecd9114f9d28791355050c36172b4f42fbdf5 | [
"self.name = label.get('Name')\nself.confidence = label.get('Confidence')\nself.parent_name = label.get('ParentName')\nself.timestamp = timestamp",
"rendering = {}\nif self.name is not None:\n rendering['name'] = self.name\nif self.parent_name is not None:\n rendering['parent_name'] = self.parent_name\nif s... | <|body_start_0|>
self.name = label.get('Name')
self.confidence = label.get('Confidence')
self.parent_name = label.get('ParentName')
self.timestamp = timestamp
<|end_body_0|>
<|body_start_1|>
rendering = {}
if self.name is not None:
rendering['name'] = self.na... | Encapsulates an Amazon Rekognition moderation label. | RekognitionModerationLabel | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RekognitionModerationLabel:
"""Encapsulates an Amazon Rekognition moderation label."""
def __init__(self, label, timestamp=None):
"""Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time w... | stack_v2_sparse_classes_75kplus_train_003322 | 11,689 | permissive | [
{
"docstring": "Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the moderation label was detected, if the label was detected in a video.",
"name": "__init__",
"signature": "def __init__(self, label... | 2 | stack_v2_sparse_classes_30k_train_037684 | Implement the Python class `RekognitionModerationLabel` described below.
Class description:
Encapsulates an Amazon Rekognition moderation label.
Method signatures and docstrings:
- def __init__(self, label, timestamp=None): Initializes the moderation label object. :param label: Label data, in the format returned by A... | Implement the Python class `RekognitionModerationLabel` described below.
Class description:
Encapsulates an Amazon Rekognition moderation label.
Method signatures and docstrings:
- def __init__(self, label, timestamp=None): Initializes the moderation label object. :param label: Label data, in the format returned by A... | dec41fb589043ac9d8667aac36fb88a53c3abe50 | <|skeleton|>
class RekognitionModerationLabel:
"""Encapsulates an Amazon Rekognition moderation label."""
def __init__(self, label, timestamp=None):
"""Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time w... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RekognitionModerationLabel:
"""Encapsulates an Amazon Rekognition moderation label."""
def __init__(self, label, timestamp=None):
"""Initializes the moderation label object. :param label: Label data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the moder... | the_stack_v2_python_sparse | python/example_code/rekognition/rekognition_objects.py | awsdocs/aws-doc-sdk-examples | train | 8,240 |
07960f998b306ba78dfd4d35030ce1ed4ed9ae94 | [
"self.a_data_object = aDataObject\nself.b_data_object = bDataObject\nself.epsilon_value = epsilonValue\nself.epsilon_percent = epsilonPercent\nself.diff_data_object = DiffInfoObject.analyze(aDataObject, bDataObject, epsilonValue, epsilonPercent)",
"type_to_return = data1.dtype\nchanged_type = False\nif data1.dtyp... | <|body_start_0|>
self.a_data_object = aDataObject
self.b_data_object = bDataObject
self.epsilon_value = epsilonValue
self.epsilon_percent = epsilonPercent
self.diff_data_object = DiffInfoObject.analyze(aDataObject, bDataObject, epsilonValue, epsilonPercent)
<|end_body_0|>
<|body... | This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences between A and B epsilon_value - the epsilon value used for comparison or None epsilon... | DiffInfoObject | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiffInfoObject:
"""This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences between A and B epsilon_value - the epsilon... | stack_v2_sparse_classes_75kplus_train_003323 | 23,284 | no_license | [
{
"docstring": "analyze the difference between these two data sets at the given epsilon values",
"name": "__init__",
"signature": "def __init__(self, aDataObject, bDataObject, epsilonValue=0.0, epsilonPercent=None)"
},
{
"docstring": "Figure out a shared type that can be used when adding or subt... | 4 | stack_v2_sparse_classes_30k_train_003191 | Implement the Python class `DiffInfoObject` described below.
Class description:
This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences betw... | Implement the Python class `DiffInfoObject` described below.
Class description:
This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences betw... | 24f451688a736f83165a2ff5f565733223252bb3 | <|skeleton|>
class DiffInfoObject:
"""This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences between A and B epsilon_value - the epsilon... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiffInfoObject:
"""This class represents the full difference between two data sets. a_data_object - data object describing the A data set b_data_object - data object describing the B data set diff_data_object - data object describing the raw differences between A and B epsilon_value - the epsilon value used f... | the_stack_v2_python_sparse | pyglance/glance/data.py | evas-ssec/uwglance | train | 0 |
d3179f6608465ee67ea41c6f5cd149eb8f50a1e3 | [
"expected_content = deepcopy(EXPECTED_CONTENT)\nexpected_content['tenant_admin'] = True\ntenant = Tenant.objects.create(name='hellothere', owner='John', owner_contact='206.867.5309')\ntoken = create_and_login(tenant=tenant)\nuser = get_user_model().objects.all()[0]\nuser.tenant = None\nuser.save()\nresponse = self.... | <|body_start_0|>
expected_content = deepcopy(EXPECTED_CONTENT)
expected_content['tenant_admin'] = True
tenant = Tenant.objects.create(name='hellothere', owner='John', owner_contact='206.867.5309')
token = create_and_login(tenant=tenant)
user = get_user_model().objects.all()[0]
... | The tenant_admin user gets and changes her Cloud credentials. | GetPutTenantAdmin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetPutTenantAdmin:
"""The tenant_admin user gets and changes her Cloud credentials."""
def test_no_tenant(self):
"""Get or change Cloud data when there's no Goldstone tenant."""
<|body_0|>
def test_no_cloud(self):
"""Get or change Cloud data when there's no Cloud... | stack_v2_sparse_classes_75kplus_train_003324 | 19,841 | permissive | [
{
"docstring": "Get or change Cloud data when there's no Goldstone tenant.",
"name": "test_no_tenant",
"signature": "def test_no_tenant(self)"
},
{
"docstring": "Get or change Cloud data when there's no Cloud.",
"name": "test_no_cloud",
"signature": "def test_no_cloud(self)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_017604 | Implement the Python class `GetPutTenantAdmin` described below.
Class description:
The tenant_admin user gets and changes her Cloud credentials.
Method signatures and docstrings:
- def test_no_tenant(self): Get or change Cloud data when there's no Goldstone tenant.
- def test_no_cloud(self): Get or change Cloud data ... | Implement the Python class `GetPutTenantAdmin` described below.
Class description:
The tenant_admin user gets and changes her Cloud credentials.
Method signatures and docstrings:
- def test_no_tenant(self): Get or change Cloud data when there's no Goldstone tenant.
- def test_no_cloud(self): Get or change Cloud data ... | d7f1f1f1ff926148d2aa541d0bd4758173aa76d5 | <|skeleton|>
class GetPutTenantAdmin:
"""The tenant_admin user gets and changes her Cloud credentials."""
def test_no_tenant(self):
"""Get or change Cloud data when there's no Goldstone tenant."""
<|body_0|>
def test_no_cloud(self):
"""Get or change Cloud data when there's no Cloud... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetPutTenantAdmin:
"""The tenant_admin user gets and changes her Cloud credentials."""
def test_no_tenant(self):
"""Get or change Cloud data when there's no Goldstone tenant."""
expected_content = deepcopy(EXPECTED_CONTENT)
expected_content['tenant_admin'] = True
tenant = ... | the_stack_v2_python_sparse | goldstone/user/tests.py | leftees/goldstone-server | train | 0 |
5565a60c531aa2a34c56168d796f4dddfbba83ef | [
"self.config = config\nself.engine: VizierEngine\nself.branches: VizierBranchApi\nself.datasets: VizierDatastoreApi\nself.files: VizierFilestoreApi\nself.projects: VizierProjectApi\nself.tasks: VizierTaskApi\nself.workflows: VizierWorkflowApi\nself.urls: UrlFactory\nself.service_descriptor: Dict[str, Any]\nself.vie... | <|body_start_0|>
self.config = config
self.engine: VizierEngine
self.branches: VizierBranchApi
self.datasets: VizierDatastoreApi
self.files: VizierFilestoreApi
self.projects: VizierProjectApi
self.tasks: VizierTaskApi
self.workflows: VizierWorkflowApi
... | The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper around the different components of the Vizier system that are necessary for the... | VizierApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VizierApi:
"""The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper around the different components of the Viz... | stack_v2_sparse_classes_75kplus_train_003325 | 14,710 | permissive | [
{
"docstring": "Initialize the API components. Parameters ---------- config: vizier.config.app.AppConfig Application configuration object init: bool, optional Defer initialization if False",
"name": "__init__",
"signature": "def __init__(self, config: AppConfig, init: bool=False)"
},
{
"docstrin... | 2 | stack_v2_sparse_classes_30k_train_015885 | Implement the Python class `VizierApi` described below.
Class description:
The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper aro... | Implement the Python class `VizierApi` described below.
Class description:
The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper aro... | e99f43df3df80ad5647f57d805c339257336ac73 | <|skeleton|>
class VizierApi:
"""The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper around the different components of the Viz... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VizierApi:
"""The Vizier API implements the methods that correspond to requests that are supported by the Vizier Web Service. the API, however, can also be used in a stand-alone manner, e.g., via the command line interpreter tool. This class is a wrapper around the different components of the Vizier system th... | the_stack_v2_python_sparse | vizier/api/webservice/base.py | VizierDB/web-api-async | train | 2 |
b8d4c229b24e65c0995698d2e6b7ec05cf330276 | [
"from heapq import heappush, heappop, heapreplace, heapify\nh = []\nres = ListNode(0)\np = res\nh = [(n.val, n) for n in lists if n]\nheapify(h)\nwhile h:\n value, minNode = h[0]\n p.next = minNode\n if not minNode.next:\n heappop(h)\n else:\n heapreplace(h, (minNode.next.val, minNode.next... | <|body_start_0|>
from heapq import heappush, heappop, heapreplace, heapify
h = []
res = ListNode(0)
p = res
h = [(n.val, n) for n in lists if n]
heapify(h)
while h:
value, minNode = h[0]
p.next = minNode
if not minNode.next:
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from heapq import he... | stack_v2_sparse_classes_75kplus_train_003326 | 1,442 | permissive | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists2",
"signature": "def mergeKLists2(self, lists)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006933 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>
class Solut... | aec1ddd0c51b619c1bae1e05f940d9ed587aa82f | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
from heapq import heappush, heappop, heapreplace, heapify
h = []
res = ListNode(0)
p = res
h = [(n.val, n) for n in lists if n]
heapify(h)
while h:
... | the_stack_v2_python_sparse | Python/leetcode/MergeKLists.py | darrencheng0817/AlgorithmLearning | train | 2 | |
86032cf0a044b388109cde1acea1d15ff76b1105 | [
"m, n = (len(grid), len(grid[0]))\n\ndef bfs(grid, i, j, visited):\n Q = deque()\n Q.append((i, j))\n while len(Q):\n i1, j1 = Q.popleft()\n if grid[i1][j1] == 1:\n return abs(i1 - i) + abs(j1 - j)\n visited[i1][j1] = 1\n if 0 <= j1 - 1 < n and visited[i1][j1 - 1] == ... | <|body_start_0|>
m, n = (len(grid), len(grid[0]))
def bfs(grid, i, j, visited):
Q = deque()
Q.append((i, j))
while len(Q):
i1, j1 = Q.popleft()
if grid[i1][j1] == 1:
return abs(i1 - i) + abs(j1 - j)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDistance(self, grid) -> int:
"""BFS,超时 :param list[list[int]] grid: :return:"""
<|body_0|>
def maxDistance2(self, grid) -> int:
"""多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_003327 | 3,231 | no_license | [
{
"docstring": "BFS,超时 :param list[list[int]] grid: :return:",
"name": "maxDistance",
"signature": "def maxDistance(self, grid) -> int"
},
{
"docstring": "多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:",
"name": "maxDistance2",
"signature": "def maxDistance2(self, gri... | 2 | stack_v2_sparse_classes_30k_train_013091 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistance(self, grid) -> int: BFS,超时 :param list[list[int]] grid: :return:
- def maxDistance2(self, grid) -> int: 多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistance(self, grid) -> int: BFS,超时 :param list[list[int]] grid: :return:
- def maxDistance2(self, grid) -> int: 多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: ... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def maxDistance(self, grid) -> int:
"""BFS,超时 :param list[list[int]] grid: :return:"""
<|body_0|>
def maxDistance2(self, grid) -> int:
"""多源BFS,其实就是有一个超级原点,然后从该点进行BFS遍历,多源点是超级原点的邻接点。 :param grid: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxDistance(self, grid) -> int:
"""BFS,超时 :param list[list[int]] grid: :return:"""
m, n = (len(grid), len(grid[0]))
def bfs(grid, i, j, visited):
Q = deque()
Q.append((i, j))
while len(Q):
i1, j1 = Q.popleft()
... | the_stack_v2_python_sparse | 华为题库/地图分析.py | 2226171237/Algorithmpractice | train | 0 | |
71c75b31a09f7d93ea8035a59b9b32f0b482f86a | [
"self.affine_layer = Affine()\nself.relu_layer = ReLU()\nif batch_norm_param is not None:\n self.batch_norm_layer = BatchNorm(eps=batch_norm_param['eps'], momentum=batch_norm_param['momentum'], running_mean=batch_norm_param.get('running_mean', None), running_var=batch_norm_param.get('running_var', None))\nelse:\... | <|body_start_0|>
self.affine_layer = Affine()
self.relu_layer = ReLU()
if batch_norm_param is not None:
self.batch_norm_layer = BatchNorm(eps=batch_norm_param['eps'], momentum=batch_norm_param['momentum'], running_mean=batch_norm_param.get('running_mean', None), running_var=batch_nor... | AffineBatchNormReLU | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AffineBatchNormReLU:
def __init__(self, batch_norm_param=None):
"""Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input... | stack_v2_sparse_classes_75kplus_train_003328 | 2,695 | no_license | [
{
"docstring": "Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input has shape (N, D), then this is array of shape (D,) - running_var: if input... | 3 | stack_v2_sparse_classes_30k_val_001269 | Implement the Python class `AffineBatchNormReLU` described below.
Class description:
Implement the AffineBatchNormReLU class.
Method signatures and docstrings:
- def __init__(self, batch_norm_param=None): Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stabi... | Implement the Python class `AffineBatchNormReLU` described below.
Class description:
Implement the AffineBatchNormReLU class.
Method signatures and docstrings:
- def __init__(self, batch_norm_param=None): Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stabi... | 7da789ef34d5e5bcf9033cfbe0ff5df607b2437a | <|skeleton|>
class AffineBatchNormReLU:
def __init__(self, batch_norm_param=None):
"""Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AffineBatchNormReLU:
def __init__(self, batch_norm_param=None):
"""Optional argument: batch_norm_param: A dictionary containing the following keys - eps: constant for numeric stability, required - momentum: constant for running mean/variance calculation, required - running_mean: if input has shape (N,... | the_stack_v2_python_sparse | convolutional_neural_networks/conv_net/composite/affine_batch_norm_relu.py | calvinfeng/machine-learning-notebook | train | 38 | |
3052a6773ed02c8b4dfe7858000b72e3c89efa12 | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.is_admin = False\nuser.is_superuser = False\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password)\nuser.is_admin ... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.set_password(password)
user.is_admin = False
user.is_superuser = False
user.save(using=self._db)
return user
<... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email and password."""
<|body_0|>
def create_superuser(self, email, password):
"""Creates and saves a superuser with the given email and password."""
<|body... | stack_v2_sparse_classes_75kplus_train_003329 | 5,264 | no_license | [
{
"docstring": "Creates and saves a User with the given email and password.",
"name": "create_user",
"signature": "def create_user(self, email, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email and password.",
"name": "create_superuser",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_016995 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email and password.
- def create_superuser(self, email, password): Creates and save... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email and password.
- def create_superuser(self, email, password): Creates and save... | 48b30854bd1fe7a064204c3c13574af80e9136dc | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email and password."""
<|body_0|>
def create_superuser(self, email, password):
"""Creates and saves a superuser with the given email and password."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.set_password(pa... | the_stack_v2_python_sparse | autoriz/models.py | bwrm/alip | train | 0 | |
9a959deda3c6824a77f6891d450154f26e6f7529 | [
"api = '/zone/del'\nzone_id = pub_param.create_zone(header=corp_header)\ndata = {'id': zone_id}\nres = run_method.post(api, data, headers=corp_header)\nnew_data = pub_param.zone_get(zone_id, corp_header)\nself.assertEqual(res.status_code, 200, run_method.errInfo(res))\nself.assertEqual(new_data['status'], 3, '园区未成功... | <|body_start_0|>
api = '/zone/del'
zone_id = pub_param.create_zone(header=corp_header)
data = {'id': zone_id}
res = run_method.post(api, data, headers=corp_header)
new_data = pub_param.zone_get(zone_id, corp_header)
self.assertEqual(res.status_code, 200, run_method.errInf... | TestZoneDel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestZoneDel:
def test01_zone_del_success(self):
"""case01:删除园区[ZCM]--删除成功"""
<|body_0|>
def test02_zone_del_zsm(self):
"""case02:删除园区[ZSM]--删除成功"""
<|body_1|>
def test03_zone_del_noRole(self):
"""case03:删除园区[普通用户]--删除失败"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_003330 | 26,453 | no_license | [
{
"docstring": "case01:删除园区[ZCM]--删除成功",
"name": "test01_zone_del_success",
"signature": "def test01_zone_del_success(self)"
},
{
"docstring": "case02:删除园区[ZSM]--删除成功",
"name": "test02_zone_del_zsm",
"signature": "def test02_zone_del_zsm(self)"
},
{
"docstring": "case03:删除园区[普通用户... | 5 | null | Implement the Python class `TestZoneDel` described below.
Class description:
Implement the TestZoneDel class.
Method signatures and docstrings:
- def test01_zone_del_success(self): case01:删除园区[ZCM]--删除成功
- def test02_zone_del_zsm(self): case02:删除园区[ZSM]--删除成功
- def test03_zone_del_noRole(self): case03:删除园区[普通用户]--删除失... | Implement the Python class `TestZoneDel` described below.
Class description:
Implement the TestZoneDel class.
Method signatures and docstrings:
- def test01_zone_del_success(self): case01:删除园区[ZCM]--删除成功
- def test02_zone_del_zsm(self): case02:删除园区[ZSM]--删除成功
- def test03_zone_del_noRole(self): case03:删除园区[普通用户]--删除失... | d03a4f2e86a701bb113c2ba6e033e6871515705c | <|skeleton|>
class TestZoneDel:
def test01_zone_del_success(self):
"""case01:删除园区[ZCM]--删除成功"""
<|body_0|>
def test02_zone_del_zsm(self):
"""case02:删除园区[ZSM]--删除成功"""
<|body_1|>
def test03_zone_del_noRole(self):
"""case03:删除园区[普通用户]--删除失败"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestZoneDel:
def test01_zone_del_success(self):
"""case01:删除园区[ZCM]--删除成功"""
api = '/zone/del'
zone_id = pub_param.create_zone(header=corp_header)
data = {'id': zone_id}
res = run_method.post(api, data, headers=corp_header)
new_data = pub_param.zone_get(zone_id,... | the_stack_v2_python_sparse | atd_test/test_zone.py | cxdtotsj/DatatronInterface | train | 0 | |
975642927e23a026950ae6ccf4fe5b9a70d59a52 | [
"def memoize(n):\n if n < 2:\n return 0\n if cache[n] != 0:\n return cache[n]\n for i in range(2, n):\n cache[n] = max(cache[n], max(i * (n - i), i * memoize(n - i)))\n return cache[n]\ncache = [0 for _ in range(n + 1)]\nreturn memoize(n)",
"if n < 2:\n return 0\ndp = [0] * (n ... | <|body_start_0|>
def memoize(n):
if n < 2:
return 0
if cache[n] != 0:
return cache[n]
for i in range(2, n):
cache[n] = max(cache[n], max(i * (n - i), i * memoize(n - i)))
return cache[n]
cache = [0 for _ in r... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def integerBreak(self, n: int) -> int:
"""图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-zhu-dong-tai-/"""
<|body_0|>
def integerBreak1(self, n: int) -> int:
"""状态转移... | stack_v2_sparse_classes_75kplus_train_003331 | 3,354 | permissive | [
{
"docstring": "图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-zhu-dong-tai-/",
"name": "integerBreak",
"signature": "def integerBreak(self, n: int) -> int"
},
{
"docstring": "状态转移方程: 特别地,0 不是正整数,1 是最小的正整... | 3 | stack_v2_sparse_classes_30k_train_054180 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def integerBreak(self, n: int) -> int: 图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def integerBreak(self, n: int) -> int: 图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def integerBreak(self, n: int) -> int:
"""图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-zhu-dong-tai-/"""
<|body_0|>
def integerBreak1(self, n: int) -> int:
"""状态转移... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def integerBreak(self, n: int) -> int:
"""图解【暴力递归】【记忆化技术】【动态规划】【动态规划优化解法】【找规律】方法二: https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/xiang-jie-bao-li-di-gui-ji-yi-hua-ji-zhu-dong-tai-/"""
def memoize(n):
if n < 2:
return 0
if cache[n... | the_stack_v2_python_sparse | 343-integer-break.py | yuenliou/leetcode | train | 0 | |
4c338c6a20047a54b90b5a5bc82ccfd7557bf5c8 | [
"minimizer_ssneb.__init__(self, path)\nself.maxmove = maxmove\nself.dt = dt\nself.dtmax = dtmax\nself.Nmin = Nmin\nself.finc = finc\nself.fdec = fdec\nself.astart = astart\nself.a = astart\nself.fa = fa\nself.Nsteps = 0\ni = self.band.numImages - 2\nj = self.band.natom + 3\nself.v = np.zeros((i, j, 3))",
"self.ba... | <|body_start_0|>
minimizer_ssneb.__init__(self, path)
self.maxmove = maxmove
self.dt = dt
self.dtmax = dtmax
self.Nmin = Nmin
self.finc = finc
self.fdec = fdec
self.astart = astart
self.a = astart
self.fa = fa
self.Nsteps = 0
... | fire_ssneb | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class fire_ssneb:
def __init__(self, path, maxmove=0.2, dt=0.1, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5, astart=0.1, fa=0.99):
"""path - neb object to optimize Fire initializer function, called in script before min Optional arguments: dt: initial dynamical timestep dtmax: maximum timestep Nmin: ... | stack_v2_sparse_classes_75kplus_train_003332 | 2,621 | no_license | [
{
"docstring": "path - neb object to optimize Fire initializer function, called in script before min Optional arguments: dt: initial dynamical timestep dtmax: maximum timestep Nmin: ??? finc: ??? fdec: ??? astart: ??? fa: ??? maxmove: maximum amount the point can move during optimization",
"name": "__init__... | 2 | stack_v2_sparse_classes_30k_train_051561 | Implement the Python class `fire_ssneb` described below.
Class description:
Implement the fire_ssneb class.
Method signatures and docstrings:
- def __init__(self, path, maxmove=0.2, dt=0.1, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5, astart=0.1, fa=0.99): path - neb object to optimize Fire initializer function, called in ... | Implement the Python class `fire_ssneb` described below.
Class description:
Implement the fire_ssneb class.
Method signatures and docstrings:
- def __init__(self, path, maxmove=0.2, dt=0.1, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5, astart=0.1, fa=0.99): path - neb object to optimize Fire initializer function, called in ... | 2b2cfef1a8f7f20b28251c78118710ce0f9eff00 | <|skeleton|>
class fire_ssneb:
def __init__(self, path, maxmove=0.2, dt=0.1, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5, astart=0.1, fa=0.99):
"""path - neb object to optimize Fire initializer function, called in script before min Optional arguments: dt: initial dynamical timestep dtmax: maximum timestep Nmin: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class fire_ssneb:
def __init__(self, path, maxmove=0.2, dt=0.1, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5, astart=0.1, fa=0.99):
"""path - neb object to optimize Fire initializer function, called in script before min Optional arguments: dt: initial dynamical timestep dtmax: maximum timestep Nmin: ??? finc: ??? ... | the_stack_v2_python_sparse | amp_optimizer/fire_ssneb.py | lileist/myScripts | train | 0 | |
d0d9b172170d949fd68ececae325326edbedb092 | [
"if not root:\n return root\nleftmost = root\nwhile leftmost.left:\n head = leftmost\n while head:\n head.left.next = head.right\n if head.next:\n head.right.next = head.next.left\n head = head.next\n leftmost = leftmost.left\nreturn root",
"if not root:\n return roo... | <|body_start_0|>
if not root:
return root
leftmost = root
while leftmost.left:
head = leftmost
while head:
head.left.next = head.right
if head.next:
head.right.next = head.next.left
head = hea... | PointerTrees | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PointerTrees:
def connect(self, root: 'Node') -> 'Node':
"""Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:"""
<|body_0|>
def connect_(self, root: 'Node') -> 'Node':
"""Approach: Next pointers stack Time Complexit... | stack_v2_sparse_classes_75kplus_train_003333 | 1,557 | no_license | [
{
"docstring": "Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:",
"name": "connect",
"signature": "def connect(self, root: 'Node') -> 'Node'"
},
{
"docstring": "Approach: Next pointers stack Time Complexity: O(N) Space Complexity: O(N) :param... | 2 | stack_v2_sparse_classes_30k_train_052604 | Implement the Python class `PointerTrees` described below.
Class description:
Implement the PointerTrees class.
Method signatures and docstrings:
- def connect(self, root: 'Node') -> 'Node': Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:
- def connect_(self, root... | Implement the Python class `PointerTrees` described below.
Class description:
Implement the PointerTrees class.
Method signatures and docstrings:
- def connect(self, root: 'Node') -> 'Node': Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:
- def connect_(self, root... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class PointerTrees:
def connect(self, root: 'Node') -> 'Node':
"""Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:"""
<|body_0|>
def connect_(self, root: 'Node') -> 'Node':
"""Approach: Next pointers stack Time Complexit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PointerTrees:
def connect(self, root: 'Node') -> 'Node':
"""Approach: Next pointers O(1) space Time Complexity: O(N) Space Complexity: O(1) :param root: :return:"""
if not root:
return root
leftmost = root
while leftmost.left:
head = leftmost
... | the_stack_v2_python_sparse | revisited/node/populating_next_right_pointer_i.py | Shiv2157k/leet_code | train | 1 | |
605d737393abfb1f7c4ccbb6e50d4de28d422788 | [
"result = dict()\ncodec = dahuffman.HuffmanCodec.from_data(''.join(str_list))\nfor i in str_list:\n result.update({i: base64.b64encode(codec.encode(i)).decode('utf-8')})\ncode_table = codec.get_code_table()\ndata = {'code_table': code_table}\ndata = base64.b64encode(pickle.dumps(data)).decode('utf-8')\nresult.up... | <|body_start_0|>
result = dict()
codec = dahuffman.HuffmanCodec.from_data(''.join(str_list))
for i in str_list:
result.update({i: base64.b64encode(codec.encode(i)).decode('utf-8')})
code_table = codec.get_code_table()
data = {'code_table': code_table}
data = b... | The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network | HuffmanCoding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HuffmanCoding:
"""The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network"""
def encode(str_list):
"""The main function... | stack_v2_sparse_classes_75kplus_train_003334 | 2,753 | no_license | [
{
"docstring": "The main function to produce a dictionary of original and encoded strings. A code table is added to the result for calibrating a new Huffman codec for decode. The code table is pickled first, and then base64 encoded to deal with custom _EOF marker included in dahuffman :param str_list: The list ... | 2 | stack_v2_sparse_classes_30k_train_047928 | Implement the Python class `HuffmanCoding` described below.
Class description:
The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network
Method signatures ... | Implement the Python class `HuffmanCoding` described below.
Class description:
The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network
Method signatures ... | 60caf3dbedc4512cd8d47c6fac4da7c4d13038d3 | <|skeleton|>
class HuffmanCoding:
"""The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network"""
def encode(str_list):
"""The main function... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HuffmanCoding:
"""The HuffmanCoding class forms the base of the dependency provider for the Huffman Coding algorithm. It uses dahuffman.HuffmanCodec to perform the majority of the work. Data is base64 encoded for transfer over the network"""
def encode(str_list):
"""The main function to produce a... | the_stack_v2_python_sparse | Development/V03/app/dependencies/huffman.py | 8563a236e65cede7b14220e65c70ad5718144a3/microservices-interview-answers | train | 0 |
5f0f06a88ed13ff447815bfff00bb6f12829139f | [
"self._data_vector = np.append(time_delay_measured, amp_measured)\nself._cov_td_measured = np.array(cov_td_measured)\nself._cov_amp_measured = np.array(cov_amp_measured)\nn_tot = len(self._data_vector)\nself._n_td = len(time_delay_measured)\nself._n_amp = len(amp_measured)\nassert self._n_td == len(cov_td_measured)... | <|body_start_0|>
self._data_vector = np.append(time_delay_measured, amp_measured)
self._cov_td_measured = np.array(cov_td_measured)
self._cov_amp_measured = np.array(cov_amp_measured)
n_tot = len(self._data_vector)
self._n_td = len(time_delay_measured)
self._n_amp = len(a... | likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications. | TDMagLikelihood | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TDMagLikelihood:
"""likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications."""
def __init__(self, time_delay_measured, cov_td_measured, amp_measured, cov_amp_measured, fermat_diff, magnification_model, cov_model, magnit... | stack_v2_sparse_classes_75kplus_train_003335 | 4,553 | permissive | [
{
"docstring": ":param time_delay_measured: array, relative time delays (relative to the first image) [days] :param cov_td_measured: 2d array, error covariance matrix of time delay measurement [days^2] :param amp_measured: array, amplitudes of measured fluxes of image positions :param cov_amp_measured: 2d array... | 3 | stack_v2_sparse_classes_30k_train_037689 | Implement the Python class `TDMagLikelihood` described below.
Class description:
likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications.
Method signatures and docstrings:
- def __init__(self, time_delay_measured, cov_td_measured, amp_measured, c... | Implement the Python class `TDMagLikelihood` described below.
Class description:
likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications.
Method signatures and docstrings:
- def __init__(self, time_delay_measured, cov_td_measured, amp_measured, c... | 1dc2be90f44f99e82ab7014f2027fbb077b14f98 | <|skeleton|>
class TDMagLikelihood:
"""likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications."""
def __init__(self, time_delay_measured, cov_td_measured, amp_measured, cov_amp_measured, fermat_diff, magnification_model, cov_model, magnit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TDMagLikelihood:
"""likelihood of time delays and magnification likelihood This likelihood uses linear flux units and linear lensing magnifications."""
def __init__(self, time_delay_measured, cov_td_measured, amp_measured, cov_amp_measured, fermat_diff, magnification_model, cov_model, magnitude_zero_poin... | the_stack_v2_python_sparse | hierarc/Likelihood/LensLikelihood/td_mag_likelihood.py | LBJ-Wade/hierarc_SGL | train | 0 |
4e9b8c123a2225ecf7660fbd919f985063439c33 | [
"page = page\nper_page = 8\nrecommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False)\nresponse = {'items': recommendations_schema.dump(recommendations.items), 'has_next': recommendations.has_next, 'has_prev': recommendations.has_prev, 'next_num': re... | <|body_start_0|>
page = page
per_page = 8
recommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False)
response = {'items': recommendations_schema.dump(recommendations.items), 'has_next': recommendations.has_next, 'has_prev':... | Recommendations | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recommendations:
def get(self, page):
"""List Recommendations"""
<|body_0|>
def post(self):
"""Add new Recommendation"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
page = page
per_page = 8
recommendations = Recommendation.query.ord... | stack_v2_sparse_classes_75kplus_train_003336 | 7,370 | no_license | [
{
"docstring": "List Recommendations",
"name": "get",
"signature": "def get(self, page)"
},
{
"docstring": "Add new Recommendation",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001938 | Implement the Python class `Recommendations` described below.
Class description:
Implement the Recommendations class.
Method signatures and docstrings:
- def get(self, page): List Recommendations
- def post(self): Add new Recommendation | Implement the Python class `Recommendations` described below.
Class description:
Implement the Recommendations class.
Method signatures and docstrings:
- def get(self, page): List Recommendations
- def post(self): Add new Recommendation
<|skeleton|>
class Recommendations:
def get(self, page):
"""List Re... | ae78fff9888b0f68d9403d7f65cba086dabb3802 | <|skeleton|>
class Recommendations:
def get(self, page):
"""List Recommendations"""
<|body_0|>
def post(self):
"""Add new Recommendation"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Recommendations:
def get(self, page):
"""List Recommendations"""
page = page
per_page = 8
recommendations = Recommendation.query.order_by(Recommendation.created_at.desc()).paginate(page, per_page, error_out=False)
response = {'items': recommendations_schema.dump(recomme... | the_stack_v2_python_sparse | api/v1/recommendations.py | mythril-io/flask-api | train | 0 | |
056629e6cace475c5b447e2e7bea8e4c6dcb8b19 | [
"assert elem_size > 0, elem_size\nassert elem_count > 0, elem_count\nself.elem_size = elem_size\nself.elem_count = elem_count\nself.buffer = bytearray(elem_size * elem_count)\nself.used = 0",
"if self.used < 1:\n return None\nself.used -= 1\ni = self.used\nreturn self.buffer[i * self.elem_size:(i + 1) * self.e... | <|body_start_0|>
assert elem_size > 0, elem_size
assert elem_count > 0, elem_count
self.elem_size = elem_size
self.elem_count = elem_count
self.buffer = bytearray(elem_size * elem_count)
self.used = 0
<|end_body_0|>
<|body_start_1|>
if self.used < 1:
... | ShuffleBuffer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShuffleBuffer:
def __init__(self, elem_size, elem_count):
"""A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' bytes."""
<|body_0|>
def extract(self):
"""Return an item from the shuffle buffer... | stack_v2_sparse_classes_75kplus_train_003337 | 4,461 | no_license | [
{
"docstring": "A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' bytes.",
"name": "__init__",
"signature": "def __init__(self, elem_size, elem_count)"
},
{
"docstring": "Return an item from the shuffle buffer. If the buf... | 3 | stack_v2_sparse_classes_30k_train_006217 | Implement the Python class `ShuffleBuffer` described below.
Class description:
Implement the ShuffleBuffer class.
Method signatures and docstrings:
- def __init__(self, elem_size, elem_count): A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' ... | Implement the Python class `ShuffleBuffer` described below.
Class description:
Implement the ShuffleBuffer class.
Method signatures and docstrings:
- def __init__(self, elem_size, elem_count): A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' ... | 44fc71f8f03a00b11431fbc3d937f071317ac3db | <|skeleton|>
class ShuffleBuffer:
def __init__(self, elem_size, elem_count):
"""A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' bytes."""
<|body_0|>
def extract(self):
"""Return an item from the shuffle buffer... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShuffleBuffer:
def __init__(self, elem_size, elem_count):
"""A shuffle buffer for fixed sized elements. Manages 'elem_count' items in a fixed buffer, each item being exactly 'elem_size' bytes."""
assert elem_size > 0, elem_size
assert elem_count > 0, elem_count
self.elem_size =... | the_stack_v2_python_sparse | tf/shufflebuffer.py | ScallyBag/lczero-training | train | 2 | |
5bb7d761e08fd0c0af2d6a3bc672e97838a4f6e2 | [
"total = 0\nfor counter in SimpleCounterShard.objects.all():\n total += counter.count\nreturn total",
"index = random.randint(0, SimpleCounterShard.NUM_SHARDS - 1)\nshard_name = 'shard' + str(index)\ncounter = SimpleCounterShard.objects.get_or_create(pk=shard_name)[0]\ncounter.count += 1\ncounter.save()"
] | <|body_start_0|>
total = 0
for counter in SimpleCounterShard.objects.all():
total += counter.count
return total
<|end_body_0|>
<|body_start_1|>
index = random.randint(0, SimpleCounterShard.NUM_SHARDS - 1)
shard_name = 'shard' + str(index)
counter = SimpleCoun... | Shards for the counter | SimpleCounterShard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleCounterShard:
"""Shards for the counter"""
def get_count(cls):
"""Retrieve the value for a given sharded counter."""
<|body_0|>
def increment(cls):
"""Increment the value for a given sharded counter."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_003338 | 4,135 | no_license | [
{
"docstring": "Retrieve the value for a given sharded counter.",
"name": "get_count",
"signature": "def get_count(cls)"
},
{
"docstring": "Increment the value for a given sharded counter.",
"name": "increment",
"signature": "def increment(cls)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003914 | Implement the Python class `SimpleCounterShard` described below.
Class description:
Shards for the counter
Method signatures and docstrings:
- def get_count(cls): Retrieve the value for a given sharded counter.
- def increment(cls): Increment the value for a given sharded counter. | Implement the Python class `SimpleCounterShard` described below.
Class description:
Shards for the counter
Method signatures and docstrings:
- def get_count(cls): Retrieve the value for a given sharded counter.
- def increment(cls): Increment the value for a given sharded counter.
<|skeleton|>
class SimpleCounterSha... | 2e3f1bdce124738e1bed2e648826ca819e0bcc57 | <|skeleton|>
class SimpleCounterShard:
"""Shards for the counter"""
def get_count(cls):
"""Retrieve the value for a given sharded counter."""
<|body_0|>
def increment(cls):
"""Increment the value for a given sharded counter."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SimpleCounterShard:
"""Shards for the counter"""
def get_count(cls):
"""Retrieve the value for a given sharded counter."""
total = 0
for counter in SimpleCounterShard.objects.all():
total += counter.count
return total
def increment(cls):
"""Increme... | the_stack_v2_python_sparse | sharded_counters/models.py | WAYbetter/waybetter | train | 2 |
7362bc70d35a5cf0cdeb84ad884fc41a0e1b650f | [
"self.verify_workflow()\nmco = self.create_mco()\nself._initialize_listeners()\nself._deliver_start_event()\ntry:\n mco.run(self.workflow)\nexcept Exception:\n log.exception(\"Method run() of MCO with id '{}' from plugin '{}' raised exception. This might indicate a programming error in the plugin.\".format(mc... | <|body_start_0|>
self.verify_workflow()
mco = self.create_mco()
self._initialize_listeners()
self._deliver_start_event()
try:
mco.run(self.workflow)
except Exception:
log.exception("Method run() of MCO with id '{}' from plugin '{}' raised exception... | Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run. | OptimizeOperation | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the o... | stack_v2_sparse_classes_75kplus_train_003339 | 2,006 | permissive | [
{
"docstring": "Create and run the optimizer.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Create the MCO from the model's factory.",
"name": "create_mco",
"signature": "def create_mco(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034666 | Implement the Python class `OptimizeOperation` described below.
Class description:
Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run.
Method signatu... | Implement the Python class `OptimizeOperation` described below.
Class description:
Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run.
Method signatu... | 6106bec35d6ad2383138a35205cea44fe529a229 | <|skeleton|>
class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OptimizeOperation:
"""Performs a full MCO run on a system described by a `Workflow` object, based on the format given by a `BaseMCO` class. Contains optional `NotificationListener` classes in order to broadcast information during the MCO run."""
def run(self):
"""Create and run the optimizer."""
... | the_stack_v2_python_sparse | force_bdss/app/optimize_operation.py | force-h2020/force-bdss | train | 2 |
bf95a17d42214aabbfd8490e705354e534f378ca | [
"if not cost:\n return 0\ndp = [0] * len(cost)\ndp[0] = cost[0]\nif len(cost) >= 2:\n dp[1] = cost[1]\nfor i in range(2, len(cost)):\n dp[i] = min(dp[i - 1], dp[i - 2]) + cost[i]\nreturn min(dp[-1], dp[-2])",
"if not cost:\n return 0\nm1, m2 = (cost[0], cost[1])\nfor i in range(2, len(cost)):\n m1,... | <|body_start_0|>
if not cost:
return 0
dp = [0] * len(cost)
dp[0] = cost[0]
if len(cost) >= 2:
dp[1] = cost[1]
for i in range(2, len(cost)):
dp[i] = min(dp[i - 1], dp[i - 2]) + cost[i]
return min(dp[-1], dp[-2])
<|end_body_0|>
<|body_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_0|>
def minCostClimbingStairs2(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not cost:
... | stack_v2_sparse_classes_75kplus_train_003340 | 1,055 | no_license | [
{
"docstring": ":type cost: List[int] :rtype: int",
"name": "minCostClimbingStairs",
"signature": "def minCostClimbingStairs(self, cost)"
},
{
"docstring": ":type cost: List[int] :rtype: int",
"name": "minCostClimbingStairs2",
"signature": "def minCostClimbingStairs2(self, cost)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011175 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int
- def minCostClimbingStairs2(self, cost): :type cost: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int
- def minCostClimbingStairs2(self, cost): :type cost: List[int] :rtype: int
<|skeleton|>
class Solution:... | 8853f85214ac88db024d26e228f1848dd5acd933 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_0|>
def minCostClimbingStairs2(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
if not cost:
return 0
dp = [0] * len(cost)
dp[0] = cost[0]
if len(cost) >= 2:
dp[1] = cost[1]
for i in range(2, len(cost)):
dp[i] = min(d... | the_stack_v2_python_sparse | 746-MinCostClimbingStairs/MinCostClimbingStairs.py | cqxmzhc/my_leetcode_solutions | train | 2 | |
3a804bd4c6fb62594cc2daeeeeb6c6609d3ee70a | [
"super().__init__(auth)\nif instruments is None:\n self.instruments = Account(auth, auth['id']).get_instruments_names()\nelse:\n self.instruments = instruments\nself.instr_objects = []\nfor instrument in self.instruments:\n self.instr_objects.append(Instrument(auth, instrument, 'S5'))\nself.pause = 5\nself... | <|body_start_0|>
super().__init__(auth)
if instruments is None:
self.instruments = Account(auth, auth['id']).get_instruments_names()
else:
self.instruments = instruments
self.instr_objects = []
for instrument in self.instruments:
self.instr_obj... | Asynchronous API receiver for getting candle data from instruments | CandleReceiver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CandleReceiver:
"""Asynchronous API receiver for getting candle data from instruments"""
def __init__(self, auth, instruments=None):
"""API receiver object constructor :param instruments: list of str -> list of instruments names :var self.instruments: list of str -> list of instrumen... | stack_v2_sparse_classes_75kplus_train_003341 | 2,756 | no_license | [
{
"docstring": "API receiver object constructor :param instruments: list of str -> list of instruments names :var self.instruments: list of str -> list of instruments names :var self.instr_objects: list of objects -> objects of instrument list for receiving candle data :var self.pause: int, seconds -> pause bet... | 2 | null | Implement the Python class `CandleReceiver` described below.
Class description:
Asynchronous API receiver for getting candle data from instruments
Method signatures and docstrings:
- def __init__(self, auth, instruments=None): API receiver object constructor :param instruments: list of str -> list of instruments name... | Implement the Python class `CandleReceiver` described below.
Class description:
Asynchronous API receiver for getting candle data from instruments
Method signatures and docstrings:
- def __init__(self, auth, instruments=None): API receiver object constructor :param instruments: list of str -> list of instruments name... | 130189a02288edf074aa9169e293634696bc947d | <|skeleton|>
class CandleReceiver:
"""Asynchronous API receiver for getting candle data from instruments"""
def __init__(self, auth, instruments=None):
"""API receiver object constructor :param instruments: list of str -> list of instruments names :var self.instruments: list of str -> list of instrumen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CandleReceiver:
"""Asynchronous API receiver for getting candle data from instruments"""
def __init__(self, auth, instruments=None):
"""API receiver object constructor :param instruments: list of str -> list of instruments names :var self.instruments: list of str -> list of instruments names :var... | the_stack_v2_python_sparse | candle_receiver.py | KonstantinSKY/skybot | train | 0 |
36f781fa6b60eca68a5f6a3cd792800d741592b7 | [
"nums.sort()\nn = len(nums)\ncount = 0\npre = nums[0]\nif n == 1:\n return pre\nfor num in nums:\n if num != pre:\n if count == 1:\n return pre\n pre = num\n count = 1\n else:\n count += 1\nreturn num",
"sum = 0\nfor n in nums:\n sum ^= n\nreturn sum"
] | <|body_start_0|>
nums.sort()
n = len(nums)
count = 0
pre = nums[0]
if n == 1:
return pre
for num in nums:
if num != pre:
if count == 1:
return pre
pre = num
count = 1
e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.sort()
n = len(nums)
... | stack_v2_sparse_classes_75kplus_train_003342 | 668 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumber",
"signature": "def singleNumber(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumber0",
"signature": "def singleNumber0(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019567 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): :type nums: List[int] :rtype: int
- def singleNumber0(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): :type nums: List[int] :rtype: int
- def singleNumber0(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def singleNu... | 9e49b2c6003b957276737005d4aaac276b44d251 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber0(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
nums.sort()
n = len(nums)
count = 0
pre = nums[0]
if n == 1:
return pre
for num in nums:
if num != pre:
if count == 1:
... | the_stack_v2_python_sparse | PythonCode/src/0136_Single_Number.py | oneyuan/CodeforFun | train | 0 | |
a2e0ba27220fbd9824b88068a36f8662ab20da74 | [
"processed_dict = {}\nfor key, value in request.GET.items():\n processed_dict[key] = value\nsign = processed_dict.pop('sign', None)\nalipay = AliPay(appid='2016091700530193', app_notify_url='http://123.206.43.75:8080/alipay/return/', app_private_key_path=private_key_path, alipay_public_key_path=ali_pub_key_path,... | <|body_start_0|>
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = processed_dict.pop('sign', None)
alipay = AliPay(appid='2016091700530193', app_notify_url='http://123.206.43.75:8080/alipay/return/', app_private_key_path=private_ke... | AlipayView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlipayView:
def get(self, request):
"""处理支付宝的return_url的返回 :param request: :return:"""
<|body_0|>
def post(self, request):
"""处理支付宝的notify_url :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
processed_dict = {}
for k... | stack_v2_sparse_classes_75kplus_train_003343 | 6,503 | no_license | [
{
"docstring": "处理支付宝的return_url的返回 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "处理支付宝的notify_url :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031108 | Implement the Python class `AlipayView` described below.
Class description:
Implement the AlipayView class.
Method signatures and docstrings:
- def get(self, request): 处理支付宝的return_url的返回 :param request: :return:
- def post(self, request): 处理支付宝的notify_url :param request: :return: | Implement the Python class `AlipayView` described below.
Class description:
Implement the AlipayView class.
Method signatures and docstrings:
- def get(self, request): 处理支付宝的return_url的返回 :param request: :return:
- def post(self, request): 处理支付宝的notify_url :param request: :return:
<|skeleton|>
class AlipayView:
... | 4447903730466ef88442c3019c33a4117544c2a1 | <|skeleton|>
class AlipayView:
def get(self, request):
"""处理支付宝的return_url的返回 :param request: :return:"""
<|body_0|>
def post(self, request):
"""处理支付宝的notify_url :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlipayView:
def get(self, request):
"""处理支付宝的return_url的返回 :param request: :return:"""
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = processed_dict.pop('sign', None)
alipay = AliPay(appid='2016091700530193', ap... | the_stack_v2_python_sparse | python/restframework项目/apps/trade/views.py | neverqaz/code | train | 1 | |
1a1a033cb1cd438b828c04e076c81b1ddf453b06 | [
"res = 0\nfor num in range(L, R + 1):\n number = bin(num).count('1')\n if self.isPrime(number):\n res += 1\nreturn res",
"if n > 1:\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n for current in range(3, int(math.sqrt(n) + 1), 2):\n if n % current == 0:\n ... | <|body_start_0|>
res = 0
for num in range(L, R + 1):
number = bin(num).count('1')
if self.isPrime(number):
res += 1
return res
<|end_body_0|>
<|body_start_1|>
if n > 1:
if n == 2:
return True
if n % 2 == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countPrimeSetBits(self, L, R):
""":type L: int :type R: int :rtype: int"""
<|body_0|>
def isPrime(self, n):
""":type n: int :rtype: boolean"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = 0
for num in range(L, R + 1):
... | stack_v2_sparse_classes_75kplus_train_003344 | 712 | no_license | [
{
"docstring": ":type L: int :type R: int :rtype: int",
"name": "countPrimeSetBits",
"signature": "def countPrimeSetBits(self, L, R)"
},
{
"docstring": ":type n: int :rtype: boolean",
"name": "isPrime",
"signature": "def isPrime(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_040698 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int
- def isPrime(self, n): :type n: int :rtype: boolean | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countPrimeSetBits(self, L, R): :type L: int :type R: int :rtype: int
- def isPrime(self, n): :type n: int :rtype: boolean
<|skeleton|>
class Solution:
def countPrimeSet... | 11ef4ace7aa1f875491163d036935dd76d8b89e0 | <|skeleton|>
class Solution:
def countPrimeSetBits(self, L, R):
""":type L: int :type R: int :rtype: int"""
<|body_0|>
def isPrime(self, n):
""":type n: int :rtype: boolean"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countPrimeSetBits(self, L, R):
""":type L: int :type R: int :rtype: int"""
res = 0
for num in range(L, R + 1):
number = bin(num).count('1')
if self.isPrime(number):
res += 1
return res
def isPrime(self, n):
""":... | the_stack_v2_python_sparse | leetcode/countPrimeSetBits.py | lilyandcy/python3 | train | 1 | |
bbdd5b58c83e55e9411b8425d21ee7c2c8c43076 | [
"super(RNNDecoder, self).__init__()\nself.units = units\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units=units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(vocab)",
"encode = SelfAttention(self... | <|body_start_0|>
super(RNNDecoder, self).__init__()
self.units = units
self.embedding = tf.keras.layers.Embedding(vocab, embedding)
self.gru = tf.keras.layers.GRU(units=units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)
self.F = tf.keras.laye... | class | RNNDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNDecoder:
"""class"""
def __init__(self, vocab, embedding, units, batch):
"""contrutor"""
<|body_0|>
def call(self, x, s_prev, hidden_states):
"""decode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(RNNDecoder, self).__init__()
... | stack_v2_sparse_classes_75kplus_train_003345 | 11,342 | no_license | [
{
"docstring": "contrutor",
"name": "__init__",
"signature": "def __init__(self, vocab, embedding, units, batch)"
},
{
"docstring": "decode",
"name": "call",
"signature": "def call(self, x, s_prev, hidden_states)"
}
] | 2 | null | Implement the Python class `RNNDecoder` described below.
Class description:
class
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): contrutor
- def call(self, x, s_prev, hidden_states): decode | Implement the Python class `RNNDecoder` described below.
Class description:
class
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): contrutor
- def call(self, x, s_prev, hidden_states): decode
<|skeleton|>
class RNNDecoder:
"""class"""
def __init__(self, vocab, embeddin... | bda9efa60075afa834433ff1b5179db80f2487ae | <|skeleton|>
class RNNDecoder:
"""class"""
def __init__(self, vocab, embedding, units, batch):
"""contrutor"""
<|body_0|>
def call(self, x, s_prev, hidden_states):
"""decode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNNDecoder:
"""class"""
def __init__(self, vocab, embedding, units, batch):
"""contrutor"""
super(RNNDecoder, self).__init__()
self.units = units
self.embedding = tf.keras.layers.Embedding(vocab, embedding)
self.gru = tf.keras.layers.GRU(units=units, recurrent_init... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer..py | vandeldiegoc/holbertonschool-machine_learning | train | 0 |
3dd7543c6f9dd04ea431ce01bae0c49ca865e058 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yufeng72', 'yufeng72')\nurl = 'http://datamechanics.io/data/yufeng72/Subway_Stops.json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = json.loads(response)\nif not trial:\n result... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('yufeng72', 'yufeng72')
url = 'http://datamechanics.io/data/yufeng72/Subway_Stops.json'
response = urllib.request.urlopen(url).read().decode('utf-8... | RetrieveSubwayStops | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetrieveSubwayStops:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing ever... | stack_v2_sparse_classes_75kplus_train_003346 | 3,977 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_016163 | Implement the Python class `RetrieveSubwayStops` described below.
Class description:
Implement the RetrieveSubwayStops class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), start... | Implement the Python class `RetrieveSubwayStops` described below.
Class description:
Implement the RetrieveSubwayStops class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), start... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class RetrieveSubwayStops:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing ever... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RetrieveSubwayStops:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('yufeng72', 'yufeng72')
... | the_stack_v2_python_sparse | yufeng72/RetrieveSubwayStops.py | maximega/course-2019-spr-proj | train | 2 | |
b4eaa6cdc5e67e18c6b3cf5ee2518a53b53ed18e | [
"params_dict = dict(self.initparams)\nparams_dict['mobilephone'] = 18888099999\nstatus_error_code = GetuserinfobymobilephoneReturnCodeEnum.USER_NOT_EXISTS.value\nreturn (params_dict, status_error_code)",
"params_dict = dict(self.initparams)\nstatus_error_code = GetuserinfobymobilephoneReturnCodeEnum.SUCCESS.value... | <|body_start_0|>
params_dict = dict(self.initparams)
params_dict['mobilephone'] = 18888099999
status_error_code = GetuserinfobymobilephoneReturnCodeEnum.USER_NOT_EXISTS.value
return (params_dict, status_error_code)
<|end_body_0|>
<|body_start_1|>
params_dict = dict(self.initpara... | 根据手机号取得用户信息 | Get_USERINFO_by_Mobilephone | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Get_USERINFO_by_Mobilephone:
"""根据手机号取得用户信息"""
def mobile_not_exist(self):
"""username不存在"""
<|body_0|>
def success(self):
"""参数正确,返回用户信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
params_dict = dict(self.initparams)
params_dict['mo... | stack_v2_sparse_classes_75kplus_train_003347 | 1,498 | no_license | [
{
"docstring": "username不存在",
"name": "mobile_not_exist",
"signature": "def mobile_not_exist(self)"
},
{
"docstring": "参数正确,返回用户信息",
"name": "success",
"signature": "def success(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022845 | Implement the Python class `Get_USERINFO_by_Mobilephone` described below.
Class description:
根据手机号取得用户信息
Method signatures and docstrings:
- def mobile_not_exist(self): username不存在
- def success(self): 参数正确,返回用户信息 | Implement the Python class `Get_USERINFO_by_Mobilephone` described below.
Class description:
根据手机号取得用户信息
Method signatures and docstrings:
- def mobile_not_exist(self): username不存在
- def success(self): 参数正确,返回用户信息
<|skeleton|>
class Get_USERINFO_by_Mobilephone:
"""根据手机号取得用户信息"""
def mobile_not_exist(self):
... | 7f5c78e083812b49d32a394dd81b55dc90ccf080 | <|skeleton|>
class Get_USERINFO_by_Mobilephone:
"""根据手机号取得用户信息"""
def mobile_not_exist(self):
"""username不存在"""
<|body_0|>
def success(self):
"""参数正确,返回用户信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Get_USERINFO_by_Mobilephone:
"""根据手机号取得用户信息"""
def mobile_not_exist(self):
"""username不存在"""
params_dict = dict(self.initparams)
params_dict['mobilephone'] = 18888099999
status_error_code = GetuserinfobymobilephoneReturnCodeEnum.USER_NOT_EXISTS.value
return (params... | the_stack_v2_python_sparse | testcase/Loginapi/Get_Userinfo_by_Mobilephone_test.py | gitchenping/apitest | train | 0 |
ba4a872bb84d469d6ab3cb06db8f31c7bd36808c | [
"_action_class = City()\nif 'ibi_cities' in params and 'ibi_districts' in params:\n _city = params['ibi_cities'].lower()\n _district = params['ibi_districts']\n return getattr(_action_class, _city)(_district)\nelse:\n return getattr(_action_class, 'guaiba')('centro')",
"_address = Address()\napp.logge... | <|body_start_0|>
_action_class = City()
if 'ibi_cities' in params and 'ibi_districts' in params:
_city = params['ibi_cities'].lower()
_district = params['ibi_districts']
return getattr(_action_class, _city)(_district)
else:
return getattr(_action_c... | Handle the intents resposes by action names | Actions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Actions:
"""Handle the intents resposes by action names"""
def ask_cells_cities(self, params, outputContexts, IntentRequest):
"""Return the list of Cell addresses by city and district"""
<|body_0|>
def ask_cells_cities_select_address(self, params, outputContexts, IntentR... | stack_v2_sparse_classes_75kplus_train_003348 | 1,284 | no_license | [
{
"docstring": "Return the list of Cell addresses by city and district",
"name": "ask_cells_cities",
"signature": "def ask_cells_cities(self, params, outputContexts, IntentRequest)"
},
{
"docstring": "Return the map link for the selected address",
"name": "ask_cells_cities_select_address",
... | 2 | stack_v2_sparse_classes_30k_train_021556 | Implement the Python class `Actions` described below.
Class description:
Handle the intents resposes by action names
Method signatures and docstrings:
- def ask_cells_cities(self, params, outputContexts, IntentRequest): Return the list of Cell addresses by city and district
- def ask_cells_cities_select_address(self,... | Implement the Python class `Actions` described below.
Class description:
Handle the intents resposes by action names
Method signatures and docstrings:
- def ask_cells_cities(self, params, outputContexts, IntentRequest): Return the list of Cell addresses by city and district
- def ask_cells_cities_select_address(self,... | 29da21469c8e78b3374f5e5237067a97107e02d2 | <|skeleton|>
class Actions:
"""Handle the intents resposes by action names"""
def ask_cells_cities(self, params, outputContexts, IntentRequest):
"""Return the list of Cell addresses by city and district"""
<|body_0|>
def ask_cells_cities_select_address(self, params, outputContexts, IntentR... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Actions:
"""Handle the intents resposes by action names"""
def ask_cells_cities(self, params, outputContexts, IntentRequest):
"""Return the list of Cell addresses by city and district"""
_action_class = City()
if 'ibi_cities' in params and 'ibi_districts' in params:
_c... | the_stack_v2_python_sparse | actions/actions.py | douglasmoraisdev/ibi_chatbot | train | 0 |
d188a6ebf4bef5e188475fa28b5bb46eba9229a5 | [
"uom_category_id = False\nif self.product_id:\n uom_category_id = self.uom_id.category_id.id\nself.uom_category_id = uom_category_id",
"uom_id = False\ncategory_id = False\nif self.product_id:\n uom_id = self.product_id.uom_id.id\n category_id = self.product_id.uom_id.category_id.id\nself.uom_id = uom_id... | <|body_start_0|>
uom_category_id = False
if self.product_id:
uom_category_id = self.uom_id.category_id.id
self.uom_category_id = uom_category_id
<|end_body_0|>
<|body_start_1|>
uom_id = False
category_id = False
if self.product_id:
uom_id = self.p... | Wiz intervention quotation line | wiz_intervention_quotation_line | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class wiz_intervention_quotation_line:
"""Wiz intervention quotation line"""
def _uom_category_compute(self):
"""Category UoM"""
<|body_0|>
def _onchange_product_id(self):
"""Onchange du produit"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
uom_cate... | stack_v2_sparse_classes_75kplus_train_003349 | 8,655 | no_license | [
{
"docstring": "Category UoM",
"name": "_uom_category_compute",
"signature": "def _uom_category_compute(self)"
},
{
"docstring": "Onchange du produit",
"name": "_onchange_product_id",
"signature": "def _onchange_product_id(self)"
}
] | 2 | null | Implement the Python class `wiz_intervention_quotation_line` described below.
Class description:
Wiz intervention quotation line
Method signatures and docstrings:
- def _uom_category_compute(self): Category UoM
- def _onchange_product_id(self): Onchange du produit | Implement the Python class `wiz_intervention_quotation_line` described below.
Class description:
Wiz intervention quotation line
Method signatures and docstrings:
- def _uom_category_compute(self): Category UoM
- def _onchange_product_id(self): Onchange du produit
<|skeleton|>
class wiz_intervention_quotation_line:
... | eb394e1f79ba1995da2dcd81adfdd511c22caff9 | <|skeleton|>
class wiz_intervention_quotation_line:
"""Wiz intervention quotation line"""
def _uom_category_compute(self):
"""Category UoM"""
<|body_0|>
def _onchange_product_id(self):
"""Onchange du produit"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class wiz_intervention_quotation_line:
"""Wiz intervention quotation line"""
def _uom_category_compute(self):
"""Category UoM"""
uom_category_id = False
if self.product_id:
uom_category_id = self.uom_id.category_id.id
self.uom_category_id = uom_category_id
def _... | the_stack_v2_python_sparse | OpenPROD/openprod-addons/base_gmao_sav/wizard/wiz_intervention_quotation.py | kazacube-mziouadi/ceci | train | 0 |
c636b1f38a35c107404544795fdf3f7e9bd04bf3 | [
"super()._build(name=name)\nself.mjcf_model.asset.add('texture', type='skybox', builtin='gradient', rgb1=(0.4, 0.6, 0.8), rgb2=(0.0, 0.0, 0.0), width=100, height=100)\ngroundplane_texture = self.mjcf_model.asset.add('texture', name='groundplane', type='2d', builtin='checker', rgb1=(0.2, 0.3, 0.4), rgb2=(0.1, 0.2, 0... | <|body_start_0|>
super()._build(name=name)
self.mjcf_model.asset.add('texture', type='skybox', builtin='gradient', rgb1=(0.4, 0.6, 0.8), rgb2=(0.0, 0.0, 0.0), width=100, height=100)
groundplane_texture = self.mjcf_model.asset.add('texture', name='groundplane', type='2d', builtin='checker', rgb1=... | Suite-specific subclass of the standard Composer arena. | Standard | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Standard:
"""Suite-specific subclass of the standard Composer arena."""
def _build(self, name=None):
"""Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file."""
<|body_0|>
def attach_offse... | stack_v2_sparse_classes_75kplus_train_003350 | 2,993 | permissive | [
{
"docstring": "Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file.",
"name": "_build",
"signature": "def _build(self, name=None)"
},
{
"docstring": "Attaches another entity at a position offset from the attachm... | 2 | stack_v2_sparse_classes_30k_train_018637 | Implement the Python class `Standard` described below.
Class description:
Suite-specific subclass of the standard Composer arena.
Method signatures and docstrings:
- def _build(self, name=None): Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in t... | Implement the Python class `Standard` described below.
Class description:
Suite-specific subclass of the standard Composer arena.
Method signatures and docstrings:
- def _build(self, name=None): Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in t... | d6f9cb4e4a616d1e1d3bd8944bc89541434f1d49 | <|skeleton|>
class Standard:
"""Suite-specific subclass of the standard Composer arena."""
def _build(self, name=None):
"""Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file."""
<|body_0|>
def attach_offse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Standard:
"""Suite-specific subclass of the standard Composer arena."""
def _build(self, name=None):
"""Initializes this arena. Args: name: (optional) A string, the name of this arena. If `None`, use the model name defined in the MJCF file."""
super()._build(name=name)
self.mjcf_m... | the_stack_v2_python_sparse | dm_control/manipulation/shared/arenas.py | wangsd01/dm_control | train | 0 |
c28af96448620dc89358593d60d0f58165176e08 | [
"self.tm = tm\nfor k, v in KRAKEN.items():\n setattr(self, k, v)\nfor k, v in COLORS.items():\n setattr(self, k, v)\nsetattr(self, 'colorBand', BAND_COLORS)\nsetattr(self, 'stageOrder', tuple(STAGES))\nsetattr(self, 'stages', STAGES)\nsetattr(self, 'markParams', MARK_PARAMS)\nself.settings = deepcopy(SETTINGS... | <|body_start_0|>
self.tm = tm
for k, v in KRAKEN.items():
setattr(self, k, v)
for k, v in COLORS.items():
setattr(self, k, v)
setattr(self, 'colorBand', BAND_COLORS)
setattr(self, 'stageOrder', tuple(STAGES))
setattr(self, 'stages', STAGES)
... | Config | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
def __init__(self, tm, **params):
"""Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the user and apply them. The default settings are kept as a separate copy that will not be changed in ... | stack_v2_sparse_classes_75kplus_train_003351 | 17,183 | permissive | [
{
"docstring": "Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the user and apply them. The default settings are kept as a separate copy that will not be changed in any way. User modifications act on the current settin... | 3 | stack_v2_sparse_classes_30k_train_043599 | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def __init__(self, tm, **params): Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the use... | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def __init__(self, tm, **params): Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the use... | 60f976d45f3c520de6ae298a12b8e214c6a9f5c9 | <|skeleton|>
class Config:
def __init__(self, tm, **params):
"""Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the user and apply them. The default settings are kept as a separate copy that will not be changed in ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Config:
def __init__(self, tm, **params):
"""Settings manager. It will expose all settings as attributes to the rest of the application. It has methods to collect modified settings from the user and apply them. The default settings are kept as a separate copy that will not be changed in any way. User ... | the_stack_v2_python_sparse | fusus/parameters.py | among/fusus | train | 6 | |
72dbc3247fdde2b7767fef402b5d6d2d5606b24f | [
"super(LogWeight, self).__init__(path, file_mode, header, separator, iteration)\nself.__variables = variables\nself.__num_variables = len(self.__variables)\nself.__sess = sess\nself.__variables_size = []\nself.__calculate_variables_size()",
"variables = self.__sess.run(self.__variables)\nfor v in range(self.__num... | <|body_start_0|>
super(LogWeight, self).__init__(path, file_mode, header, separator, iteration)
self.__variables = variables
self.__num_variables = len(self.__variables)
self.__sess = sess
self.__variables_size = []
self.__calculate_variables_size()
<|end_body_0|>
<|body... | Log 2d Tensors into buffer and than stores it. | LogWeight | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogWeight:
"""Log 2d Tensors into buffer and than stores it."""
def __init__(self, path, file_mode, variables, sess, header=None, separator=',', iteration=0):
"""Initialize variables. Args: path: Path of the new/old file. file_mode: The mode in which the file will be open. (w, w+, a)... | stack_v2_sparse_classes_75kplus_train_003352 | 2,249 | no_license | [
{
"docstring": "Initialize variables. Args: path: Path of the new/old file. file_mode: The mode in which the file will be open. (w, w+, a) variables: A list with 2d Tensorflow variables. sess: An instance of tf.Session() to read the variables. header: First line of the file. separator: When working with csv fil... | 3 | null | Implement the Python class `LogWeight` described below.
Class description:
Log 2d Tensors into buffer and than stores it.
Method signatures and docstrings:
- def __init__(self, path, file_mode, variables, sess, header=None, separator=',', iteration=0): Initialize variables. Args: path: Path of the new/old file. file_... | Implement the Python class `LogWeight` described below.
Class description:
Log 2d Tensors into buffer and than stores it.
Method signatures and docstrings:
- def __init__(self, path, file_mode, variables, sess, header=None, separator=',', iteration=0): Initialize variables. Args: path: Path of the new/old file. file_... | 4f6dc9ad64672b123d6d3272f80586e157bf9f38 | <|skeleton|>
class LogWeight:
"""Log 2d Tensors into buffer and than stores it."""
def __init__(self, path, file_mode, variables, sess, header=None, separator=',', iteration=0):
"""Initialize variables. Args: path: Path of the new/old file. file_mode: The mode in which the file will be open. (w, w+, a)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogWeight:
"""Log 2d Tensors into buffer and than stores it."""
def __init__(self, path, file_mode, variables, sess, header=None, separator=',', iteration=0):
"""Initialize variables. Args: path: Path of the new/old file. file_mode: The mode in which the file will be open. (w, w+, a) variables: A... | the_stack_v2_python_sparse | classes/Log/LogWeight.py | arieli13/Practica | train | 0 |
aaa0cca2a3036099858c49b9d9a370082f2cc6ad | [
"super().__init__()\nwidth = 15\nheight = 15\nself.image = pygame.Surface([width, height])\nself.image.fill(constants.WHITE)\nself.rect = self.image.get_rect()\nif player.direction == 'r':\n self.rect.x = player.rect.x + 60\n self.dir = 'r'\nelif player.direction == 'l':\n self.rect.x = player.rect.x - 30\... | <|body_start_0|>
super().__init__()
width = 15
height = 15
self.image = pygame.Surface([width, height])
self.image.fill(constants.WHITE)
self.rect = self.image.get_rect()
if player.direction == 'r':
self.rect.x = player.rect.x + 60
self.dir... | Shooter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Shooter:
def __init__(self, player):
"""This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite... | stack_v2_sparse_classes_75kplus_train_003353 | 2,500 | no_license | [
{
"docstring": "This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite self.rect.y: The y-position of the sprite self.... | 2 | stack_v2_sparse_classes_30k_test_000987 | Implement the Python class `Shooter` described below.
Class description:
Implement the Shooter class.
Method signatures and docstrings:
- def __init__(self, player): This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to rep... | Implement the Python class `Shooter` described below.
Class description:
Implement the Shooter class.
Method signatures and docstrings:
- def __init__(self, player): This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to rep... | 56fbcfc786dfc373f477270468f06e31b6271749 | <|skeleton|>
class Shooter:
def __init__(self, player):
"""This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Shooter:
def __init__(self, player):
"""This initializes the attack :param player: Variables: width: The width of the bullet height: The height of the bullet self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite self.rect.y: ... | the_stack_v2_python_sparse | Doki Doki Island/attack2.py | cashpop5000/DokiProject | train | 0 | |
5b906d046cb037d823c982b174c73aa92092263f | [
"self.n_x = n_x\nself.n_y = n_y\nself.N_h = N_h\nself.name = name\nself.bias_start = 0.0\nnetwork_weights = self._create_weights()\nself.weights = network_weights\nself.nonlinearity = tf.nn.leaky_relu",
"hidden1_pre = tfm.add(tfl.matmul(x, self.weights['W_x_to_h1']), self.weights['b_x_to_h1'])\nhidden_post = self... | <|body_start_0|>
self.n_x = n_x
self.n_y = n_y
self.N_h = N_h
self.name = name
self.bias_start = 0.0
network_weights = self._create_weights()
self.weights = network_weights
self.nonlinearity = tf.nn.leaky_relu
<|end_body_0|>
<|body_start_1|>
hidde... | Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x) | Gaussian_NN | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Gaussian_NN:
"""Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x)"""
def __init__(self, name, n_x, n_y, N_h):
"""Initialisation INPUTS: name - name to assign to the decoder n_x - dimensionality of the input n_y - dimensionality of output N_... | stack_v2_sparse_classes_75kplus_train_003354 | 18,069 | permissive | [
{
"docstring": "Initialisation INPUTS: name - name to assign to the decoder n_x - dimensionality of the input n_y - dimensionality of output N_h - array of hidden units' dimensionalities in the format [Nhx,Nh1,Nh2,...,Nhn]",
"name": "__init__",
"signature": "def __init__(self, name, n_x, n_y, N_h)"
},... | 3 | stack_v2_sparse_classes_30k_train_048397 | Implement the Python class `Gaussian_NN` described below.
Class description:
Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x)
Method signatures and docstrings:
- def __init__(self, name, n_x, n_y, N_h): Initialisation INPUTS: name - name to assign to the decoder n_x - dime... | Implement the Python class `Gaussian_NN` described below.
Class description:
Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x)
Method signatures and docstrings:
- def __init__(self, name, n_x, n_y, N_h): Initialisation INPUTS: name - name to assign to the decoder n_x - dime... | 7508328b474492edc7479bb41527cbbfd5f43a1d | <|skeleton|>
class Gaussian_NN:
"""Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x)"""
def __init__(self, name, n_x, n_y, N_h):
"""Initialisation INPUTS: name - name to assign to the decoder n_x - dimensionality of the input n_y - dimensionality of output N_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Gaussian_NN:
"""Class for Gaussian neural network, taking input x and outputting Gaussian distribution p(y|x)"""
def __init__(self, name, n_x, n_y, N_h):
"""Initialisation INPUTS: name - name to assign to the decoder n_x - dimensionality of the input n_y - dimensionality of output N_h - array of ... | the_stack_v2_python_sparse | neural_networks/standard.py | ftonolini45/VICI | train | 1 |
b95db30f47cefaf1286c99582769eebc75f96c5f | [
"def subset_indices(subset):\n return [i for i, use_component in enumerate(subset) if use_component]\nself.op1_subset = op1_subset\nself.op2_subset = op2_subset\nself.result_subset = result_subset\nimport pymbolic\nop1 = pymbolic.var('x')\nop2 = pymbolic.var('y')\nself.functions = []\nself.component_lcjk = []\nf... | <|body_start_0|>
def subset_indices(subset):
return [i for i, use_component in enumerate(subset) if use_component]
self.op1_subset = op1_subset
self.op2_subset = op2_subset
self.result_subset = result_subset
import pymbolic
op1 = pymbolic.var('x')
op2 ... | A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result. | SubsettableCrossProduct | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubsettableCrossProduct:
"""A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result."""
def __init__(self, op1_subset=full_subset, op2_subset=full_subset, result_subset=full_subset):
"""Construct a subset-able cross pr... | stack_v2_sparse_classes_75kplus_train_003355 | 19,273 | no_license | [
{
"docstring": "Construct a subset-able cross product. :param op1_subset: The subset of indices of operand 1 to be taken into account. Given as a 3-sequence of bools. :param op2_subset: The subset of indices of operand 2 to be taken into account. Given as a 3-sequence of bools. :param result_subset: The subset ... | 2 | stack_v2_sparse_classes_30k_train_018908 | Implement the Python class `SubsettableCrossProduct` described below.
Class description:
A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result.
Method signatures and docstrings:
- def __init__(self, op1_subset=full_subset, op2_subset=full_subset, res... | Implement the Python class `SubsettableCrossProduct` described below.
Class description:
A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result.
Method signatures and docstrings:
- def __init__(self, op1_subset=full_subset, op2_subset=full_subset, res... | 190ab9c00a5b63d7da38028928f7eb03cb20020c | <|skeleton|>
class SubsettableCrossProduct:
"""A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result."""
def __init__(self, op1_subset=full_subset, op2_subset=full_subset, result_subset=full_subset):
"""Construct a subset-able cross pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubsettableCrossProduct:
"""A cross product that can operate on an arbitrary subsets of its two operands and return an arbitrary subset of its result."""
def __init__(self, op1_subset=full_subset, op2_subset=full_subset, result_subset=full_subset):
"""Construct a subset-able cross product. :param... | the_stack_v2_python_sparse | grudge/models/em.py | inducer/grudge | train | 11 |
33c5f28443948561a104e84f9b587988a9c1aa23 | [
"user_id = request._request.uid\ndata = {'question': question_id, 'content': request.data.get('content', None), 'user_id': user_id}\ns = AnswerCreateSerializer(data=data)\ns.is_valid()\nif s.errors:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\ntry:\n with transaction.atomic():\n ... | <|body_start_0|>
user_id = request._request.uid
data = {'question': question_id, 'content': request.data.get('content', None), 'user_id': user_id}
s = AnswerCreateSerializer(data=data)
s.is_valid()
if s.errors:
return self.error(errorcode.MSG_INVALID_DATA, errorcode.I... | AnswerView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswerView:
def post(self, request, question_id):
"""回答问题"""
<|body_0|>
def put(self, request, question_id):
"""修改回答,只能修改本人的回答"""
<|body_1|>
def delete(self, request, question_id):
"""删除回答,只能删除本人的回答"""
<|body_2|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_75kplus_train_003356 | 19,130 | no_license | [
{
"docstring": "回答问题",
"name": "post",
"signature": "def post(self, request, question_id)"
},
{
"docstring": "修改回答,只能修改本人的回答",
"name": "put",
"signature": "def put(self, request, question_id)"
},
{
"docstring": "删除回答,只能删除本人的回答",
"name": "delete",
"signature": "def delete(... | 3 | null | Implement the Python class `AnswerView` described below.
Class description:
Implement the AnswerView class.
Method signatures and docstrings:
- def post(self, request, question_id): 回答问题
- def put(self, request, question_id): 修改回答,只能修改本人的回答
- def delete(self, request, question_id): 删除回答,只能删除本人的回答 | Implement the Python class `AnswerView` described below.
Class description:
Implement the AnswerView class.
Method signatures and docstrings:
- def post(self, request, question_id): 回答问题
- def put(self, request, question_id): 修改回答,只能修改本人的回答
- def delete(self, request, question_id): 删除回答,只能删除本人的回答
<|skeleton|>
class ... | 6a68fb207f43e5ed65299cc08535b35d5e934ead | <|skeleton|>
class AnswerView:
def post(self, request, question_id):
"""回答问题"""
<|body_0|>
def put(self, request, question_id):
"""修改回答,只能修改本人的回答"""
<|body_1|>
def delete(self, request, question_id):
"""删除回答,只能删除本人的回答"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnswerView:
def post(self, request, question_id):
"""回答问题"""
user_id = request._request.uid
data = {'question': question_id, 'content': request.data.get('content', None), 'user_id': user_id}
s = AnswerCreateSerializer(data=data)
s.is_valid()
if s.errors:
... | the_stack_v2_python_sparse | apps/questions/views.py | Slowhalfframe/fanyijiang-API | train | 0 | |
d429ce156cadb40a081b901d84518b8504dc6be3 | [
"newcls = type.__new__(metacls, clsname, bases, clsdict)\nif 'countrycode' in clsdict and newcls.name:\n metacls.converters.append(newcls)\n metacls.converters_by_iso[newcls.countrycode] = newcls\n metacls.converters_by_classname[clsname] = newcls\nreturn newcls",
"if countrycode in cls.converters_by_iso... | <|body_start_0|>
newcls = type.__new__(metacls, clsname, bases, clsdict)
if 'countrycode' in clsdict and newcls.name:
metacls.converters.append(newcls)
metacls.converters_by_iso[newcls.countrycode] = newcls
metacls.converters_by_classname[clsname] = newcls
ret... | Meta annex factory class for online BBAN to IBAN converters. | OnlineBBANtoIBANconverters | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnlineBBANtoIBANconverters:
"""Meta annex factory class for online BBAN to IBAN converters."""
def __new__(metacls, clsname, bases, clsdict):
"""Register class for online conversion when countrycode has been set"""
<|body_0|>
def bban_to_iban(cls, countrycode, bankcode=N... | stack_v2_sparse_classes_75kplus_train_003357 | 3,864 | no_license | [
{
"docstring": "Register class for online conversion when countrycode has been set",
"name": "__new__",
"signature": "def __new__(metacls, clsname, bases, clsdict)"
},
{
"docstring": "Generic interface to converter classes. Tests validity of resulting IBAN. Returns valid IBAN object or None",
... | 2 | stack_v2_sparse_classes_30k_train_015523 | Implement the Python class `OnlineBBANtoIBANconverters` described below.
Class description:
Meta annex factory class for online BBAN to IBAN converters.
Method signatures and docstrings:
- def __new__(metacls, clsname, bases, clsdict): Register class for online conversion when countrycode has been set
- def bban_to_i... | Implement the Python class `OnlineBBANtoIBANconverters` described below.
Class description:
Meta annex factory class for online BBAN to IBAN converters.
Method signatures and docstrings:
- def __new__(metacls, clsname, bases, clsdict): Register class for online conversion when countrycode has been set
- def bban_to_i... | 1081f3a5ff8864a31b2dcd89406fac076a908e78 | <|skeleton|>
class OnlineBBANtoIBANconverters:
"""Meta annex factory class for online BBAN to IBAN converters."""
def __new__(metacls, clsname, bases, clsdict):
"""Register class for online conversion when countrycode has been set"""
<|body_0|>
def bban_to_iban(cls, countrycode, bankcode=N... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OnlineBBANtoIBANconverters:
"""Meta annex factory class for online BBAN to IBAN converters."""
def __new__(metacls, clsname, bases, clsdict):
"""Register class for online conversion when countrycode has been set"""
newcls = type.__new__(metacls, clsname, bases, clsdict)
if 'countr... | the_stack_v2_python_sparse | extra-addons/account_banking_old/old/sepa/bbantoiban.py | sgeerish/sirr_production | train | 0 |
9ac45fa4ab975b98dbad1e179b4eeb96a8ec6efd | [
"try:\n self.fd = open(filePath, mode)\nexcept Exception:\n logger.debug(traceback.format_exc())\n raise ValueError('{0} \\nFile: \"{1}\"'.format(sys.exc_info()[1], filePath))\nelse:\n self.filePath = filePath\n self.verbosity = verbosity\n self.logger = logger\n self.logHandler = _addHandle... | <|body_start_0|>
try:
self.fd = open(filePath, mode)
except Exception:
logger.debug(traceback.format_exc())
raise ValueError('{0} \nFile: "{1}"'.format(sys.exc_info()[1], filePath))
else:
self.filePath = filePath
self.verbosity = ver... | Class that contains information about a particular file logger. | _FileLogger | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"HPND",
"GPL-2.0-onl... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _FileLogger:
"""Class that contains information about a particular file logger."""
def __init__(self, filePath, verbosity, mode, logger):
"""Initialize a file logger"""
<|body_0|>
def deinit(self):
"""De-initialize the file logger"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus_train_003358 | 23,164 | permissive | [
{
"docstring": "Initialize a file logger",
"name": "__init__",
"signature": "def __init__(self, filePath, verbosity, mode, logger)"
},
{
"docstring": "De-initialize the file logger",
"name": "deinit",
"signature": "def deinit(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002096 | Implement the Python class `_FileLogger` described below.
Class description:
Class that contains information about a particular file logger.
Method signatures and docstrings:
- def __init__(self, filePath, verbosity, mode, logger): Initialize a file logger
- def deinit(self): De-initialize the file logger | Implement the Python class `_FileLogger` described below.
Class description:
Class that contains information about a particular file logger.
Method signatures and docstrings:
- def __init__(self, filePath, verbosity, mode, logger): Initialize a file logger
- def deinit(self): De-initialize the file logger
<|skeleton... | 78c02e5fbb129b1bc4147bd55eec2882267d7e87 | <|skeleton|>
class _FileLogger:
"""Class that contains information about a particular file logger."""
def __init__(self, filePath, verbosity, mode, logger):
"""Initialize a file logger"""
<|body_0|>
def deinit(self):
"""De-initialize the file logger"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _FileLogger:
"""Class that contains information about a particular file logger."""
def __init__(self, filePath, verbosity, mode, logger):
"""Initialize a file logger"""
try:
self.fd = open(filePath, mode)
except Exception:
logger.debug(traceback.format_exc(... | the_stack_v2_python_sparse | QCA4020_SDK/target/sectools/qdn/sectools/common/utils/c_logging.py | r8d8/lastlock | train | 1 |
698f1ccc3ec8fc4baf8aafa32738909a67ab4aed | [
"item_links = response.css('.grid-uniform a.product-grid-item::attr(href)').getall()\nyield from response.follow_all(item_links, self.parse_details)\nnext_page = response.xpath('//ul[@class=\"pagination-custom\"]//a[@title=\"Next »\"]/@href').get()\nif next_page is not None:\n yield response.follow(next_page, ca... | <|body_start_0|>
item_links = response.css('.grid-uniform a.product-grid-item::attr(href)').getall()
yield from response.follow_all(item_links, self.parse_details)
next_page = response.xpath('//ul[@class="pagination-custom"]//a[@title="Next »"]/@href').get()
if next_page is not None:
... | KanmaincSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KanmaincSpider:
def parse(self, response):
"""This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request https://kanmainc.com/collections/all?page=2"""
<|body_0|>
def parse_details(self, response)... | stack_v2_sparse_classes_75kplus_train_003359 | 2,511 | no_license | [
{
"docstring": "This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request https://kanmainc.com/collections/all?page=2",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "This function shoul... | 2 | null | Implement the Python class `KanmaincSpider` described below.
Class description:
Implement the KanmaincSpider class.
Method signatures and docstrings:
- def parse(self, response): This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request h... | Implement the Python class `KanmaincSpider` described below.
Class description:
Implement the KanmaincSpider class.
Method signatures and docstrings:
- def parse(self, response): This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request h... | 025babe4a03553d720806828f89929c6e773d683 | <|skeleton|>
class KanmaincSpider:
def parse(self, response):
"""This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request https://kanmainc.com/collections/all?page=2"""
<|body_0|>
def parse_details(self, response)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KanmaincSpider:
def parse(self, response):
"""This function should extract and loop item urls. @url https://kanmainc.com/collections/all @returns items 0 @returns requests 41 @request https://kanmainc.com/collections/all?page=2"""
item_links = response.css('.grid-uniform a.product-grid-item::a... | the_stack_v2_python_sparse | data_scraping/gmd/spiders/kanmainc.py | panky2202/scrapy-dev | train | 1 | |
f35445a6d7cf3d6ef032b861547ab39bbb451586 | [
"node = head\ncount = 0\nret = head\nprevLast = None\nwhile node != None:\n count += 1\n if count == k:\n ret = node\n if count % k == 0:\n tmp = node\n node = node.next\n tmp.next = None\n newHead = self.reverseList(head)\n if prevLast != None:\n prevLa... | <|body_start_0|>
node = head
count = 0
ret = head
prevLast = None
while node != None:
count += 1
if count == k:
ret = node
if count % k == 0:
tmp = node
node = node.next
tmp.next =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseKGroup(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
node = head
... | stack_v2_sparse_classes_75kplus_train_003360 | 1,389 | no_license | [
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "reverseKGroup",
"signature": "def reverseKGroup(self, head, k)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def reverseList(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solu... | 2c3dbcbcb20cfdb276c0886e0193ef42551c5747 | <|skeleton|>
class Solution:
def reverseKGroup(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseKGroup(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
node = head
count = 0
ret = head
prevLast = None
while node != None:
count += 1
if count == k:
ret = node
if ... | the_stack_v2_python_sparse | reverseKGroup_25.py | Lucces/leetcode | train | 0 | |
f8a8c0ae49a906382844e3bf70f9c24985b78624 | [
"ts = TopologicalSorter()\nfor cur, pre in prerequisites:\n ts.add(cur, pre)\ntry:\n ts.prepare()\n return True\nexcept CycleError:\n return False",
"adjList = [[] for _ in range(numCourses)]\ndeg = [0] * numCourses\nfor cur, pre in prerequisites:\n adjList[pre].append(cur)\n deg[cur] += 1\nretu... | <|body_start_0|>
ts = TopologicalSorter()
for cur, pre in prerequisites:
ts.add(cur, pre)
try:
ts.prepare()
return True
except CycleError:
return False
<|end_body_0|>
<|body_start_1|>
adjList = [[] for _ in range(numCourses)]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
"""有向图是否无环"""
<|body_0|>
def canFinish2(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
"""有向图是否无环"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003361 | 1,875 | no_license | [
{
"docstring": "有向图是否无环",
"name": "canFinish",
"signature": "def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool"
},
{
"docstring": "有向图是否无环",
"name": "canFinish2",
"signature": "def canFinish2(self, numCourses: int, prerequisites: list[list[int]]) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_032731 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool: 有向图是否无环
- def canFinish2(self, numCourses: int, prerequisites: list[list[int]]) -> bool: 有向图是否无环 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool: 有向图是否无环
- def canFinish2(self, numCourses: int, prerequisites: list[list[int]]) -> bool: 有向图是否无环
<|... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
"""有向图是否无环"""
<|body_0|>
def canFinish2(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
"""有向图是否无环"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canFinish(self, numCourses: int, prerequisites: list[list[int]]) -> bool:
"""有向图是否无环"""
ts = TopologicalSorter()
for cur, pre in prerequisites:
ts.add(cur, pre)
try:
ts.prepare()
return True
except CycleError:
... | the_stack_v2_python_sparse | 7_graph/拓扑排序/课程表/207. 课程表拓扑排序调库.py | 981377660LMT/algorithm-study | train | 225 | |
df7bcd9688ad2f9b48249e417d7d6a54a78e10a2 | [
"self.assertEquals(Role.objects.count(), 0)\nself.assertEquals(Grant.objects.count(), 0)\ncommand = cchq_prbac_bootstrap.Command()\ncommand.handle(dry_run=True)\nself.assertEquals(Role.objects.count(), 0)\nself.assertEquals(Grant.objects.count(), 0)",
"self.assertEquals(Role.objects.count(), 0)\nself.assertEquals... | <|body_start_0|>
self.assertEquals(Role.objects.count(), 0)
self.assertEquals(Grant.objects.count(), 0)
command = cchq_prbac_bootstrap.Command()
command.handle(dry_run=True)
self.assertEquals(Role.objects.count(), 0)
self.assertEquals(Grant.objects.count(), 0)
<|end_body_... | Tests the PRBAC bootstrap with and without --dry-run | TestCchqPrbacBootstrap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCchqPrbacBootstrap:
"""Tests the PRBAC bootstrap with and without --dry-run"""
def test_dry_run(self):
"""When --dry-run is passed, no models should be created"""
<|body_0|>
def test_non_dry_run(self):
"""When there is no --dry-run passed, it defaults to fals... | stack_v2_sparse_classes_75kplus_train_003362 | 5,424 | no_license | [
{
"docstring": "When --dry-run is passed, no models should be created",
"name": "test_dry_run",
"signature": "def test_dry_run(self)"
},
{
"docstring": "When there is no --dry-run passed, it defaults to false, and things happen. Furthermore, the thing should be idempotent",
"name": "test_non... | 2 | null | Implement the Python class `TestCchqPrbacBootstrap` described below.
Class description:
Tests the PRBAC bootstrap with and without --dry-run
Method signatures and docstrings:
- def test_dry_run(self): When --dry-run is passed, no models should be created
- def test_non_dry_run(self): When there is no --dry-run passed... | Implement the Python class `TestCchqPrbacBootstrap` described below.
Class description:
Tests the PRBAC bootstrap with and without --dry-run
Method signatures and docstrings:
- def test_dry_run(self): When --dry-run is passed, no models should be created
- def test_non_dry_run(self): When there is no --dry-run passed... | 972129fc26864c08c7bef07874bd2a7218550bff | <|skeleton|>
class TestCchqPrbacBootstrap:
"""Tests the PRBAC bootstrap with and without --dry-run"""
def test_dry_run(self):
"""When --dry-run is passed, no models should be created"""
<|body_0|>
def test_non_dry_run(self):
"""When there is no --dry-run passed, it defaults to fals... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCchqPrbacBootstrap:
"""Tests the PRBAC bootstrap with and without --dry-run"""
def test_dry_run(self):
"""When --dry-run is passed, no models should be created"""
self.assertEquals(Role.objects.count(), 0)
self.assertEquals(Grant.objects.count(), 0)
command = cchq_prba... | the_stack_v2_python_sparse | corehq/apps/hqadmin/tests.py | bglar/commcare-hq | train | 1 |
c3ae9ba7ad2c5c3460f2bb4e281835bf267f2ef8 | [
"np.random.seed(6589)\nn = 100\ndtypes = [np.float32, np.float64]\nfor dtype in dtypes:\n volatilities = np.exp(np.random.randn(n) / 2)\n forwards = np.exp(np.random.randn(n))\n strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2)\n expiries = np.exp(np.random.randn(n))\n prices = self.evaluate... | <|body_start_0|>
np.random.seed(6589)
n = 100
dtypes = [np.float32, np.float64]
for dtype in dtypes:
volatilities = np.exp(np.random.randn(n) / 2)
forwards = np.exp(np.random.randn(n))
strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2)
... | Tests for methods in implied_vol module. | ImpliedVolTest | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
<|body_0|>
def test_validate(self):
"""Test the algorithm doesn't raise where it shouldn't."""
<|body_1|>
def ... | stack_v2_sparse_classes_75kplus_train_003363 | 4,993 | permissive | [
{
"docstring": "Basic test of the implied vol calculation.",
"name": "test_implied_vol",
"signature": "def test_implied_vol(self)"
},
{
"docstring": "Test the algorithm doesn't raise where it shouldn't.",
"name": "test_validate",
"signature": "def test_validate(self)"
},
{
"docst... | 3 | stack_v2_sparse_classes_30k_train_004857 | Implement the Python class `ImpliedVolTest` described below.
Class description:
Tests for methods in implied_vol module.
Method signatures and docstrings:
- def test_implied_vol(self): Basic test of the implied vol calculation.
- def test_validate(self): Test the algorithm doesn't raise where it shouldn't.
- def test... | Implement the Python class `ImpliedVolTest` described below.
Class description:
Tests for methods in implied_vol module.
Method signatures and docstrings:
- def test_implied_vol(self): Basic test of the implied vol calculation.
- def test_validate(self): Test the algorithm doesn't raise where it shouldn't.
- def test... | 0d3a2193c0f2d320b65e602cf01d7a617da484df | <|skeleton|>
class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
<|body_0|>
def test_validate(self):
"""Test the algorithm doesn't raise where it shouldn't."""
<|body_1|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
np.random.seed(6589)
n = 100
dtypes = [np.float32, np.float64]
for dtype in dtypes:
volatilities = np.exp(np.rand... | the_stack_v2_python_sparse | tf_quant_finance/black_scholes/implied_vol_lib_test.py | google/tf-quant-finance | train | 4,165 |
dbd33664f481b75af7745dfc7af14b93996246a2 | [
"self.ruckus = ruckus\nupdate_interval = timedelta(seconds=SCAN_INTERVAL)\nsuper().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)",
"clients = await self.ruckus.api.get_active_clients()\n_LOGGER.debug('fetched %d active clients', len(clients))\nreturn {client[API_CLIENT_MAC]: client for cli... | <|body_start_0|>
self.ruckus = ruckus
update_interval = timedelta(seconds=SCAN_INTERVAL)
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
<|end_body_0|>
<|body_start_1|>
clients = await self.ruckus.api.get_active_clients()
_LOGGER.debug('fetched %d a... | Coordinator to manage data from Ruckus Unleashed client. | RuckusUnleashedDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuckusUnleashedDataUpdateCoordinator:
"""Coordinator to manage data from Ruckus Unleashed client."""
def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None:
"""Initialize global Ruckus Unleashed data updater."""
<|body_0|>
async def _fetch_clients(self) ... | stack_v2_sparse_classes_75kplus_train_003364 | 1,639 | permissive | [
{
"docstring": "Initialize global Ruckus Unleashed data updater.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None"
},
{
"docstring": "Fetch clients from the API and format them.",
"name": "_fetch_clients",
"signature": "async def... | 3 | stack_v2_sparse_classes_30k_train_053406 | Implement the Python class `RuckusUnleashedDataUpdateCoordinator` described below.
Class description:
Coordinator to manage data from Ruckus Unleashed client.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None: Initialize global Ruckus Unleashed data updater.
-... | Implement the Python class `RuckusUnleashedDataUpdateCoordinator` described below.
Class description:
Coordinator to manage data from Ruckus Unleashed client.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None: Initialize global Ruckus Unleashed data updater.
-... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class RuckusUnleashedDataUpdateCoordinator:
"""Coordinator to manage data from Ruckus Unleashed client."""
def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None:
"""Initialize global Ruckus Unleashed data updater."""
<|body_0|>
async def _fetch_clients(self) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RuckusUnleashedDataUpdateCoordinator:
"""Coordinator to manage data from Ruckus Unleashed client."""
def __init__(self, hass: HomeAssistant, *, ruckus: AjaxSession) -> None:
"""Initialize global Ruckus Unleashed data updater."""
self.ruckus = ruckus
update_interval = timedelta(sec... | the_stack_v2_python_sparse | homeassistant/components/ruckus_unleashed/coordinator.py | home-assistant/core | train | 35,501 |
5a9bc394abfec97c2ed61fdca423b0a26c146d42 | [
"threading.Thread.__init__(self)\nself.taskBuffer = taskBuffer\nif log_stream:\n self.log_stream = log_stream\nelse:\n self.log_stream = _logger\nif hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'):\n self.CRIC_URL_SCHEDCONFIG = panda_config.CRIC_URL_SCHEDCONFIG\nelse:\n self.CRIC_URL_SCHEDCONFIG = 'https:... | <|body_start_0|>
threading.Thread.__init__(self)
self.taskBuffer = taskBuffer
if log_stream:
self.log_stream = log_stream
else:
self.log_stream = _logger
if hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'):
self.CRIC_URL_SCHEDCONFIG = panda_config... | Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue | SchedconfigJsonDumper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
<|body_0|>
def run(self):
"""Principal function"""
<|body_1... | stack_v2_sparse_classes_75kplus_train_003365 | 38,097 | permissive | [
{
"docstring": "Initialization and configuration",
"name": "__init__",
"signature": "def __init__(self, taskBuffer, log_stream=None)"
},
{
"docstring": "Principal function",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007821 | Implement the Python class `SchedconfigJsonDumper` described below.
Class description:
Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue
Method signatures and docstrings:
- def __init__(self, taskBuffer, log_stream=None): Initialization and configuration
- def run(self): Principal functio... | Implement the Python class `SchedconfigJsonDumper` described below.
Class description:
Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue
Method signatures and docstrings:
- def __init__(self, taskBuffer, log_stream=None): Initialization and configuration
- def run(self): Principal functio... | 365a9feb55d493b208e3052428f0b524e63e4178 | <|skeleton|>
class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
<|body_0|>
def run(self):
"""Principal function"""
<|body_1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
threading.Thread.__init__(self)
self.taskBuffer = taskBuffer
if log_stream:
... | the_stack_v2_python_sparse | pandaserver/configurator/Configurator.py | PanDAWMS/panda-server | train | 8 |
07eb2568c3aeb7f3dc2f54698290ffd3bfe912e6 | [
"user = request.user\ntags = models.Tag.objects.filter(owner=user)\ntags_sr = serializers.TagSerializer(tags, many=True)\nreturn Response(data=tags_sr.data)",
"user = request.user\nname: str = request.data.get('name')\nif name:\n tag = models.Tag(name=name, owner=user)\n tag.save()\n tag_sr = serializers... | <|body_start_0|>
user = request.user
tags = models.Tag.objects.filter(owner=user)
tags_sr = serializers.TagSerializer(tags, many=True)
return Response(data=tags_sr.data)
<|end_body_0|>
<|body_start_1|>
user = request.user
name: str = request.data.get('name')
if n... | TagView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagView:
def get(self, request: Request) -> Response:
"""show all tags belonging to the user"""
<|body_0|>
def post(self, request: Request) -> Response:
"""Create a new tag"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = request.user
... | stack_v2_sparse_classes_75kplus_train_003366 | 10,567 | no_license | [
{
"docstring": "show all tags belonging to the user",
"name": "get",
"signature": "def get(self, request: Request) -> Response"
},
{
"docstring": "Create a new tag",
"name": "post",
"signature": "def post(self, request: Request) -> Response"
}
] | 2 | null | Implement the Python class `TagView` described below.
Class description:
Implement the TagView class.
Method signatures and docstrings:
- def get(self, request: Request) -> Response: show all tags belonging to the user
- def post(self, request: Request) -> Response: Create a new tag | Implement the Python class `TagView` described below.
Class description:
Implement the TagView class.
Method signatures and docstrings:
- def get(self, request: Request) -> Response: show all tags belonging to the user
- def post(self, request: Request) -> Response: Create a new tag
<|skeleton|>
class TagView:
... | 68e3cd3c3ec6496f9b858032dd8bbc4f64f6a4aa | <|skeleton|>
class TagView:
def get(self, request: Request) -> Response:
"""show all tags belonging to the user"""
<|body_0|>
def post(self, request: Request) -> Response:
"""Create a new tag"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TagView:
def get(self, request: Request) -> Response:
"""show all tags belonging to the user"""
user = request.user
tags = models.Tag.objects.filter(owner=user)
tags_sr = serializers.TagSerializer(tags, many=True)
return Response(data=tags_sr.data)
def post(self, r... | the_stack_v2_python_sparse | paper/views.py | rubbieKelvin/paper-api | train | 1 | |
bcc70713e0e3d2baaaaf8951fefb2516e611e911 | [
"super(HierarchyGCNModule, self).__init__()\nself.self_loop = self_loop\nself.out_arc = out_arc\nself.in_arc = in_arc\nself.device = device\nself.dataset = dataset\nassert in_arc or out_arc\nin_prob = in_adj\nself.adj_matrix = Parameter(torch.Tensor(in_prob))\nself.edge_bias = Parameter(torch.Tensor(num_nodes, in_d... | <|body_start_0|>
super(HierarchyGCNModule, self).__init__()
self.self_loop = self_loop
self.out_arc = out_arc
self.in_arc = in_arc
self.device = device
self.dataset = dataset
assert in_arc or out_arc
in_prob = in_adj
self.adj_matrix = Parameter(tor... | HierarchyGCNModule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HierarchyGCNModule:
def __init__(self, num_nodes, in_adj, out_adj, in_dim, dropout, device, in_arc=True, out_arc=True, self_loop=True, dataset=None):
"""module of Hierarchy-GCN :param num_nodes: int, N :param in_adj: numpy.Array(N, N), input adjacent matrix for child2parent (bottom-up ma... | stack_v2_sparse_classes_75kplus_train_003367 | 5,773 | permissive | [
{
"docstring": "module of Hierarchy-GCN :param num_nodes: int, N :param in_adj: numpy.Array(N, N), input adjacent matrix for child2parent (bottom-up manner) :param out_adj: numpy.Array(N, N), output adjacent matrix for parent2child (top-down manner) :param in_dim: int, the dimension of each node <- config.struc... | 3 | null | Implement the Python class `HierarchyGCNModule` described below.
Class description:
Implement the HierarchyGCNModule class.
Method signatures and docstrings:
- def __init__(self, num_nodes, in_adj, out_adj, in_dim, dropout, device, in_arc=True, out_arc=True, self_loop=True, dataset=None): module of Hierarchy-GCN :par... | Implement the Python class `HierarchyGCNModule` described below.
Class description:
Implement the HierarchyGCNModule class.
Method signatures and docstrings:
- def __init__(self, num_nodes, in_adj, out_adj, in_dim, dropout, device, in_arc=True, out_arc=True, self_loop=True, dataset=None): module of Hierarchy-GCN :par... | 199ebc6b06b3cce2b3f2298cb9e20f81c01dc7a6 | <|skeleton|>
class HierarchyGCNModule:
def __init__(self, num_nodes, in_adj, out_adj, in_dim, dropout, device, in_arc=True, out_arc=True, self_loop=True, dataset=None):
"""module of Hierarchy-GCN :param num_nodes: int, N :param in_adj: numpy.Array(N, N), input adjacent matrix for child2parent (bottom-up ma... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HierarchyGCNModule:
def __init__(self, num_nodes, in_adj, out_adj, in_dim, dropout, device, in_arc=True, out_arc=True, self_loop=True, dataset=None):
"""module of Hierarchy-GCN :param num_nodes: int, N :param in_adj: numpy.Array(N, N), input adjacent matrix for child2parent (bottom-up manner) :param o... | the_stack_v2_python_sparse | models/structure_model/graphcnn.py | RuiBai1999/HiMatch | train | 7 | |
3cc7ce709f41f29e6f365e21a763703d6de68109 | [
"if self.session:\n char = self.session.puppet\n if char:\n char.locks.reset()\naccount.locks.reset()",
"account = self.account\npermstr = account.is_superuser and '(superuser)' or '(%s)' % ', '.join(account.permissions.all())\nif self.cmdstring in ('unquell', 'unquell'):\n if not account.attribut... | <|body_start_0|>
if self.session:
char = self.session.puppet
if char:
char.locks.reset()
account.locks.reset()
<|end_body_0|>
<|body_start_1|>
account = self.account
permstr = account.is_superuser and '(superuser)' or '(%s)' % ', '.join(account.pe... | use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppeted Object's permissions instead. This is useful mainly for testing. Hierarch... | CmdQuell | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CmdQuell:
"""use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppeted Object's permissions instead. This is... | stack_v2_sparse_classes_75kplus_train_003368 | 37,414 | permissive | [
{
"docstring": "Helper method to reset the lockhandler on an already puppeted object",
"name": "_recache_locks",
"signature": "def _recache_locks(self, account)"
},
{
"docstring": "Perform the command",
"name": "func",
"signature": "def func(self)"
}
] | 2 | null | Implement the Python class `CmdQuell` described below.
Class description:
use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppete... | Implement the Python class `CmdQuell` described below.
Class description:
use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppete... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class CmdQuell:
"""use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppeted Object's permissions instead. This is... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CmdQuell:
"""use character's permissions instead of account's Usage: quell unquell Normally the permission level of the Account is used when puppeting a Character/Object to determine access. This command will switch the lock system to make use of the puppeted Object's permissions instead. This is useful mainl... | the_stack_v2_python_sparse | evennia/commands/default/account.py | evennia/evennia | train | 1,781 |
1bae7037644746aece4cd6b240ffbeb33abad1fa | [
"self.id = id\nself.meta_media_directory_id = meta_media_directory_id\nself.title = title\nself.alt = alt\nself.file_name = file_name\nself.password_hash = password_hash\nself.is_active = is_active\nself.expire_on = expire_on\nself.file_library_label_param = file_library_label_param\nself.file_size = file_size\nsel... | <|body_start_0|>
self.id = id
self.meta_media_directory_id = meta_media_directory_id
self.title = title
self.alt = alt
self.file_name = file_name
self.password_hash = password_hash
self.is_active = is_active
self.expire_on = expire_on
self.file_lib... | Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string): پسورد فایل is_active (string): وضعیت اکتیو بودن فایل expire_on (string... | Upload | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Upload:
"""Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string): پسورد فایل is_active (string): وضعیت... | stack_v2_sparse_classes_75kplus_train_003369 | 6,335 | permissive | [
{
"docstring": "Constructor for the Upload class",
"name": "__init__",
"signature": "def __init__(self, id=None, meta_media_directory_id=None, file_name=None, file_size_value=None, file_url=None, file_thumbnail_url=None, expire_on_persian_date=None, update_on=None, create_on=None, create_on_persian_date... | 2 | stack_v2_sparse_classes_30k_val_002780 | Implement the Python class `Upload` described below.
Class description:
Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string... | Implement the Python class `Upload` described below.
Class description:
Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string... | b574a76a8805b306a423229b572c36dae0159def | <|skeleton|>
class Upload:
"""Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string): پسورد فایل is_active (string): وضعیت... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Upload:
"""Implementation of the 'Upload' model. اطلاعات فایل آپلود شده Attributes: id (int): شناسه ی فایل meta_media_directory_id (int): شناسه ی دایرکتوری فایل title (string): عنوان alt (string): توضیح فایل file_name (string): نام فایل password_hash (string): پسورد فایل is_active (string): وضعیت اکتیو بودن ف... | the_stack_v2_python_sparse | easybimehlanding/models/upload.py | kmelodi/EasyBimehLanding_Python | train | 0 |
0dbe5d508dfc4613ef8dd5352c6f2801ce135631 | [
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ndatabase = 'scratch/toy.db'\ntalon.get_counters(database)\nedge_dict = init_refs.make_edge_dict(cursor)\nlocation_dict = init_refs.make_location_dict(build, cursor)\nrun_info = talon.init_run_info(database, build)\ntranscript_dict = init_refs.make_transcript_dic... | <|body_start_0|>
conn, cursor = get_db_cursor()
build = 'toy_build'
database = 'scratch/toy.db'
talon.get_counters(database)
edge_dict = init_refs.make_edge_dict(cursor)
location_dict = init_refs.make_location_dict(build, cursor)
run_info = talon.init_run_info(dat... | TestIdentifyRemaining | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestIdentifyRemaining:
def test_intergenic(self):
"""Example where the transcript is an NIC match to an existing one by virtue of a new splice donor."""
<|body_0|>
def test_antisense(self):
"""Example where the transcript is antisense but contains no known splice ver... | stack_v2_sparse_classes_75kplus_train_003370 | 6,699 | permissive | [
{
"docstring": "Example where the transcript is an NIC match to an existing one by virtue of a new splice donor.",
"name": "test_intergenic",
"signature": "def test_intergenic(self)"
},
{
"docstring": "Example where the transcript is antisense but contains no known splice vertices",
"name": ... | 3 | stack_v2_sparse_classes_30k_val_002784 | Implement the Python class `TestIdentifyRemaining` described below.
Class description:
Implement the TestIdentifyRemaining class.
Method signatures and docstrings:
- def test_intergenic(self): Example where the transcript is an NIC match to an existing one by virtue of a new splice donor.
- def test_antisense(self): ... | Implement the Python class `TestIdentifyRemaining` described below.
Class description:
Implement the TestIdentifyRemaining class.
Method signatures and docstrings:
- def test_intergenic(self): Example where the transcript is an NIC match to an existing one by virtue of a new splice donor.
- def test_antisense(self): ... | 8014faed5f982e5e106ec05239e47d65878e76c3 | <|skeleton|>
class TestIdentifyRemaining:
def test_intergenic(self):
"""Example where the transcript is an NIC match to an existing one by virtue of a new splice donor."""
<|body_0|>
def test_antisense(self):
"""Example where the transcript is antisense but contains no known splice ver... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestIdentifyRemaining:
def test_intergenic(self):
"""Example where the transcript is an NIC match to an existing one by virtue of a new splice donor."""
conn, cursor = get_db_cursor()
build = 'toy_build'
database = 'scratch/toy.db'
talon.get_counters(database)
e... | the_stack_v2_python_sparse | testing_suite/test_process_remaining_mult_cases.py | kopardev/TALON | train | 0 | |
e8ffa64829feab3d947afcbd0fffedc3034aefe6 | [
"assert scene in sms_constant.SMS_NOTICE_SCENE_MAP, scene\nif self.filter(scene=scene, instid=instid).exists():\n logger.warning(f'sms_send__msg_remind__exists {scene} {instid}')\n return (False, f'提醒短信已存在: {scene} {instid}')\ntemplate = sms_constant.SMS_NOTICE_SCENE_MAP[scene]\nsign = sms_constant.SMS_SIGN\n... | <|body_start_0|>
assert scene in sms_constant.SMS_NOTICE_SCENE_MAP, scene
if self.filter(scene=scene, instid=instid).exists():
logger.warning(f'sms_send__msg_remind__exists {scene} {instid}')
return (False, f'提醒短信已存在: {scene} {instid}')
template = sms_constant.SMS_NOTICE_... | SmsRecordManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmsRecordManager:
def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid):
"""发送 消息短信提醒消息"""
<|body_0|>
def sms_notice_report_receipt(self, dic):
"""通知短信,发送回执MNS订阅"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
assert scene in... | stack_v2_sparse_classes_75kplus_train_003371 | 6,280 | no_license | [
{
"docstring": "发送 消息短信提醒消息",
"name": "sms_send__msg_remind",
"signature": "def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid)"
},
{
"docstring": "通知短信,发送回执MNS订阅",
"name": "sms_notice_report_receipt",
"signature": "def sms_notice_report_receipt(self, dic)"
}
... | 2 | stack_v2_sparse_classes_30k_val_002329 | Implement the Python class `SmsRecordManager` described below.
Class description:
Implement the SmsRecordManager class.
Method signatures and docstrings:
- def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid): 发送 消息短信提醒消息
- def sms_notice_report_receipt(self, dic): 通知短信,发送回执MNS订阅 | Implement the Python class `SmsRecordManager` described below.
Class description:
Implement the SmsRecordManager class.
Method signatures and docstrings:
- def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid): 发送 消息短信提醒消息
- def sms_notice_report_receipt(self, dic): 通知短信,发送回执MNS订阅
<|skeleton|... | b7ed6588e13d2916a4162d56509d2794742a1eb1 | <|skeleton|>
class SmsRecordManager:
def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid):
"""发送 消息短信提醒消息"""
<|body_0|>
def sms_notice_report_receipt(self, dic):
"""通知短信,发送回执MNS订阅"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SmsRecordManager:
def sms_send__msg_remind(self, scene, number, params, usrid, touchid, instid):
"""发送 消息短信提醒消息"""
assert scene in sms_constant.SMS_NOTICE_SCENE_MAP, scene
if self.filter(scene=scene, instid=instid).exists():
logger.warning(f'sms_send__msg_remind__exists {sc... | the_stack_v2_python_sparse | server/applibs/outside/models/ali_dysms.py | fanshuai/kubrick | train | 0 | |
856f77729ec30a7942ed90236321017f1b7d9a0c | [
"self.W1 = 0.01 * rd.randn(hidden_dim, input_dim)\nself.W2 = 0.01 * rd.randn(hidden_dim)\nself.actions = actions\nself.num_actions = len(actions)\nself.T = time_horizon\nself.prior_var = prior_var\nself.noise_var = noise_var\nself.p = drop_prob\nself.lr = learning_rate\nself.num_gradient_steps = num_gradient_steps\... | <|body_start_0|>
self.W1 = 0.01 * rd.randn(hidden_dim, input_dim)
self.W2 = 0.01 * rd.randn(hidden_dim)
self.actions = actions
self.num_actions = len(actions)
self.T = time_horizon
self.prior_var = prior_var
self.noise_var = noise_var
self.p = drop_prob
... | Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link. | TwoLayerNNDropout | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoLayerNNDropout:
"""Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link."""
def __init__(self, input_dim, hidden_dim, actions, time_horizon, prior_var, noise_... | stack_v2_sparse_classes_75kplus_train_003372 | 13,684 | permissive | [
{
"docstring": "Dropout agent with two-layer neural network model. Args: input_dim: int dimension of input. hidden_dim: int size of hidden layer. actions: numpy array of valid actions (generated by environment). time_horizon: int size to pre-allocate data storage. prior_var: prior variance for random initializa... | 4 | stack_v2_sparse_classes_30k_train_032000 | Implement the Python class `TwoLayerNNDropout` described below.
Class description:
Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link.
Method signatures and docstrings:
- def __init__(s... | Implement the Python class `TwoLayerNNDropout` described below.
Class description:
Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link.
Method signatures and docstrings:
- def __init__(s... | 147ff28dc507172774693f225071f8e244e5994e | <|skeleton|>
class TwoLayerNNDropout:
"""Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link."""
def __init__(self, input_dim, hidden_dim, actions, time_horizon, prior_var, noise_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TwoLayerNNDropout:
"""Dropout is used to represent model uncertainty. ICML paper suggests this is Bayesian uncertainty: arXiv:1506.02142. Follow up work suggests that this is flawed: TODO(iosband) add link."""
def __init__(self, input_dim, hidden_dim, actions, time_horizon, prior_var, noise_var, drop_pro... | the_stack_v2_python_sparse | src/ensemble_nn/agent_nn.py | AbhinavGopal/ts_tutorial | train | 0 |
dff53f89f1a92c45a8c6ac70f1d2f166a20f41e7 | [
"self.num_feat_per_dim = num_feat_per_dim\nself.scale = to.sqrt(to.tensor(2.0 / num_feat_per_dim))\nself.freq = to.randn(num_feat_per_dim, inp_dim)\nif not isinstance(bandwidth, to.Tensor):\n bandwidth = to.from_numpy(np.asanyarray(bandwidth))\nself.freq *= to.sqrt(to.tensor(2.0) / atleast_2D(bandwidth))\nself.s... | <|body_start_0|>
self.num_feat_per_dim = num_feat_per_dim
self.scale = to.sqrt(to.tensor(2.0 / num_feat_per_dim))
self.freq = to.randn(num_feat_per_dim, inp_dim)
if not isinstance(bandwidth, to.Tensor):
bandwidth = to.from_numpy(np.asanyarray(bandwidth))
self.freq *= ... | Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007 | RandFourierFeat | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandFourierFeat:
"""Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007"""
def __init__(self, inp_dim: int, num_feat_per_dim: int, bandwidth: Union[float, np.ndarray, to.Tensor]):
"""Gaussian kernel: $k(x,y) = ... | stack_v2_sparse_classes_75kplus_train_003373 | 17,010 | permissive | [
{
"docstring": "Gaussian kernel: $k(x,y) = \\\\exp(-\\\\sigma**2 / (2*d) * ||x-y||^2)$ Sample from $\\\\mathcal{N}(0,1)$ and scale the result by $\\\\sigma / \\\\sqrt{2*d}$ :param inp_dim: flat dimension of the inputs i.e. the observations, called $d$ in [1] :param num_feat_per_dim: number of random Fourier fea... | 2 | stack_v2_sparse_classes_30k_train_004784 | Implement the Python class `RandFourierFeat` described below.
Class description:
Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007
Method signatures and docstrings:
- def __init__(self, inp_dim: int, num_feat_per_dim: int, bandwidth: Union[fl... | Implement the Python class `RandFourierFeat` described below.
Class description:
Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007
Method signatures and docstrings:
- def __init__(self, inp_dim: int, num_feat_per_dim: int, bandwidth: Union[fl... | 15901f70f0538bce19acdda2a0018984f67cc0fe | <|skeleton|>
class RandFourierFeat:
"""Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007"""
def __init__(self, inp_dim: int, num_feat_per_dim: int, bandwidth: Union[float, np.ndarray, to.Tensor]):
"""Gaussian kernel: $k(x,y) = ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandFourierFeat:
"""Random Fourier features .. seealso:: [1] A. Rahimi and B. Recht "Random Features for Large-Scale Kernel Machines", NIPS, 2007"""
def __init__(self, inp_dim: int, num_feat_per_dim: int, bandwidth: Union[float, np.ndarray, to.Tensor]):
"""Gaussian kernel: $k(x,y) = \\exp(-\\sigm... | the_stack_v2_python_sparse | Pyrado/pyrado/policies/features.py | arlene-kuehn/SimuRLacra | train | 0 |
3b8cb8e60ca0e9206d8de760bd899198e45ea77a | [
"url = self.base_path + '?contract_id=%s' % contract_id\nresp = session.get(url, endpoint_filter=self.service)\nself._translate_response(resp, has_body=True)\nreturn self",
"url = self.base_path + '/%s/roles/%s' % (iam_group_id, iam_role_id)\nresp = session.put(url, endpoint_filter=self.service)\nself._translate_... | <|body_start_0|>
url = self.base_path + '?contract_id=%s' % contract_id
resp = session.get(url, endpoint_filter=self.service)
self._translate_response(resp, has_body=True)
return self
<|end_body_0|>
<|body_start_1|>
url = self.base_path + '/%s/roles/%s' % (iam_group_id, iam_role... | IAMGroup | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IAMGroup:
def list(self, session, contract_id):
"""List iam groups by contract id"""
<|body_0|>
def assign_iam_role(self, session, iam_group_id, iam_role_id):
"""Assignment of the IAM Role to the IAM Group."""
<|body_1|>
def delete_assign_iam_role(self, ... | stack_v2_sparse_classes_75kplus_train_003374 | 3,642 | permissive | [
{
"docstring": "List iam groups by contract id",
"name": "list",
"signature": "def list(self, session, contract_id)"
},
{
"docstring": "Assignment of the IAM Role to the IAM Group.",
"name": "assign_iam_role",
"signature": "def assign_iam_role(self, session, iam_group_id, iam_role_id)"
... | 6 | stack_v2_sparse_classes_30k_train_033012 | Implement the Python class `IAMGroup` described below.
Class description:
Implement the IAMGroup class.
Method signatures and docstrings:
- def list(self, session, contract_id): List iam groups by contract id
- def assign_iam_role(self, session, iam_group_id, iam_role_id): Assignment of the IAM Role to the IAM Group.... | Implement the Python class `IAMGroup` described below.
Class description:
Implement the IAMGroup class.
Method signatures and docstrings:
- def list(self, session, contract_id): List iam groups by contract id
- def assign_iam_role(self, session, iam_group_id, iam_role_id): Assignment of the IAM Role to the IAM Group.... | c2dafba850c4e6fb55b5e10de79257bbc9a01af3 | <|skeleton|>
class IAMGroup:
def list(self, session, contract_id):
"""List iam groups by contract id"""
<|body_0|>
def assign_iam_role(self, session, iam_group_id, iam_role_id):
"""Assignment of the IAM Role to the IAM Group."""
<|body_1|>
def delete_assign_iam_role(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IAMGroup:
def list(self, session, contract_id):
"""List iam groups by contract id"""
url = self.base_path + '?contract_id=%s' % contract_id
resp = session.get(url, endpoint_filter=self.service)
self._translate_response(resp, has_body=True)
return self
def assign_ia... | the_stack_v2_python_sparse | ecl/sss/v1/iam_group.py | nttcom/eclsdk | train | 5 | |
45a198a120472b8c3f4dcf75dd05c0e2d50a3b67 | [
"self.sessionsByKey = {}\nfor session in sessions:\n key = session.getKey()\n if not key in self.sessionsByKey:\n self.sessionsByKey[key] = [session]\n else:\n self.sessionsByKey[key].append(session)",
"succeeded, failed = (0, 0)\ntaskDurations = []\nsessionDurations = []\nlastSession = Non... | <|body_start_0|>
self.sessionsByKey = {}
for session in sessions:
key = session.getKey()
if not key in self.sessionsByKey:
self.sessionsByKey[key] = [session]
else:
self.sessionsByKey[key].append(session)
<|end_body_0|>
<|body_start_1|... | provides functionality to print summary and detailed statistic | Statistic | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Statistic:
"""provides functionality to print summary and detailed statistic"""
def __init__(self, sessions):
"""stores sessions by session key"""
<|body_0|>
def printSummary(self):
"""independent of type of session or task you get an overview"""
<|body_1... | stack_v2_sparse_classes_75kplus_train_003375 | 19,342 | permissive | [
{
"docstring": "stores sessions by session key",
"name": "__init__",
"signature": "def __init__(self, sessions)"
},
{
"docstring": "independent of type of session or task you get an overview",
"name": "printSummary",
"signature": "def printSummary(self)"
},
{
"docstring": "prints... | 3 | stack_v2_sparse_classes_30k_train_021999 | Implement the Python class `Statistic` described below.
Class description:
provides functionality to print summary and detailed statistic
Method signatures and docstrings:
- def __init__(self, sessions): stores sessions by session key
- def printSummary(self): independent of type of session or task you get an overvie... | Implement the Python class `Statistic` described below.
Class description:
provides functionality to print summary and detailed statistic
Method signatures and docstrings:
- def __init__(self, sessions): stores sessions by session key
- def printSummary(self): independent of type of session or task you get an overvie... | d097ca0ad6a6aee2180d32dce6a3322621f655fd | <|skeleton|>
class Statistic:
"""provides functionality to print summary and detailed statistic"""
def __init__(self, sessions):
"""stores sessions by session key"""
<|body_0|>
def printSummary(self):
"""independent of type of session or task you get an overview"""
<|body_1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Statistic:
"""provides functionality to print summary and detailed statistic"""
def __init__(self, sessions):
"""stores sessions by session key"""
self.sessionsByKey = {}
for session in sessions:
key = session.getKey()
if not key in self.sessionsByKey:
... | the_stack_v2_python_sparse | recipes/Python/578111_Learning_calculate_mental/recipe-578111.py | betty29/code-1 | train | 0 |
aba5f39be17f3e4b8dfe4d9e04aa933084f8328b | [
"self.value = value\nself.left = None\nself.right = None",
"num_univals = 0\nis_unival = True\nif self.left:\n n, common_value = self.left.count_univals()\n num_univals += n\n if common_value != self.value:\n is_unival = False\nif self.right:\n n, common_value = self.right.count_univals()\n ... | <|body_start_0|>
self.value = value
self.left = None
self.right = None
<|end_body_0|>
<|body_start_1|>
num_univals = 0
is_unival = True
if self.left:
n, common_value = self.left.count_univals()
num_univals += n
if common_value != self.... | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
def __init__(self, value):
"""value cannot be None"""
<|body_0|>
def count_univals(self):
"""Return (num_univals, common_value_or_None)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.value = value
self.left = None
self.ri... | stack_v2_sparse_classes_75kplus_train_003376 | 1,483 | no_license | [
{
"docstring": "value cannot be None",
"name": "__init__",
"signature": "def __init__(self, value)"
},
{
"docstring": "Return (num_univals, common_value_or_None)",
"name": "count_univals",
"signature": "def count_univals(self)"
}
] | 2 | null | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def __init__(self, value): value cannot be None
- def count_univals(self): Return (num_univals, common_value_or_None) | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def __init__(self, value): value cannot be None
- def count_univals(self): Return (num_univals, common_value_or_None)
<|skeleton|>
class Node:
def __init__(self, value):
""... | 2fdc609b03ba6f2e8c57313084c74d171c538a08 | <|skeleton|>
class Node:
def __init__(self, value):
"""value cannot be None"""
<|body_0|>
def count_univals(self):
"""Return (num_univals, common_value_or_None)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Node:
def __init__(self, value):
"""value cannot be None"""
self.value = value
self.left = None
self.right = None
def count_univals(self):
"""Return (num_univals, common_value_or_None)"""
num_univals = 0
is_unival = True
if self.left:
... | the_stack_v2_python_sparse | prob8.py | dustinboswell/daily-coding-problem | train | 0 | |
099a75548caf7eacf69f71558bdd95d3a448cb40 | [
"self = object.__new__(cls)\nself.all = 0\nself.ban = 0\nself.kick = 0\nself.mute = 0\nreturn self",
"self.all += 1\nif action_type == TYPE_BAN:\n self.ban += 1\nelif action_type == TYPE_KICK:\n self.kick += 1\nelif action_type == TYPE_MUTE:\n self.mute += 1",
"repr_parts = ['<', self.__class__.__name_... | <|body_start_0|>
self = object.__new__(cls)
self.all = 0
self.ban = 0
self.kick = 0
self.mute = 0
return self
<|end_body_0|>
<|body_start_1|>
self.all += 1
if action_type == TYPE_BAN:
self.ban += 1
elif action_type == TYPE_KICK:
... | Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed. | ActionCounter | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionCounter:
"""Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed."""
def __new__(cls):
"""Creates a new action counter."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_003377 | 20,308 | no_license | [
{
"docstring": "Creates a new action counter.",
"name": "__new__",
"signature": "def __new__(cls)"
},
{
"docstring": "Increments the action counter counter by the given action type. Parameters ---------- action_type : `int` Action type identifier.",
"name": "increment_by",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_043352 | Implement the Python class `ActionCounter` described below.
Class description:
Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed.
Method signatures and docstrings:
- def __new__(cls): Crea... | Implement the Python class `ActionCounter` described below.
Class description:
Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed.
Method signatures and docstrings:
- def __new__(cls): Crea... | 74f92b598e86606ea3a269311316cddd84a5215f | <|skeleton|>
class ActionCounter:
"""Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed."""
def __new__(cls):
"""Creates a new action counter."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActionCounter:
"""Used to count moderation actions. Attributes ---------- all : `int` The total actions executed. ban : `int` Bans executed. kick : `int` Kicks executed. mute : `int` Mutes executed."""
def __new__(cls):
"""Creates a new action counter."""
self = object.__new__(cls)
... | the_stack_v2_python_sparse | koishi/plugins/moderation/other/top_list.py | HuyaneMatsu/Koishi | train | 17 |
0585a76b1418b599c32a59a6effb8a81cfcf5923 | [
"if parameters.Has(old_variable_name):\n if not parameters.Has(new_variable_name):\n KM.Logger.PrintWarning(context_string, '\\n\\x1b[1;31m[DEPRECATED INPUT PARAMETERS] \\x1b[0m' + \"'\" + old_variable_name + \"' is deprecated; use '\" + new_variable_name + \"' instead.\")\n return True\n else:\... | <|body_start_0|>
if parameters.Has(old_variable_name):
if not parameters.Has(new_variable_name):
KM.Logger.PrintWarning(context_string, '\n\x1b[1;31m[DEPRECATED INPUT PARAMETERS] \x1b[0m' + "'" + old_variable_name + "' is deprecated; use '" + new_variable_name + "' instead.")
... | This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this encapsulation are: 1. Avoid repeating too much cod... | DeprecationManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this enca... | stack_v2_sparse_classes_75kplus_train_003378 | 3,012 | permissive | [
{
"docstring": "Check if a given deprecated variable is present in a given parameters object (Parameters object)",
"name": "HasDeprecatedVariable",
"signature": "def HasDeprecatedVariable(context_string, parameters, old_variable_name, new_variable_name)"
},
{
"docstring": "Replace a key by anoth... | 2 | stack_v2_sparse_classes_30k_train_019435 | Implement the Python class `DeprecationManager` described below.
Class description:
This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. ... | Implement the Python class `DeprecationManager` described below.
Class description:
This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. ... | 366949ec4e3651702edc6ac3061d2988f10dd271 | <|skeleton|>
class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this enca... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeprecationManager:
"""This class is intended to encapsulate common operations that may be needed when dealing with deprecated input variable names. Its original purpose is the management of json-type input, although it may be extended to other input types. The basic goals that inspired this encapsulation are... | the_stack_v2_python_sparse | kratos/python_scripts/deprecation_management.py | KratosMultiphysics/Kratos | train | 994 |
5f74d2d9173fb1ddd102625fc8f122dca8d7b73e | [
"self.script = script\nself.example_command = example_command\nself.searchtext = 'output'",
"opt_dict = parse_example_command(self.example_command)\noutputs = {}\nfor key, value in opt_dict.iteritems():\n if self.searchtext in key:\n for i, line in enumerate(self.script):\n line = line.strip(... | <|body_start_0|>
self.script = script
self.example_command = example_command
self.searchtext = 'output'
<|end_body_0|>
<|body_start_1|>
opt_dict = parse_example_command(self.example_command)
outputs = {}
for key, value in opt_dict.iteritems():
if self.searcht... | Output class for parsing outputs. | Output | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Output:
"""Output class for parsing outputs."""
def __init__(self, script, example_command):
"""Initialize Input with searchtext - output."""
<|body_0|>
def find_outputs(self):
"""Find outputs in example command."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_75kplus_train_003379 | 5,433 | permissive | [
{
"docstring": "Initialize Input with searchtext - output.",
"name": "__init__",
"signature": "def __init__(self, script, example_command)"
},
{
"docstring": "Find outputs in example command.",
"name": "find_outputs",
"signature": "def find_outputs(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011389 | Implement the Python class `Output` described below.
Class description:
Output class for parsing outputs.
Method signatures and docstrings:
- def __init__(self, script, example_command): Initialize Input with searchtext - output.
- def find_outputs(self): Find outputs in example command. | Implement the Python class `Output` described below.
Class description:
Output class for parsing outputs.
Method signatures and docstrings:
- def __init__(self, script, example_command): Initialize Input with searchtext - output.
- def find_outputs(self): Find outputs in example command.
<|skeleton|>
class Output:
... | 063bf0dca5d465466aefa77edaf47df12c4ff932 | <|skeleton|>
class Output:
"""Output class for parsing outputs."""
def __init__(self, script, example_command):
"""Initialize Input with searchtext - output."""
<|body_0|>
def find_outputs(self):
"""Find outputs in example command."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Output:
"""Output class for parsing outputs."""
def __init__(self, script, example_command):
"""Initialize Input with searchtext - output."""
self.script = script
self.example_command = example_command
self.searchtext = 'output'
def find_outputs(self):
"""Find... | the_stack_v2_python_sparse | .venv/lib/python2.7/site-packages/planemo/rscript_parse.py | maumauleon/galaxy-irri-dev | train | 1 |
c25f12f104c9433903baa15292696b05b0171894 | [
"super(MainWindow, self).__init__()\nself.w = 0\nself.h = 0\nself.init_ui(name, title)",
"self.w = 140\nself.h = 100\nself.setObjectName(name)\nself.setWindowTitle(title)\nself.resize(self.w, self.h)\nself.custom_edit = CustomEdit(self, size=(10, 10, 120, 24), name='custom_edit', search=False)\ndata_list = [i * (... | <|body_start_0|>
super(MainWindow, self).__init__()
self.w = 0
self.h = 0
self.init_ui(name, title)
<|end_body_0|>
<|body_start_1|>
self.w = 140
self.h = 100
self.setObjectName(name)
self.setWindowTitle(title)
self.resize(self.w, self.h)
s... | 主窗口,继承了QMainWindow类 | MainWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
<|body_0|>
def init_ui(self, name, title):
"""初始化UI界面"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MainWindow, self).__init__()
self.w = 0
... | stack_v2_sparse_classes_75kplus_train_003380 | 5,622 | no_license | [
{
"docstring": "初始化类的成员变量",
"name": "__init__",
"signature": "def __init__(self, name, title)"
},
{
"docstring": "初始化UI界面",
"name": "init_ui",
"signature": "def init_ui(self, name, title)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011600 | Implement the Python class `MainWindow` described below.
Class description:
主窗口,继承了QMainWindow类
Method signatures and docstrings:
- def __init__(self, name, title): 初始化类的成员变量
- def init_ui(self, name, title): 初始化UI界面 | Implement the Python class `MainWindow` described below.
Class description:
主窗口,继承了QMainWindow类
Method signatures and docstrings:
- def __init__(self, name, title): 初始化类的成员变量
- def init_ui(self, name, title): 初始化UI界面
<|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
... | 925612139b6ac62dfb0c1a5d143485f1fd36645a | <|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
<|body_0|>
def init_ui(self, name, title):
"""初始化UI界面"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
super(MainWindow, self).__init__()
self.w = 0
self.h = 0
self.init_ui(name, title)
def init_ui(self, name, title):
"""初始化UI界面"""
self.w = 140
self.h ... | the_stack_v2_python_sparse | Custom_Edit.py | harry2002731/Stock-programe | train | 2 |
9c0c3b64e469c154e4385b71e27e8bd3a22eebf6 | [
"ret = {}\nsds = self.db.Status\nquery = {'component': component}\nlogging.debug(f'MONGO-START: db.Status.find(filter={query}, projection={REMOVE_ID})')\nasync for row in sds.find(filter=query, projection=REMOVE_ID):\n name = row['name']\n del row['component']\n del row['name']\n update_dict = {name: ro... | <|body_start_0|>
ret = {}
sds = self.db.Status
query = {'component': component}
logging.debug(f'MONGO-START: db.Status.find(filter={query}, projection={REMOVE_ID})')
async for row in sds.find(filter=query, projection=REMOVE_ID):
name = row['name']
del row[... | StatusComponentHandler is a BaseLTAHandler that handles component status routes. | StatusComponentHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusComponentHandler:
"""StatusComponentHandler is a BaseLTAHandler that handles component status routes."""
async def get(self, component: str) -> None:
"""Get the detailed status of components of a given type. This handles the route: GET /status/{component-type} In MongoDB, we st... | stack_v2_sparse_classes_75kplus_train_003381 | 42,572 | permissive | [
{
"docstring": "Get the detailed status of components of a given type. This handles the route: GET /status/{component-type} In MongoDB, we store the status records like this: { \"component\": \"picker\" \"name\": \"picker-node001\" keys: values } But the response to GET /status/picker should be like this: { \"p... | 2 | stack_v2_sparse_classes_30k_train_039217 | Implement the Python class `StatusComponentHandler` described below.
Class description:
StatusComponentHandler is a BaseLTAHandler that handles component status routes.
Method signatures and docstrings:
- async def get(self, component: str) -> None: Get the detailed status of components of a given type. This handles ... | Implement the Python class `StatusComponentHandler` described below.
Class description:
StatusComponentHandler is a BaseLTAHandler that handles component status routes.
Method signatures and docstrings:
- async def get(self, component: str) -> None: Get the detailed status of components of a given type. This handles ... | 12719efa84be2281debe98a18c69bbe7a6d0f399 | <|skeleton|>
class StatusComponentHandler:
"""StatusComponentHandler is a BaseLTAHandler that handles component status routes."""
async def get(self, component: str) -> None:
"""Get the detailed status of components of a given type. This handles the route: GET /status/{component-type} In MongoDB, we st... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StatusComponentHandler:
"""StatusComponentHandler is a BaseLTAHandler that handles component status routes."""
async def get(self, component: str) -> None:
"""Get the detailed status of components of a given type. This handles the route: GET /status/{component-type} In MongoDB, we store the statu... | the_stack_v2_python_sparse | lta/rest_server.py | blinkdog/lta | train | 0 |
e1054b304d7557ebad7fbfe99f4e76880defd500 | [
"self.host = database_config['host']\nif user is None:\n self.user = database_config['user']\nelse:\n self.user = user\nif password is None:\n self.password = database_config['password']\nelse:\n self.password = password\nself.database_name = database_config['database']\nif 'port' in database_config:\n ... | <|body_start_0|>
self.host = database_config['host']
if user is None:
self.user = database_config['user']
else:
self.user = user
if password is None:
self.password = database_config['password']
else:
self.password = password
... | Class to hold info on some connection. | DatabaseConnector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseConnector:
"""Class to hold info on some connection."""
def __init__(self, database_config, user=None, password=None):
"""Class to easily connect and disconnect some database. :param database_config: The config section for the database."""
<|body_0|>
def connect(... | stack_v2_sparse_classes_75kplus_train_003382 | 1,483 | no_license | [
{
"docstring": "Class to easily connect and disconnect some database. :param database_config: The config section for the database.",
"name": "__init__",
"signature": "def __init__(self, database_config, user=None, password=None)"
},
{
"docstring": "Connect to some database. :return: The database... | 2 | stack_v2_sparse_classes_30k_train_007074 | Implement the Python class `DatabaseConnector` described below.
Class description:
Class to hold info on some connection.
Method signatures and docstrings:
- def __init__(self, database_config, user=None, password=None): Class to easily connect and disconnect some database. :param database_config: The config section ... | Implement the Python class `DatabaseConnector` described below.
Class description:
Class to hold info on some connection.
Method signatures and docstrings:
- def __init__(self, database_config, user=None, password=None): Class to easily connect and disconnect some database. :param database_config: The config section ... | e10166847bd112fcd4fb7044e1478515104017e4 | <|skeleton|>
class DatabaseConnector:
"""Class to hold info on some connection."""
def __init__(self, database_config, user=None, password=None):
"""Class to easily connect and disconnect some database. :param database_config: The config section for the database."""
<|body_0|>
def connect(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatabaseConnector:
"""Class to hold info on some connection."""
def __init__(self, database_config, user=None, password=None):
"""Class to easily connect and disconnect some database. :param database_config: The config section for the database."""
self.host = database_config['host']
... | the_stack_v2_python_sparse | scripts/database/connect_database.py | Tubbz-alt/harmony | train | 0 |
a0ec762e7ad34c70bf99512d247f61f701998161 | [
"super(BasicBlock, self).__init__()\nself.filter_num = filter_num\nself.l2_regularization = tf.keras.regularizers.l2(l2_amount)\nself.conv1 = tf.keras.layers.Conv2D(filters=filter_num, kernel_size=(3, 3), strides=stride, padding='same', bias_regularizer=self.l2_regularization, kernel_regularizer=self.l2_regularizat... | <|body_start_0|>
super(BasicBlock, self).__init__()
self.filter_num = filter_num
self.l2_regularization = tf.keras.regularizers.l2(l2_amount)
self.conv1 = tf.keras.layers.Conv2D(filters=filter_num, kernel_size=(3, 3), strides=stride, padding='same', bias_regularizer=self.l2_regularizatio... | Implementation of a basic block layer used for the ResNet type I model. | BasicBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicBlock:
"""Implementation of a basic block layer used for the ResNet type I model."""
def __init__(self, filter_num, stride=1, l2_amount=0.1):
"""Initialises the basic block by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of ... | stack_v2_sparse_classes_75kplus_train_003383 | 6,270 | permissive | [
{
"docstring": "Initialises the basic block by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of filters in both of the two dimensional convolution layers. :param stride: the stride for the two dimensional convolution layers. :param l2_amount: the l2 regulari... | 2 | stack_v2_sparse_classes_30k_train_007188 | Implement the Python class `BasicBlock` described below.
Class description:
Implementation of a basic block layer used for the ResNet type I model.
Method signatures and docstrings:
- def __init__(self, filter_num, stride=1, l2_amount=0.1): Initialises the basic block by providing the number of filter, strides and l2... | Implement the Python class `BasicBlock` described below.
Class description:
Implementation of a basic block layer used for the ResNet type I model.
Method signatures and docstrings:
- def __init__(self, filter_num, stride=1, l2_amount=0.1): Initialises the basic block by providing the number of filter, strides and l2... | 084a0ab5807e912bee80ae2dcf5f22b7ef8579a1 | <|skeleton|>
class BasicBlock:
"""Implementation of a basic block layer used for the ResNet type I model."""
def __init__(self, filter_num, stride=1, l2_amount=0.1):
"""Initialises the basic block by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicBlock:
"""Implementation of a basic block layer used for the ResNet type I model."""
def __init__(self, filter_num, stride=1, l2_amount=0.1):
"""Initialises the basic block by providing the number of filter, strides and l2 regularisation amount. :param filter_num: the number of filters in bo... | the_stack_v2_python_sparse | src/models/resnet/residual_block.py | FabianGroeger96/semantic-segmentation-dtd | train | 3 |
e3bdc17e158e8f2e9d6404e510b93140dc2d89f9 | [
"self.headerNames = []\nself.outData = []\nfor outFile in outFiles:\n outFileName, outFileType = (outFile[0], outFile[1])\n if outFileType == 'uncertainty':\n headers, data = self.getUncertainty(outFileName)\n self.headerNames.extend(headers)\n self.outData.extend(data)\n elif outFileT... | <|body_start_0|>
self.headerNames = []
self.outData = []
for outFile in outFiles:
outFileName, outFileType = (outFile[0], outFile[1])
if outFileType == 'uncertainty':
headers, data = self.getUncertainty(outFileName)
self.headerNames.extend(... | Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV | SaphireData | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SaphireData:
"""Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV"""
def __init__(self, outFiles):
"""Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None"""
<|body_0|>
def getUncertainty(self, outName):
... | stack_v2_sparse_classes_75kplus_train_003384 | 4,507 | permissive | [
{
"docstring": "Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None",
"name": "__init__",
"signature": "def __init__(self, outFiles)"
},
{
"docstring": "Method to extract the uncertainty information of Event Tree or Fault Tree from SAPHIRE output files @ In, ou... | 4 | stack_v2_sparse_classes_30k_train_007557 | Implement the Python class `SaphireData` described below.
Class description:
Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV
Method signatures and docstrings:
- def __init__(self, outFiles): Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None
- def getUn... | Implement the Python class `SaphireData` described below.
Class description:
Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV
Method signatures and docstrings:
- def __init__(self, outFiles): Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None
- def getUn... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class SaphireData:
"""Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV"""
def __init__(self, outFiles):
"""Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None"""
<|body_0|>
def getUncertainty(self, outName):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SaphireData:
"""Class that parses output of SAPHIRE outputs and write a RAVEN compatible CSV"""
def __init__(self, outFiles):
"""Initialize the class @ In, outFiles, list, list of output files of SAPHIRE @ Out, None"""
self.headerNames = []
self.outData = []
for outFile in... | the_stack_v2_python_sparse | ravenframework/CodeInterfaceClasses/Saphire/SaphireData.py | idaholab/raven | train | 201 |
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_75kplus_train_003385 | 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_037251 | 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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | 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 | |
9749640fcda24434b223602f0cfbe2dcc4ab07f7 | [
"assert isinstance(wrapper, ForwardWrapperBase)\nassert isinstance(self.container_type, Container)\ncontainer_tmp_var = wrapper.declarations.declare_variable(self.container_type.full_name, self.name + '_value', self.default_value)\nif self.direction & Parameter.DIRECTION_IN:\n wrapper.parse_params.add_parameter(... | <|body_start_0|>
assert isinstance(wrapper, ForwardWrapperBase)
assert isinstance(self.container_type, Container)
container_tmp_var = wrapper.declarations.declare_variable(self.container_type.full_name, self.name + '_value', self.default_value)
if self.direction & Parameter.DIRECTION_IN:... | Container handlers | ContainerRefParameter | [
"LGPL-2.1-only",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
<|body_0|>
def convert_c_to_python(self, wrapper):
"""Write some code before calling the Python method."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus_train_003386 | 34,197 | permissive | [
{
"docstring": "parses python args to get C++ value",
"name": "convert_python_to_c",
"signature": "def convert_python_to_c(self, wrapper)"
},
{
"docstring": "Write some code before calling the Python method.",
"name": "convert_c_to_python",
"signature": "def convert_c_to_python(self, wra... | 2 | stack_v2_sparse_classes_30k_test_000421 | Implement the Python class `ContainerRefParameter` described below.
Class description:
Container handlers
Method signatures and docstrings:
- def convert_python_to_c(self, wrapper): parses python args to get C++ value
- def convert_c_to_python(self, wrapper): Write some code before calling the Python method. | Implement the Python class `ContainerRefParameter` described below.
Class description:
Container handlers
Method signatures and docstrings:
- def convert_python_to_c(self, wrapper): parses python args to get C++ value
- def convert_c_to_python(self, wrapper): Write some code before calling the Python method.
<|skele... | cbedcf671ba19fded26e4776c0e068f81f068dfd | <|skeleton|>
class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
<|body_0|>
def convert_c_to_python(self, wrapper):
"""Write some code before calling the Python method."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
assert isinstance(wrapper, ForwardWrapperBase)
assert isinstance(self.container_type, Container)
container_tmp_var = wrapper.declarations.decla... | the_stack_v2_python_sparse | ns3/pybindgen-0.17.0.post57+nga6376f2/pybindgen/container.py | cyliustack/clusim | train | 7 |
2e4fc1df6c8477fca0febcc0652485ae5da19d34 | [
"if not username or not password:\n logger.error('Attempted to authenticate HTTP Digest user without supplying either a username or password parameter! This may be a bug in Review Board. Please report it.')\n return None\nusername = username.strip()\nfilename = settings.DIGEST_FILE_LOCATION\ndigest_text = '%s... | <|body_start_0|>
if not username or not password:
logger.error('Attempted to authenticate HTTP Digest user without supplying either a username or password parameter! This may be a bug in Review Board. Please report it.')
return None
username = username.strip()
filename = ... | Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_digest_file_location`` in the site configuration. ... | HTTPDigestBackend | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_diges... | stack_v2_sparse_classes_75kplus_train_003387 | 5,413 | permissive | [
{
"docstring": "Authenticate a user against the HTTP password file. This will attempt to authenticate the user against the digest password file. If the username and password are valid, a user will be returned, and added to the database if it doesn't already exist. Version Changed: 6.0: * ``request`` is now opti... | 2 | stack_v2_sparse_classes_30k_train_009504 | Implement the Python class `HTTPDigestBackend` described below.
Class description:
Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file... | Implement the Python class `HTTPDigestBackend` described below.
Class description:
Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_diges... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_digest_file_locati... | the_stack_v2_python_sparse | reviewboard/accounts/backends/http_digest.py | reviewboard/reviewboard | train | 1,141 |
3ba98098466b472909ac637a0b4118f66025cc13 | [
"if not self._saved_mail_backend:\n self._saved_mail_backend = smtp.EmailBackend(SMTP_HOST, SMTP_PORT)\nreturn self._saved_mail_backend",
"emails = params\nif not emails:\n log.error('Invalid email address from params: %s' % params)\n raise gen.Return()\nsubject = 'Warning! %s has an alert!' % path\nbody... | <|body_start_0|>
if not self._saved_mail_backend:
self._saved_mail_backend = smtp.EmailBackend(SMTP_HOST, SMTP_PORT)
return self._saved_mail_backend
<|end_body_0|>
<|body_start_1|>
emails = params
if not emails:
log.error('Invalid email address from params: %s' %... | Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /services/foo/min_1: alerter: email: you@home.... | EmailAlerter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailAlerter:
"""Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /servi... | stack_v2_sparse_classes_75kplus_train_003388 | 4,661 | no_license | [
{
"docstring": "Returns a single EmailBackend object every time its called",
"name": "_mail_backend",
"signature": "def _mail_backend(self)"
},
{
"docstring": "Send an email alert. args: path: String of the path that is being alerted. state: String of the monitor.states for given path. message: ... | 2 | stack_v2_sparse_classes_30k_train_048227 | Implement the Python class `EmailAlerter` described below.
Class description:
Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configu... | Implement the Python class `EmailAlerter` described below.
Class description:
Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configu... | d33720eeec274396435896ed4fb1c71025344fc1 | <|skeleton|>
class EmailAlerter:
"""Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /servi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailAlerter:
"""Simple Email-based Alerter Object This object handles incoming alert calls from the main zk_monitor.alerts.Dispatcher class and converts them into email messages. Your zk_monitor YAML configuration file must include (for each path) a configured 'alerter' section like this: /services/foo/min_1... | the_stack_v2_python_sparse | zk_monitor/alerts/email.py | Nextdoor/zkmonitor | train | 4 |
b05a6ab488b278b2517584bf4ef8c76a5461e8d5 | [
"self.reqparse = reqparse.RequestParser()\nself.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide email, contact, password and role')\nself.reqparse.add_argument('email', type=str, required=True, help='Email not given, provide username, contact, password and role')\nself.r... | <|body_start_0|>
self.reqparse = reqparse.RequestParser()
self.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide email, contact, password and role')
self.reqparse.add_argument('email', type=str, required=True, help='Email not given, provide username, co... | class view registers user | RegisterUser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterUser:
"""class view registers user"""
def __init__(self):
"""constructor method for the RegisterUser class"""
<|body_0|>
def post(self):
"""method for post request registers new user"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.r... | stack_v2_sparse_classes_75kplus_train_003389 | 4,568 | no_license | [
{
"docstring": "constructor method for the RegisterUser class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "method for post request registers new user",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034276 | Implement the Python class `RegisterUser` described below.
Class description:
class view registers user
Method signatures and docstrings:
- def __init__(self): constructor method for the RegisterUser class
- def post(self): method for post request registers new user | Implement the Python class `RegisterUser` described below.
Class description:
class view registers user
Method signatures and docstrings:
- def __init__(self): constructor method for the RegisterUser class
- def post(self): method for post request registers new user
<|skeleton|>
class RegisterUser:
"""class view... | 9af0b1c029279a9fc0ea6047e9d45fcf7d51f22e | <|skeleton|>
class RegisterUser:
"""class view registers user"""
def __init__(self):
"""constructor method for the RegisterUser class"""
<|body_0|>
def post(self):
"""method for post request registers new user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegisterUser:
"""class view registers user"""
def __init__(self):
"""constructor method for the RegisterUser class"""
self.reqparse = reqparse.RequestParser()
self.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide email, contact, password... | the_stack_v2_python_sparse | api/views/userview.py | billkabanga/fast-food-fast-2 | train | 2 |
abd8fc2a554d030bd5a47829b325dbc3682785f4 | [
"if self.no_deps:\n develop.install_for_development(self)\n return\nself._run_pip(['install', '-e', '.'])\nself._run_pip(['install', '-r', 'dev-requirements.txt'])",
"cmd = subprocess.list2cmdline([sys.executable, '-m', 'pip'] + args)\nret = os.system(cmd)\nif ret != 0:\n raise RuntimeError('Failed to ru... | <|body_start_0|>
if self.no_deps:
develop.install_for_development(self)
return
self._run_pip(['install', '-e', '.'])
self._run_pip(['install', '-r', 'dev-requirements.txt'])
<|end_body_0|>
<|body_start_1|>
cmd = subprocess.list2cmdline([sys.executable, '-m', 'pip... | Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1 | DevelopCommand | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DevelopCommand:
"""Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1"""
def install_for_development(self):
"""Install the package for development. This take... | stack_v2_sparse_classes_75kplus_train_003390 | 6,380 | permissive | [
{
"docstring": "Install the package for development. This takes care of the work of installing all dependencies.",
"name": "install_for_development",
"signature": "def install_for_development(self)"
},
{
"docstring": "Run pip. Args: args (list): Arguments to pass to :command:`pip`. Raises: Runti... | 2 | null | Implement the Python class `DevelopCommand` described below.
Class description:
Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1
Method signatures and docstrings:
- def install_for_developm... | Implement the Python class `DevelopCommand` described below.
Class description:
Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1
Method signatures and docstrings:
- def install_for_developm... | b59b566e127b5ef1b08f3189f1aa0194b7437d94 | <|skeleton|>
class DevelopCommand:
"""Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1"""
def install_for_development(self):
"""Install the package for development. This take... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DevelopCommand:
"""Installs Review Bot in developer mode. This will install all standard and development dependencies and add the source tree to the Python module search path. Version Added: 3.2.1"""
def install_for_development(self):
"""Install the package for development. This takes care of the... | the_stack_v2_python_sparse | bot/setup.py | reviewboard/ReviewBot | train | 110 |
5a8e8464d120b2fcb4a61b693c828f79db7b439c | [
"dim_ob = ob_space.shape[0]\nn_actions = ac_space.n\nexpected_shape = (dim_ob + 1) * n_actions\nif len(theta) != expected_shape:\n raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta)))\nself.W = theta[0:dim_ob * n_actions].reshape(dim_ob, n_actions)\nself.b = the... | <|body_start_0|>
dim_ob = ob_space.shape[0]
n_actions = ac_space.n
expected_shape = (dim_ob + 1) * n_actions
if len(theta) != expected_shape:
raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta)))
self.W = theta[0:dim_o... | Deterministicially select an action from a discrete action space using a linear function. | DeterministicDiscreteActionLinearPolicy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeterministicDiscreteActionLinearPolicy:
"""Deterministicially select an action from a discrete action space using a linear function."""
def __init__(self, theta, ob_space, ac_space) -> None:
"""dim_ob: dimension of observations n_actions: number of actions theta: flat vector of para... | stack_v2_sparse_classes_75kplus_train_003391 | 7,807 | permissive | [
{
"docstring": "dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters",
"name": "__init__",
"signature": "def __init__(self, theta, ob_space, ac_space) -> None"
},
{
"docstring": "Select the action that got the highest value from the linear function.",
... | 2 | stack_v2_sparse_classes_30k_train_002027 | Implement the Python class `DeterministicDiscreteActionLinearPolicy` described below.
Class description:
Deterministicially select an action from a discrete action space using a linear function.
Method signatures and docstrings:
- def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observation... | Implement the Python class `DeterministicDiscreteActionLinearPolicy` described below.
Class description:
Deterministicially select an action from a discrete action space using a linear function.
Method signatures and docstrings:
- def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observation... | d63ea61f8379a7e0a9786e4bb717813ed53bb8f0 | <|skeleton|>
class DeterministicDiscreteActionLinearPolicy:
"""Deterministicially select an action from a discrete action space using a linear function."""
def __init__(self, theta, ob_space, ac_space) -> None:
"""dim_ob: dimension of observations n_actions: number of actions theta: flat vector of para... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeterministicDiscreteActionLinearPolicy:
"""Deterministicially select an action from a discrete action space using a linear function."""
def __init__(self, theta, ob_space, ac_space) -> None:
"""dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters"""
... | the_stack_v2_python_sparse | yarll/agents/basic/cem.py | arnomoonens/yarll | train | 21 |
1bd1c02b237a89ac9c5c9cb3be0e2cf1d2602d2d | [
"self.data_dicts = data_dicts\nself.max_rep = max_rep\nself.csv_file_name = csv_fname\nself.dot_file_name = dot_fname\nself.png_file_name = png_fname\nlogger.info('Initialized the EmailRelations instance.')",
"data_dict_obj = DataDict(self.data_dicts, self.max_rep)\ndata_dict_obj.write_dup_data(self.csv_file_name... | <|body_start_0|>
self.data_dicts = data_dicts
self.max_rep = max_rep
self.csv_file_name = csv_fname
self.dot_file_name = dot_fname
self.png_file_name = png_fname
logger.info('Initialized the EmailRelations instance.')
<|end_body_0|>
<|body_start_1|>
data_dict_obj... | Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. of times an email is to duplicated. csv_fname : name of csv file where data is sto... | EmailRelations | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmailRelations:
"""Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. of times an email is to duplicated. csv_... | stack_v2_sparse_classes_75kplus_train_003392 | 1,902 | permissive | [
{
"docstring": "Initializes the list of emails, max. repition for each email, csv filename where the duplicated data is stored, the dot file where intermediate graph is stored and final png file.",
"name": "__init__",
"signature": "def __init__(self, data_dicts, max_rep, csv_fname, dot_fname, png_fname)... | 2 | stack_v2_sparse_classes_30k_test_002464 | Implement the Python class `EmailRelations` described below.
Class description:
Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. o... | Implement the Python class `EmailRelations` described below.
Class description:
Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. o... | 056e4c89e4f8d7fc4a4095ee0671d6944a86630e | <|skeleton|>
class EmailRelations:
"""Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. of times an email is to duplicated. csv_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmailRelations:
"""Creates a png file describing relations based on emails list. Methods ------- create_relations_image : Creates a png file describing relations based on emails list. Parameters ---------- data_dicts : list of email dicts max_rep : max no. of times an email is to duplicated. csv_fname : name ... | the_stack_v2_python_sparse | Section_10/10_4 Logging your Project/my_package/get_relations.py | PacktPublishing/Software-Engineering-with-Python-3.x | train | 2 |
e5e892d3a714909c5d69e375dd3055e1ecf2be1b | [
"super(IperfParametersBuilder, self).__init__()\nself.config_map = config_map\nself._client_parameters = None\nself._server_parameters = None\nself._protocol = None\nself._options = None\nreturn",
"if self._options is None:\n self._options = self.config_map.options(ConfigOptions.iperf_section)\nreturn self._op... | <|body_start_0|>
super(IperfParametersBuilder, self).__init__()
self.config_map = config_map
self._client_parameters = None
self._server_parameters = None
self._protocol = None
self._options = None
return
<|end_body_0|>
<|body_start_1|>
if self._options i... | A builder of IperfParameters | IperfParametersBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IperfParametersBuilder:
"""A builder of IperfParameters"""
def __init__(self, config_map):
""":param: - `config_map`: a loaded configuration map"""
<|body_0|>
def options(self):
"""The configuration file options :return: the configuration-file options for the ipe... | stack_v2_sparse_classes_75kplus_train_003393 | 4,073 | permissive | [
{
"docstring": ":param: - `config_map`: a loaded configuration map",
"name": "__init__",
"signature": "def __init__(self, config_map)"
},
{
"docstring": "The configuration file options :return: the configuration-file options for the iperf section",
"name": "options",
"signature": "def op... | 5 | null | Implement the Python class `IperfParametersBuilder` described below.
Class description:
A builder of IperfParameters
Method signatures and docstrings:
- def __init__(self, config_map): :param: - `config_map`: a loaded configuration map
- def options(self): The configuration file options :return: the configuration-fil... | Implement the Python class `IperfParametersBuilder` described below.
Class description:
A builder of IperfParameters
Method signatures and docstrings:
- def __init__(self, config_map): :param: - `config_map`: a loaded configuration map
- def options(self): The configuration file options :return: the configuration-fil... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class IperfParametersBuilder:
"""A builder of IperfParameters"""
def __init__(self, config_map):
""":param: - `config_map`: a loaded configuration map"""
<|body_0|>
def options(self):
"""The configuration file options :return: the configuration-file options for the ipe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IperfParametersBuilder:
"""A builder of IperfParameters"""
def __init__(self, config_map):
""":param: - `config_map`: a loaded configuration map"""
super(IperfParametersBuilder, self).__init__()
self.config_map = config_map
self._client_parameters = None
self._serv... | the_stack_v2_python_sparse | apetools/builders/subbuilders/iperfparameterbuilders.py | russell-n/oldape | train | 0 |
e09396c2dc74aae9fe58864b3456d8411454ca82 | [
"self.feedback_type = feedback\nif const.FEEDBACK_PV in self.feedback_type:\n self.detector = detector\n feedback_pvs = utils.get_feedback_pvs(quality_checks)\n for fb_pv in feedback_pvs:\n caput(self.detector + ':data_' + fb_pv + '_ctr', 0)\nif const.FEEDBACK_LOG in self.feedback_type:\n self.lo... | <|body_start_0|>
self.feedback_type = feedback
if const.FEEDBACK_PV in self.feedback_type:
self.detector = detector
feedback_pvs = utils.get_feedback_pvs(quality_checks)
for fb_pv in feedback_pvs:
caput(self.detector + ':data_' + fb_pv + '_ctr', 0)
... | This class is a container of real-time feedback related information. | Feedback | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_75kplus_train_003394 | 2,461 | no_license | [
{
"docstring": "Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv",
"name": "__init__",
"signature": "def __init__(self, feedback, detector, quality_checks, logger)"
},
{
"docstring": "This function provides feedback... | 2 | stack_v2_sparse_classes_30k_train_000612 | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | c8e9ef7c9cba497479faf60136f6810c41d8bd3c | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""
self... | the_stack_v2_python_sparse | dquality/clients/fb_client/simple_feedback.py | AdvancedPhotonSource/data-quality | train | 2 |
a93aa3d8167f7cd78ae31374510671e928590c65 | [
"BLOCKSIZE = 65536\nsha = sha256()\nwith open(asset, 'rb') as file:\n buff = file.read(BLOCKSIZE)\n while len(buff) > 0:\n sha.update(buff)\n buff = file.read(BLOCKSIZE)\nreturn sha.hexdigest()",
"if url:\n if url.endswith('/'):\n url = url[:-1]\n if url.endswith(API_XMLRPC_BIND_P... | <|body_start_0|>
BLOCKSIZE = 65536
sha = sha256()
with open(asset, 'rb') as file:
buff = file.read(BLOCKSIZE)
while len(buff) > 0:
sha.update(buff)
buff = file.read(BLOCKSIZE)
return sha.hexdigest()
<|end_body_0|>
<|body_start_1|>
... | confluence utility helper class This class is used to hold a series of utility methods. | ConfluenceUtil | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfluenceUtil:
"""confluence utility helper class This class is used to hold a series of utility methods."""
def hashAsset(asset):
"""generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file). When publishing assets as attachments for a Confluence... | stack_v2_sparse_classes_75kplus_train_003395 | 2,114 | permissive | [
{
"docstring": "generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file). When publishing assets as attachments for a Confluence page, hashes can be used to check if an attachment needs to be uploaded again. Args: asset: the asset (file) Returns: the hash",
"name": "hash... | 2 | stack_v2_sparse_classes_30k_train_054015 | Implement the Python class `ConfluenceUtil` described below.
Class description:
confluence utility helper class This class is used to hold a series of utility methods.
Method signatures and docstrings:
- def hashAsset(asset): generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file... | Implement the Python class `ConfluenceUtil` described below.
Class description:
confluence utility helper class This class is used to hold a series of utility methods.
Method signatures and docstrings:
- def hashAsset(asset): generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file... | 7211ffc50d1d5a874d6c789be410355cbf89c662 | <|skeleton|>
class ConfluenceUtil:
"""confluence utility helper class This class is used to hold a series of utility methods."""
def hashAsset(asset):
"""generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file). When publishing assets as attachments for a Confluence... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfluenceUtil:
"""confluence utility helper class This class is used to hold a series of utility methods."""
def hashAsset(asset):
"""generate a hash of the provided asset Calculate a hash for an asset file (e.x. an image file). When publishing assets as attachments for a Confluence page, hashes... | the_stack_v2_python_sparse | sphinxcontrib/confluencebuilder/util.py | keesj/sphinxcontrib-confluencebuilder | train | 1 |
3f26175aaafd92983bd95a468f0502ba158dcf5a | [
"if not isinstance(states, list):\n states = [states]\nif not isinstance(states, Tensor):\n states = torch.tensor(states, device=device)\ndist = self.net(states)\nreturn list(dist.sample().cpu().numpy())",
"if not isinstance(states, list):\n states = [states]\nif not isinstance(states, Tensor):\n stat... | <|body_start_0|>
if not isinstance(states, list):
states = [states]
if not isinstance(states, Tensor):
states = torch.tensor(states, device=device)
dist = self.net(states)
return list(dist.sample().cpu().numpy())
<|end_body_0|>
<|body_start_1|>
if not isi... | Actor-Critic based agent that returns a continuous action based on the policy. | SoftActorCriticAgent | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoftActorCriticAgent:
"""Actor-Critic based agent that returns a continuous action based on the policy."""
def __call__(self, states: Tensor, device: str) -> List[float]:
"""Takes in the current state and returns the action based on the agents policy. Args: states: current state of t... | stack_v2_sparse_classes_75kplus_train_003396 | 6,194 | permissive | [
{
"docstring": "Takes in the current state and returns the action based on the agents policy. Args: states: current state of the environment device: the device used for the current batch Returns: action defined by policy",
"name": "__call__",
"signature": "def __call__(self, states: Tensor, device: str)... | 2 | stack_v2_sparse_classes_30k_val_000219 | Implement the Python class `SoftActorCriticAgent` described below.
Class description:
Actor-Critic based agent that returns a continuous action based on the policy.
Method signatures and docstrings:
- def __call__(self, states: Tensor, device: str) -> List[float]: Takes in the current state and returns the action bas... | Implement the Python class `SoftActorCriticAgent` described below.
Class description:
Actor-Critic based agent that returns a continuous action based on the policy.
Method signatures and docstrings:
- def __call__(self, states: Tensor, device: str) -> List[float]: Takes in the current state and returns the action bas... | bdf311369b236c1e3d0336c7ed4ba249854f8606 | <|skeleton|>
class SoftActorCriticAgent:
"""Actor-Critic based agent that returns a continuous action based on the policy."""
def __call__(self, states: Tensor, device: str) -> List[float]:
"""Takes in the current state and returns the action based on the agents policy. Args: states: current state of t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SoftActorCriticAgent:
"""Actor-Critic based agent that returns a continuous action based on the policy."""
def __call__(self, states: Tensor, device: str) -> List[float]:
"""Takes in the current state and returns the action based on the agents policy. Args: states: current state of the environmen... | the_stack_v2_python_sparse | src/pl_bolts/models/rl/common/agents.py | Lightning-Universe/lightning-bolts | train | 76 |
19921b947e848cc044d8d0394c4fecf3bdb3bcdb | [
"if k == 0 or k > len(arr):\n return []\ntarget = k - 1\nl = 0\nr = len(arr) - 1\nwhile True:\n idx = self.partition(arr, l, r)\n if idx == target:\n return arr[:idx + 1]\n elif idx < target:\n l = idx + 1\n else:\n r = idx - 1",
"random_idx = random.randint(l, r)\narr[random_i... | <|body_start_0|>
if k == 0 or k > len(arr):
return []
target = k - 1
l = 0
r = len(arr) - 1
while True:
idx = self.partition(arr, l, r)
if idx == target:
return arr[:idx + 1]
elif idx < target:
l = id... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getLeastNumbers(self, arr: List[int], k: int) -> List[int]:
"""partition"""
<|body_0|>
def partition(self, arr, l, r):
"""单路partition"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if k == 0 or k > len(arr):
return []
... | stack_v2_sparse_classes_75kplus_train_003397 | 1,011 | no_license | [
{
"docstring": "partition",
"name": "getLeastNumbers",
"signature": "def getLeastNumbers(self, arr: List[int], k: int) -> List[int]"
},
{
"docstring": "单路partition",
"name": "partition",
"signature": "def partition(self, arr, l, r)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getLeastNumbers(self, arr: List[int], k: int) -> List[int]: partition
- def partition(self, arr, l, r): 单路partition | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getLeastNumbers(self, arr: List[int], k: int) -> List[int]: partition
- def partition(self, arr, l, r): 单路partition
<|skeleton|>
class Solution:
def getLeastNumbers(sel... | 3fa96c81f92595cf076ad675ba332e2b0eb0e071 | <|skeleton|>
class Solution:
def getLeastNumbers(self, arr: List[int], k: int) -> List[int]:
"""partition"""
<|body_0|>
def partition(self, arr, l, r):
"""单路partition"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def getLeastNumbers(self, arr: List[int], k: int) -> List[int]:
"""partition"""
if k == 0 or k > len(arr):
return []
target = k - 1
l = 0
r = len(arr) - 1
while True:
idx = self.partition(arr, l, r)
if idx == target:... | the_stack_v2_python_sparse | 2020-03/3-20/offer40最小的k个数/40.py | Annihilation7/Leetcode-Love | train | 0 | |
f2cd104bc2ebfe7b954b3cb64400b6b5c9f2a8a9 | [
"result = super(DataArray, self).__add__(other)\nresult.attrs = self.attrs\nreturn result",
"result = super(DataArray, self).__sub__(other)\nresult.attrs = self.attrs\nreturn result",
"if 'units' not in self.attrs:\n raise KeyError('\"units\" not present in attrs')\ntry:\n return to_units_function(self, u... | <|body_start_0|>
result = super(DataArray, self).__add__(other)
result.attrs = self.attrs
return result
<|end_body_0|>
<|body_start_1|>
result = super(DataArray, self).__sub__(other)
result.attrs = self.attrs
return result
<|end_body_1|>
<|body_start_2|>
if 'uni... | DataArray | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataArray:
def __add__(self, other):
"""If this DataArray is on the left side of the addition, keep its attributes when adding to the other object."""
<|body_0|>
def __sub__(self, other):
"""If this DataArray is on the left side of the subtraction, keep its attribute... | stack_v2_sparse_classes_75kplus_train_003398 | 1,724 | permissive | [
{
"docstring": "If this DataArray is on the left side of the addition, keep its attributes when adding to the other object.",
"name": "__add__",
"signature": "def __add__(self, other)"
},
{
"docstring": "If this DataArray is on the left side of the subtraction, keep its attributes when subtracti... | 3 | stack_v2_sparse_classes_30k_train_000889 | Implement the Python class `DataArray` described below.
Class description:
Implement the DataArray class.
Method signatures and docstrings:
- def __add__(self, other): If this DataArray is on the left side of the addition, keep its attributes when adding to the other object.
- def __sub__(self, other): If this DataAr... | Implement the Python class `DataArray` described below.
Class description:
Implement the DataArray class.
Method signatures and docstrings:
- def __add__(self, other): If this DataArray is on the left side of the addition, keep its attributes when adding to the other object.
- def __sub__(self, other): If this DataAr... | ff798fec7549f7ad832112a6467cf7164c1acb77 | <|skeleton|>
class DataArray:
def __add__(self, other):
"""If this DataArray is on the left side of the addition, keep its attributes when adding to the other object."""
<|body_0|>
def __sub__(self, other):
"""If this DataArray is on the left side of the subtraction, keep its attribute... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataArray:
def __add__(self, other):
"""If this DataArray is on the left side of the addition, keep its attributes when adding to the other object."""
result = super(DataArray, self).__add__(other)
result.attrs = self.attrs
return result
def __sub__(self, other):
"... | the_stack_v2_python_sparse | sympl/_core/dataarray.py | mcgibbon/sympl | train | 51 | |
0f62e113da36e8dc8647ebb6fcf0b9c0fe9690e7 | [
"self.s = Solver()\nself.m, self.n = Ints('m n')\nself.x, self.y, self.z = Ints('x y z')\nself.s.add(self.m > 0)\nself.s.add(self.n > 0)\nself.s.add(self.m > self.n)\nself.s.add(2 * self.m * self.n == self.y)\nself.s.add(self.m * self.m - self.n * self.n == self.x)\nself.s.add(self.m * self.m + self.n * self.n == s... | <|body_start_0|>
self.s = Solver()
self.m, self.n = Ints('m n')
self.x, self.y, self.z = Ints('x y z')
self.s.add(self.m > 0)
self.s.add(self.n > 0)
self.s.add(self.m > self.n)
self.s.add(2 * self.m * self.n == self.y)
self.s.add(self.m * self.m - self.n *... | PythagoreanTriples | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PythagoreanTriples:
def __init__(self):
"""Constructor of this class"""
<|body_0|>
def verify(self):
"""PART 1"""
<|body_1|>
def isNonPrimitive(self):
"""PART 2"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.s = Solver()
... | stack_v2_sparse_classes_75kplus_train_003399 | 2,710 | no_license | [
{
"docstring": "Constructor of this class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "PART 1",
"name": "verify",
"signature": "def verify(self)"
},
{
"docstring": "PART 2",
"name": "isNonPrimitive",
"signature": "def isNonPrimitive(self)"
... | 3 | null | Implement the Python class `PythagoreanTriples` described below.
Class description:
Implement the PythagoreanTriples class.
Method signatures and docstrings:
- def __init__(self): Constructor of this class
- def verify(self): PART 1
- def isNonPrimitive(self): PART 2 | Implement the Python class `PythagoreanTriples` described below.
Class description:
Implement the PythagoreanTriples class.
Method signatures and docstrings:
- def __init__(self): Constructor of this class
- def verify(self): PART 1
- def isNonPrimitive(self): PART 2
<|skeleton|>
class PythagoreanTriples:
def _... | eff5b30f7a3c6070d6a226616e208e33cd7b81c4 | <|skeleton|>
class PythagoreanTriples:
def __init__(self):
"""Constructor of this class"""
<|body_0|>
def verify(self):
"""PART 1"""
<|body_1|>
def isNonPrimitive(self):
"""PART 2"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PythagoreanTriples:
def __init__(self):
"""Constructor of this class"""
self.s = Solver()
self.m, self.n = Ints('m n')
self.x, self.y, self.z = Ints('x y z')
self.s.add(self.m > 0)
self.s.add(self.n > 0)
self.s.add(self.m > self.n)
self.s.add(2 *... | the_stack_v2_python_sparse | systems/cs195/8/pythagorean.py | davenfarnham/glob | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.