blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e38617898721f14860f1f03ac7d3e1c7bbf09ea | [
"now = timezone.now()\ntoday = datetime(now.year, now.month, now.day, tzinfo=timezone.get_default_timezone())\nreturn self.filter(end_time__gte=today)",
"now = timezone.now()\ntoday = datetime(now.year, now.month, now.day, tzinfo=timezone.get_default_timezone())\nreturn self.filter(end_time__lt=today).order_by('-... | <|body_start_0|>
now = timezone.now()
today = datetime(now.year, now.month, now.day, tzinfo=timezone.get_default_timezone())
return self.filter(end_time__gte=today)
<|end_body_0|>
<|body_start_1|>
now = timezone.now()
today = datetime(now.year, now.month, now.day, tzinfo=timezon... | EventQuerySet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventQuerySet:
def upcoming(self):
"""Find upcoming events. Includes events that end on the current day even if the start time is past."""
<|body_0|>
def recent(self):
"""Find past events, most recent first. Only includes events with end date in the past."""
... | stack_v2_sparse_classes_36k_train_007900 | 7,174 | no_license | [
{
"docstring": "Find upcoming events. Includes events that end on the current day even if the start time is past.",
"name": "upcoming",
"signature": "def upcoming(self)"
},
{
"docstring": "Find past events, most recent first. Only includes events with end date in the past.",
"name": "recent"... | 2 | stack_v2_sparse_classes_30k_train_013434 | Implement the Python class `EventQuerySet` described below.
Class description:
Implement the EventQuerySet class.
Method signatures and docstrings:
- def upcoming(self): Find upcoming events. Includes events that end on the current day even if the start time is past.
- def recent(self): Find past events, most recent ... | Implement the Python class `EventQuerySet` described below.
Class description:
Implement the EventQuerySet class.
Method signatures and docstrings:
- def upcoming(self): Find upcoming events. Includes events that end on the current day even if the start time is past.
- def recent(self): Find past events, most recent ... | d15cdd8667f73baf5f7a44c143b886ca6a15625c | <|skeleton|>
class EventQuerySet:
def upcoming(self):
"""Find upcoming events. Includes events that end on the current day even if the start time is past."""
<|body_0|>
def recent(self):
"""Find past events, most recent first. Only includes events with end date in the past."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventQuerySet:
def upcoming(self):
"""Find upcoming events. Includes events that end on the current day even if the start time is past."""
now = timezone.now()
today = datetime(now.year, now.month, now.day, tzinfo=timezone.get_default_timezone())
return self.filter(end_time__gt... | the_stack_v2_python_sparse | cdhweb/events/models.py | geosaber/prince-web | train | 0 | |
ad1cb38434939561a99abb8c19bbbfa49001411c | [
"super(SageDisplayFormatter, self).__init__(*args, **kwds)\nfrom sage.repl.rich_output.display_manager import get_display_manager\nself.dm = get_display_manager()\nfrom sage.repl.rich_output.backend_ipython import BackendIPython\nself.dm.check_backend_class(BackendIPython)",
"PLAIN_TEXT = u'text/plain'\nsage_form... | <|body_start_0|>
super(SageDisplayFormatter, self).__init__(*args, **kwds)
from sage.repl.rich_output.display_manager import get_display_manager
self.dm = get_display_manager()
from sage.repl.rich_output.backend_ipython import BackendIPython
self.dm.check_backend_class(BackendIPy... | SageDisplayFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.... | stack_v2_sparse_classes_36k_train_007901 | 9,448 | no_license | [
{
"docstring": "This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.repl.display.formatter import SageDisplayFormatter sage: fmt = SageD... | 2 | stack_v2_sparse_classes_30k_val_000978 | Implement the Python class `SageDisplayFormatter` described below.
Class description:
Implement the SageDisplayFormatter class.
Method signatures and docstrings:
- def __init__(self, *args, **kwds): This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: Th... | Implement the Python class `SageDisplayFormatter` described below.
Class description:
Implement the SageDisplayFormatter class.
Method signatures and docstrings:
- def __init__(self, *args, **kwds): This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: Th... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.repl.display.f... | the_stack_v2_python_sparse | sage/src/sage/repl/display/formatter.py | bopopescu/geosci | train | 0 | |
488c9b33e2a4599bc6435a8972781a565688292d | [
"super(PersonalizedPageRank, self).__init__(self.name)\nself.alpha = alpha\nself.log = log\nself.threshold = threshold",
"A = adjacency_matrix\nif len(A.shape) == 2:\n A = A.unsqueeze(0)\nN = A.shape[1]\ndegs_inv = A.sum(-1) ** (-1)\ndegs_inv[A.sum(-1) == 0] = 0\nD_inv = torch.diag_embed(degs_inv)\nA_rw = A.tr... | <|body_start_0|>
super(PersonalizedPageRank, self).__init__(self.name)
self.alpha = alpha
self.log = log
self.threshold = threshold
<|end_body_0|>
<|body_start_1|>
A = adjacency_matrix
if len(A.shape) == 2:
A = A.unsqueeze(0)
N = A.shape[1]
de... | PersonalizedPageRank | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonalizedPageRank:
def __init__(self, log=True, alpha=0.15, threshold=None):
""":param log: whether to return the log of the ppr values :param alpha: teleport probability :param threshold: Any ppr score below this threshold will be regarded as 0"""
<|body_0|>
def __call__... | stack_v2_sparse_classes_36k_train_007902 | 11,329 | permissive | [
{
"docstring": ":param log: whether to return the log of the ppr values :param alpha: teleport probability :param threshold: Any ppr score below this threshold will be regarded as 0",
"name": "__init__",
"signature": "def __init__(self, log=True, alpha=0.15, threshold=None)"
},
{
"docstring": ":... | 2 | stack_v2_sparse_classes_30k_train_012225 | Implement the Python class `PersonalizedPageRank` described below.
Class description:
Implement the PersonalizedPageRank class.
Method signatures and docstrings:
- def __init__(self, log=True, alpha=0.15, threshold=None): :param log: whether to return the log of the ppr values :param alpha: teleport probability :para... | Implement the Python class `PersonalizedPageRank` described below.
Class description:
Implement the PersonalizedPageRank class.
Method signatures and docstrings:
- def __init__(self, log=True, alpha=0.15, threshold=None): :param log: whether to return the log of the ppr values :param alpha: teleport probability :para... | 52600ab17d05a238f35c39a78b22c5c706fbb13c | <|skeleton|>
class PersonalizedPageRank:
def __init__(self, log=True, alpha=0.15, threshold=None):
""":param log: whether to return the log of the ppr values :param alpha: teleport probability :param threshold: Any ppr score below this threshold will be regarded as 0"""
<|body_0|>
def __call__... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PersonalizedPageRank:
def __init__(self, log=True, alpha=0.15, threshold=None):
""":param log: whether to return the log of the ppr values :param alpha: teleport probability :param threshold: Any ppr score below this threshold will be regarded as 0"""
super(PersonalizedPageRank, self).__init__... | the_stack_v2_python_sparse | code_transformer/preprocessing/graph/distances.py | maximzubkov/code-transformer | train | 0 | |
f3c12209910fcb6771468b9770dead888dfe37b3 | [
"sentence = s.split(' ')\nword_order = {}\nfor word in sentence:\n word_order[word[-1]] = word[:len(word) - 1]\nsort = word_order['1']\nfor i in range(2, len(sentence) + 1):\n sort += ' ' + word_order[f'{i}']\nreturn sort",
"sentence = s.split(' ')\nsort = [0] * len(sentence)\nfor i, word in enumerate(sente... | <|body_start_0|>
sentence = s.split(' ')
word_order = {}
for word in sentence:
word_order[word[-1]] = word[:len(word) - 1]
sort = word_order['1']
for i in range(2, len(sentence) + 1):
sort += ' ' + word_order[f'{i}']
return sort
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortSentence(self, s: str) -> str:
"""O(2n) where the time limiting step would be the first loop"""
<|body_0|>
def sortSentence(self, s: str) -> str:
"""O(n)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sentence = s.split(' ')
... | stack_v2_sparse_classes_36k_train_007903 | 716 | no_license | [
{
"docstring": "O(2n) where the time limiting step would be the first loop",
"name": "sortSentence",
"signature": "def sortSentence(self, s: str) -> str"
},
{
"docstring": "O(n)",
"name": "sortSentence",
"signature": "def sortSentence(self, s: str) -> str"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortSentence(self, s: str) -> str: O(2n) where the time limiting step would be the first loop
- def sortSentence(self, s: str) -> str: O(n) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortSentence(self, s: str) -> str: O(2n) where the time limiting step would be the first loop
- def sortSentence(self, s: str) -> str: O(n)
<|skeleton|>
class Solution:
... | 6d6afba93d20665d033fe542c97e3eb50368bd3c | <|skeleton|>
class Solution:
def sortSentence(self, s: str) -> str:
"""O(2n) where the time limiting step would be the first loop"""
<|body_0|>
def sortSentence(self, s: str) -> str:
"""O(n)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortSentence(self, s: str) -> str:
"""O(2n) where the time limiting step would be the first loop"""
sentence = s.split(' ')
word_order = {}
for word in sentence:
word_order[word[-1]] = word[:len(word) - 1]
sort = word_order['1']
for i i... | the_stack_v2_python_sparse | sorting_sentence.py | naomi397liu/AlgorithmPactice | train | 1 | |
ec259df031dc0f5f6488d834a865a51182284efd | [
"logic = CourseLogic(self.auth, sid, cid)\nparams = ParamsParser(request.GET)\nlimit = params.int('limit', desc='每页最大渲染数', require=False, default=10)\npage = params.int('page', desc='当前页数', require=False, default=1)\nevaluates = PracticeEvaluateTeacherToStudent.objects.filter(author=logic.course.author).values('id'... | <|body_start_0|>
logic = CourseLogic(self.auth, sid, cid)
params = ParamsParser(request.GET)
limit = params.int('limit', desc='每页最大渲染数', require=False, default=10)
page = params.int('page', desc='当前页数', require=False, default=1)
evaluates = PracticeEvaluateTeacherToStudent.object... | PracticeTeacherToStudentListMgetView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PracticeTeacherToStudentListMgetView:
def get(self, request, sid, cid):
"""获取老师对学生评价列表 :param request: :param sid: :param cid: :return:"""
<|body_0|>
def post(self, request, sid, cid):
"""批量获取老师对学生评价 :param request: :param sid: :param cid: :return:"""
<|body_... | stack_v2_sparse_classes_36k_train_007904 | 4,837 | no_license | [
{
"docstring": "获取老师对学生评价列表 :param request: :param sid: :param cid: :return:",
"name": "get",
"signature": "def get(self, request, sid, cid)"
},
{
"docstring": "批量获取老师对学生评价 :param request: :param sid: :param cid: :return:",
"name": "post",
"signature": "def post(self, request, sid, cid)"... | 2 | stack_v2_sparse_classes_30k_val_000596 | Implement the Python class `PracticeTeacherToStudentListMgetView` described below.
Class description:
Implement the PracticeTeacherToStudentListMgetView class.
Method signatures and docstrings:
- def get(self, request, sid, cid): 获取老师对学生评价列表 :param request: :param sid: :param cid: :return:
- def post(self, request, s... | Implement the Python class `PracticeTeacherToStudentListMgetView` described below.
Class description:
Implement the PracticeTeacherToStudentListMgetView class.
Method signatures and docstrings:
- def get(self, request, sid, cid): 获取老师对学生评价列表 :param request: :param sid: :param cid: :return:
- def post(self, request, s... | 7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b | <|skeleton|>
class PracticeTeacherToStudentListMgetView:
def get(self, request, sid, cid):
"""获取老师对学生评价列表 :param request: :param sid: :param cid: :return:"""
<|body_0|>
def post(self, request, sid, cid):
"""批量获取老师对学生评价 :param request: :param sid: :param cid: :return:"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PracticeTeacherToStudentListMgetView:
def get(self, request, sid, cid):
"""获取老师对学生评价列表 :param request: :param sid: :param cid: :return:"""
logic = CourseLogic(self.auth, sid, cid)
params = ParamsParser(request.GET)
limit = params.int('limit', desc='每页最大渲染数', require=False, defa... | the_stack_v2_python_sparse | FireHydrant/server/practice/views/evaluate/teacher_student.py | shoogoome/FireHydrant | train | 4 | |
b105420447c6bebd1494e6b8cf1bcb9c0a81624a | [
"if k >= len(cardPoints):\n return sum(cardPoints)\nleft = [0] + list(itertools.accumulate(cardPoints))\nright = [0] + list(itertools.accumulate(reversed(cardPoints)))\nreturn max((left[i] + right[k - i] for i in range(k + 1)))",
"n = len(cardPoints) - 1\n\n@lru_cache(None)\ndef rec(i, j):\n if i + (n - j) ... | <|body_start_0|>
if k >= len(cardPoints):
return sum(cardPoints)
left = [0] + list(itertools.accumulate(cardPoints))
right = [0] + list(itertools.accumulate(reversed(cardPoints)))
return max((left[i] + right[k - i] for i in range(k + 1)))
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxScore(self, cardPoints: List[int], k: int) -> int:
"""05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)"""
<|body_0|>
def maxScore(self, cardPoints: List[int], k: int) -> int:
"""TLE"""
<|body_1|>
def maxScore(self, cardPo... | stack_v2_sparse_classes_36k_train_007905 | 3,048 | no_license | [
{
"docstring": "05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)",
"name": "maxScore",
"signature": "def maxScore(self, cardPoints: List[int], k: int) -> int"
},
{
"docstring": "TLE",
"name": "maxScore",
"signature": "def maxScore(self, cardPoints: List[int], k: int) -> i... | 3 | stack_v2_sparse_classes_30k_train_006382 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxScore(self, cardPoints: List[int], k: int) -> int: 05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)
- def maxScore(self, cardPoints: List[int], k: int) -> ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxScore(self, cardPoints: List[int], k: int) -> int: 05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)
- def maxScore(self, cardPoints: List[int], k: int) -> ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def maxScore(self, cardPoints: List[int], k: int) -> int:
"""05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)"""
<|body_0|>
def maxScore(self, cardPoints: List[int], k: int) -> int:
"""TLE"""
<|body_1|>
def maxScore(self, cardPo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxScore(self, cardPoints: List[int], k: int) -> int:
"""05/27/2021 15:20 DP Time complexity: O(n) Space complexity: O(n)"""
if k >= len(cardPoints):
return sum(cardPoints)
left = [0] + list(itertools.accumulate(cardPoints))
right = [0] + list(itertool... | the_stack_v2_python_sparse | leetcode/solved/1538_Maximum_Points_You_Can_Obtain_from_Cards/solution.py | sungminoh/algorithms | train | 0 | |
f5d43fcd8d8a7e9c4a510d3b2dc4b049758070b6 | [
"session: Session = schema.new_session()\nhas_role: bool\ntry:\n if isinstance(role, str):\n role = Role[role]\n has_role = bool(UserRoles.find_role(session, username, role) is not None)\nexcept KeyError:\n has_role = False\nexcept UserNotFoundError:\n has_role = False\nschema.remove_session()\nr... | <|body_start_0|>
session: Session = schema.new_session()
has_role: bool
try:
if isinstance(role, str):
role = Role[role]
has_role = bool(UserRoles.find_role(session, username, role) is not None)
except KeyError:
has_role = False
... | Monostate class that provides high-level services to handle role-related use cases. | RoleServices | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleServices:
"""Monostate class that provides high-level services to handle role-related use cases."""
def has_role(username: str, role: Union[Role, str], schema: Schema) -> bool:
"""Determines whether a user has a certain role or not. Args: - username (str): The username of the use... | stack_v2_sparse_classes_36k_train_007906 | 3,911 | no_license | [
{
"docstring": "Determines whether a user has a certain role or not. Args: - username (str): The username of the user to test. - role (Union[Role, str]): The role to be tested. - schema (Schema): A database handler where users and roles are mapped into. Returns: - bool: `True` if the user has the given role. `F... | 4 | stack_v2_sparse_classes_30k_train_005936 | Implement the Python class `RoleServices` described below.
Class description:
Monostate class that provides high-level services to handle role-related use cases.
Method signatures and docstrings:
- def has_role(username: str, role: Union[Role, str], schema: Schema) -> bool: Determines whether a user has a certain rol... | Implement the Python class `RoleServices` described below.
Class description:
Monostate class that provides high-level services to handle role-related use cases.
Method signatures and docstrings:
- def has_role(username: str, role: Union[Role, str], schema: Schema) -> bool: Determines whether a user has a certain rol... | d7d50f84e93914d388ccd084b3bee7e02c9e717b | <|skeleton|>
class RoleServices:
"""Monostate class that provides high-level services to handle role-related use cases."""
def has_role(username: str, role: Union[Role, str], schema: Schema) -> bool:
"""Determines whether a user has a certain role or not. Args: - username (str): The username of the use... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleServices:
"""Monostate class that provides high-level services to handle role-related use cases."""
def has_role(username: str, role: Union[Role, str], schema: Schema) -> bool:
"""Determines whether a user has a certain role or not. Args: - username (str): The username of the user to test. - ... | the_stack_v2_python_sparse | components/dms2122auth/dms2122auth/service/roleservices.py | Kencho/practica-dms-2021-2022 | train | 0 |
cc0ab4517fc230ae28637fd8120a94186d5c1bfc | [
"output, stack = ([], [(root, False)])\nwhile stack:\n node, is_visited = stack.pop()\n if not node:\n continue\n if is_visited:\n output.append(node.val)\n else:\n stack.append((node, True))\n stack.append((node.right, False))\n stack.append((node.left, False))\nretur... | <|body_start_0|>
output, stack = ([], [(root, False)])
while stack:
node, is_visited = stack.pop()
if not node:
continue
if is_visited:
output.append(node.val)
else:
stack.append((node, True))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def postorderTraversal_iterative2(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal_recursive(self, root):
... | stack_v2_sparse_classes_36k_train_007907 | 3,850 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "postorderTraversal",
"signature": "def postorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "postorderTraversal_iterative2",
"signature": "def postorderTraversal_iterative2(se... | 4 | stack_v2_sparse_classes_30k_train_005123 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def postorderTraversal_iterative2(self, root): :type root: TreeNode :rtype: List[int]
- def postorder... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def postorderTraversal_iterative2(self, root): :type root: TreeNode :rtype: List[int]
- def postorder... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def postorderTraversal_iterative2(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal_recursive(self, root):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
output, stack = ([], [(root, False)])
while stack:
node, is_visited = stack.pop()
if not node:
continue
if is_visited:
output.a... | the_stack_v2_python_sparse | src/lt_145.py | oxhead/CodingYourWay | train | 0 | |
9dca4a7bb775978960c45433e3f720d950c5e9a4 | [
"self.policy = policy\nself.mtype = mtype\nself.value = value",
"if dictionary is None:\n return None\npolicy = dictionary.get('policy')\nmtype = dictionary.get('type')\nvalue = dictionary.get('value')\nreturn cls(policy, mtype, value)"
] | <|body_start_0|>
self.policy = policy
self.mtype = mtype
self.value = value
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
policy = dictionary.get('policy')
mtype = dictionary.get('type')
value = dictionary.get('value')
ret... | Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' or 'ipRange' value (string): The 'value' of what... | L7FirewallRuleModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class L7FirewallRuleModel:
"""Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' o... | stack_v2_sparse_classes_36k_train_007908 | 2,311 | permissive | [
{
"docstring": "Constructor for the L7FirewallRuleModel class",
"name": "__init__",
"signature": "def __init__(self, policy=None, mtype=None, value=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the obje... | 2 | null | Implement the Python class `L7FirewallRuleModel` described below.
Class description:
Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', ... | Implement the Python class `L7FirewallRuleModel` described below.
Class description:
Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', ... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class L7FirewallRuleModel:
"""Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class L7FirewallRuleModel:
"""Implementation of the 'L7FirewallRule' model. TODO: type model description here. Attributes: policy (Policy2Enum): The policy applied to matching traffic. Must be 'deny'. mtype (Type1Enum): Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' or 'ipRange' v... | the_stack_v2_python_sparse | meraki_sdk/models/l_7_firewall_rule_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES)\nif org is None:\n response, status = ({'message': 'The requested organization could not be found.'}, http_status.HTTP_404_NOT_FOUND)\nelse:\n response, status = (org.as_dict(), http_status.HTTP_200_OK)\nreturn (response, status)",
"r... | <|body_start_0|>
org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES)
if org is None:
response, status = ({'message': 'The requested organization could not be found.'}, http_status.HTTP_404_NOT_FOUND)
else:
response, status = (org.as_dict(), http_statu... | Resource for managing a single org. | Org | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Org:
"""Resource for managing a single org."""
def get(org_id):
"""Get the org specified by the provided id."""
<|body_0|>
def put(org_id):
"""Update the org specified by the provided id with the request body."""
<|body_1|>
def delete(org_id):
... | stack_v2_sparse_classes_36k_train_007909 | 30,185 | permissive | [
{
"docstring": "Get the org specified by the provided id.",
"name": "get",
"signature": "def get(org_id)"
},
{
"docstring": "Update the org specified by the provided id with the request body.",
"name": "put",
"signature": "def put(org_id)"
},
{
"docstring": "Inactivates the org i... | 4 | stack_v2_sparse_classes_30k_train_014568 | Implement the Python class `Org` described below.
Class description:
Resource for managing a single org.
Method signatures and docstrings:
- def get(org_id): Get the org specified by the provided id.
- def put(org_id): Update the org specified by the provided id with the request body.
- def delete(org_id): Inactivate... | Implement the Python class `Org` described below.
Class description:
Resource for managing a single org.
Method signatures and docstrings:
- def get(org_id): Get the org specified by the provided id.
- def put(org_id): Update the org specified by the provided id with the request body.
- def delete(org_id): Inactivate... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class Org:
"""Resource for managing a single org."""
def get(org_id):
"""Get the org specified by the provided id."""
<|body_0|>
def put(org_id):
"""Update the org specified by the provided id with the request body."""
<|body_1|>
def delete(org_id):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Org:
"""Resource for managing a single org."""
def get(org_id):
"""Get the org specified by the provided id."""
org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES)
if org is None:
response, status = ({'message': 'The requested organization could no... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
bdf603244bcb064e1eb8ded2b93860fc0759dfe8 | [
"classname = item[0]\nfilename = item[1]\ncontents = Utils().file_get_contents(filename)\nif contents == False:\n print('Could not find the contents of ' + filename)\n return\nnamespace = re.findall('namespace ([^\\\\s]+);', contents, re.MULTILINE)\nif namespace:\n namespace = namespace[0] + '\\\\' + class... | <|body_start_0|>
classname = item[0]
filename = item[1]
contents = Utils().file_get_contents(filename)
if contents == False:
print('Could not find the contents of ' + filename)
return
namespace = re.findall('namespace ([^\\s]+);', contents, re.MULTILINE)
... | InsertNamespaceCommand | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InsertNamespaceCommand:
def run(self, edit, item):
"""INSERT AND ORDER THE NAMESPACES"""
<|body_0|>
def build_uses(self, namespace):
"""BUILD USE STATEMENTS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
classname = item[0]
filename = item[... | stack_v2_sparse_classes_36k_train_007910 | 3,956 | no_license | [
{
"docstring": "INSERT AND ORDER THE NAMESPACES",
"name": "run",
"signature": "def run(self, edit, item)"
},
{
"docstring": "BUILD USE STATEMENTS",
"name": "build_uses",
"signature": "def build_uses(self, namespace)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000239 | Implement the Python class `InsertNamespaceCommand` described below.
Class description:
Implement the InsertNamespaceCommand class.
Method signatures and docstrings:
- def run(self, edit, item): INSERT AND ORDER THE NAMESPACES
- def build_uses(self, namespace): BUILD USE STATEMENTS | Implement the Python class `InsertNamespaceCommand` described below.
Class description:
Implement the InsertNamespaceCommand class.
Method signatures and docstrings:
- def run(self, edit, item): INSERT AND ORDER THE NAMESPACES
- def build_uses(self, namespace): BUILD USE STATEMENTS
<|skeleton|>
class InsertNamespace... | 82dcdccf4aadda938ff085efd2a40e44aa5b3284 | <|skeleton|>
class InsertNamespaceCommand:
def run(self, edit, item):
"""INSERT AND ORDER THE NAMESPACES"""
<|body_0|>
def build_uses(self, namespace):
"""BUILD USE STATEMENTS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InsertNamespaceCommand:
def run(self, edit, item):
"""INSERT AND ORDER THE NAMESPACES"""
classname = item[0]
filename = item[1]
contents = Utils().file_get_contents(filename)
if contents == False:
print('Could not find the contents of ' + filename)
... | the_stack_v2_python_sparse | sublime_basic/commands/ImportNamespaceCommand.py | MrAtiebatie/SublimeBasic | train | 0 | |
f3b95bbb2afdea25904c8d4b8de5b77f5ecf174c | [
"curr_a = curr_b = 0\nall_max = float('-inf')\nall_min = float('inf')\nfor i in range(len(A)):\n curr_a = max(curr_a, 0) + A[i]\n all_max = max(curr_a, all_max)\n curr_b = min(curr_b, 0) + A[i]\n all_min = min(curr_b, all_min)\nreturn all_max if all_max < 0 else max(sum(A) - all_min, all_max)",
"curr ... | <|body_start_0|>
curr_a = curr_b = 0
all_max = float('-inf')
all_min = float('inf')
for i in range(len(A)):
curr_a = max(curr_a, 0) + A[i]
all_max = max(curr_a, all_max)
curr_b = min(curr_b, 0) + A[i]
all_min = min(curr_b, all_min)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubarraySumCircular(self, A):
""":type A: List[int] :rtype: int 請看下一個function解釋"""
<|body_0|>
def maxSubarraySumCircularNavie(self, A):
""":type A: List[int] :rtype: int https://leetcode.com/problems/maximum-sum-circular-subarray/discuss/178422/C++Ja... | stack_v2_sparse_classes_36k_train_007911 | 1,831 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int 請看下一個function解釋",
"name": "maxSubarraySumCircular",
"signature": "def maxSubarraySumCircular(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: int https://leetcode.com/problems/maximum-sum-circular-subarray/discuss/178422/C++JavaPython-One-Pas... | 3 | stack_v2_sparse_classes_30k_train_001509 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubarraySumCircular(self, A): :type A: List[int] :rtype: int 請看下一個function解釋
- def maxSubarraySumCircularNavie(self, A): :type A: List[int] :rtype: int https://leetcode.co... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubarraySumCircular(self, A): :type A: List[int] :rtype: int 請看下一個function解釋
- def maxSubarraySumCircularNavie(self, A): :type A: List[int] :rtype: int https://leetcode.co... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def maxSubarraySumCircular(self, A):
""":type A: List[int] :rtype: int 請看下一個function解釋"""
<|body_0|>
def maxSubarraySumCircularNavie(self, A):
""":type A: List[int] :rtype: int https://leetcode.com/problems/maximum-sum-circular-subarray/discuss/178422/C++Ja... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubarraySumCircular(self, A):
""":type A: List[int] :rtype: int 請看下一個function解釋"""
curr_a = curr_b = 0
all_max = float('-inf')
all_min = float('inf')
for i in range(len(A)):
curr_a = max(curr_a, 0) + A[i]
all_max = max(curr_a, al... | the_stack_v2_python_sparse | cs_notes/arrays/maximum_sum_circular_subarray.py | hwc1824/LeetCodeSolution | train | 0 | |
580e085599250ae6ff6db02070968b11dde6bf7b | [
"self.mirror = mirror\nself.cleanLine = cleanLine\nself.Busnum = cleanLine[1]\nself.Busnam = cleanLine[2]\nself.baseKv = cleanLine[3]\nself.Id = cleanLine[4]\nself.mwCap = float(cleanLine[6].split('=')[1])\nself.droop = cleanLine[7]\nself.Gen = ltd.find.findGenOnBus(mirror, self.Busnum, self.Id)\nif self.Gen:\n ... | <|body_start_0|>
self.mirror = mirror
self.cleanLine = cleanLine
self.Busnum = cleanLine[1]
self.Busnam = cleanLine[2]
self.baseKv = cleanLine[3]
self.Id = cleanLine[4]
self.mwCap = float(cleanLine[6].split('=')[1])
self.droop = cleanLine[7]
self.G... | Agent to perform proportional governor action (droop) | pgov1Agent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pgov1Agent:
"""Agent to perform proportional governor action (droop)"""
def __init__(self, mirror, cleanLine):
"""Objects created from parseDyd, cleanLine is list of parameters"""
<|body_0|>
def stepDynamics(self):
"""Perform droop control"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_007912 | 1,524 | permissive | [
{
"docstring": "Objects created from parseDyd, cleanLine is list of parameters",
"name": "__init__",
"signature": "def __init__(self, mirror, cleanLine)"
},
{
"docstring": "Perform droop control",
"name": "stepDynamics",
"signature": "def stepDynamics(self)"
},
{
"docstring": "On... | 3 | stack_v2_sparse_classes_30k_test_000708 | Implement the Python class `pgov1Agent` described below.
Class description:
Agent to perform proportional governor action (droop)
Method signatures and docstrings:
- def __init__(self, mirror, cleanLine): Objects created from parseDyd, cleanLine is list of parameters
- def stepDynamics(self): Perform droop control
- ... | Implement the Python class `pgov1Agent` described below.
Class description:
Agent to perform proportional governor action (droop)
Method signatures and docstrings:
- def __init__(self, mirror, cleanLine): Objects created from parseDyd, cleanLine is list of parameters
- def stepDynamics(self): Perform droop control
- ... | 1bc598f3733c1369c164f54249e5f7757e6bf466 | <|skeleton|>
class pgov1Agent:
"""Agent to perform proportional governor action (droop)"""
def __init__(self, mirror, cleanLine):
"""Objects created from parseDyd, cleanLine is list of parameters"""
<|body_0|>
def stepDynamics(self):
"""Perform droop control"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pgov1Agent:
"""Agent to perform proportional governor action (droop)"""
def __init__(self, mirror, cleanLine):
"""Objects created from parseDyd, cleanLine is list of parameters"""
self.mirror = mirror
self.cleanLine = cleanLine
self.Busnum = cleanLine[1]
self.Busna... | the_stack_v2_python_sparse | psltdsim/dynamicAgents/pgov1Agent.py | thadhaines/PSLTDSim | train | 0 |
ef9dd5a9191c46ea8e3c49385a0d9f701fd93556 | [
"if not root:\n return False\nque_node = collections.deque([root])\nque_val = collections.deque([root.val])\nwhile que_node:\n now = que_node.popleft()\n temp = que_val.popleft()\n if not now.left and (not now.right):\n if temp == sum:\n return True\n continue\n if now.left:\... | <|body_start_0|>
if not root:
return False
que_node = collections.deque([root])
que_val = collections.deque([root.val])
while que_node:
now = que_node.popleft()
temp = que_val.popleft()
if not now.left and (not now.right):
i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPathSum_1(self, root: TreeNode, sum: int) -> bool:
"""方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: :param sum: :return:"""
<|body_0|>
def hasPathSum_2(self, root: TreeNode, sum: int) ... | stack_v2_sparse_classes_36k_train_007913 | 2,789 | no_license | [
{
"docstring": "方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: :param sum: :return:",
"name": "hasPathSum_1",
"signature": "def hasPathSum_1(self, root: TreeNode, sum: int) -> bool"
},
{
"docstring": "深度优先搜索(递归) 时间复杂度:O(N)O... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum_1(self, root: TreeNode, sum: int) -> bool: 方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum_1(self, root: TreeNode, sum: int) -> bool: 方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: ... | 62419b49000e79962bcdc99cd98afd2fb82ea345 | <|skeleton|>
class Solution:
def hasPathSum_1(self, root: TreeNode, sum: int) -> bool:
"""方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: :param sum: :return:"""
<|body_0|>
def hasPathSum_2(self, root: TreeNode, sum: int) ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasPathSum_1(self, root: TreeNode, sum: int) -> bool:
"""方法一:广度优先搜索(队列) 时间复杂度:O(N),其中 N 是树的节点数。对每个节点访问一次。 空间复杂度:O(N),其中 N 是树的节点数。空间复杂度主要取决于队列的开销,队列中的元素个数不会超过树的节点数。 :param root: :param sum: :return:"""
if not root:
return False
que_node = collections.deque([roo... | the_stack_v2_python_sparse | 软件开发岗刷题(华为笔试准备)/二叉树/hasPathSum.py | MaoningGuan/LeetCode | train | 3 | |
e63d0933fbcebaf6cc08bd13c72e3845f94120ec | [
"super().__init__(apply_sd, False, False, apply_mask, False, edge_weight)\nself.alpha = alpha\nself.eps = 1e-07",
"n_classes = yhat.shape[1]\nif target.size() != yhat.size():\n target = target.unsqueeze(1).repeat_interleave(n_classes, dim=1)\nif not yhat.shape == target.shape:\n raise ValueError(f'Pred and ... | <|body_start_0|>
super().__init__(apply_sd, False, False, apply_mask, False, edge_weight)
self.alpha = alpha
self.eps = 1e-07
<|end_body_0|>
<|body_start_1|>
n_classes = yhat.shape[1]
if target.size() != yhat.size():
target = target.unsqueeze(1).repeat_interleave(n_c... | MAE | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MAE:
def __init__(self, alpha: float=0.0001, apply_sd: bool=False, apply_mask: bool=False, edge_weight: float=None, **kwargs) -> None:
"""Compute the MAE loss. Used in the stardist method. Stardist: https://arxiv.org/pdf/1806.03535.pdf NOTE: We have added the option to apply spectral dec... | stack_v2_sparse_classes_36k_train_007914 | 3,114 | permissive | [
{
"docstring": "Compute the MAE loss. Used in the stardist method. Stardist: https://arxiv.org/pdf/1806.03535.pdf NOTE: We have added the option to apply spectral decoupling and edge weights to the loss matrix. Parameters ---------- alpha : float, default=1e-4 Weight regulizer b/w [0,1]. In stardist repo, this ... | 2 | stack_v2_sparse_classes_30k_train_001748 | Implement the Python class `MAE` described below.
Class description:
Implement the MAE class.
Method signatures and docstrings:
- def __init__(self, alpha: float=0.0001, apply_sd: bool=False, apply_mask: bool=False, edge_weight: float=None, **kwargs) -> None: Compute the MAE loss. Used in the stardist method. Stardis... | Implement the Python class `MAE` described below.
Class description:
Implement the MAE class.
Method signatures and docstrings:
- def __init__(self, alpha: float=0.0001, apply_sd: bool=False, apply_mask: bool=False, edge_weight: float=None, **kwargs) -> None: Compute the MAE loss. Used in the stardist method. Stardis... | 7f79405012eb934b419bbdba8de23f35e840ca85 | <|skeleton|>
class MAE:
def __init__(self, alpha: float=0.0001, apply_sd: bool=False, apply_mask: bool=False, edge_weight: float=None, **kwargs) -> None:
"""Compute the MAE loss. Used in the stardist method. Stardist: https://arxiv.org/pdf/1806.03535.pdf NOTE: We have added the option to apply spectral dec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MAE:
def __init__(self, alpha: float=0.0001, apply_sd: bool=False, apply_mask: bool=False, edge_weight: float=None, **kwargs) -> None:
"""Compute the MAE loss. Used in the stardist method. Stardist: https://arxiv.org/pdf/1806.03535.pdf NOTE: We have added the option to apply spectral decoupling and ed... | the_stack_v2_python_sparse | cellseg_models_pytorch/losses/criterions/mae.py | okunator/cellseg_models.pytorch | train | 43 | |
46512ce80b1e597e38843e8e0680ed8d3d139810 | [
"self.df = data\nself.attr1 = attr1\nself.attr2 = attr2",
"sns.jointplot(x=self.attr1, y=self.attr2, data=self.df)\nplt.savefig('graphs/' + 'Jointplot of ' + str(self.attr1) + ' and ' + str(self.attr2) + '.pdf', format='pdf')\nplt.show()"
] | <|body_start_0|>
self.df = data
self.attr1 = attr1
self.attr2 = attr2
<|end_body_0|>
<|body_start_1|>
sns.jointplot(x=self.attr1, y=self.attr2, data=self.df)
plt.savefig('graphs/' + 'Jointplot of ' + str(self.attr1) + ' and ' + str(self.attr2) + '.pdf', format='pdf')
plt... | This is the class for visulization methods of numerical feature vs. another numerical feature | nvn_graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class nvn_graph:
"""This is the class for visulization methods of numerical feature vs. another numerical feature"""
def __init__(self, data, attr1, attr2):
"""Constructor"""
<|body_0|>
def joint_plot(self):
"""get the dataframe and desired attributions. Return ====== ... | stack_v2_sparse_classes_36k_train_007915 | 832 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, data, attr1, attr2)"
},
{
"docstring": "get the dataframe and desired attributions. Return ====== return jointplot of attributions",
"name": "joint_plot",
"signature": "def joint_plot(self)"
}
] | 2 | null | Implement the Python class `nvn_graph` described below.
Class description:
This is the class for visulization methods of numerical feature vs. another numerical feature
Method signatures and docstrings:
- def __init__(self, data, attr1, attr2): Constructor
- def joint_plot(self): get the dataframe and desired attribu... | Implement the Python class `nvn_graph` described below.
Class description:
This is the class for visulization methods of numerical feature vs. another numerical feature
Method signatures and docstrings:
- def __init__(self, data, attr1, attr2): Constructor
- def joint_plot(self): get the dataframe and desired attribu... | dc9185cbc5e65650d985ebecf877a157c8c19a13 | <|skeleton|>
class nvn_graph:
"""This is the class for visulization methods of numerical feature vs. another numerical feature"""
def __init__(self, data, attr1, attr2):
"""Constructor"""
<|body_0|>
def joint_plot(self):
"""get the dataframe and desired attributions. Return ====== ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class nvn_graph:
"""This is the class for visulization methods of numerical feature vs. another numerical feature"""
def __init__(self, data, attr1, attr2):
"""Constructor"""
self.df = data
self.attr1 = attr1
self.attr2 = attr2
def joint_plot(self):
"""get the dataf... | the_stack_v2_python_sparse | sj2384/nvn_graph.py | ds-ga-1007/final_project | train | 0 |
b4f7e2212b4b22a17b8771713ab4761ca709f65b | [
"path = os.path.join(BASE_DIR, 'librairy/test_files')\nrecursive_import(path)\npicts = Picture.objects.all().count()\nself.assertEqual(picts, 3)",
"path = os.path.join(BASE_DIR, 'librairy/test_files/test.zip')\nrecursive_import(path)\npicts = Picture.objects.all().count()\nself.assertEqual(picts, 1)",
"recursiv... | <|body_start_0|>
path = os.path.join(BASE_DIR, 'librairy/test_files')
recursive_import(path)
picts = Picture.objects.all().count()
self.assertEqual(picts, 3)
<|end_body_0|>
<|body_start_1|>
path = os.path.join(BASE_DIR, 'librairy/test_files/test.zip')
recursive_import(pa... | Command line import test class. | RecursiveImportTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecursiveImportTest:
"""Command line import test class."""
def test_with_folder(self):
"""Test with one folder path as argument."""
<|body_0|>
def test_with_zip_archive(self):
"""Test with one archive as argument."""
<|body_1|>
def test_with_picture(... | stack_v2_sparse_classes_36k_train_007916 | 44,838 | no_license | [
{
"docstring": "Test with one folder path as argument.",
"name": "test_with_folder",
"signature": "def test_with_folder(self)"
},
{
"docstring": "Test with one archive as argument.",
"name": "test_with_zip_archive",
"signature": "def test_with_zip_archive(self)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_002329 | Implement the Python class `RecursiveImportTest` described below.
Class description:
Command line import test class.
Method signatures and docstrings:
- def test_with_folder(self): Test with one folder path as argument.
- def test_with_zip_archive(self): Test with one archive as argument.
- def test_with_picture(self... | Implement the Python class `RecursiveImportTest` described below.
Class description:
Command line import test class.
Method signatures and docstrings:
- def test_with_folder(self): Test with one folder path as argument.
- def test_with_zip_archive(self): Test with one archive as argument.
- def test_with_picture(self... | ed2e458dfb6247d7fe487f4795a855a5275cfe5f | <|skeleton|>
class RecursiveImportTest:
"""Command line import test class."""
def test_with_folder(self):
"""Test with one folder path as argument."""
<|body_0|>
def test_with_zip_archive(self):
"""Test with one archive as argument."""
<|body_1|>
def test_with_picture(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecursiveImportTest:
"""Command line import test class."""
def test_with_folder(self):
"""Test with one folder path as argument."""
path = os.path.join(BASE_DIR, 'librairy/test_files')
recursive_import(path)
picts = Picture.objects.all().count()
self.assertEqual(pi... | the_stack_v2_python_sparse | src/api/librairy/tests.py | Fenykepy/phiroom | train | 1 |
8fd1cdd2f48b7836cfb82f52cd1960c39fce9dc2 | [
"settings = self.settings\ncmd = [config['exe_paths']['jshint'], '--extract=%s' % settings['extract_js_from_html'], '--reporter=%s' % self.REPORTER_PATH]\nconfig_content = self.settings['config']\nif config_content:\n cmd.append('--config=%s' % make_tempfile(content=config_content.encode('utf-8')))\nreturn cmd",... | <|body_start_0|>
settings = self.settings
cmd = [config['exe_paths']['jshint'], '--extract=%s' % settings['extract_js_from_html'], '--reporter=%s' % self.REPORTER_PATH]
config_content = self.settings['config']
if config_content:
cmd.append('--config=%s' % make_tempfile(conten... | Review Bot tool to run jshint. | JSHintTool | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, un... | stack_v2_sparse_classes_36k_train_007917 | 4,667 | permissive | [
{
"docstring": "Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.",
"name": "bui... | 2 | null | Implement the Python class `JSHintTool` described below.
Class description:
Review Bot tool to run jshint.
Method signatures and docstrings:
- def build_base_command(self, **kwargs): Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pa... | Implement the Python class `JSHintTool` described below.
Class description:
Review Bot tool to run jshint.
Method signatures and docstrings:
- def build_base_command(self, **kwargs): Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pa... | b59b566e127b5ef1b08f3189f1aa0194b7437d94 | <|skeleton|>
class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, un... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JSHintTool:
"""Review Bot tool to run jshint."""
def build_base_command(self, **kwargs):
"""Build the base command line used to review files. If a custom JSHint configuration is set, this will save it to a temporary file and pass it along for all JSHint runs. Args: **kwargs (dict, unused): Additi... | the_stack_v2_python_sparse | bot/reviewbot/tools/jshint.py | reviewboard/ReviewBot | train | 110 |
21038c60a5e482730394e0c107cf630c24c86443 | [
"if not (isinstance(paths, list) and isinstance(overwrite, bool) and isinstance(restore_data_and_acl, bool)):\n raise SDKException('Subclient', '101')\nif kwargs.get('common_options_dict') is None:\n kwargs['common_options_dict'] = {}\nif kwargs.get('lndb_restore_options') is None:\n kwargs['lndb_restore_o... | <|body_start_0|>
if not (isinstance(paths, list) and isinstance(overwrite, bool) and isinstance(restore_data_and_acl, bool)):
raise SDKException('Subclient', '101')
if kwargs.get('common_options_dict') is None:
kwargs['common_options_dict'] = {}
if kwargs.get('lndb_restor... | Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient. | LNSubclient | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LNSubclient:
"""Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient."""
def restore_in_place(self, paths, overwrite=True, restore_data_and_acl=True, copy_precedence=None, from_time=None, to_time=None, **kwargs):
"""Restor... | stack_v2_sparse_classes_36k_train_007918 | 8,884 | permissive | [
{
"docstring": "Restores the files/folders specified in the input paths list to the same location. Args: paths (list) -- list of full paths of files/folders to restore overwrite (bool) -- unconditional overwrite files during restore default: True restore_data_and_acl (bool) -- restore data and ACL files default... | 3 | null | Implement the Python class `LNSubclient` described below.
Class description:
Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient.
Method signatures and docstrings:
- def restore_in_place(self, paths, overwrite=True, restore_data_and_acl=True, copy_precede... | Implement the Python class `LNSubclient` described below.
Class description:
Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient.
Method signatures and docstrings:
- def restore_in_place(self, paths, overwrite=True, restore_data_and_acl=True, copy_precede... | 6aa0beb426a95de877cd531602234515723ccc94 | <|skeleton|>
class LNSubclient:
"""Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient."""
def restore_in_place(self, paths, overwrite=True, restore_data_and_acl=True, copy_precedence=None, from_time=None, to_time=None, **kwargs):
"""Restor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LNSubclient:
"""Derived class from Subclient Base class, representing an LN subclient, and to perform operations on that subclient."""
def restore_in_place(self, paths, overwrite=True, restore_data_and_acl=True, copy_precedence=None, from_time=None, to_time=None, **kwargs):
"""Restores the files/... | the_stack_v2_python_sparse | cvpysdk/subclients/lotusnotes/lnsubclient.py | jack1806/cvpysdk | train | 1 |
cdfbf5e8b614f4709b2b35703a562c839c88df4f | [
"logging.info('Validando os dados para criação do usuário na plataforma ALMA.')\nif 'user' not in data.keys():\n raise ParseError('Objeto user é obrigatório.')\nreturn data",
"logging.info(f'Dados para criação do usuário na plataforma ALMA: {validated_data}')\nserializer = UserRegisterSerializer()\nuser_valida... | <|body_start_0|>
logging.info('Validando os dados para criação do usuário na plataforma ALMA.')
if 'user' not in data.keys():
raise ParseError('Objeto user é obrigatório.')
return data
<|end_body_0|>
<|body_start_1|>
logging.info(f'Dados para criação do usuário na plataforma... | O serializer para registrar um novo usuário | AlmaUserRegisterSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlmaUserRegisterSerializer:
"""O serializer para registrar um novo usuário"""
def validate(self, data):
"""Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde."""
<|body_0|>
def create(self, validated_data):
"""Cria... | stack_v2_sparse_classes_36k_train_007919 | 3,343 | no_license | [
{
"docstring": "Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Cria e retorna um novo usuário",
"name": "create",
"signature": "def create(self, validate... | 2 | stack_v2_sparse_classes_30k_train_006818 | Implement the Python class `AlmaUserRegisterSerializer` described below.
Class description:
O serializer para registrar um novo usuário
Method signatures and docstrings:
- def validate(self, data): Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde.
- def create(self, ... | Implement the Python class `AlmaUserRegisterSerializer` described below.
Class description:
O serializer para registrar um novo usuário
Method signatures and docstrings:
- def validate(self, data): Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde.
- def create(self, ... | 3a8009b17518384c269dfee3c8fe44cbe2567cc0 | <|skeleton|>
class AlmaUserRegisterSerializer:
"""O serializer para registrar um novo usuário"""
def validate(self, data):
"""Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde."""
<|body_0|>
def create(self, validated_data):
"""Cria... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlmaUserRegisterSerializer:
"""O serializer para registrar um novo usuário"""
def validate(self, data):
"""Valide se existe outro usuário com o mesmo endereço de email e verifique se a senha não corresponde."""
logging.info('Validando os dados para criação do usuário na plataforma ALMA.')... | the_stack_v2_python_sparse | project/alma/accounts/serializers.py | VWApplications/VWAlmaAPI | train | 1 |
c94193bc12627234ed22ac1750e11ddc49b05da0 | [
"stats = self._generate_stats(host_state, filter_properties)\nLOG.debug(\"Driver Filter: Checking host '%s'\", stats['host_stats']['host'])\nresult = self._check_filter_function(stats)\nLOG.debug('Result: %s', result)\nLOG.debug(\"Done checking host '%s'\", stats['host_stats']['host'])\nreturn result",
"if stats[... | <|body_start_0|>
stats = self._generate_stats(host_state, filter_properties)
LOG.debug("Driver Filter: Checking host '%s'", stats['host_stats']['host'])
result = self._check_filter_function(stats)
LOG.debug('Result: %s', result)
LOG.debug("Done checking host '%s'", stats['host_st... | DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics. | DriverFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_36k_train_007920 | 3,736 | permissive | [
{
"docstring": "Determines whether a host has a passing filter_function or not.",
"name": "host_passes",
"signature": "def host_passes(self, host_state, filter_properties)"
},
{
"docstring": "Checks if a share passes a host's filter function. Returns a tuple in the format (filter_passing, filter... | 4 | stack_v2_sparse_classes_30k_train_005870 | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | a93a844398a11a8a85f204782fb9456f7caccdbe | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function or not."""
... | the_stack_v2_python_sparse | manila/scheduler/filters/driver.py | openstack/manila | train | 178 |
77346fe559d546712187956ec4b5f3bb8f842a2e | [
"sample = list(self.fetch_samples(sample_id=sample_id))\nif len(sample) > 0:\n LOG.info('Deleting sample %s from database', sample[0].id)\n self.delete_commit(sample)",
"LOG.info('Deleting entire group %s from database', group_id)\nsamples = self.fetch_samples(group_id=group_id)\nfor sample in samples:\n ... | <|body_start_0|>
sample = list(self.fetch_samples(sample_id=sample_id))
if len(sample) > 0:
LOG.info('Deleting sample %s from database', sample[0].id)
self.delete_commit(sample)
<|end_body_0|>
<|body_start_1|>
LOG.info('Deleting entire group %s from database', group_id)
... | Methods for deleting samples from database | DeleteMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteMixin:
"""Methods for deleting samples from database"""
def delete_sample(self, sample_id):
"""Delete single sample from database"""
<|body_0|>
def delete_group(self, group_id):
"""Delete entire group from database"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_007921 | 807 | permissive | [
{
"docstring": "Delete single sample from database",
"name": "delete_sample",
"signature": "def delete_sample(self, sample_id)"
},
{
"docstring": "Delete entire group from database",
"name": "delete_group",
"signature": "def delete_group(self, group_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000030 | Implement the Python class `DeleteMixin` described below.
Class description:
Methods for deleting samples from database
Method signatures and docstrings:
- def delete_sample(self, sample_id): Delete single sample from database
- def delete_group(self, group_id): Delete entire group from database | Implement the Python class `DeleteMixin` described below.
Class description:
Methods for deleting samples from database
Method signatures and docstrings:
- def delete_sample(self, sample_id): Delete single sample from database
- def delete_group(self, group_id): Delete entire group from database
<|skeleton|>
class D... | 13f80c592ade1693590992bc66af31b8c0600210 | <|skeleton|>
class DeleteMixin:
"""Methods for deleting samples from database"""
def delete_sample(self, sample_id):
"""Delete single sample from database"""
<|body_0|>
def delete_group(self, group_id):
"""Delete entire group from database"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeleteMixin:
"""Methods for deleting samples from database"""
def delete_sample(self, sample_id):
"""Delete single sample from database"""
sample = list(self.fetch_samples(sample_id=sample_id))
if len(sample) > 0:
LOG.info('Deleting sample %s from database', sample[0].... | the_stack_v2_python_sparse | chanjo/store/delete.py | Clinical-Genomics/chanjo | train | 10 |
1d1632a377ab824b567e386158282e5c401e95ae | [
"re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['validTo'])\nresult = re\nAssertions().assert_in_text(result, expect['createMonthTicketConfigMsg'])",
"re = MonthTicketBill(userLogin).openMonthTicketBill(send_data['c... | <|body_start_0|>
re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['validTo'])
result = re
Assertions().assert_in_text(result, expect['createMonthTicketConfigMsg'])
<|end_body_0|>
<|body_start_1|>
... | VIP车无在场宽出 | TestNoPresenceVipWideOutProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNoPresenceVipWideOutProcess:
"""VIP车无在场宽出"""
def test_createMonthTicketConfig(self, userLogin, send_data, expect):
"""创建自定义月票类型"""
<|body_0|>
def test_openMonthTicketBill(self, userLogin, send_data, expect):
"""用自定义月票类型开通月票"""
<|body_1|>
def test... | stack_v2_sparse_classes_36k_train_007922 | 2,390 | no_license | [
{
"docstring": "创建自定义月票类型",
"name": "test_createMonthTicketConfig",
"signature": "def test_createMonthTicketConfig(self, userLogin, send_data, expect)"
},
{
"docstring": "用自定义月票类型开通月票",
"name": "test_openMonthTicketBill",
"signature": "def test_openMonthTicketBill(self, userLogin, send_d... | 4 | null | Implement the Python class `TestNoPresenceVipWideOutProcess` described below.
Class description:
VIP车无在场宽出
Method signatures and docstrings:
- def test_createMonthTicketConfig(self, userLogin, send_data, expect): 创建自定义月票类型
- def test_openMonthTicketBill(self, userLogin, send_data, expect): 用自定义月票类型开通月票
- def test_moc... | Implement the Python class `TestNoPresenceVipWideOutProcess` described below.
Class description:
VIP车无在场宽出
Method signatures and docstrings:
- def test_createMonthTicketConfig(self, userLogin, send_data, expect): 创建自定义月票类型
- def test_openMonthTicketBill(self, userLogin, send_data, expect): 用自定义月票类型开通月票
- def test_moc... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class TestNoPresenceVipWideOutProcess:
"""VIP车无在场宽出"""
def test_createMonthTicketConfig(self, userLogin, send_data, expect):
"""创建自定义月票类型"""
<|body_0|>
def test_openMonthTicketBill(self, userLogin, send_data, expect):
"""用自定义月票类型开通月票"""
<|body_1|>
def test... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestNoPresenceVipWideOutProcess:
"""VIP车无在场宽出"""
def test_createMonthTicketConfig(self, userLogin, send_data, expect):
"""创建自定义月票类型"""
re = MonthTicketConfig(userLogin).createMonthTicketConfig(send_data['parkName'], send_data['ticketTypeName'], send_data['renewMethod'], send_data['validTo... | the_stack_v2_python_sparse | test_suite/parkingManage/monthTicket/test_noPresenceVipWideOutProcess.py | oyebino/pomp_api | train | 1 |
707224378ed0cd849660f38f9bacfca1cd411f1a | [
"article = request.data.get('article', {})\narticle['author'] = request.user.pk\narticle_instance = get_object_or_404(Article, slug=slug)\nslug = slugify(article['title']).replace('_', '-')\nslug = slug + '-' + str(uuid.uuid4()).split('-')[-1]\narticle['slug'] = slug\nthe_full_sentence = '{} {}'.format(article['tit... | <|body_start_0|>
article = request.data.get('article', {})
article['author'] = request.user.pk
article_instance = get_object_or_404(Article, slug=slug)
slug = slugify(article['title']).replace('_', '-')
slug = slug + '-' + str(uuid.uuid4()).split('-')[-1]
article['slug'] ... | UpdateDestroyArticleAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDestroyArticleAPIView:
def update(self, request, slug):
"""This method updates a user article"""
<|body_0|>
def destroy(self, request, slug):
"""This method allows a user to delete his article"""
<|body_1|>
def retrieve(self, request, slug):
... | stack_v2_sparse_classes_36k_train_007923 | 16,404 | permissive | [
{
"docstring": "This method updates a user article",
"name": "update",
"signature": "def update(self, request, slug)"
},
{
"docstring": "This method allows a user to delete his article",
"name": "destroy",
"signature": "def destroy(self, request, slug)"
},
{
"docstring": "This me... | 3 | stack_v2_sparse_classes_30k_train_001018 | Implement the Python class `UpdateDestroyArticleAPIView` described below.
Class description:
Implement the UpdateDestroyArticleAPIView class.
Method signatures and docstrings:
- def update(self, request, slug): This method updates a user article
- def destroy(self, request, slug): This method allows a user to delete ... | Implement the Python class `UpdateDestroyArticleAPIView` described below.
Class description:
Implement the UpdateDestroyArticleAPIView class.
Method signatures and docstrings:
- def update(self, request, slug): This method updates a user article
- def destroy(self, request, slug): This method allows a user to delete ... | 0e9ef1a10c8a3f6736999a5111736f7bd7236689 | <|skeleton|>
class UpdateDestroyArticleAPIView:
def update(self, request, slug):
"""This method updates a user article"""
<|body_0|>
def destroy(self, request, slug):
"""This method allows a user to delete his article"""
<|body_1|>
def retrieve(self, request, slug):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateDestroyArticleAPIView:
def update(self, request, slug):
"""This method updates a user article"""
article = request.data.get('article', {})
article['author'] = request.user.pk
article_instance = get_object_or_404(Article, slug=slug)
slug = slugify(article['title'])... | the_stack_v2_python_sparse | authors/apps/articles/views.py | andela/ah-backend-odin | train | 0 | |
efe029700f5bd48612b484882f0964419a24bb77 | [
"modellist = ioUtils.getModelListForEnumProp(self, context)\nif len(modellist) > 1:\n return context.window_manager.invoke_props_dialog(self)\nelif modellist:\n self.modelname = modellist[0][0]\n return self.execute(context)\nlog('No properly defined models to export.', 'ERROR')\nreturn {'CANCELLED'}",
"... | <|body_start_0|>
modellist = ioUtils.getModelListForEnumProp(self, context)
if len(modellist) > 1:
return context.window_manager.invoke_props_dialog(self)
elif modellist:
self.modelname = modellist[0][0]
return self.execute(context)
log('No properly de... | Export the selected model | ExportModelOperator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExportModelOperator:
"""Export the selected model"""
def invoke(self, context, event):
"""Args: context: event: Returns:"""
<|body_0|>
def exportModel(self, root, exportpath='.'):
"""Exports model to a given path in the provided formats. Args: model(dict): dictio... | stack_v2_sparse_classes_36k_train_007924 | 34,326 | permissive | [
{
"docstring": "Args: context: event: Returns:",
"name": "invoke",
"signature": "def invoke(self, context, event)"
},
{
"docstring": "Exports model to a given path in the provided formats. Args: model(dict): dictionary of model to export exportpath(str, optional): path to export root (Default va... | 3 | null | Implement the Python class `ExportModelOperator` described below.
Class description:
Export the selected model
Method signatures and docstrings:
- def invoke(self, context, event): Args: context: event: Returns:
- def exportModel(self, root, exportpath='.'): Exports model to a given path in the provided formats. Args... | Implement the Python class `ExportModelOperator` described below.
Class description:
Export the selected model
Method signatures and docstrings:
- def invoke(self, context, event): Args: context: event: Returns:
- def exportModel(self, root, exportpath='.'): Exports model to a given path in the provided formats. Args... | 543d220c65bbee0e23e810d89307e23aa79eb0cd | <|skeleton|>
class ExportModelOperator:
"""Export the selected model"""
def invoke(self, context, event):
"""Args: context: event: Returns:"""
<|body_0|>
def exportModel(self, root, exportpath='.'):
"""Exports model to a given path in the provided formats. Args: model(dict): dictio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExportModelOperator:
"""Export the selected model"""
def invoke(self, context, event):
"""Args: context: event: Returns:"""
modellist = ioUtils.getModelListForEnumProp(self, context)
if len(modellist) > 1:
return context.window_manager.invoke_props_dialog(self)
... | the_stack_v2_python_sparse | phobos/blender/operators/io.py | dfki-ric/phobos | train | 483 |
dd9ca90775715c738beacebe50fd9e6a5d4adae6 | [
"if root is None:\n return []\nresult = []\nq = deque()\nq.appendleft(root)\nwhile q:\n node = q.pop()\n if node is not None:\n result.append(str(node.val))\n q.appendleft(node.left)\n q.appendleft(node.right)\n else:\n result.append('null')\nreturn result",
"if not data:\n... | <|body_start_0|>
if root is None:
return []
result = []
q = deque()
q.appendleft(root)
while q:
node = q.pop()
if node is not None:
result.append(str(node.val))
q.appendleft(node.left)
q.appendlef... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_007925 | 3,354 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 6a83cb798cc317d1e4357ac6b2b1fbf76fa034fb | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root is None:
return []
result = []
q = deque()
q.appendleft(root)
while q:
node = q.pop()
if node is not None:
... | the_stack_v2_python_sparse | Month 02/Week 03/Day 06/d.py | KevinKnott/Coding-Review | train | 0 | |
e0dca471d149615ebb6fce3f5011a80b609c5b73 | [
"f = [[] for i in range(len(s) + 1)]\nfor i in range(len(s)):\n if f[i]:\n for word in wordDict:\n if s[i:i + len(word)] == word:\n f[i + len(word)].extend(map(lambda x: x + ' ' + word, f[i]))\n elif i == 0:\n for word in wordDict:\n if s[i:i + len(word)] == ... | <|body_start_0|>
f = [[] for i in range(len(s) + 1)]
for i in range(len(s)):
if f[i]:
for word in wordDict:
if s[i:i + len(word)] == word:
f[i + len(word)].extend(map(lambda x: x + ' ' + word, f[i]))
elif i == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
"""Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]"""
<|body_0|>
def wordBreak(self, s, wordDict):
"""Dynamic programming with subsequent dealing. :type s: str :type wordDict: Set[str] :rty... | stack_v2_sparse_classes_36k_train_007926 | 1,943 | no_license | [
{
"docstring": "Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]",
"name": "wordBreak",
"signature": "def wordBreak(self, s, wordDict)"
},
{
"docstring": "Dynamic programming with subsequent dealing. :type s: str :type wordDict: Set[str] :rtype: List[str]",
"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]
- def wordBreak(self, s, wordDict): Dynamic programming with s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s, wordDict): Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]
- def wordBreak(self, s, wordDict): Dynamic programming with s... | 052bd7915257679877dbe55b60ed1abb7528eaa2 | <|skeleton|>
class Solution:
def wordBreak(self, s, wordDict):
"""Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]"""
<|body_0|>
def wordBreak(self, s, wordDict):
"""Dynamic programming with subsequent dealing. :type s: str :type wordDict: Set[str] :rty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wordBreak(self, s, wordDict):
"""Basic dynamic programming :type s: str :type wordDict: Set[str] :rtype: List[str]"""
f = [[] for i in range(len(s) + 1)]
for i in range(len(s)):
if f[i]:
for word in wordDict:
if s[i:i + len(... | the_stack_v2_python_sparse | python_solution/Combination/140_WordBreakII.py | Dimen61/leetcode | train | 4 | |
74cbd573509f5d338965d5eec8a09ea8c9c239c1 | [
"auth = TokenAuthenticatorBase64(token=config['api_secret'])\nfunnels = FunnelsList(authenticator=auth, **config)\ntry:\n response = requests.request('GET', url=funnels.url_base + funnels.path(), headers={'Accept': 'application/json', **auth.get_auth_header()})\n if response.status_code != 200:\n messa... | <|body_start_0|>
auth = TokenAuthenticatorBase64(token=config['api_secret'])
funnels = FunnelsList(authenticator=auth, **config)
try:
response = requests.request('GET', url=funnels.url_base + funnels.path(), headers={'Accept': 'application/json', **auth.get_auth_header()})
... | SourceMixpanel | [
"MIT",
"Elastic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourceMixpanel:
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
"""See https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-stripe/source_stripe/source.py#L232 for an example. :param config: the user-inp... | stack_v2_sparse_classes_36k_train_007927 | 32,100 | permissive | [
{
"docstring": "See https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-stripe/source_stripe/source.py#L232 for an example. :param config: the user-input config object conforming to the connector's spec.json :param logger: logger object :return Tuple[bool, any]: (True, None) ... | 2 | null | Implement the Python class `SourceMixpanel` described below.
Class description:
Implement the SourceMixpanel class.
Method signatures and docstrings:
- def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]: See https://github.com/airbytehq/airbyte/blob/master/airbyte-integra... | Implement the Python class `SourceMixpanel` described below.
Class description:
Implement the SourceMixpanel class.
Method signatures and docstrings:
- def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]: See https://github.com/airbytehq/airbyte/blob/master/airbyte-integra... | 802a8184cdd11c1eb905a54ed07c8732b0c0b807 | <|skeleton|>
class SourceMixpanel:
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
"""See https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-stripe/source_stripe/source.py#L232 for an example. :param config: the user-inp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SourceMixpanel:
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
"""See https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/source-stripe/source_stripe/source.py#L232 for an example. :param config: the user-input config obje... | the_stack_v2_python_sparse | airbyte-integrations/connectors/source-mixpanel/source_mixpanel/source.py | Velocity-Engineering/airbyte | train | 0 | |
7466c1601403866ca6b6be942ac5e4939b4f2188 | [
"if not grid:\n return 0\nm, n = (len(grid), len(grid[0]))\ndp = [[0 for i in range(n)] for j in range(m)]\ndp[0][0] = grid[0][0]\nfor i in range(1, m):\n dp[i][0] = dp[i - 1][0] + grid[i][0]\nfor j in range(1, n):\n dp[0][j] = dp[0][j - 1] + grid[0][j]\nfor i in range(1, m):\n for j in range(1, n):\n ... | <|body_start_0|>
if not grid:
return 0
m, n = (len(grid), len(grid[0]))
dp = [[0 for i in range(n)] for j in range(m)]
dp[0][0] = grid[0][0]
for i in range(1, m):
dp[i][0] = dp[i - 1][0] + grid[i][0]
for j in range(1, n):
dp[0][j] = dp[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def minPathSum2(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
def minPathSum3(self, grid):
""":type grid: List[List[int]] :rtyp... | stack_v2_sparse_classes_36k_train_007928 | 3,941 | no_license | [
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "minPathSum",
"signature": "def minPathSum(self, grid)"
},
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "minPathSum2",
"signature": "def minPathSum2(self, grid)"
},
{
"docstring": ":type grid: ... | 4 | stack_v2_sparse_classes_30k_train_000568 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum2(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum3(self, grid): :type gr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum2(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum3(self, grid): :type gr... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def minPathSum2(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
def minPathSum3(self, grid):
""":type grid: List[List[int]] :rtyp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
if not grid:
return 0
m, n = (len(grid), len(grid[0]))
dp = [[0 for i in range(n)] for j in range(m)]
dp[0][0] = grid[0][0]
for i in range(1, m):
dp[i][0]... | the_stack_v2_python_sparse | 64. Minimum Path Sum/minimum_path.py | Macielyoung/LeetCode | train | 1 | |
8a5d39c88322e754dc29eebdcfab791e9aedbdae | [
"meetup = MeetupModels.get_specific(self, meetupId)\nmeetup = json.loads(meetup)\nif not meetup:\n return ({'status': 404, 'error': 'Meetup {} does not exist'.format(meetupId)}, 404)\nreturn ({'status': 200, 'meetups': meetup}, 200)",
"delete_meetup = MeetupModels.delete_specific(self, meetupId)\nif delete_mee... | <|body_start_0|>
meetup = MeetupModels.get_specific(self, meetupId)
meetup = json.loads(meetup)
if not meetup:
return ({'status': 404, 'error': 'Meetup {} does not exist'.format(meetupId)}, 404)
return ({'status': 200, 'meetups': meetup}, 200)
<|end_body_0|>
<|body_start_1|>... | Class for specific meetup | OneMeetup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OneMeetup:
"""Class for specific meetup"""
def get(self, meetupId, current_user):
"""Method to fetch specific meetup"""
<|body_0|>
def delete(self, meetupId, current_user):
"""Method to delete meetup record"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_007929 | 5,065 | no_license | [
{
"docstring": "Method to fetch specific meetup",
"name": "get",
"signature": "def get(self, meetupId, current_user)"
},
{
"docstring": "Method to delete meetup record",
"name": "delete",
"signature": "def delete(self, meetupId, current_user)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018304 | Implement the Python class `OneMeetup` described below.
Class description:
Class for specific meetup
Method signatures and docstrings:
- def get(self, meetupId, current_user): Method to fetch specific meetup
- def delete(self, meetupId, current_user): Method to delete meetup record | Implement the Python class `OneMeetup` described below.
Class description:
Class for specific meetup
Method signatures and docstrings:
- def get(self, meetupId, current_user): Method to fetch specific meetup
- def delete(self, meetupId, current_user): Method to delete meetup record
<|skeleton|>
class OneMeetup:
... | 93c7aeb54c240b6312e6164859acd2c878e85825 | <|skeleton|>
class OneMeetup:
"""Class for specific meetup"""
def get(self, meetupId, current_user):
"""Method to fetch specific meetup"""
<|body_0|>
def delete(self, meetupId, current_user):
"""Method to delete meetup record"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OneMeetup:
"""Class for specific meetup"""
def get(self, meetupId, current_user):
"""Method to fetch specific meetup"""
meetup = MeetupModels.get_specific(self, meetupId)
meetup = json.loads(meetup)
if not meetup:
return ({'status': 404, 'error': 'Meetup {} doe... | the_stack_v2_python_sparse | app/api/v2/views/meetup_views.py | matthenge/Questioner-api-v2 | train | 0 |
fae32d7a1065bb1b86503afb26b8220aabe0a717 | [
"self.n_y = n_y\nself.n_x = n_x\nsuper().__init__(centre=centre, ell_comps=ell_comps, beta=beta)",
"hermite_y = hermite(n=self.n_y)\nhermite_x = hermite(n=self.n_x)\ny = grid[:, 0]\nx = grid[:, 1]\nshapelet_y = hermite_y(y / self.beta)\nshapelet_x = hermite_x(x / self.beta)\nreturn shapelet_y * shapelet_x * np.ex... | <|body_start_0|>
self.n_y = n_y
self.n_x = n_x
super().__init__(centre=centre, ell_comps=ell_comps, beta=beta)
<|end_body_0|>
<|body_start_1|>
hermite_y = hermite(n=self.n_y)
hermite_x = hermite(n=self.n_x)
y = grid[:, 0]
x = grid[:, 1]
shapelet_y = hermi... | ShapeletCartesianEll | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShapeletCartesianEll:
def __init__(self, n_y: int, n_x: int, centre: Tuple[float, float]=(0.0, 0.0), ell_comps: Tuple[float, float]=(0.0, 0.0), beta: float=1.0):
"""Shapelets where the basis function is defined according to a Cartesian (y,x) grid of coordinates. Shapelets are defined acc... | stack_v2_sparse_classes_36k_train_007930 | 4,264 | permissive | [
{
"docstring": "Shapelets where the basis function is defined according to a Cartesian (y,x) grid of coordinates. Shapelets are defined according to: https://arxiv.org/abs/astro-ph/0105178 Shapelets are are described in the context of strong lens modeling in: https://ui.adsabs.harvard.edu/abs/2016MNRAS.457.3066... | 2 | stack_v2_sparse_classes_30k_test_000529 | Implement the Python class `ShapeletCartesianEll` described below.
Class description:
Implement the ShapeletCartesianEll class.
Method signatures and docstrings:
- def __init__(self, n_y: int, n_x: int, centre: Tuple[float, float]=(0.0, 0.0), ell_comps: Tuple[float, float]=(0.0, 0.0), beta: float=1.0): Shapelets wher... | Implement the Python class `ShapeletCartesianEll` described below.
Class description:
Implement the ShapeletCartesianEll class.
Method signatures and docstrings:
- def __init__(self, n_y: int, n_x: int, centre: Tuple[float, float]=(0.0, 0.0), ell_comps: Tuple[float, float]=(0.0, 0.0), beta: float=1.0): Shapelets wher... | d1a2e400b7ac984a21d972f54e419d8783342454 | <|skeleton|>
class ShapeletCartesianEll:
def __init__(self, n_y: int, n_x: int, centre: Tuple[float, float]=(0.0, 0.0), ell_comps: Tuple[float, float]=(0.0, 0.0), beta: float=1.0):
"""Shapelets where the basis function is defined according to a Cartesian (y,x) grid of coordinates. Shapelets are defined acc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShapeletCartesianEll:
def __init__(self, n_y: int, n_x: int, centre: Tuple[float, float]=(0.0, 0.0), ell_comps: Tuple[float, float]=(0.0, 0.0), beta: float=1.0):
"""Shapelets where the basis function is defined according to a Cartesian (y,x) grid of coordinates. Shapelets are defined according to: htt... | the_stack_v2_python_sparse | autogalaxy/profiles/light/shapelets/cartesian.py | Jammy2211/PyAutoGalaxy | train | 27 | |
0109d22100ce7f260de6109aeb3ff82d7225c149 | [
"shape_file = self.find_shx(shxname)\nif shape_file is None:\n dxfattribs = {'font': shxname, 'flags': 1, 'name': '', 'last_height': 2.5}\n return self.new_entry(dxfattribs)\nelse:\n return shape_file",
"lower_name = shxname.lower()\nfor entry in iter(self):\n if entry.dxf.font.lower() == lower_name:\... | <|body_start_0|>
shape_file = self.find_shx(shxname)
if shape_file is None:
dxfattribs = {'font': shxname, 'flags': 1, 'name': '', 'last_height': 2.5}
return self.new_entry(dxfattribs)
else:
return shape_file
<|end_body_0|>
<|body_start_1|>
lower_name... | StyleTable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StyleTable:
def get_shx(self, shxname: str) -> 'DXFEntity':
"""Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'"""
<|body_0|>
def find_shx(self, shxname: str) -> Optional['DXFEntity']:
"""Find .shx shape file table ent... | stack_v2_sparse_classes_36k_train_007931 | 9,038 | permissive | [
{
"docstring": "Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'",
"name": "get_shx",
"signature": "def get_shx(self, shxname: str) -> 'DXFEntity'"
},
{
"docstring": "Find .shx shape file table entry, by a case insensitive search. A .shx shape fil... | 2 | null | Implement the Python class `StyleTable` described below.
Class description:
Implement the StyleTable class.
Method signatures and docstrings:
- def get_shx(self, shxname: str) -> 'DXFEntity': Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'
- def find_shx(self, shxname... | Implement the Python class `StyleTable` described below.
Class description:
Implement the StyleTable class.
Method signatures and docstrings:
- def get_shx(self, shxname: str) -> 'DXFEntity': Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'
- def find_shx(self, shxname... | a01ed68ea45f25a231e470d239aefed73ab285d5 | <|skeleton|>
class StyleTable:
def get_shx(self, shxname: str) -> 'DXFEntity':
"""Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'"""
<|body_0|>
def find_shx(self, shxname: str) -> Optional['DXFEntity']:
"""Find .shx shape file table ent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StyleTable:
def get_shx(self, shxname: str) -> 'DXFEntity':
"""Get existing shx entry, or create a new entry. Args: shxname: shape file name like 'ltypeshp.lin'"""
shape_file = self.find_shx(shxname)
if shape_file is None:
dxfattribs = {'font': shxname, 'flags': 1, 'name': ... | the_stack_v2_python_sparse | ezdxf/sections/table.py | ols3er/ezdxf | train | 0 | |
afd3d389a6f02115ef58124ee861aab1e29b3413 | [
"nzones = zone_set.size()\ncomb_index = indices((nzones, nzones))\ntable_name = 'storage'\nin_storage = StorageFactory().get_storage('dict_storage')\nin_storage.write_table(table_name=table_name, table_data={'from_zone_id': zone_set.get_id_attribute()[comb_index[0].ravel()].astype('int32'), 'to_zone_id': zone_set.g... | <|body_start_0|>
nzones = zone_set.size()
comb_index = indices((nzones, nzones))
table_name = 'storage'
in_storage = StorageFactory().get_storage('dict_storage')
in_storage.write_table(table_name=table_name, table_data={'from_zone_id': zone_set.get_id_attribute()[comb_index[0].ra... | Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory). | TravelModelOutput | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TravelModelOutput:
"""Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory)."""
def get_travel_data_set(self, zone_set, matrix_attribute_name_map, out_storage=None, **kwargs):
"""Create and return a travel data set containing the given set of emme ... | stack_v2_sparse_classes_36k_train_007932 | 8,564 | no_license | [
{
"docstring": "Create and return a travel data set containing the given set of emme matrices populated from given storage. The columns in the travel data set are those given in the attribute name of the map. Arguments: zone_set -- dataset of zones matrix_attribute_name_map -- dictionary of skim names and corre... | 2 | null | Implement the Python class `TravelModelOutput` described below.
Class description:
Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory).
Method signatures and docstrings:
- def get_travel_data_set(self, zone_set, matrix_attribute_name_map, out_storage=None, **kwargs): Create and r... | Implement the Python class `TravelModelOutput` described below.
Class description:
Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory).
Method signatures and docstrings:
- def get_travel_data_set(self, zone_set, matrix_attribute_name_map, out_storage=None, **kwargs): Create and r... | c392d15b35aa1d47bbc185ed76314f8e6dd9f92f | <|skeleton|>
class TravelModelOutput:
"""Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory)."""
def get_travel_data_set(self, zone_set, matrix_attribute_name_map, out_storage=None, **kwargs):
"""Create and return a travel data set containing the given set of emme ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TravelModelOutput:
"""Access the output of emme4 travel model in any format (e.g. hdf5 or directly from memory)."""
def get_travel_data_set(self, zone_set, matrix_attribute_name_map, out_storage=None, **kwargs):
"""Create and return a travel data set containing the given set of emme matrices popu... | the_stack_v2_python_sparse | psrc_parcel/emme/travel_model_output.py | psrc/urbansim | train | 4 |
222a401d10fb35279cd9603571d067ea60195720 | [
"resource_args.AddDatabaseResourceArg(parser, 'to update')\ngroup_parser = parser.add_argument_group(mutex=True)\nflags.EnableDropProtection().AddToParser(group_parser)\nbase.ASYNC_FLAG.AddToParser(parser)",
"op = databases.Update(args.CONCEPTS.database.Parse(), args.enable_drop_protection)\nif args.async_:\n ... | <|body_start_0|>
resource_args.AddDatabaseResourceArg(parser, 'to update')
group_parser = parser.add_argument_group(mutex=True)
flags.EnableDropProtection().AddToParser(group_parser)
base.ASYNC_FLAG.AddToParser(parser)
<|end_body_0|>
<|body_start_1|>
op = databases.Update(args.C... | Update a Cloud Spanner database. | Update | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Update:
"""Update a Cloud Spanner database."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed."""... | stack_v2_sparse_classes_36k_train_007933 | 2,534 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_021153 | Implement the Python class `Update` described below.
Class description:
Update a Cloud Spanner database.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line... | Implement the Python class `Update` described below.
Class description:
Update a Cloud Spanner database.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class Update:
"""Update a Cloud Spanner database."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Update:
"""Update a Cloud Spanner database."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed."""
reso... | the_stack_v2_python_sparse | lib/surface/spanner/databases/update.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
f1d61fa611cc283b196ea7dd2bf11061bd0907f5 | [
"self.n_estimators = n_estimators\nself.criteron = criterion\nself.max_depth = max_depth\nself.models = []\nself.col_names = []\nself.X = None\nself.y = None",
"N, col = X.shape\nfor i in range(self.n_estimators):\n base = DecisionTree(criterion=self.criteron)\n base.output = 'discrete'\n base.input = 'r... | <|body_start_0|>
self.n_estimators = n_estimators
self.criteron = criterion
self.max_depth = max_depth
self.models = []
self.col_names = []
self.X = None
self.y = None
<|end_body_0|>
<|body_start_1|>
N, col = X.shape
for i in range(self.n_estimato... | RandomForestClassifier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth ... | stack_v2_sparse_classes_36k_train_007934 | 7,799 | no_license | [
{
"docstring": ":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth of the tree.",
"name": "__init__",
"signature": "def __init__(self, n_estimators=100, criterion='g... | 4 | stack_v2_sparse_classes_30k_train_002650 | Implement the Python class `RandomForestClassifier` described below.
Class description:
Implement the RandomForestClassifier class.
Method signatures and docstrings:
- def __init__(self, n_estimators=100, criterion='gini', max_depth=100): :param estimators: DecisionTree :param n_estimators: The number of trees in the... | Implement the Python class `RandomForestClassifier` described below.
Class description:
Implement the RandomForestClassifier class.
Method signatures and docstrings:
- def __init__(self, n_estimators=100, criterion='gini', max_depth=100): :param estimators: DecisionTree :param n_estimators: The number of trees in the... | 18e4733e1bf7713502cce514e1cf7e587b35ca5c | <|skeleton|>
class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomForestClassifier:
def __init__(self, n_estimators=100, criterion='gini', max_depth=100):
""":param estimators: DecisionTree :param n_estimators: The number of trees in the forest. :param criterion: The function to measure the quality of a split. :param max_depth: The maximum depth of the tree.""... | the_stack_v2_python_sparse | assignment-2-jatinkumar762/tree/randomForest.py | jatinkumar762/MachineLearning | train | 0 | |
4c1a241158c58661ed813d7f4673748d30c6fd0b | [
"timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_webkit_time.WebKitTime(timestamp=timestamp)",
"query_hash = hash(query)\nevent_data = ChromeExtensionActivityEventData()\nevent_data.action_type = self._GetRowValue(query_hash, row, 'action_type'... | <|body_start_0|>
timestamp = self._GetRowValue(query_hash, row, value_name)
if timestamp is None:
return None
return dfdatetime_webkit_time.WebKitTime(timestamp=timestamp)
<|end_body_0|>
<|body_start_1|>
query_hash = hash(query)
event_data = ChromeExtensionActivityEv... | SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity | ChromeExtensionActivityPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChromeExtensionActivityPlugin:
"""SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a dat... | stack_v2_sparse_classes_36k_train_007935 | 4,725 | permissive | [
{
"docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.WebKitTime: date and time value or None if not available.",
"nam... | 2 | null | Implement the Python class `ChromeExtensionActivityPlugin` described below.
Class description:
SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity
Method signatures and docstrings:
- def _GetDateTimeRow... | Implement the Python class `ChromeExtensionActivityPlugin` described below.
Class description:
SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity
Method signatures and docstrings:
- def _GetDateTimeRow... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class ChromeExtensionActivityPlugin:
"""SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a dat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChromeExtensionActivityPlugin:
"""SQLite parser plugin for Google Chrome extension activity database files. The Google Chrome extension activity database file is typically stored in: Extension Activity"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time va... | the_stack_v2_python_sparse | plaso/parsers/sqlite_plugins/chrome_extension_activity.py | log2timeline/plaso | train | 1,506 |
fd1eb433a667e93f061cffd39a8bbd32f2ebbb39 | [
"self.maxDiff = None\nentry = dedent('\\n Main topic text\\n # subtopics\\n ## foo\\n Foo sub-category\\n ### moo\\n Foo/Moo subsub-category\\n #### dum\\n Foo/Moo/Dum subsubsub-category\\n ## bar\\n Bar su... | <|body_start_0|>
self.maxDiff = None
entry = dedent('\n Main topic text\n # subtopics\n ## foo\n Foo sub-category\n ### moo\n Foo/Moo subsub-category\n #### dum\n Foo/Moo/Dum subsubsub-category\n ## bar\n ... | Test the subtopic parser. | TestParseSubtopics | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestParseSubtopics:
"""Test the subtopic parser."""
def test_parse_entry(self):
"""Test for subcategories"""
<|body_0|>
def test_parse_single_entry(self):
"""Test parsing single subcategory"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.ma... | stack_v2_sparse_classes_36k_train_007936 | 3,736 | permissive | [
{
"docstring": "Test for subcategories",
"name": "test_parse_entry",
"signature": "def test_parse_entry(self)"
},
{
"docstring": "Test parsing single subcategory",
"name": "test_parse_single_entry",
"signature": "def test_parse_single_entry(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007585 | Implement the Python class `TestParseSubtopics` described below.
Class description:
Test the subtopic parser.
Method signatures and docstrings:
- def test_parse_entry(self): Test for subcategories
- def test_parse_single_entry(self): Test parsing single subcategory | Implement the Python class `TestParseSubtopics` described below.
Class description:
Test the subtopic parser.
Method signatures and docstrings:
- def test_parse_entry(self): Test for subcategories
- def test_parse_single_entry(self): Test parsing single subcategory
<|skeleton|>
class TestParseSubtopics:
"""Test ... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class TestParseSubtopics:
"""Test the subtopic parser."""
def test_parse_entry(self):
"""Test for subcategories"""
<|body_0|>
def test_parse_single_entry(self):
"""Test parsing single subcategory"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestParseSubtopics:
"""Test the subtopic parser."""
def test_parse_entry(self):
"""Test for subcategories"""
self.maxDiff = None
entry = dedent('\n Main topic text\n # subtopics\n ## foo\n Foo sub-category\n ### moo\n ... | the_stack_v2_python_sparse | evennia/help/tests.py | evennia/evennia | train | 1,781 |
19df958b8d89de3aeff4dd122fc0510d9c68f23a | [
"person = PersonServiceManagement.retrieve_object(person_id=person_id)\nshare = ShareModel.objects.create(person=person, **data)\nreturn share",
"person = PersonServiceManagement.retrieve_object(person_id=person_id)\ntry:\n ShareModel.objects.filter(share_id=share_id).update(person=person, **data)\nexcept Obje... | <|body_start_0|>
person = PersonServiceManagement.retrieve_object(person_id=person_id)
share = ShareModel.objects.create(person=person, **data)
return share
<|end_body_0|>
<|body_start_1|>
person = PersonServiceManagement.retrieve_object(person_id=person_id)
try:
Sha... | ShareServiceManagement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShareServiceManagement:
def create_object(data: dict, person_id: int) -> ShareModel:
"""Creates a share object Args: data (dict): information about the share person_id (int): unique identifier of the person object Returns: (ShareModel): created share"""
<|body_0|>
def update... | stack_v2_sparse_classes_36k_train_007937 | 4,864 | no_license | [
{
"docstring": "Creates a share object Args: data (dict): information about the share person_id (int): unique identifier of the person object Returns: (ShareModel): created share",
"name": "create_object",
"signature": "def create_object(data: dict, person_id: int) -> ShareModel"
},
{
"docstring... | 5 | stack_v2_sparse_classes_30k_train_021095 | Implement the Python class `ShareServiceManagement` described below.
Class description:
Implement the ShareServiceManagement class.
Method signatures and docstrings:
- def create_object(data: dict, person_id: int) -> ShareModel: Creates a share object Args: data (dict): information about the share person_id (int): un... | Implement the Python class `ShareServiceManagement` described below.
Class description:
Implement the ShareServiceManagement class.
Method signatures and docstrings:
- def create_object(data: dict, person_id: int) -> ShareModel: Creates a share object Args: data (dict): information about the share person_id (int): un... | 84ad5886ec3cd8d2aae43f5812e2c894b71685b5 | <|skeleton|>
class ShareServiceManagement:
def create_object(data: dict, person_id: int) -> ShareModel:
"""Creates a share object Args: data (dict): information about the share person_id (int): unique identifier of the person object Returns: (ShareModel): created share"""
<|body_0|>
def update... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShareServiceManagement:
def create_object(data: dict, person_id: int) -> ShareModel:
"""Creates a share object Args: data (dict): information about the share person_id (int): unique identifier of the person object Returns: (ShareModel): created share"""
person = PersonServiceManagement.retriev... | the_stack_v2_python_sparse | platform_inistock/inistock/models/service_management.py | MihailButnaru/Inistock-API | train | 0 | |
a18ce716515f7e48781a636b1e1e7fbc39e92603 | [
"decorator_name = ''.join(('@', Epilog.__name__.lower()))\nself.decorator_name = decorator_name\nself.args = args\nself.kwargs = kwargs\nself.scope = CONTEXT.in_pycompss()\nself.core_element = None\nself.core_element_configured = False\nif self.scope:\n check_arguments(MANDATORY_ARGUMENTS, DEPRECATED_ARGUMENTS, ... | <|body_start_0|>
decorator_name = ''.join(('@', Epilog.__name__.lower()))
self.decorator_name = decorator_name
self.args = args
self.kwargs = kwargs
self.scope = CONTEXT.in_pycompss()
self.core_element = None
self.core_element_configured = False
if self.sc... | Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition. | Epilog | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Epilog:
"""Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition."""
def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
"""Store arguments passed to the decorator. s... | stack_v2_sparse_classes_36k_train_007938 | 5,194 | permissive | [
{
"docstring": "Store arguments passed to the decorator. self = itself. args = not used. kwargs = dictionary with the given binary and args strings. :param args: Arguments :param kwargs: Keyword arguments",
"name": "__init__",
"signature": "def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> ... | 3 | null | Implement the Python class `Epilog` described below.
Class description:
Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition.
Method signatures and docstrings:
- def __init__(self, *args: typing.Any, **kwargs: typing... | Implement the Python class `Epilog` described below.
Class description:
Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition.
Method signatures and docstrings:
- def __init__(self, *args: typing.Any, **kwargs: typing... | 5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092 | <|skeleton|>
class Epilog:
"""Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition."""
def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
"""Store arguments passed to the decorator. s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Epilog:
"""Epilog decorator class. If defined, will execute the binary after the task execution on the worker. Should always be added on top of the 'task' definition."""
def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
"""Store arguments passed to the decorator. self = itself.... | the_stack_v2_python_sparse | compss/programming_model/bindings/python/src/pycompss/api/epilog.py | bsc-wdc/compss | train | 39 |
a62b00cfedc58b0688149f7e3960fbcf3d1130a4 | [
"dic = {}\nsum, res = (0, 0)\nfor i in xrange(len(nums)):\n sum += nums[i]\n if sum == k:\n res = max(res, i + 1)\n elif sum - k in dic:\n res = max(res, i - dic[sum - k])\n if sum not in dic:\n dic[sum] = i\nreturn res",
"sum = [0] * (len(nums) + 1)\nres = 0\nfor i in xrange(1, l... | <|body_start_0|>
dic = {}
sum, res = (0, 0)
for i in xrange(len(nums)):
sum += nums[i]
if sum == k:
res = max(res, i + 1)
elif sum - k in dic:
res = max(res, i - dic[sum - k])
if sum not in dic:
dic[s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dic = {... | stack_v2_sparse_classes_36k_train_007939 | 1,023 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "maxSubArrayLen",
"signature": "def maxSubArrayLen(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "maxSubArrayLen",
"signature": "def maxSubArrayLen(self, nums, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019195 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|... | 09669844cf6ff504e6ef05f1fa21c45a9c698470 | <|skeleton|>
class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
dic = {}
sum, res = (0, 0)
for i in xrange(len(nums)):
sum += nums[i]
if sum == k:
res = max(res, i + 1)
elif sum - k in dic:
... | the_stack_v2_python_sparse | 325_Maximum_Size_Subarray_Sum_Equals_k.py | claire-tr/algorithms | train | 0 | |
4ef289c933f5338d59d2977a6ea77968ac3e3442 | [
"kw: Dict[str, Any] = {}\nif self.dataclasses_default_factory is not _NoArg.NO_ARG:\n kw['default_factory'] = self.dataclasses_default_factory\nif self.dataclasses_default is not _NoArg.NO_ARG:\n kw['default'] = self.dataclasses_default\nif self.dataclasses_init is not _NoArg.NO_ARG:\n kw['init'] = self.da... | <|body_start_0|>
kw: Dict[str, Any] = {}
if self.dataclasses_default_factory is not _NoArg.NO_ARG:
kw['default_factory'] = self.dataclasses_default_factory
if self.dataclasses_default is not _NoArg.NO_ARG:
kw['default'] = self.dataclasses_default
if self.dataclass... | define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0 | _AttributeOptions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _AttributeOptions:
"""define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0"""
def _as_dataclass_field(self, key: str) -> Any:
"""Return a ``dataclasses.Field`` obje... | stack_v2_sparse_classes_36k_train_007940 | 48,410 | permissive | [
{
"docstring": "Return a ``dataclasses.Field`` object given these arguments.",
"name": "_as_dataclass_field",
"signature": "def _as_dataclass_field(self, key: str) -> Any"
},
{
"docstring": "given attribute key, annotation, and value from a class, return the argument tuple we would pass to datac... | 2 | stack_v2_sparse_classes_30k_train_007345 | Implement the Python class `_AttributeOptions` described below.
Class description:
define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0
Method signatures and docstrings:
- def _as_dataclass_field(se... | Implement the Python class `_AttributeOptions` described below.
Class description:
define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0
Method signatures and docstrings:
- def _as_dataclass_field(se... | b382bff6e3464f039db0fd1f2ce1b79038675e48 | <|skeleton|>
class _AttributeOptions:
"""define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0"""
def _as_dataclass_field(self, key: str) -> Any:
"""Return a ``dataclasses.Field`` obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _AttributeOptions:
"""define Python-local attribute behavior options common to all :class:`.MapperProperty` objects. Currently this includes dataclass-generation arguments. .. versionadded:: 2.0"""
def _as_dataclass_field(self, key: str) -> Any:
"""Return a ``dataclasses.Field`` object given thes... | the_stack_v2_python_sparse | lib/sqlalchemy/orm/interfaces.py | sqlalchemy/sqlalchemy | train | 8,083 |
8506068dfebcad06906f4f2a08004d41faeef545 | [
"if not head:\n return head\nnewHead = head\ntail = head\nlength = 1\nwhile tail.next:\n tail = tail.next\n length += 1\ntail.next = head\nk = k % length\nif k:\n for i in range(length - k):\n tail = tail.next\nnewHead = tail.next\ntail.next = None\nreturn newHead",
"if not head or k == 0:\n ... | <|body_start_0|>
if not head:
return head
newHead = head
tail = head
length = 1
while tail.next:
tail = tail.next
length += 1
tail.next = head
k = k % length
if k:
for i in range(length - k):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight_self(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_007941 | 1,498 | no_license | [
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight",
"signature": "def rotateRight(self, head, k)"
},
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight_self",
"signature": "def rotateRight_self(self, head, k)"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight_self(self, head, k): :type head: ListNode :type k: int :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight_self(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
<|sk... | ea492ec864b50547214ecbbb2cdeeac21e70229b | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight_self(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
if not head:
return head
newHead = head
tail = head
length = 1
while tail.next:
tail = tail.next
length += 1
tail.next ... | the_stack_v2_python_sparse | 61_rotate_list/sol.py | lianke123321/leetcode_sol | train | 0 | |
0911aecfae2a7fe78165764280f29550ee1bbca7 | [
"QItemDelegate.__init__(self, parent)\nself.itemsDict = itemsDict\nself.column = column",
"if index.column() == self.column:\n list = QListWidget(parent)\n for item in self.itemsDict:\n listItem = QListWidgetItem(item)\n listItem.setCheckState(Qt.Unchecked)\n list.addItem(listItem)\n ... | <|body_start_0|>
QItemDelegate.__init__(self, parent)
self.itemsDict = itemsDict
self.column = column
<|end_body_0|>
<|body_start_1|>
if index.column() == self.column:
list = QListWidget(parent)
for item in self.itemsDict:
listItem = QListWidgetIt... | ListWidgetDelegate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListWidgetDelegate:
def __init__(self, parent, itemsDict, column):
"""Constructor"""
<|body_0|>
def createEditor(self, parent, option, index):
"""Creates a custom editor to edit value relation data"""
<|body_1|>
def setEditorData(self, editor, index):
... | stack_v2_sparse_classes_36k_train_007942 | 16,608 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, parent, itemsDict, column)"
},
{
"docstring": "Creates a custom editor to edit value relation data",
"name": "createEditor",
"signature": "def createEditor(self, parent, option, index)"
},
{
"docst... | 4 | null | Implement the Python class `ListWidgetDelegate` described below.
Class description:
Implement the ListWidgetDelegate class.
Method signatures and docstrings:
- def __init__(self, parent, itemsDict, column): Constructor
- def createEditor(self, parent, option, index): Creates a custom editor to edit value relation dat... | Implement the Python class `ListWidgetDelegate` described below.
Class description:
Implement the ListWidgetDelegate class.
Method signatures and docstrings:
- def __init__(self, parent, itemsDict, column): Constructor
- def createEditor(self, parent, option, index): Creates a custom editor to edit value relation dat... | edff378f356db3c0577ce34e618c5ae493d296ba | <|skeleton|>
class ListWidgetDelegate:
def __init__(self, parent, itemsDict, column):
"""Constructor"""
<|body_0|>
def createEditor(self, parent, option, index):
"""Creates a custom editor to edit value relation data"""
<|body_1|>
def setEditorData(self, editor, index):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ListWidgetDelegate:
def __init__(self, parent, itemsDict, column):
"""Constructor"""
QItemDelegate.__init__(self, parent)
self.itemsDict = itemsDict
self.column = column
def createEditor(self, parent, option, index):
"""Creates a custom editor to edit value relatio... | the_stack_v2_python_sparse | ComplexTools/manageComplex.py | euriconicacio/DsgTools | train | 0 | |
590952aad40e57d825a0a66afb8e7a7903573b6b | [
"url = ''\nresp, body = self.get(url)\nself.expected_success([200, 203], resp.status)\nbody = json.loads(body)\nreturn rest_client.ResponseBody(resp, body)",
"resp, body = self.get('tokens/%s' % token_id)\nself.expected_success(200, resp.status)\nbody = json.loads(body)\nreturn rest_client.ResponseBody(resp, body... | <|body_start_0|>
url = ''
resp, body = self.get(url)
self.expected_success([200, 203], resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
<|end_body_0|>
<|body_start_1|>
resp, body = self.get('tokens/%s' % token_id)
self.expected_suc... | IdentityClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentityClient:
def show_api_description(self):
"""Retrieves info about the v2.0 Identity API"""
<|body_0|>
def show_token(self, token_id):
"""Get token details."""
<|body_1|>
def delete_token(self, token_id):
"""Delete a token."""
<|body... | stack_v2_sparse_classes_36k_train_007943 | 2,643 | permissive | [
{
"docstring": "Retrieves info about the v2.0 Identity API",
"name": "show_api_description",
"signature": "def show_api_description(self)"
},
{
"docstring": "Get token details.",
"name": "show_token",
"signature": "def show_token(self, token_id)"
},
{
"docstring": "Delete a token... | 6 | null | Implement the Python class `IdentityClient` described below.
Class description:
Implement the IdentityClient class.
Method signatures and docstrings:
- def show_api_description(self): Retrieves info about the v2.0 Identity API
- def show_token(self, token_id): Get token details.
- def delete_token(self, token_id): De... | Implement the Python class `IdentityClient` described below.
Class description:
Implement the IdentityClient class.
Method signatures and docstrings:
- def show_api_description(self): Retrieves info about the v2.0 Identity API
- def show_token(self, token_id): Get token details.
- def delete_token(self, token_id): De... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class IdentityClient:
def show_api_description(self):
"""Retrieves info about the v2.0 Identity API"""
<|body_0|>
def show_token(self, token_id):
"""Get token details."""
<|body_1|>
def delete_token(self, token_id):
"""Delete a token."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdentityClient:
def show_api_description(self):
"""Retrieves info about the v2.0 Identity API"""
url = ''
resp, body = self.get(url)
self.expected_success([200, 203], resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
def show_... | the_stack_v2_python_sparse | tempest/lib/services/identity/v2/identity_client.py | openstack/tempest | train | 270 | |
5490971e975bfcce10ccd1b9ffe2100189e5ad3c | [
"total = 0\nbuy = -1\nfor index, item in enumerate(prices):\n if buy == -1:\n if index != len(prices) - 1 and item < prices[index + 1]:\n buy = item\n elif item > buy and (index == len(prices) - 1 or item > prices[index + 1]):\n total += item - buy\n buy = -1\nreturn total",
... | <|body_start_0|>
total = 0
buy = -1
for index, item in enumerate(prices):
if buy == -1:
if index != len(prices) - 1 and item < prices[index + 1]:
buy = item
elif item > buy and (index == len(prices) - 1 or item > prices[index + 1]):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit2(self, prices: List[int]) -> int:
"""贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:"""
<|body_0|>
def maxProfit(self, prices: List[int]) -> int:
"""动态规划 最大利润 dp[i][0] = max(dp[i-1][0], dp[i-1][1]... | stack_v2_sparse_classes_36k_train_007944 | 2,434 | no_license | [
{
"docstring": "贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:",
"name": "maxProfit2",
"signature": "def maxProfit2(self, prices: List[int]) -> int"
},
{
"docstring": "动态规划 最大利润 dp[i][0] = max(dp[i-1][0], dp[i-1][1] + prices[i]) dp[i][1] = max(dp[i... | 2 | stack_v2_sparse_classes_30k_train_009230 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit2(self, prices: List[int]) -> int: 贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:
- def maxProfit(self, prices: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit2(self, prices: List[int]) -> int: 贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:
- def maxProfit(self, prices: List[... | c0dd577481b46129d950354d567d332a4d091137 | <|skeleton|>
class Solution:
def maxProfit2(self, prices: List[int]) -> int:
"""贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:"""
<|body_0|>
def maxProfit(self, prices: List[int]) -> int:
"""动态规划 最大利润 dp[i][0] = max(dp[i-1][0], dp[i-1][1]... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit2(self, prices: List[int]) -> int:
"""贪心算法 1. 只要未买入,则买入 2. 只要后一天的价格大于持有的价格,则卖出赚取差价。 3. 如果是最后一天,如果持有,就算亏损也要卖出。 Args: prices: Returns:"""
total = 0
buy = -1
for index, item in enumerate(prices):
if buy == -1:
if index != len(pric... | the_stack_v2_python_sparse | leetcode/122_买卖股票的最佳时机二.py | tenqaz/crazy_arithmetic | train | 0 | |
be2f10e3e04444372375cc9c2c48e0cd675760a4 | [
"with report_plugins_test_mocks.MockedReportPlugins():\n self.assertIn(report_plugins_test_mocks.FooReportPlugin, report_plugins.GetAvailableReportPlugins())\n self.assertIn(report_plugins_test_mocks.BarReportPlugin, report_plugins.GetAvailableReportPlugins())",
"with report_plugins_test_mocks.MockedReportP... | <|body_start_0|>
with report_plugins_test_mocks.MockedReportPlugins():
self.assertIn(report_plugins_test_mocks.FooReportPlugin, report_plugins.GetAvailableReportPlugins())
self.assertIn(report_plugins_test_mocks.BarReportPlugin, report_plugins.GetAvailableReportPlugins())
<|end_body_0|>
... | ReportPluginsTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportPluginsTest:
def testGetAvailableReportPlugins(self):
"""Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses."""
<|body_0|>
def testGetReportByName(self):
"""Ensure GetReportByName instantiates correct subclasses based on name."""
<|bod... | stack_v2_sparse_classes_36k_train_007945 | 34,681 | permissive | [
{
"docstring": "Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses.",
"name": "testGetAvailableReportPlugins",
"signature": "def testGetAvailableReportPlugins(self)"
},
{
"docstring": "Ensure GetReportByName instantiates correct subclasses based on name.",
"name": "testGetR... | 3 | stack_v2_sparse_classes_30k_val_000951 | Implement the Python class `ReportPluginsTest` described below.
Class description:
Implement the ReportPluginsTest class.
Method signatures and docstrings:
- def testGetAvailableReportPlugins(self): Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses.
- def testGetReportByName(self): Ensure GetReport... | Implement the Python class `ReportPluginsTest` described below.
Class description:
Implement the ReportPluginsTest class.
Method signatures and docstrings:
- def testGetAvailableReportPlugins(self): Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses.
- def testGetReportByName(self): Ensure GetReport... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class ReportPluginsTest:
def testGetAvailableReportPlugins(self):
"""Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses."""
<|body_0|>
def testGetReportByName(self):
"""Ensure GetReportByName instantiates correct subclasses based on name."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReportPluginsTest:
def testGetAvailableReportPlugins(self):
"""Ensure GetAvailableReportPlugins lists ReportPluginBase's subclasses."""
with report_plugins_test_mocks.MockedReportPlugins():
self.assertIn(report_plugins_test_mocks.FooReportPlugin, report_plugins.GetAvailableReportPl... | the_stack_v2_python_sparse | grr/server/grr_response_server/gui/api_plugins/report_plugins/report_plugins_test.py | google/grr | train | 4,683 | |
9f209ac631b39d81aeafdf0039105b6c73cc881a | [
"self.getI2Cinfo()\nself.pwm = Adafruit_PCA9685.PCA9685(address=self.addr, busnum=self.bus)\nself.getPCAinfo()\nself.sendSignal()",
"screen.clear()\nscreen.addstr(\"If you want to use default I2C-values press 'y', otherwise default values are used: \")\nscreen.refresh()\nansw = screen.getch()\nif answ == ord('y')... | <|body_start_0|>
self.getI2Cinfo()
self.pwm = Adafruit_PCA9685.PCA9685(address=self.addr, busnum=self.bus)
self.getPCAinfo()
self.sendSignal()
<|end_body_0|>
<|body_start_1|>
screen.clear()
screen.addstr("If you want to use default I2C-values press 'y', otherwise default... | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
def __init__(self):
"""collects information on connection and initializes I2C-link"""
<|body_0|>
def getI2Cinfo(self):
"""collects I2C information from user"""
<|body_1|>
def getPCAinfo(self):
"""get PCA channel from user"""
<... | stack_v2_sparse_classes_36k_train_007946 | 4,667 | no_license | [
{
"docstring": "collects information on connection and initializes I2C-link",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "collects I2C information from user",
"name": "getI2Cinfo",
"signature": "def getI2Cinfo(self)"
},
{
"docstring": "get PCA channel... | 5 | stack_v2_sparse_classes_30k_train_002689 | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def __init__(self): collects information on connection and initializes I2C-link
- def getI2Cinfo(self): collects I2C information from user
- def getPCAinfo(self): get PCA cha... | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def __init__(self): collects information on connection and initializes I2C-link
- def getI2Cinfo(self): collects I2C information from user
- def getPCAinfo(self): get PCA cha... | bb8881635d8b95ca3b72648e68416bbf7adb0867 | <|skeleton|>
class Controller:
def __init__(self):
"""collects information on connection and initializes I2C-link"""
<|body_0|>
def getI2Cinfo(self):
"""collects I2C information from user"""
<|body_1|>
def getPCAinfo(self):
"""get PCA channel from user"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
def __init__(self):
"""collects information on connection and initializes I2C-link"""
self.getI2Cinfo()
self.pwm = Adafruit_PCA9685.PCA9685(address=self.addr, busnum=self.bus)
self.getPCAinfo()
self.sendSignal()
def getI2Cinfo(self):
"""collects... | the_stack_v2_python_sparse | scripts/pca_controler.py | lukashaverbeck/parknet | train | 5 | |
e1423d947641b2b3a68de8634fc74139b599e3e1 | [
"keys = set(keys)\nmatch = {}\nif depth == 1:\n for key in keys:\n value = top_level.get(key, None)\n if value is not None:\n match[key] = value\nelse:\n for _, parsed_key, parsed_value in plist_interface.RecurseKey(top_level, depth=depth):\n if parsed_key in keys:\n ... | <|body_start_0|>
keys = set(keys)
match = {}
if depth == 1:
for key in keys:
value = top_level.get(key, None)
if value is not None:
match[key] = value
else:
for _, parsed_key, parsed_value in plist_interface.Recu... | MacOS user accounts plugin. | MacOSUserAccountsPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetKeysDefaultEmpty(self, top_level, keys, depth=1):
"""Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be re... | stack_v2_sparse_classes_36k_train_007947 | 10,128 | permissive | [
{
"docstring": "Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be returned. depth (int): depth within the plist, where 1 is top level. Returns: dict[str, str]: values of the requested keys.",
"nam... | 3 | stack_v2_sparse_classes_30k_train_019436 | Implement the Python class `MacOSUserAccountsPlugin` described below.
Class description:
MacOS user accounts plugin.
Method signatures and docstrings:
- def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist... | Implement the Python class `MacOSUserAccountsPlugin` described below.
Class description:
MacOS user accounts plugin.
Method signatures and docstrings:
- def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist... | f9299b8ad0cb2a6bbbd5e65f01d2ba06406c70ac | <|skeleton|>
class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetKeysDefaultEmpty(self, top_level, keys, depth=1):
"""Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetKeysDefaultEmpty(self, top_level, keys, depth=1):
"""Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be returned. depth... | the_stack_v2_python_sparse | engine/preprocessors/macos.py | dfrc-korea/carpe | train | 75 |
e0b0a4eed2cd74f88bc99ca421d259a38881f8ab | [
"if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):\n QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)\nif hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):\n QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)\nsuper().__init__(sys.argv)\nself.setApplicationName(a... | <|body_start_0|>
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
super... | Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec() | nspyreApp | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class nspyreApp:
"""Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec()"""
def __init__(self, app_name: str='nspyre', palette: QtGui.QP... | stack_v2_sparse_classes_36k_train_007948 | 2,745 | permissive | [
{
"docstring": "Args: app_name: Display name of the application. palette: Qt palette. font: QFont to use for the application.",
"name": "__init__",
"signature": "def __init__(self, app_name: str='nspyre', palette: QtGui.QPalette=nspyre_palette, font: QtGui.QFont=nspyre_font)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_007061 | Implement the Python class `nspyreApp` described below.
Class description:
Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec()
Method signatures and docstr... | Implement the Python class `nspyreApp` described below.
Class description:
Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec()
Method signatures and docstr... | a772070b11be129309201f250ded86b4a4843495 | <|skeleton|>
class nspyreApp:
"""Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec()"""
def __init__(self, app_name: str='nspyre', palette: QtGui.QP... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class nspyreApp:
"""Create a Qt application object with the default nspyre settings. Typical usage example: .. code-block:: python from nspyre import nspyreApp app = nspyreApp() some_widget = SomeWidget() some_widget.show() app.exec()"""
def __init__(self, app_name: str='nspyre', palette: QtGui.QPalette=nspyre... | the_stack_v2_python_sparse | src/nspyre/gui/app.py | nspyre-org/nspyre | train | 11 |
7c010d0271e2abcc1248b638d0706518bee0d77a | [
"self.prefix = filename\nself.backup_count = backup_count\nself.interval = interval.upper()\nself.re_match = '^\\\\d{4}-\\\\d{2}-\\\\d{2}'\nself.interval_formater_dict = {'S': '%Y-%m-%d-%H-%M-%S', 'M': '%Y-%m-%d-%H-%M', 'H': '%Y-%m-%d-%H', 'D': '%Y-%m-%d'}\nself.formater = self.interval_formater_dict.get(interval)\... | <|body_start_0|>
self.prefix = filename
self.backup_count = backup_count
self.interval = interval.upper()
self.re_match = '^\\d{4}-\\d{2}-\\d{2}'
self.interval_formater_dict = {'S': '%Y-%m-%d-%H-%M-%S', 'M': '%Y-%m-%d-%H-%M', 'H': '%Y-%m-%d-%H', 'D': '%Y-%m-%d'}
self.form... | 支持多进程的TimedRotatingFileHandler | MultiprocessHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiprocessHandler:
"""支持多进程的TimedRotatingFileHandler"""
def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=None, delay: bool=False):
"""filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个数,0表示不删除 delay 是否开启 OutSteam缓存 True 表示开启缓存,OutStream输出到缓存... | stack_v2_sparse_classes_36k_train_007949 | 9,763 | permissive | [
{
"docstring": "filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个数,0表示不删除 delay 是否开启 OutSteam缓存 True 表示开启缓存,OutStream输出到缓存,待缓存区满后,刷新缓存区,并输出缓存数据到文件。 False表示不缓存,OutStrea直接输出到文件",
"name": "__init__",
"signature": "def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=No... | 5 | stack_v2_sparse_classes_30k_train_002630 | Implement the Python class `MultiprocessHandler` described below.
Class description:
支持多进程的TimedRotatingFileHandler
Method signatures and docstrings:
- def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=None, delay: bool=False): filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个... | Implement the Python class `MultiprocessHandler` described below.
Class description:
支持多进程的TimedRotatingFileHandler
Method signatures and docstrings:
- def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=None, delay: bool=False): filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个... | 7f4fd3cd202712b083ed7dc2f346ba4bb1bda6d7 | <|skeleton|>
class MultiprocessHandler:
"""支持多进程的TimedRotatingFileHandler"""
def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=None, delay: bool=False):
"""filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个数,0表示不删除 delay 是否开启 OutSteam缓存 True 表示开启缓存,OutStream输出到缓存... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiprocessHandler:
"""支持多进程的TimedRotatingFileHandler"""
def __init__(self, filename: str, interval: str='D', backup_count: int=0, encoding: str=None, delay: bool=False):
"""filename 日志文件名, interval 时间间隔的单位, backup_count 保留文件个数,0表示不删除 delay 是否开启 OutSteam缓存 True 表示开启缓存,OutStream输出到缓存,待缓存区满后,刷新缓存区... | the_stack_v2_python_sparse | vnpy/trader/util_logger.py | msincenselee/vnpy | train | 359 |
77541a206df1eade4bd31f98a04bacaf070e4b71 | [
"super().__init__(coordinator, serial)\nself._attr_unique_id = f'{serial}_{description.key}'\nself.entity_description = description\nself._attr_is_on = False\nself._delay_listener: Callable | None = None",
"if not (last_state := (await self.async_get_last_state())):\n return\nself._attr_is_on = last_state.stat... | <|body_start_0|>
super().__init__(coordinator, serial)
self._attr_unique_id = f'{serial}_{description.key}'
self.entity_description = description
self._attr_is_on = False
self._delay_listener: Callable | None = None
<|end_body_0|>
<|body_start_1|>
if not (last_state := (... | Representation of a EZVIZ Siren entity. | EzvizSirenEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EzvizSirenEntity:
"""Representation of a EZVIZ Siren entity."""
def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None:
"""Initialize the Siren."""
<|body_0|>
async def async_added_to_hass(self) -> None:
... | stack_v2_sparse_classes_36k_train_007950 | 4,462 | permissive | [
{
"docstring": "Initialize the Siren.",
"name": "__init__",
"signature": "def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None"
},
{
"docstring": "Run when entity about to be added to hass.",
"name": "async_added_to_hass",
... | 5 | stack_v2_sparse_classes_30k_train_012567 | Implement the Python class `EzvizSirenEntity` described below.
Class description:
Representation of a EZVIZ Siren entity.
Method signatures and docstrings:
- def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: Initialize the Siren.
- async def async_a... | Implement the Python class `EzvizSirenEntity` described below.
Class description:
Representation of a EZVIZ Siren entity.
Method signatures and docstrings:
- def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: Initialize the Siren.
- async def async_a... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class EzvizSirenEntity:
"""Representation of a EZVIZ Siren entity."""
def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None:
"""Initialize the Siren."""
<|body_0|>
async def async_added_to_hass(self) -> None:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EzvizSirenEntity:
"""Representation of a EZVIZ Siren entity."""
def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None:
"""Initialize the Siren."""
super().__init__(coordinator, serial)
self._attr_unique_id = f'{serial... | the_stack_v2_python_sparse | homeassistant/components/ezviz/siren.py | home-assistant/core | train | 35,501 |
423330e2069b955723084dcd464c1bfe545eedf3 | [
"length = len(nums)\nstore = [0] * length\nfor num in nums:\n store[num] += 1\n if store[num] >= 2:\n return num\nreturn -1",
"find_dict = dict()\nfor num in nums:\n if num in find_dict:\n return num\n else:\n find_dict[num] = 0",
"find_set = set()\nfor num in nums:\n if num ... | <|body_start_0|>
length = len(nums)
store = [0] * length
for num in nums:
store[num] += 1
if store[num] >= 2:
return num
return -1
<|end_body_0|>
<|body_start_1|>
find_dict = dict()
for num in nums:
if num in find_dict:... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费"""
<|body_0|>
def findRepeatNumber2(self, nums: List[int]) -> int:
"""第二种方法 把方法一中的数组换成字典来存储,不需要初始化空间,查找也是O(1)"""
<|body_1|>
def findRepeatNumber2_2(sel... | stack_v2_sparse_classes_36k_train_007951 | 1,945 | no_license | [
{
"docstring": "第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费",
"name": "findRepeatNumber",
"signature": "def findRepeatNumber(self, nums: List[int]) -> int"
},
{
"docstring": "第二种方法 把方法一中的数组换成字典来存储,不需要初始化空间,查找也是O(1)",
"name": "findRepeatNumber2",
"signature": "def findRepeatNumber2(self, nums: ... | 3 | stack_v2_sparse_classes_30k_train_002714 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums: List[int]) -> int: 第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费
- def findRepeatNumber2(self, nums: List[int]) -> int: 第二种方法 把方法一中的数组换成字典来存储,不需要初始化空间,查找... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums: List[int]) -> int: 第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费
- def findRepeatNumber2(self, nums: List[int]) -> int: 第二种方法 把方法一中的数组换成字典来存储,不需要初始化空间,查找... | c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0 | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费"""
<|body_0|>
def findRepeatNumber2(self, nums: List[int]) -> int:
"""第二种方法 把方法一中的数组换成字典来存储,不需要初始化空间,查找也是O(1)"""
<|body_1|>
def findRepeatNumber2_2(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""第一种方法 维持一个数组,a[n] 位置保存对应的数的个数 空间上有些浪费"""
length = len(nums)
store = [0] * length
for num in nums:
store[num] += 1
if store[num] >= 2:
return num
return -1
def f... | the_stack_v2_python_sparse | SwordOffer/SwordOffer_03.py | EachenKuang/LeetCode | train | 28 | |
b0b21148c077bc12a88c18e066d32fa1ca49cb44 | [
"grid_size = np.array(self.tile_grid_size(level))\nif any(grid_size <= [x, y]):\n raise IndexError\ncumulative_sum = sum((np.prod(self.tile_grid_size(n)) for n in range(level)))\nindex_in_level = np.ravel_multi_index((y, x), self.tile_grid_size(level)[::-1])\ntile_index = cumulative_sum + index_in_level\nreturn ... | <|body_start_0|>
grid_size = np.array(self.tile_grid_size(level))
if any(grid_size <= [x, y]):
raise IndexError
cumulative_sum = sum((np.prod(self.tile_grid_size(n)) for n in range(level)))
index_in_level = np.ravel_multi_index((y, x), self.tile_grid_size(level)[::-1])
... | Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths. An old description of the Zoomify format can be found `here`_. .. _here: https://e... | ZoomifyGenerator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZoomifyGenerator:
"""Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths. An old description of the Zoomify form... | stack_v2_sparse_classes_36k_train_007952 | 24,119 | permissive | [
{
"docstring": "Find the tile group for a tile index. Tile groups are numbered from level 0 (tile 0-0-0) and increment every 256 tiles in ZXY axis order. Args: level (int): The pyramid level of the tile starting from 0 (the whole slide in one tile, 0-0-0). x (int): The tile index in the x direction. y (int): Th... | 2 | stack_v2_sparse_classes_30k_train_013877 | Implement the Python class `ZoomifyGenerator` described below.
Class description:
Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths.... | Implement the Python class `ZoomifyGenerator` described below.
Class description:
Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths.... | f26387f46f675a7b9a8a48c95dad26e819229f2f | <|skeleton|>
class ZoomifyGenerator:
"""Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths. An old description of the Zoomify form... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZoomifyGenerator:
"""Pyramid tile generator with extra Zoomify specific methods. Zoomify splits tiles into groups of 256 (due to old file system limitations). The extra `tile_group` method here is for calculating these tile groups when generating tile paths. An old description of the Zoomify format can be fou... | the_stack_v2_python_sparse | tiatoolbox/tools/pyramid.py | TissueImageAnalytics/tiatoolbox | train | 222 |
15ebe61aba36f78ad74bd23b094b08074d2b9ea0 | [
"task = db.Task.get(id)\nif not task:\n return ({'msg': f'task id={id} is not found'}, HTTPStatus.NOT_FOUND)\nauth_org = self.obtain_auth_organization()\nschema = task_result_schema if request.args.get('include') == 'results' else task_schema\nif not self.r.v_glo.can():\n org_ids = [org.id for org in task.col... | <|body_start_0|>
task = db.Task.get(id)
if not task:
return ({'msg': f'task id={id} is not found'}, HTTPStatus.NOT_FOUND)
auth_org = self.obtain_auth_organization()
schema = task_result_schema if request.args.get('include') == 'results' else task_schema
if not self.r.... | Resource for /api/task | Task | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |T... | stack_v2_sparse_classes_36k_train_007953 | 26,603 | permissive | [
{
"docstring": "Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |Task|Organization|View|✅|✅|View any task in your organization| Accessi... | 2 | null | Implement the Python class `Task` described below.
Class description:
Resource for /api/task
Method signatures and docstrings:
- def get(self, id): Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |-... | Implement the Python class `Task` described below.
Class description:
Resource for /api/task
Method signatures and docstrings:
- def get(self, id): Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |-... | b3ff6e91ac4caeaf31c12c20f73dfc61cfd9baca | <|skeleton|>
class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |Task|Organizat... | the_stack_v2_python_sparse | vantage6-server/vantage6/server/resource/task.py | vantage6/vantage6 | train | 15 |
351310f3f05ff86d90a6201eca8d36c9610a097e | [
"self.c = c\nself.nof_joints = nof_joints\nself.checkpoint_path = checkpoint_path\nself.resolution = resolution\nself.interpolation = interpolation\nself.multiperson = multiperson\nself.max_batch_size = max_batch_size\nself.device = device\nself.model = HRNet(c=c, nof_joints=nof_joints).to(device)\nself.model.load_... | <|body_start_0|>
self.c = c
self.nof_joints = nof_joints
self.checkpoint_path = checkpoint_path
self.resolution = resolution
self.interpolation = interpolation
self.multiperson = multiperson
self.max_batch_size = max_batch_size
self.device = device
... | SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also included (and enabled by default). | SimpleHRNet2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleHRNet2:
"""SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also included (and enabled by default)."""
d... | stack_v2_sparse_classes_36k_train_007954 | 4,627 | no_license | [
{
"docstring": "Initializes a new SimpleHRNet object. HRNet (and YOLOv3) are initialized on the torch.device(``device``) and its (their) pretrained weights will be loaded from disk. Arguments: c (int): number of channels. nof_joints (int): number of joints. checkpoint_path (str): hrnet checkpoint path. resoluti... | 2 | stack_v2_sparse_classes_30k_train_006551 | Implement the Python class `SimpleHRNet2` described below.
Class description:
SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also inclu... | Implement the Python class `SimpleHRNet2` described below.
Class description:
SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also inclu... | b401a487a613b6e9dcfb42ce9ca134e7bda8b4f8 | <|skeleton|>
class SimpleHRNet2:
"""SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also included (and enabled by default)."""
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleHRNet2:
"""SimpleHRNet class. The class provides a simple and customizable method to load the HRNet network, load the official pre-trained weights, and predict the human pose on single images. Multi-person support with the YOLOv3 detector is also included (and enabled by default)."""
def __init__(s... | the_stack_v2_python_sparse | preprocessing/preparation/Pose_HRNet/SimpleHRNet.py | subburajs/ChaLearn-2021-ISLR-Challenge | train | 0 |
96677fcd22f17a9574c55935317528f2edeb6955 | [
"entity = db.Entity(user_locale=self.get_user_locale(), user_id=self.current_user.id)\nitem = entity.get(entity_id=entity_id, limit=1, full_definition=False)\nif not item:\n return\nfiles = self.__get_files(entity_id)\nf = StringIO()\nzf = zipfile.ZipFile(f, 'w', zipfile.ZIP_DEFLATED)\nfor file in files:\n fi... | <|body_start_0|>
entity = db.Entity(user_locale=self.get_user_locale(), user_id=self.current_user.id)
item = entity.get(entity_id=entity_id, limit=1, full_definition=False)
if not item:
return
files = self.__get_files(entity_id)
f = StringIO()
zf = zipfile.Zip... | DownloadEntity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DownloadEntity:
def get(self, entity_id):
"""Download Entity as ZIP file"""
<|body_0|>
def __get_files(self, entity_id, path=''):
"""Return Entity properties as YAML file and all files (from file properties)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_007955 | 19,683 | no_license | [
{
"docstring": "Download Entity as ZIP file",
"name": "get",
"signature": "def get(self, entity_id)"
},
{
"docstring": "Return Entity properties as YAML file and all files (from file properties)",
"name": "__get_files",
"signature": "def __get_files(self, entity_id, path='')"
}
] | 2 | stack_v2_sparse_classes_30k_train_000074 | Implement the Python class `DownloadEntity` described below.
Class description:
Implement the DownloadEntity class.
Method signatures and docstrings:
- def get(self, entity_id): Download Entity as ZIP file
- def __get_files(self, entity_id, path=''): Return Entity properties as YAML file and all files (from file prop... | Implement the Python class `DownloadEntity` described below.
Class description:
Implement the DownloadEntity class.
Method signatures and docstrings:
- def get(self, entity_id): Download Entity as ZIP file
- def __get_files(self, entity_id, path=''): Return Entity properties as YAML file and all files (from file prop... | b1c906dbad9f0bd34fb647a69846ece192d18c86 | <|skeleton|>
class DownloadEntity:
def get(self, entity_id):
"""Download Entity as ZIP file"""
<|body_0|>
def __get_files(self, entity_id, path=''):
"""Return Entity properties as YAML file and all files (from file properties)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DownloadEntity:
def get(self, entity_id):
"""Download Entity as ZIP file"""
entity = db.Entity(user_locale=self.get_user_locale(), user_id=self.current_user.id)
item = entity.get(entity_id=entity_id, limit=1, full_definition=False)
if not item:
return
files ... | the_stack_v2_python_sparse | app/entity.py | strogo/Entu | train | 0 | |
087fb15d89b20082e4aadd1a7d01c3f173f25b07 | [
"res = requests.get(url=self.url, params=self.para, headers=self.headers)\nresult = res.json()\nself.assertEqual(res.status_code, 200)\nif len(result) == 1:\n self.assertIn('b-2', result[0]['name'])\n self.assertEqual(1, result[0]['language_type'])\nelif len(result) > 1:\n self.assertIn('work_id', result[0... | <|body_start_0|>
res = requests.get(url=self.url, params=self.para, headers=self.headers)
result = res.json()
self.assertEqual(res.status_code, 200)
if len(result) == 1:
self.assertIn('b-2', result[0]['name'])
self.assertEqual(1, result[0]['language_type'])
... | 搜索云端作品 | Search_file | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Search_file:
"""搜索云端作品"""
def test_06_search_file01(self):
"""登录态正常--进行作品搜索"""
<|body_0|>
def test_07_search_file02(self):
"""登录态失效--进行作品搜搜"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = requests.get(url=self.url, params=self.para, header... | stack_v2_sparse_classes_36k_train_007956 | 1,854 | no_license | [
{
"docstring": "登录态正常--进行作品搜索",
"name": "test_06_search_file01",
"signature": "def test_06_search_file01(self)"
},
{
"docstring": "登录态失效--进行作品搜搜",
"name": "test_07_search_file02",
"signature": "def test_07_search_file02(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013951 | Implement the Python class `Search_file` described below.
Class description:
搜索云端作品
Method signatures and docstrings:
- def test_06_search_file01(self): 登录态正常--进行作品搜索
- def test_07_search_file02(self): 登录态失效--进行作品搜搜 | Implement the Python class `Search_file` described below.
Class description:
搜索云端作品
Method signatures and docstrings:
- def test_06_search_file01(self): 登录态正常--进行作品搜索
- def test_07_search_file02(self): 登录态失效--进行作品搜搜
<|skeleton|>
class Search_file:
"""搜索云端作品"""
def test_06_search_file01(self):
"""登录态... | e75039fcd2361977a2a5dc7ea95b7fb2fbc96bb0 | <|skeleton|>
class Search_file:
"""搜索云端作品"""
def test_06_search_file01(self):
"""登录态正常--进行作品搜索"""
<|body_0|>
def test_07_search_file02(self):
"""登录态失效--进行作品搜搜"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Search_file:
"""搜索云端作品"""
def test_06_search_file01(self):
"""登录态正常--进行作品搜索"""
res = requests.get(url=self.url, params=self.para, headers=self.headers)
result = res.json()
self.assertEqual(res.status_code, 200)
if len(result) == 1:
self.assertIn('b-2', ... | the_stack_v2_python_sparse | API_study/Wood/C_Search_file.py | JmeterChen/api_wood | train | 1 |
5e6985314d55561cfb1a6055d8f223f3fd1e149a | [
"super(DataQ_DI145, self).__init__()\nself.comm_port = comm_port\nself.baud_rate = baud_rate\nself.stop_thread = True\ntry:\n self.scan()\n self.sts()\nexcept:\n self.serDataq = serial.Serial(comm_port, baud_rate)\n self.serDataq.write(b'S0\\r')\n self.serDataq.write(b'C3')",
"self.stop_thread = Fa... | <|body_start_0|>
super(DataQ_DI145, self).__init__()
self.comm_port = comm_port
self.baud_rate = baud_rate
self.stop_thread = True
try:
self.scan()
self.sts()
except:
self.serDataq = serial.Serial(comm_port, baud_rate)
self.... | DataQ_DI145 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataQ_DI145:
def __init__(self, comm_port='COM4', baud_rate=4800):
"""Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication port of ADC device (default: COM4 on 17021058 Machine) baud_rate - baud rate of the device (default: ... | stack_v2_sparse_classes_36k_train_007957 | 3,869 | no_license | [
{
"docstring": "Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication port of ADC device (default: COM4 on 17021058 Machine) baud_rate - baud rate of the device (default: 4800 for DI145) C1 - Slope coefficient of counts vs Volts (default: 0.0003 for... | 4 | stack_v2_sparse_classes_30k_train_013156 | Implement the Python class `DataQ_DI145` described below.
Class description:
Implement the DataQ_DI145 class.
Method signatures and docstrings:
- def __init__(self, comm_port='COM4', baud_rate=4800): Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication p... | Implement the Python class `DataQ_DI145` described below.
Class description:
Implement the DataQ_DI145 class.
Method signatures and docstrings:
- def __init__(self, comm_port='COM4', baud_rate=4800): Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication p... | eccd3b5a68173ee4f78a0182f9f0317fede84e81 | <|skeleton|>
class DataQ_DI145:
def __init__(self, comm_port='COM4', baud_rate=4800):
"""Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication port of ADC device (default: COM4 on 17021058 Machine) baud_rate - baud rate of the device (default: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataQ_DI145:
def __init__(self, comm_port='COM4', baud_rate=4800):
"""Initialize instance variable defaults for the DataQ_DI145 class Variable Descriptions: comm_port - USB communication port of ADC device (default: COM4 on 17021058 Machine) baud_rate - baud rate of the device (default: 4800 for DI145... | the_stack_v2_python_sparse | ADC.py | jbaviation/humidity_cart | train | 0 | |
6d6941d0a51b52544cf220fa4d7aafac0595a695 | [
"self.server = server\nself.platformname = platformname\nself.devicename = devicename\nself.app_value = app_value",
"desired_caps = {'platformName': self.platformname, 'deviceName': self.devicename, 'app': self.app_value}\ntry:\n driver = webdriver.Remote(self.server, desired_caps)\nexcept Exception as e:\n ... | <|body_start_0|>
self.server = server
self.platformname = platformname
self.devicename = devicename
self.app_value = app_value
<|end_body_0|>
<|body_start_1|>
desired_caps = {'platformName': self.platformname, 'deviceName': self.devicename, 'app': self.app_value}
try:
... | Install | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Install:
def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE):
"""初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径"""
<|body_0|>
def install(self):
"... | stack_v2_sparse_classes_36k_train_007958 | 1,508 | no_license | [
{
"docstring": "初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径",
"name": "__init__",
"signature": "def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE)"
},
{
"docstring": "从PC端... | 2 | stack_v2_sparse_classes_30k_train_001223 | Implement the Python class `Install` described below.
Class description:
Implement the Install class.
Method signatures and docstrings:
- def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): 初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param... | Implement the Python class `Install` described below.
Class description:
Implement the Install class.
Method signatures and docstrings:
- def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE): 初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param... | ca958c07ce007219914ca101f010d1d523dabb94 | <|skeleton|>
class Install:
def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE):
"""初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径"""
<|body_0|>
def install(self):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Install:
def __init__(self, server=SERVER, platformname=PLANTFORM, devicename=DEVIDE_NAME, app_value=APP_VALUE):
"""初始化信息 :param server: Appium Server :param platformname: 手机类型:安卓 | IOS :param devicename: 设备名称 :param app_value: 安装路径"""
self.server = server
self.platformname = platformn... | the_stack_v2_python_sparse | 03-Install_App/Install_local.py | hyqgod/Sao_Operation | train | 0 | |
989272c13ed589c24ecd22586cf009af3afd15b8 | [
"self.exchange_dag_protection_preference = exchange_dag_protection_preference\nself.exchange_host_info_list = exchange_host_info_list\nself.guid = guid\nself.is_standalone_host = is_standalone_host\nself.name = name\nself.protection_source_id = protection_source_id",
"if dictionary is None:\n return None\nexch... | <|body_start_0|>
self.exchange_dag_protection_preference = exchange_dag_protection_preference
self.exchange_host_info_list = exchange_host_info_list
self.guid = guid
self.is_standalone_host = is_standalone_host
self.name = name
self.protection_source_id = protection_sourc... | Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong to the Exchange DAG are returned. Attributes: exchange_dag_protection_preference (ExchangeDA... | ExchangeDagHostsResponse | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExchangeDagHostsResponse:
"""Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong to the Exchange DAG are returned. Attrib... | stack_v2_sparse_classes_36k_train_007959 | 4,179 | permissive | [
{
"docstring": "Constructor for the ExchangeDagHostsResponse class",
"name": "__init__",
"signature": "def __init__(self, exchange_dag_protection_preference=None, exchange_host_info_list=None, guid=None, is_standalone_host=None, name=None, protection_source_id=None)"
},
{
"docstring": "Creates a... | 2 | stack_v2_sparse_classes_30k_train_012130 | Implement the Python class `ExchangeDagHostsResponse` described below.
Class description:
Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong t... | Implement the Python class `ExchangeDagHostsResponse` described below.
Class description:
Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong t... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ExchangeDagHostsResponse:
"""Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong to the Exchange DAG are returned. Attrib... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExchangeDagHostsResponse:
"""Implementation of the 'ExchangeDagHostsResponse' model. Specifies if the endpoint provided in the request is standalone exchange server or not. If the endpoint is not a standalone exchange server, the list of hosts which belong to the Exchange DAG are returned. Attributes: exchang... | the_stack_v2_python_sparse | cohesity_management_sdk/models/exchange_dag_hosts_response.py | cohesity/management-sdk-python | train | 24 |
7025fc7a0d15ededfffab6e641b3d3521d849942 | [
"StochasticSolver.__init__(self, **kwargs)\nself.spec['base_accum'] = self.spec.get('base_accum', 1e-08)\nself._accum = None",
"params = self._decaf_net.params()\nself._accum = [base.Blob(p.data().shape, p.data().dtype) for p in params]\nfor accum in self._accum:\n accum_data = accum.data()\n accum_data[:] ... | <|body_start_0|>
StochasticSolver.__init__(self, **kwargs)
self.spec['base_accum'] = self.spec.get('base_accum', 1e-08)
self._accum = None
<|end_body_0|>
<|body_start_1|>
params = self._decaf_net.params()
self._accum = [base.Blob(p.data().shape, p.data().dtype) for p in params]
... | The Adagrad Solver. | AdagradSolver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdagradSolver:
"""The Adagrad Solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value to initialize the accumulated gradient diagonal. Default... | stack_v2_sparse_classes_36k_train_007960 | 13,002 | no_license | [
{
"docstring": "Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value to initialize the accumulated gradient diagonal. Default 1e-8.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
... | 4 | stack_v2_sparse_classes_30k_train_013415 | Implement the Python class `AdagradSolver` described below.
Class description:
The Adagrad Solver.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value... | Implement the Python class `AdagradSolver` described below.
Class description:
The Adagrad Solver.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value... | 6fa4cdfbd0d0b8d486d7146bf1e32edd3662fec4 | <|skeleton|>
class AdagradSolver:
"""The Adagrad Solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value to initialize the accumulated gradient diagonal. Default... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdagradSolver:
"""The Adagrad Solver."""
def __init__(self, **kwargs):
"""Initializes the SGD solver. kwargs: base_lr: the base learning rate. max_iter: the maximum number of iterations. Default 1000. base_accum: the base value to initialize the accumulated gradient diagonal. Default 1e-8."""
... | the_stack_v2_python_sparse | decaf/opt/stochastic_solver.py | UCBAIR/decaf-release | train | 62 |
0a9c7b82034d41762eb7a5bbc5bba07b9aca46cc | [
"if (name_arg := f.request.args.get('name')):\n benchmark_results = BenchmarkResult.search(filters=[Case.name == name_arg], joins=[Case])\nelif (batch_id_arg := f.request.args.get('batch_id')):\n batch_ids = batch_id_arg.split(',')\n benchmark_results = BenchmarkResult.search(filters=[BenchmarkResult.batch... | <|body_start_0|>
if (name_arg := f.request.args.get('name')):
benchmark_results = BenchmarkResult.search(filters=[Case.name == name_arg], joins=[Case])
elif (batch_id_arg := f.request.args.get('batch_id')):
batch_ids = batch_id_arg.split(',')
benchmark_results = Bench... | BenchmarkListAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BenchmarkListAPI:
def get(self) -> f.Response:
"""--- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection analysis (lookback z-score method). Behavior at the time of writing (subject to change): Benchmark results a... | stack_v2_sparse_classes_36k_train_007961 | 9,204 | permissive | [
{
"docstring": "--- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection analysis (lookback z-score method). Behavior at the time of writing (subject to change): Benchmark results are usually returned in order of their timestamp property (... | 2 | null | Implement the Python class `BenchmarkListAPI` described below.
Class description:
Implement the BenchmarkListAPI class.
Method signatures and docstrings:
- def get(self) -> f.Response: --- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection ana... | Implement the Python class `BenchmarkListAPI` described below.
Class description:
Implement the BenchmarkListAPI class.
Method signatures and docstrings:
- def get(self) -> f.Response: --- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection ana... | 534762befe9429ae1080e42056e9c681afab9801 | <|skeleton|>
class BenchmarkListAPI:
def get(self) -> f.Response:
"""--- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection analysis (lookback z-score method). Behavior at the time of writing (subject to change): Benchmark results a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BenchmarkListAPI:
def get(self) -> f.Response:
"""--- description: | Return a JSON array of benchmark results. Note that this endpoint does not provide on-the-fly change detection analysis (lookback z-score method). Behavior at the time of writing (subject to change): Benchmark results are usually ret... | the_stack_v2_python_sparse | conbench/api/results.py | conbench/conbench | train | 50 | |
598f5c5a046c0ae1aea4b5bd889668f98dec243d | [
"if name == '__setstate__':\n raise AttributeError\nreturn self[name]",
"if name in self:\n self[name] = value\nelse:\n super(CaseInfo, self).__setattr__(name, value)",
"tokens = key.split('.', 1)\nfkey = tokens[0]\nif len(tokens) == 2:\n self[fkey]._set_through(tokens[1], val)\nelse:\n self[fkey... | <|body_start_0|>
if name == '__setstate__':
raise AttributeError
return self[name]
<|end_body_0|>
<|body_start_1|>
if name in self:
self[name] = value
else:
super(CaseInfo, self).__setattr__(name, value)
<|end_body_1|>
<|body_start_2|>
tokens... | Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object. | CaseInfo | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseInfo:
"""Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object."""
def __getattr__(self, name):
"""Consult self dictionary for attribute. It's a shorthand."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_007962 | 7,485 | permissive | [
{
"docstring": "Consult self dictionary for attribute. It's a shorthand.",
"name": "__getattr__",
"signature": "def __getattr__(self, name)"
},
{
"docstring": "Save to self dictionary first, then self object table. @note: This method is overriden as a stupid-preventer. It makes attribute setting... | 4 | null | Implement the Python class `CaseInfo` described below.
Class description:
Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object.
Method signatures and docstrings:
- def __getattr__(self, name): Consult self dictionary fo... | Implement the Python class `CaseInfo` described below.
Class description:
Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object.
Method signatures and docstrings:
- def __getattr__(self, name): Consult self dictionary fo... | ff0c71c5081dc67522d42bc65719e16c8365ab47 | <|skeleton|>
class CaseInfo:
"""Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object."""
def __getattr__(self, name):
"""Consult self dictionary for attribute. It's a shorthand."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseInfo:
"""Generic case information abstract class. It's the base class that all case information classes should subclass, to form hierarchical information object."""
def __getattr__(self, name):
"""Consult self dictionary for attribute. It's a shorthand."""
if name == '__setstate__':
... | the_stack_v2_python_sparse | solvcon/case_core.py | gitter-badger/solvcon | train | 1 |
2ecb456243b1ceaa7ebee4db351d932104657d1a | [
"pname = '_' + name\n\ndef getter(self):\n if not hasattr(self, pname) and hasattr(self, f'{self._getter_prefix}{pname}'):\n self[f'{self._getter_prefix}{pname}']()\n if not hasattr(self, pname):\n raise AttributeError(f'Please compute or set {name} first.')\n return getattr(self, pname)\n\nd... | <|body_start_0|>
pname = '_' + name
def getter(self):
if not hasattr(self, pname) and hasattr(self, f'{self._getter_prefix}{pname}'):
self[f'{self._getter_prefix}{pname}']()
if not hasattr(self, pname):
raise AttributeError(f'Please compute or set... | This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2): self.attr1 = attr1 self.attr2 = attr2 The above code dynamically creates ... | TypedMeta | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypedMeta:
"""This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2): self.attr1 = attr1 self.attr2 = attr... | stack_v2_sparse_classes_36k_train_007963 | 24,927 | permissive | [
{
"docstring": "Creates a custom property with a getter that performs computing functionality (if available) and raise a type error if setting with the wrong type. Note: By default, the setter attempts to convert the object to the correct type; a type error is raised if this fails.",
"name": "create_propert... | 2 | null | Implement the Python class `TypedMeta` described below.
Class description:
This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2... | Implement the Python class `TypedMeta` described below.
Class description:
This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2... | 2e87bae3e043e6958129fc823c83ab0b46add8b5 | <|skeleton|>
class TypedMeta:
"""This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2): self.attr1 = attr1 self.attr2 = attr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TypedMeta:
"""This metaclass creates statically typed class attributes using the property framework. .. code-block:: Python class TestMeta(TypedMeta): attr1 = (int, float) attr2 = DataFrame class TestClass(metaclass=TestMeta): def __init__(self, attr1, attr2): self.attr1 = attr1 self.attr2 = attr2 The above c... | the_stack_v2_python_sparse | exatomic/exa/core/container.py | exa-analytics/exatomic | train | 15 |
9207b9ec4a6f036b860241906173acab4ff5bc90 | [
"if pid_value or 'cnum' in data:\n cnum = pid_value or data.get('cnum')\nelse:\n cnum = cls.next(data)\nif not cnum:\n return\nkwargs['pid_value'] = cnum\nif object_type and object_uuid:\n kwargs['status'] = PIDStatus.REGISTERED\nreturn super().create(object_type=object_type, object_uuid=object_uuid, **... | <|body_start_0|>
if pid_value or 'cnum' in data:
cnum = pid_value or data.get('cnum')
else:
cnum = cls.next(data)
if not cnum:
return
kwargs['pid_value'] = cnum
if object_type and object_uuid:
kwargs['status'] = PIDStatus.REGISTERED... | CNUM identifier provider. | InspireCNUMProvider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InspireCNUMProvider:
"""CNUM identifier provider."""
def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs):
"""Create a new record identifier."""
<|body_0|>
def next(cls, data):
"""Generate a CNUM identifier from a conference re... | stack_v2_sparse_classes_36k_train_007964 | 2,487 | no_license | [
{
"docstring": "Create a new record identifier.",
"name": "create",
"signature": "def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs)"
},
{
"docstring": "Generate a CNUM identifier from a conference record. Args: data (dict): the record metadata Returns: str:... | 2 | null | Implement the Python class `InspireCNUMProvider` described below.
Class description:
CNUM identifier provider.
Method signatures and docstrings:
- def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs): Create a new record identifier.
- def next(cls, data): Generate a CNUM identifier... | Implement the Python class `InspireCNUMProvider` described below.
Class description:
CNUM identifier provider.
Method signatures and docstrings:
- def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs): Create a new record identifier.
- def next(cls, data): Generate a CNUM identifier... | 8b7aab80a39d5615f4038cfc35cdc19c2316750f | <|skeleton|>
class InspireCNUMProvider:
"""CNUM identifier provider."""
def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs):
"""Create a new record identifier."""
<|body_0|>
def next(cls, data):
"""Generate a CNUM identifier from a conference re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InspireCNUMProvider:
"""CNUM identifier provider."""
def create(cls, object_type=None, object_uuid=None, data=None, pid_value=None, **kwargs):
"""Create a new record identifier."""
if pid_value or 'cnum' in data:
cnum = pid_value or data.get('cnum')
else:
c... | the_stack_v2_python_sparse | backend/inspirehep/pidstore/providers/cnum.py | inspirehep/inspirehep | train | 17 |
63a6b556565b3dad50037422ace812925b881f48 | [
"try:\n result = {}\n cls.logger.info('Merging the dictionaries: ')\n for dictionary in dict_args:\n result.update(dictionary)\n cls.logger.info('Merged dictionary: ' + str(result))\n return result\nexcept Exception as exp:\n cls.logger.error('Exception occured while merging and overwriting... | <|body_start_0|>
try:
result = {}
cls.logger.info('Merging the dictionaries: ')
for dictionary in dict_args:
result.update(dictionary)
cls.logger.info('Merged dictionary: ' + str(result))
return result
except Exception as exp:
... | Implement the operations to create concrete product objects. | DictionaryUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DictionaryUtils:
"""Implement the operations to create concrete product objects."""
def merge_and_overwrite_dicts(cls, *dict_args):
"""author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. :... | stack_v2_sparse_classes_36k_train_007965 | 1,999 | no_license | [
{
"docstring": "author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. :param base_dict: dictionary with original values :param overwrite_dict: dictionary with va;ues to overwrite :return: the new merged dictionary with... | 2 | stack_v2_sparse_classes_30k_train_016005 | Implement the Python class `DictionaryUtils` described below.
Class description:
Implement the operations to create concrete product objects.
Method signatures and docstrings:
- def merge_and_overwrite_dicts(cls, *dict_args): author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new di... | Implement the Python class `DictionaryUtils` described below.
Class description:
Implement the operations to create concrete product objects.
Method signatures and docstrings:
- def merge_and_overwrite_dicts(cls, *dict_args): author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new di... | 7e384f6e13377723bb651130733a16ed53fe31d1 | <|skeleton|>
class DictionaryUtils:
"""Implement the operations to create concrete product objects."""
def merge_and_overwrite_dicts(cls, *dict_args):
"""author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DictionaryUtils:
"""Implement the operations to create concrete product objects."""
def merge_and_overwrite_dicts(cls, *dict_args):
"""author: afarooq01@i2cinc.com Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts. :param base_di... | the_stack_v2_python_sparse | AICommons/aicommons/dictionaryutils/DictionaryUtils.py | Rmsharks4/NLPEngine-opensource | train | 0 |
504965ca16c711d8ffdf189e653d12c7e6dccfab | [
"self.type = 'OPTIM'\nself.date = ''\nself.modules = []\nself.minmax = 'min'\nself.objective = ['cl']\nself.driver = 'COBYLA'\nself.save_iter = 1\nself.max_iter = 200\nself.tol = 0.001\nself.doedriver = 'Uniform'\nself.samplesnb = 3\nself.doe_file = ''\nself.user_config = Path(MODULE_DIR, 'files', 'Default_config.c... | <|body_start_0|>
self.type = 'OPTIM'
self.date = ''
self.modules = []
self.minmax = 'min'
self.objective = ['cl']
self.driver = 'COBYLA'
self.save_iter = 1
self.max_iter = 200
self.tol = 0.001
self.doedriver = 'Uniform'
self.samples... | Setup the routine to launch in Openmdao. | Routine | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Routine:
"""Setup the routine to launch in Openmdao."""
def __init__(self):
"""Define default main parameters."""
<|body_0|>
def get_user_inputs(self, tixi):
"""Take user inputs from the GUI."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.... | stack_v2_sparse_classes_36k_train_007966 | 16,742 | permissive | [
{
"docstring": "Define default main parameters.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Take user inputs from the GUI.",
"name": "get_user_inputs",
"signature": "def get_user_inputs(self, tixi)"
}
] | 2 | null | Implement the Python class `Routine` described below.
Class description:
Setup the routine to launch in Openmdao.
Method signatures and docstrings:
- def __init__(self): Define default main parameters.
- def get_user_inputs(self, tixi): Take user inputs from the GUI. | Implement the Python class `Routine` described below.
Class description:
Setup the routine to launch in Openmdao.
Method signatures and docstrings:
- def __init__(self): Define default main parameters.
- def get_user_inputs(self, tixi): Take user inputs from the GUI.
<|skeleton|>
class Routine:
"""Setup the rout... | 30ca55b39dc14e3f8ec1e00a475f76024d1b5fef | <|skeleton|>
class Routine:
"""Setup the routine to launch in Openmdao."""
def __init__(self):
"""Define default main parameters."""
<|body_0|>
def get_user_inputs(self, tixi):
"""Take user inputs from the GUI."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Routine:
"""Setup the routine to launch in Openmdao."""
def __init__(self):
"""Define default main parameters."""
self.type = 'OPTIM'
self.date = ''
self.modules = []
self.minmax = 'min'
self.objective = ['cl']
self.driver = 'COBYLA'
self.sa... | the_stack_v2_python_sparse | ceasiompy/Optimisation/func/optimfunctions.py | cfsengineering/CEASIOMpy | train | 60 |
d55fd7759070307896340cbfcdf2a78d14f618db | [
"Frame.__init__(self, master)\nself.grid()\nself.create_widgets()",
"self.instruction = Label(self, text='Enter your API key')\nself.instruction.grid(row=0, column=0, columnspan=2, sticky=W)\nself.apikey = Entry(self)\nself.apikey.grid(row=1, column=1, sticky=W)\nself.submit_button = Button(self, text='Submit', c... | <|body_start_0|>
Frame.__init__(self, master)
self.grid()
self.create_widgets()
<|end_body_0|>
<|body_start_1|>
self.instruction = Label(self, text='Enter your API key')
self.instruction.grid(row=0, column=0, columnspan=2, sticky=W)
self.apikey = Entry(self)
self... | A GUI Test | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
"""A GUI Test"""
def __init__(self, master):
"""Initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""Text"""
<|body_1|>
def reveal(self):
"""display whateves"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_007967 | 1,251 | no_license | [
{
"docstring": "Initialize the Frame",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "Text",
"name": "create_widgets",
"signature": "def create_widgets(self)"
},
{
"docstring": "display whateves",
"name": "reveal",
"signature": "def revea... | 3 | stack_v2_sparse_classes_30k_train_019774 | Implement the Python class `Application` described below.
Class description:
A GUI Test
Method signatures and docstrings:
- def __init__(self, master): Initialize the Frame
- def create_widgets(self): Text
- def reveal(self): display whateves | Implement the Python class `Application` described below.
Class description:
A GUI Test
Method signatures and docstrings:
- def __init__(self, master): Initialize the Frame
- def create_widgets(self): Text
- def reveal(self): display whateves
<|skeleton|>
class Application:
"""A GUI Test"""
def __init__(sel... | a351c79223c234e9c75120fefa4bc24443629017 | <|skeleton|>
class Application:
"""A GUI Test"""
def __init__(self, master):
"""Initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""Text"""
<|body_1|>
def reveal(self):
"""display whateves"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Application:
"""A GUI Test"""
def __init__(self, master):
"""Initialize the Frame"""
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
"""Text"""
self.instruction = Label(self, text='Enter your API key')
s... | the_stack_v2_python_sparse | scripts/tk_test3.py | ponbiki/Py | train | 2 |
bb2dcd274f9d6bf1dadffaab697538dccd0def86 | [
"self.coverage = coverage\nself.ignore_errors = ignore_errors\nself.code_units = []\nself.directory = None",
"morfs = morfs or self.coverage.data.measured_files()\nfile_locator = self.coverage.file_locator\nself.code_units = code_unit_factory(morfs, file_locator)\nif config.include:\n patterns = [file_locator.... | <|body_start_0|>
self.coverage = coverage
self.ignore_errors = ignore_errors
self.code_units = []
self.directory = None
<|end_body_0|>
<|body_start_1|>
morfs = morfs or self.coverage.data.measured_files()
file_locator = self.coverage.file_locator
self.code_units ... | A base class for all reporters. | Reporter | [
"W3C",
"LGPL-2.0-only",
"BSD-3-Clause",
"MIT",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, ignore_errors=False):
"""Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing."""
<|body_0|>
def find_code_un... | stack_v2_sparse_classes_36k_train_007968 | 2,906 | permissive | [
{
"docstring": "Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing.",
"name": "__init__",
"signature": "def __init__(self, coverage, ignore_errors=False)"
},
{
"docstring": "Find the code units we'll report on... | 3 | null | Implement the Python class `Reporter` described below.
Class description:
A base class for all reporters.
Method signatures and docstrings:
- def __init__(self, coverage, ignore_errors=False): Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during fil... | Implement the Python class `Reporter` described below.
Class description:
A base class for all reporters.
Method signatures and docstrings:
- def __init__(self, coverage, ignore_errors=False): Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during fil... | acefdaaadd3ef46f10f63d1acae2259e4024d383 | <|skeleton|>
class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, ignore_errors=False):
"""Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing."""
<|body_0|>
def find_code_un... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, ignore_errors=False):
"""Create a reporter. `coverage` is the coverage instance. `ignore_errors` controls how skittish the reporter will be during file processing."""
self.coverage = coverage
self.ignore_... | the_stack_v2_python_sparse | third_party/blink/Tools/Scripts/webkitpy/thirdparty/coverage/report.py | youtube/cobalt | train | 169 |
42a0b3a8a3fdf238898e0cd8b958c06e447c72cd | [
"args = parser.parse_args()\ntry:\n db.session.add(UserModel(username=args['username'], password=args['password']))\n db.session.commit()\n response = {'message': 'success'}\nexcept IntegrityError:\n db.session.rollback()\n response = {'message': f\"User {args['username']} already exists in database.... | <|body_start_0|>
args = parser.parse_args()
try:
db.session.add(UserModel(username=args['username'], password=args['password']))
db.session.commit()
response = {'message': 'success'}
except IntegrityError:
db.session.rollback()
response... | Users | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Users:
def post(self):
"""Create a user."""
<|body_0|>
def delete(self):
"""Deletes a user."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
args = parser.parse_args()
try:
db.session.add(UserModel(username=args['username'], passw... | stack_v2_sparse_classes_36k_train_007969 | 2,132 | permissive | [
{
"docstring": "Create a user.",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Deletes a user.",
"name": "delete",
"signature": "def delete(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010497 | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def post(self): Create a user.
- def delete(self): Deletes a user. | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def post(self): Create a user.
- def delete(self): Deletes a user.
<|skeleton|>
class Users:
def post(self):
"""Create a user."""
<|body_0|>
def delete(self)... | 4ddf5cd60d5e0e87e7641e97c9fbe78965c4b522 | <|skeleton|>
class Users:
def post(self):
"""Create a user."""
<|body_0|>
def delete(self):
"""Deletes a user."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Users:
def post(self):
"""Create a user."""
args = parser.parse_args()
try:
db.session.add(UserModel(username=args['username'], password=args['password']))
db.session.commit()
response = {'message': 'success'}
except IntegrityError:
... | the_stack_v2_python_sparse | api/api/endpoints/user.py | andschneider/soil_sense | train | 0 | |
cc49419d8ec219c24e76e28edf75c2aa94ab2ba2 | [
"java_params = list(self._java_obj.params())\nfrom pyspark.ml.param import Param\nfor java_param in java_params:\n java_param_name = java_param.name()\n if not hasattr(self, java_param_name):\n param = Param(self, java_param_name, java_param.doc())\n setattr(param, 'created_from_java_param', Tru... | <|body_start_0|>
java_params = list(self._java_obj.params())
from pyspark.ml.param import Param
for java_param in java_params:
java_param_name = java_param.name()
if not hasattr(self, java_param_name):
param = Param(self, java_param_name, java_param.doc())... | Mixin for overriding methods derived from JavaParams. | JavaParamsOverrides | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JavaParamsOverrides:
"""Mixin for overriding methods derived from JavaParams."""
def _create_params_from_java(self):
"""Create params that are defined in the Java obj but not here"""
<|body_0|>
def _transfer_params_from_java(self):
"""Transforms the embedded para... | stack_v2_sparse_classes_36k_train_007970 | 9,805 | no_license | [
{
"docstring": "Create params that are defined in the Java obj but not here",
"name": "_create_params_from_java",
"signature": "def _create_params_from_java(self)"
},
{
"docstring": "Transforms the embedded params from the companion Java object.",
"name": "_transfer_params_from_java",
"s... | 3 | stack_v2_sparse_classes_30k_train_002284 | Implement the Python class `JavaParamsOverrides` described below.
Class description:
Mixin for overriding methods derived from JavaParams.
Method signatures and docstrings:
- def _create_params_from_java(self): Create params that are defined in the Java obj but not here
- def _transfer_params_from_java(self): Transfo... | Implement the Python class `JavaParamsOverrides` described below.
Class description:
Mixin for overriding methods derived from JavaParams.
Method signatures and docstrings:
- def _create_params_from_java(self): Create params that are defined in the Java obj but not here
- def _transfer_params_from_java(self): Transfo... | 72d51e8e072fbeb5e2068d0a568fa4595282aa61 | <|skeleton|>
class JavaParamsOverrides:
"""Mixin for overriding methods derived from JavaParams."""
def _create_params_from_java(self):
"""Create params that are defined in the Java obj but not here"""
<|body_0|>
def _transfer_params_from_java(self):
"""Transforms the embedded para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JavaParamsOverrides:
"""Mixin for overriding methods derived from JavaParams."""
def _create_params_from_java(self):
"""Create params that are defined in the Java obj but not here"""
java_params = list(self._java_obj.params())
from pyspark.ml.param import Param
for java_pa... | the_stack_v2_python_sparse | docker/pyspark_lab/main/module/sparkxgb/xgboost.py | stansuo/BDSE12-Group3 | train | 6 |
d208ca4db22c8cf8466a505e4ff0d86271a9748e | [
"BaseDustNode.__init__(self, xml_node)\nself._value = xml_node.text.strip()\nself._length = length\nself._columns = [Column(name=col_name, dtype='S' + str(length))]",
"base_string = BaseDustNode.__str__(self)\nstring = '[StringNode: ' + base_string + ', value: ' + self._value + ']'\nreturn string"
] | <|body_start_0|>
BaseDustNode.__init__(self, xml_node)
self._value = xml_node.text.strip()
self._length = length
self._columns = [Column(name=col_name, dtype='S' + str(length))]
<|end_body_0|>
<|body_start_1|>
base_string = BaseDustNode.__str__(self)
string = '[StringNod... | A node that contains text. | StringNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : ... | stack_v2_sparse_classes_36k_train_007971 | 41,056 | permissive | [
{
"docstring": "Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : int the size of the column associated with this item",
"name": "__init__",
"signature": "def __init_... | 2 | stack_v2_sparse_classes_30k_train_004229 | Implement the Python class `StringNode` described below.
Class description:
A node that contains text.
Method signatures and docstrings:
- def __init__(self, xml_node, col_name, length): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str t... | Implement the Python class `StringNode` described below.
Class description:
A node that contains text.
Method signatures and docstrings:
- def __init__(self, xml_node, col_name, length): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str t... | 51316d7417d7daf01a8b29d1df99037b9227c2bc | <|skeleton|>
class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : int the size ... | the_stack_v2_python_sparse | astroquery/ipac/irsa/irsa_dust/core.py | astropy/astroquery | train | 636 |
9490d63bf56ad38360752e412f420e9e6b1f373c | [
"input_json = request.data\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))\njson_params = dict(zip(['profile_id', 'ticket_id'], [input_json['SessionDe... | <|body_start_0|>
input_json = request.data
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))
json_params = dict(zip(['profile_id', 't... | This covers the API for fetching all support centre tickets raised by the user | PostLoginGetTicketRepliesAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostLoginGetTicketRepliesAPI:
"""This covers the API for fetching all support centre tickets raised by the user"""
def post(self, request):
"""Post Function to fetching common questions based on ticket type."""
<|body_0|>
def post_login_get_ticket_replies_json(self, requ... | stack_v2_sparse_classes_36k_train_007972 | 4,647 | no_license | [
{
"docstring": "Post Function to fetching common questions based on ticket type.",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "This function fetches all the support centre tickets raised by logged in user :param request: { 'profile_id': 1, 'ticket_id' = 1 } :return:... | 2 | stack_v2_sparse_classes_30k_train_013543 | Implement the Python class `PostLoginGetTicketRepliesAPI` described below.
Class description:
This covers the API for fetching all support centre tickets raised by the user
Method signatures and docstrings:
- def post(self, request): Post Function to fetching common questions based on ticket type.
- def post_login_ge... | Implement the Python class `PostLoginGetTicketRepliesAPI` described below.
Class description:
This covers the API for fetching all support centre tickets raised by the user
Method signatures and docstrings:
- def post(self, request): Post Function to fetching common questions based on ticket type.
- def post_login_ge... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class PostLoginGetTicketRepliesAPI:
"""This covers the API for fetching all support centre tickets raised by the user"""
def post(self, request):
"""Post Function to fetching common questions based on ticket type."""
<|body_0|>
def post_login_get_ticket_replies_json(self, requ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PostLoginGetTicketRepliesAPI:
"""This covers the API for fetching all support centre tickets raised by the user"""
def post(self, request):
"""Post Function to fetching common questions based on ticket type."""
input_json = request.data
output_json = dict(zip(['AvailabilityDetails... | the_stack_v2_python_sparse | Generic/common/supportcentre/api/post_login_get_ticket_replies/views_post_login_get_ticket_replies.py | archiemb303/common_backend_django | train | 0 |
d535b156f2eba68f012b3b871e4c5b007e79b2b2 | [
"self.convertTimes = convertTimes\nself.dataA = self.loadEphem(fPathA)\nself.dataB = self.loadEphem(fPathB)\nreturn",
"lat = np.stack((self.dataA['lat'], self.dataB['lat']))\nlon = np.stack((self.dataA['lon'], self.dataB['lon']))\nalt = np.mean(np.stack((self.dataA['lat'], self.dataB['lat'])), axis=0)\nself.crowF... | <|body_start_0|>
self.convertTimes = convertTimes
self.dataA = self.loadEphem(fPathA)
self.dataB = self.loadEphem(fPathB)
return
<|end_body_0|>
<|body_start_1|>
lat = np.stack((self.dataA['lat'], self.dataB['lat']))
lon = np.stack((self.dataA['lon'], self.dataB['lon']))
... | CalcSep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalcSep:
def __init__(self, fPathA, fPathB, convertTimes=False):
"""Convert times will convert timestamps to datetime objects (slow!)"""
<|body_0|>
def calcDistance(self):
"""This function will blindly calculate the spacecraft separation assuming the time stamps all ... | stack_v2_sparse_classes_36k_train_007973 | 4,031 | no_license | [
{
"docstring": "Convert times will convert timestamps to datetime objects (slow!)",
"name": "__init__",
"signature": "def __init__(self, fPathA, fPathB, convertTimes=False)"
},
{
"docstring": "This function will blindly calculate the spacecraft separation assuming the time stamps all line up.",
... | 5 | stack_v2_sparse_classes_30k_train_006540 | Implement the Python class `CalcSep` described below.
Class description:
Implement the CalcSep class.
Method signatures and docstrings:
- def __init__(self, fPathA, fPathB, convertTimes=False): Convert times will convert timestamps to datetime objects (slow!)
- def calcDistance(self): This function will blindly calcu... | Implement the Python class `CalcSep` described below.
Class description:
Implement the CalcSep class.
Method signatures and docstrings:
- def __init__(self, fPathA, fPathB, convertTimes=False): Convert times will convert timestamps to datetime objects (slow!)
- def calcDistance(self): This function will blindly calcu... | 196342fe358ff5e195541269646bb228941bed64 | <|skeleton|>
class CalcSep:
def __init__(self, fPathA, fPathB, convertTimes=False):
"""Convert times will convert timestamps to datetime objects (slow!)"""
<|body_0|>
def calcDistance(self):
"""This function will blindly calculate the spacecraft separation assuming the time stamps all ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CalcSep:
def __init__(self, fPathA, fPathB, convertTimes=False):
"""Convert times will convert timestamps to datetime objects (slow!)"""
self.convertTimes = convertTimes
self.dataA = self.loadEphem(fPathA)
self.dataB = self.loadEphem(fPathB)
return
def calcDistance... | the_stack_v2_python_sparse | mission_tools/orbit/calc_separation.py | mshumko/mission_tools | train | 0 | |
09bebe5a33b440118b0737c6949d2bd04cf8e867 | [
"n = len(nums)\nfor i in range(n - 1):\n res = target - nums[i]\n for j in range(i + 1, n):\n if nums[j] == res:\n return [i, j]",
"nums_dict = dict()\nfor i, num in enumerate(nums):\n if nums_dict.get(num) == None:\n nums_dict[target - num] = i\n else:\n return [nums_d... | <|body_start_0|>
n = len(nums)
for i in range(n - 1):
res = target - nums[i]
for j in range(i + 1, n):
if nums[j] == res:
return [i, j]
<|end_body_0|>
<|body_start_1|>
nums_dict = dict()
for i, num in enumerate(nums):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum_1(self, nums: List[int], target: int) -> List[int]:
"""1. 暴力法, 两次遍历"""
<|body_0|>
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""2. 哈希表,一次遍历 KEY:将 数 及 余数的索引 作为键值对储存 >>> nums=[2,4,5],target=7 i=0 --> {7-2: 0} i=1 --> {5: 0, 7-4: 1... | stack_v2_sparse_classes_36k_train_007974 | 1,598 | no_license | [
{
"docstring": "1. 暴力法, 两次遍历",
"name": "twoSum_1",
"signature": "def twoSum_1(self, nums: List[int], target: int) -> List[int]"
},
{
"docstring": "2. 哈希表,一次遍历 KEY:将 数 及 余数的索引 作为键值对储存 >>> nums=[2,4,5],target=7 i=0 --> {7-2: 0} i=1 --> {5: 0, 7-4: 1}",
"name": "twoSum",
"signature": "def t... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_1(self, nums: List[int], target: int) -> List[int]: 1. 暴力法, 两次遍历
- def twoSum(self, nums: List[int], target: int) -> List[int]: 2. 哈希表,一次遍历 KEY:将 数 及 余数的索引 作为键值对储存 >>>... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum_1(self, nums: List[int], target: int) -> List[int]: 1. 暴力法, 两次遍历
- def twoSum(self, nums: List[int], target: int) -> List[int]: 2. 哈希表,一次遍历 KEY:将 数 及 余数的索引 作为键值对储存 >>>... | 4732fb80710a08a715c3e7080c394f5298b8326d | <|skeleton|>
class Solution:
def twoSum_1(self, nums: List[int], target: int) -> List[int]:
"""1. 暴力法, 两次遍历"""
<|body_0|>
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""2. 哈希表,一次遍历 KEY:将 数 及 余数的索引 作为键值对储存 >>> nums=[2,4,5],target=7 i=0 --> {7-2: 0} i=1 --> {5: 0, 7-4: 1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum_1(self, nums: List[int], target: int) -> List[int]:
"""1. 暴力法, 两次遍历"""
n = len(nums)
for i in range(n - 1):
res = target - nums[i]
for j in range(i + 1, n):
if nums[j] == res:
return [i, j]
def twoSum... | the_stack_v2_python_sparse | .leetcode/1.两数之和.py | xiaoruijiang/algorithm | train | 0 | |
e6cf20081f4778a6a0dc5f268d51dfe3dc383451 | [
"self.m = transitionmatrix\nself.s = statenames\nr, c = self.m.shape\nassert r == c, \"state transition matrix isn't square\"\nassert r == len(self.s), \"number of states doesn't match matrix\"\nirow: np.ndarray = None\nfor irow in self.m:\n assert np.isclose(irow.sum(), 1.0), \"row doesn't add up to 1: {}\".for... | <|body_start_0|>
self.m = transitionmatrix
self.s = statenames
r, c = self.m.shape
assert r == c, "state transition matrix isn't square"
assert r == len(self.s), "number of states doesn't match matrix"
irow: np.ndarray = None
for irow in self.m:
assert... | MarkovSimple | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MarkovSimple:
def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1):
"""initialize markov chain. if no initial state given, one chosen at random"""
<|body_0|>
def next(self):
"""based on current state, go to next state"""
<|body_... | stack_v2_sparse_classes_36k_train_007975 | 2,002 | permissive | [
{
"docstring": "initialize markov chain. if no initial state given, one chosen at random",
"name": "__init__",
"signature": "def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1)"
},
{
"docstring": "based on current state, go to next state",
"name": "next",
... | 2 | stack_v2_sparse_classes_30k_train_001867 | Implement the Python class `MarkovSimple` described below.
Class description:
Implement the MarkovSimple class.
Method signatures and docstrings:
- def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1): initialize markov chain. if no initial state given, one chosen at random
- def next(s... | Implement the Python class `MarkovSimple` described below.
Class description:
Implement the MarkovSimple class.
Method signatures and docstrings:
- def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1): initialize markov chain. if no initial state given, one chosen at random
- def next(s... | 87a6ce221e7210f73b360f4e9642d7ccbdebb94b | <|skeleton|>
class MarkovSimple:
def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1):
"""initialize markov chain. if no initial state given, one chosen at random"""
<|body_0|>
def next(self):
"""based on current state, go to next state"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MarkovSimple:
def __init__(self, transitionmatrix: np.ndarray, statenames: list, initialstate=-1):
"""initialize markov chain. if no initial state given, one chosen at random"""
self.m = transitionmatrix
self.s = statenames
r, c = self.m.shape
assert r == c, "state tran... | the_stack_v2_python_sparse | py_sandbox/archive/idea_markov_chain.py | kjgonzalez/codefiles | train | 0 | |
18fc30e15e09b73052e0267ee7a5bd97a4876c06 | [
"self.send_response(200)\nself.send_header('Content-type', 'text/html')\nself.end_headers()\nself.wfile.write(b'<html><head><title>Authentication Status</title>')\nself.wfile.write(b'<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\"></script></head>')\nself.wfile.write(b\"<link href='... | <|body_start_0|>
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(b'<html><head><title>Authentication Status</title>')
self.wfile.write(b'<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></scri... | A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving. | ClientRedirectHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientRedirectHandler:
"""A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving."""
def do_GET(self):
"""Handle a GET request. opens index.html and try to parse token"""
<|b... | stack_v2_sparse_classes_36k_train_007976 | 6,261 | permissive | [
{
"docstring": "Handle a GET request. opens index.html and try to parse token",
"name": "do_GET",
"signature": "def do_GET(self)"
},
{
"docstring": "Handle a POST request. Should only ever be sending self urlencoded so",
"name": "do_POST",
"signature": "def do_POST(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016428 | Implement the Python class `ClientRedirectHandler` described below.
Class description:
A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving.
Method signatures and docstrings:
- def do_GET(self): Handle a GET reques... | Implement the Python class `ClientRedirectHandler` described below.
Class description:
A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving.
Method signatures and docstrings:
- def do_GET(self): Handle a GET reques... | 059ea3c16d6061395586820a0c62402c414251e3 | <|skeleton|>
class ClientRedirectHandler:
"""A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving."""
def do_GET(self):
"""Handle a GET request. opens index.html and try to parse token"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientRedirectHandler:
"""A handler for OAuth 2.0 redirects back to localhost. Waits for two requests and parses the access token into the servers query_params and then stops serving."""
def do_GET(self):
"""Handle a GET request. opens index.html and try to parse token"""
self.send_respon... | the_stack_v2_python_sparse | python3/ltk/auth.py | Lingotek/filesystem-connector | train | 11 |
72e97b8126d6b7df4ecd17263cef682d55ad90c9 | [
"items = str.split()\ni_len = len(items)\np_len = len(pattern)\nif i_len != p_len:\n return False\npatternDic = {}\nitemDic = {}\nfor i in range(i_len):\n if pattern[i] not in patternDic:\n patternDic[pattern[i]] = items[i]\n elif items[i] != patternDic[pattern[i]]:\n return False\n if ite... | <|body_start_0|>
items = str.split()
i_len = len(items)
p_len = len(pattern)
if i_len != p_len:
return False
patternDic = {}
itemDic = {}
for i in range(i_len):
if pattern[i] not in patternDic:
patternDic[pattern[i]] = items... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordPattern(self, pattern, str):
""":type pattern: str :type str: str :rtype: bool"""
<|body_0|>
def wordPattern1(self, pattern, str):
""":type pattern: str :type str: str :rtype: bool"""
<|body_1|>
def wordzip(self, pattern, str):
... | stack_v2_sparse_classes_36k_train_007977 | 1,735 | no_license | [
{
"docstring": ":type pattern: str :type str: str :rtype: bool",
"name": "wordPattern",
"signature": "def wordPattern(self, pattern, str)"
},
{
"docstring": ":type pattern: str :type str: str :rtype: bool",
"name": "wordPattern1",
"signature": "def wordPattern1(self, pattern, str)"
},
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool
- def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool
- def w... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordPattern(self, pattern, str): :type pattern: str :type str: str :rtype: bool
- def wordPattern1(self, pattern, str): :type pattern: str :type str: str :rtype: bool
- def w... | 04919147dca5b4772e3414cc2e967033c229e8e5 | <|skeleton|>
class Solution:
def wordPattern(self, pattern, str):
""":type pattern: str :type str: str :rtype: bool"""
<|body_0|>
def wordPattern1(self, pattern, str):
""":type pattern: str :type str: str :rtype: bool"""
<|body_1|>
def wordzip(self, pattern, str):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wordPattern(self, pattern, str):
""":type pattern: str :type str: str :rtype: bool"""
items = str.split()
i_len = len(items)
p_len = len(pattern)
if i_len != p_len:
return False
patternDic = {}
itemDic = {}
for i in rang... | the_stack_v2_python_sparse | 290.py | bondlee/leetcode | train | 0 | |
75fe9aef4402ca9ba4f3807b9cd5115fcea297e1 | [
"VapiInterface.__init__(self, config, _ServicesAppliedConfigStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})\nself._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})\nself._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})",
"task_id = self._invoke('g... | <|body_start_0|>
VapiInterface.__init__(self, config, _ServicesAppliedConfigStub)
self._VAPI_OPERATION_IDS = {}
self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})
self._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})
self._VAPI_OPERATION_IDS.update({'delete_task'... | The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations is stored within vCenter, while the applied configuration is stored on the hosts in the c... | ServicesAppliedConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServicesAppliedConfig:
"""The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations is stored within vCenter, while the appl... | stack_v2_sparse_classes_36k_train_007978 | 18,379 | no_license | [
{
"docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Returns detailed information about the health of the applied Trust ... | 4 | stack_v2_sparse_classes_30k_train_019770 | Implement the Python class `ServicesAppliedConfig` described below.
Class description:
The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations i... | Implement the Python class `ServicesAppliedConfig` described below.
Class description:
The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations i... | a3b6d86a802f28c7ee249fc03523d5e5f0a2e3bd | <|skeleton|>
class ServicesAppliedConfig:
"""The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations is stored within vCenter, while the appl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServicesAppliedConfig:
"""The ``ServicesAppliedConfig`` class provides information about the aggregate health of the applied Trust Authority Component configurations on the Trusted Clusters. The desired state of the Trust Authority Component configurations is stored within vCenter, while the applied configura... | the_stack_v2_python_sparse | venv/Lib/site-packages/com/vmware/vcenter/trusted_infrastructure/trusted_clusters_client.py | dungla2011/python_pyvmomi_working_sample_vmware_easy | train | 1 |
f4d21f1d28ddf68dbd8190d03b02aba93fce7f39 | [
"self.m_folder = 'VisionTest\\\\inputFrames'\nself.m_pathlist = os.listdir(self.m_folder)\nself.currentFrame = 0",
"if self.currentFrame < len(self.m_pathlist):\n path = self.m_pathlist[self.currentFrame]\n fullPath = self.m_folder + '\\\\' + str(path)\n frame = cv2.imread(fullPath)\n self.currentFram... | <|body_start_0|>
self.m_folder = 'VisionTest\\inputFrames'
self.m_pathlist = os.listdir(self.m_folder)
self.currentFrame = 0
<|end_body_0|>
<|body_start_1|>
if self.currentFrame < len(self.m_pathlist):
path = self.m_pathlist[self.currentFrame]
fullPath = self.m_f... | CameraTEST | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraTEST:
def __init__(self):
"""CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames"""
<|body_0|>
def getNextFrame(self):
"""Grabs the next frame Returns: The frame"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_007979 | 858 | permissive | [
{
"docstring": "CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Grabs the next frame Returns: The frame",
"name": "getNextFrame",
"signature"... | 2 | null | Implement the Python class `CameraTEST` described below.
Class description:
Implement the CameraTEST class.
Method signatures and docstrings:
- def __init__(self): CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames
- def getNextFrame(self): Grabs th... | Implement the Python class `CameraTEST` described below.
Class description:
Implement the CameraTEST class.
Method signatures and docstrings:
- def __init__(self): CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames
- def getNextFrame(self): Grabs th... | 2130b462b0038a527061744ab7faf20c2996c04f | <|skeleton|>
class CameraTEST:
def __init__(self):
"""CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames"""
<|body_0|>
def getNextFrame(self):
"""Grabs the next frame Returns: The frame"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CameraTEST:
def __init__(self):
"""CameraTEST class's constructor. Initializes, notably, a self.m_pathlist attribute, which is the list of all test frames"""
self.m_folder = 'VisionTest\\inputFrames'
self.m_pathlist = os.listdir(self.m_folder)
self.currentFrame = 0
def get... | the_stack_v2_python_sparse | vision/src/VisionTest/CameraTEST.py | victoriapc/HockusPockus | train | 0 | |
59a143d5c7b951c271d2928b144908a511cb6936 | [
"user = self.cleaned_data['user_name']\nif BaseUser.objects.filter(username=user).exists():\n raise forms.ValidationError('کاربر از قبل ایجاد شده است ')\nreturn user",
"password1 = self.cleaned_data['password_1']\npassword2 = self.cleaned_data['password_2']\nif password1 != password2:\n raise forms.Validati... | <|body_start_0|>
user = self.cleaned_data['user_name']
if BaseUser.objects.filter(username=user).exists():
raise forms.ValidationError('کاربر از قبل ایجاد شده است ')
return user
<|end_body_0|>
<|body_start_1|>
password1 = self.cleaned_data['password_1']
password2 = s... | ایجاد فرم برای ثبت نام کاربر | UserRegisterForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRegisterForm:
"""ایجاد فرم برای ثبت نام کاربر"""
def clean_user_name(self):
"""در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:"""
<|body_0|>
def clean_password_2(self):
"""جهت ارسال مجدد پسوورد و بررسی مساوی بودن پسوورد و تکرار پسووردو همچنین... | stack_v2_sparse_classes_36k_train_007980 | 2,904 | no_license | [
{
"docstring": "در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:",
"name": "clean_user_name",
"signature": "def clean_user_name(self)"
},
{
"docstring": "جهت ارسال مجدد پسوورد و بررسی مساوی بودن پسوورد و تکرار پسووردو همچنین اضافه کردن شرط پسوورد باید بیشتر از پنج حرف باشد :retur... | 2 | stack_v2_sparse_classes_30k_train_016369 | Implement the Python class `UserRegisterForm` described below.
Class description:
ایجاد فرم برای ثبت نام کاربر
Method signatures and docstrings:
- def clean_user_name(self): در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:
- def clean_password_2(self): جهت ارسال مجدد پسوورد و بررسی مساوی بودن پسوورد و... | Implement the Python class `UserRegisterForm` described below.
Class description:
ایجاد فرم برای ثبت نام کاربر
Method signatures and docstrings:
- def clean_user_name(self): در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:
- def clean_password_2(self): جهت ارسال مجدد پسوورد و بررسی مساوی بودن پسوورد و... | dc2ef0644ad70c9c2a19cbcb9b2fa3135f1b5394 | <|skeleton|>
class UserRegisterForm:
"""ایجاد فرم برای ثبت نام کاربر"""
def clean_user_name(self):
"""در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:"""
<|body_0|>
def clean_password_2(self):
"""جهت ارسال مجدد پسوورد و بررسی مساوی بودن پسوورد و تکرار پسووردو همچنین... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserRegisterForm:
"""ایجاد فرم برای ثبت نام کاربر"""
def clean_user_name(self):
"""در این متد بررسی میشود که کاربر قبلا ثبت نام نکرده باشد :return:"""
user = self.cleaned_data['user_name']
if BaseUser.objects.filter(username=user).exists():
raise forms.ValidationError(... | the_stack_v2_python_sparse | account/forms.py | somayejalilii/book_store_jalili | train | 0 |
f294db7e8f57dfc2b924776f5d9da136fc5362ff | [
"self.accessible_users = accessible_users\nself.audit_logs = audit_logs\nself.copy_task_info = copy_task_info\nself.is_protected = is_protected\nself.location = location\nself.protection_info = protection_info\nself.root_node_id = root_node_id\nself.source_id = source_id\nself.source_name = source_name",
"if dict... | <|body_start_0|>
self.accessible_users = accessible_users
self.audit_logs = audit_logs
self.copy_task_info = copy_task_info
self.is_protected = is_protected
self.location = location
self.protection_info = protection_info
self.root_node_id = root_node_id
se... | Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the audit log information. copy_task_info (list of GdprCopyTask): Specifies the copy task ... | ObjectInformation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectInformation:
"""Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the audit log information. copy_task_info (li... | stack_v2_sparse_classes_36k_train_007981 | 4,500 | permissive | [
{
"docstring": "Constructor for the ObjectInformation class",
"name": "__init__",
"signature": "def __init__(self, accessible_users=None, audit_logs=None, copy_task_info=None, is_protected=None, location=None, protection_info=None, root_node_id=None, source_id=None, source_name=None)"
},
{
"docs... | 2 | null | Implement the Python class `ObjectInformation` described below.
Class description:
Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the au... | Implement the Python class `ObjectInformation` described below.
Class description:
Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the au... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ObjectInformation:
"""Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the audit log information. copy_task_info (li... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObjectInformation:
"""Implementation of the 'ObjectInformation' model. TODO: type description here. Attributes: accessible_users (list of string): Species the list of user who have access to this object. audit_logs (list of ClusterAuditLog): Specifies the audit log information. copy_task_info (list of GdprCop... | the_stack_v2_python_sparse | cohesity_management_sdk/models/object_information.py | cohesity/management-sdk-python | train | 24 |
c32a559ae4148152c36e85dc9695bd546b322229 | [
"l = len(nums)\ni = 0\nr = 0\nwhile i < l:\n j = i\n subsum = 0\n while j < l:\n subsum += nums[j]\n if subsum == k:\n r += 1\n j += 1\n i += 1\nreturn r",
"dic = dict()\nsubsum = 0\nr = 0\nfor i in nums:\n if subsum in dic:\n dic[subsum] += 1\n else:\n ... | <|body_start_0|>
l = len(nums)
i = 0
r = 0
while i < l:
j = i
subsum = 0
while j < l:
subsum += nums[j]
if subsum == k:
r += 1
j += 1
i += 1
return r
<|end_body_0|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subarraySum1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = len(nums... | stack_v2_sparse_classes_36k_train_007982 | 842 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySum1",
"signature": "def subarraySum1(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySum",
"signature": "def subarraySum(self, nums, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum1(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum1(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|>
cla... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def subarraySum1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def subarraySum1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
l = len(nums)
i = 0
r = 0
while i < l:
j = i
subsum = 0
while j < l:
subsum += nums[j]
if subsum == k:
... | the_stack_v2_python_sparse | py/leetcode/560.py | wfeng1991/learnpy | train | 0 | |
a673de6b8b9c9e46fbc9b1fd9b6b0b2d69f27d28 | [
"self.nums = nums\nself.sums = []\ntemp = 0\nfor i in nums:\n temp += i\n self.sums.append(temp)",
"if i == 0:\n return self.sums[j]\nreturn self.sums[j] - self.sums[i - 1]"
] | <|body_start_0|>
self.nums = nums
self.sums = []
temp = 0
for i in nums:
temp += i
self.sums.append(temp)
<|end_body_0|>
<|body_start_1|>
if i == 0:
return self.sums[j]
return self.sums[j] - self.sums[i - 1]
<|end_body_1|>
| NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.nums = nums
self.sums = []
temp = 0
... | stack_v2_sparse_classes_36k_train_007983 | 1,286 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | d156c6a13c89727f80ed6244cae40574395ecf34 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.nums = nums
self.sums = []
temp = 0
for i in nums:
temp += i
self.sums.append(temp)
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
if... | the_stack_v2_python_sparse | easy/303.py | longhao54/leetcode | train | 0 | |
7649b34263f80427226e846f791f51d410df528e | [
"if k == 1:\n return max(nums)\nn = nums[-1]\ni, j = (0, len(nums) - 1)\nwhile i <= j:\n if nums[i] < n < nums[j]:\n nums[i], nums[j] = (nums[j], nums[i])\n if nums[i] >= n:\n i += 1\n if nums[j] <= n:\n j -= 1\nnums[j + 1], nums[-1] = (n, nums[j + 1])\nif k - 1 < j + 1:\n return... | <|body_start_0|>
if k == 1:
return max(nums)
n = nums[-1]
i, j = (0, len(nums) - 1)
while i <= j:
if nums[i] < n < nums[j]:
nums[i], nums[j] = (nums[j], nums[i])
if nums[i] >= n:
i += 1
if nums[j] <= n:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
<|body_0|>
def findKthLargest(self, nums: List[int], k: int) -> int:
"""Heap Time complexity: O(nlogk) Sapce complexity: O(k)"""
<|body_1|>
def findKthLargest(self... | stack_v2_sparse_classes_36k_train_007984 | 3,084 | no_license | [
{
"docstring": "04/29/2019 00:26",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums: List[int], k: int) -> int"
},
{
"docstring": "Heap Time complexity: O(nlogk) Sapce complexity: O(k)",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums: List[int]... | 3 | stack_v2_sparse_classes_30k_train_004712 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums: List[int], k: int) -> int: 04/29/2019 00:26
- def findKthLargest(self, nums: List[int], k: int) -> int: Heap Time complexity: O(nlogk) Sapce comple... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums: List[int], k: int) -> int: 04/29/2019 00:26
- def findKthLargest(self, nums: List[int], k: int) -> int: Heap Time complexity: O(nlogk) Sapce comple... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
<|body_0|>
def findKthLargest(self, nums: List[int], k: int) -> int:
"""Heap Time complexity: O(nlogk) Sapce complexity: O(k)"""
<|body_1|>
def findKthLargest(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""04/29/2019 00:26"""
if k == 1:
return max(nums)
n = nums[-1]
i, j = (0, len(nums) - 1)
while i <= j:
if nums[i] < n < nums[j]:
nums[i], nums[j] = (nums[j], num... | the_stack_v2_python_sparse | leetcode/solved/215_Kth_Largest_Element_in_an_Array/solution.py | sungminoh/algorithms | train | 0 | |
a58c662ffec0386d5b1a109dee4ba1dd9ac6c178 | [
"pub = Publisher()\nnow_time = datetime.datetime.now().isoformat()\nlocation = Geolocation().run()\npub.publish({'username': username, 'pass': password, 'agentid': Database().get_id(), 'timestamp': now_time, 'location': location}, 'UP')",
"vs = VideoStream()\nvs.stream(username, 'fr')\nfr = RecognizeUserFace()\nn... | <|body_start_0|>
pub = Publisher()
now_time = datetime.datetime.now().isoformat()
location = Geolocation().run()
pub.publish({'username': username, 'pass': password, 'agentid': Database().get_id(), 'timestamp': now_time, 'location': location}, 'UP')
<|end_body_0|>
<|body_start_1|>
... | Manages authentication using password and facial recognition. | Authenticator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Authenticator:
"""Manages authentication using password and facial recognition."""
def authenticate_user_pass(self, username, password):
"""When user chooses to authenticate with password, this function will be used. Sends MP the username and password with location of the car. :param... | stack_v2_sparse_classes_36k_train_007985 | 3,848 | no_license | [
{
"docstring": "When user chooses to authenticate with password, this function will be used. Sends MP the username and password with location of the car. :param username: user name that's being authenticated :type username: string :param password: password that's being authenticated :type password: string",
... | 3 | stack_v2_sparse_classes_30k_train_000177 | Implement the Python class `Authenticator` described below.
Class description:
Manages authentication using password and facial recognition.
Method signatures and docstrings:
- def authenticate_user_pass(self, username, password): When user chooses to authenticate with password, this function will be used. Sends MP t... | Implement the Python class `Authenticator` described below.
Class description:
Manages authentication using password and facial recognition.
Method signatures and docstrings:
- def authenticate_user_pass(self, username, password): When user chooses to authenticate with password, this function will be used. Sends MP t... | d5de98b225afb6ce07dae25e4734105432533830 | <|skeleton|>
class Authenticator:
"""Manages authentication using password and facial recognition."""
def authenticate_user_pass(self, username, password):
"""When user chooses to authenticate with password, this function will be used. Sends MP the username and password with location of the car. :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Authenticator:
"""Manages authentication using password and facial recognition."""
def authenticate_user_pass(self, username, password):
"""When user chooses to authenticate with password, this function will be used. Sends MP the username and password with location of the car. :param username: us... | the_stack_v2_python_sparse | auth/authenticate.py | PIoT-CSS/agent-pi | train | 0 |
ddb5dbf20117d1b816ced62a67115d65fbef6c90 | [
"running_status = self.filter(Q(status__in=self.model.CAN_OPERATE_STATUS) | Q(status=FAILED, type=TASK_STATE))\nif ticket_id:\n running_status = running_status.filter(ticket_id=ticket_id)\nreturn running_status",
"dotted_username = dotted_name(username)\nfilters = [Q(processors_type='PERSON') & Q(processors__c... | <|body_start_0|>
running_status = self.filter(Q(status__in=self.model.CAN_OPERATE_STATUS) | Q(status=FAILED, type=TASK_STATE))
if ticket_id:
running_status = running_status.filter(ticket_id=ticket_id)
return running_status
<|end_body_0|>
<|body_start_1|>
dotted_username = do... | 状态管理器 | StatusManager | [
"MIT",
"LGPL-2.1-or-later",
"LGPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusManager:
"""状态管理器"""
def get_running_status(self, ticket_id=None):
"""查看执行中的状态"""
<|body_0|>
def build_role_filter(username):
"""暂未用到"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
running_status = self.filter(Q(status__in=self.model.CAN_... | stack_v2_sparse_classes_36k_train_007986 | 39,063 | permissive | [
{
"docstring": "查看执行中的状态",
"name": "get_running_status",
"signature": "def get_running_status(self, ticket_id=None)"
},
{
"docstring": "暂未用到",
"name": "build_role_filter",
"signature": "def build_role_filter(username)"
}
] | 2 | null | Implement the Python class `StatusManager` described below.
Class description:
状态管理器
Method signatures and docstrings:
- def get_running_status(self, ticket_id=None): 查看执行中的状态
- def build_role_filter(username): 暂未用到 | Implement the Python class `StatusManager` described below.
Class description:
状态管理器
Method signatures and docstrings:
- def get_running_status(self, ticket_id=None): 查看执行中的状态
- def build_role_filter(username): 暂未用到
<|skeleton|>
class StatusManager:
"""状态管理器"""
def get_running_status(self, ticket_id=None):
... | 2d708bd0d869d391456e0fb8d644af3b9f031acf | <|skeleton|>
class StatusManager:
"""状态管理器"""
def get_running_status(self, ticket_id=None):
"""查看执行中的状态"""
<|body_0|>
def build_role_filter(username):
"""暂未用到"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatusManager:
"""状态管理器"""
def get_running_status(self, ticket_id=None):
"""查看执行中的状态"""
running_status = self.filter(Q(status__in=self.model.CAN_OPERATE_STATUS) | Q(status=FAILED, type=TASK_STATE))
if ticket_id:
running_status = running_status.filter(ticket_id=ticket_i... | the_stack_v2_python_sparse | itsm/ticket/managers.py | TencentBlueKing/bk-itsm | train | 100 |
74cada21c63162ab8915a1fd637e80d2a82fa9ff | [
"super(LogWatcherBuilder, self).__init__(*args, **kwargs)\nself._arguments = None\nreturn",
"if self._product is None:\n self._product = LogWatcher(output=self.output_file, connection=self.node.connection, arguments=self.arguments)\nreturn self._product"
] | <|body_start_0|>
super(LogWatcherBuilder, self).__init__(*args, **kwargs)
self._arguments = None
return
<|end_body_0|>
<|body_start_1|>
if self._product is None:
self._product = LogWatcher(output=self.output_file, connection=self.node.connection, arguments=self.arguments)
... | A builder of log watchers | LogWatcherBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogWatcherBuilder:
"""A builder of log watchers"""
def __init__(self, *args, **kwargs):
""":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to w... | stack_v2_sparse_classes_36k_train_007987 | 7,765 | permissive | [
{
"docstring": ":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to watch to decide when to stop",
"name": "__init__",
"signature": "def __init__(self, *args, **kwa... | 2 | null | Implement the Python class `LogWatcherBuilder` described below.
Class description:
A builder of log watchers
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name... | Implement the Python class `LogWatcherBuilder` described below.
Class description:
A builder of log watchers
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class LogWatcherBuilder:
"""A builder of log watchers"""
def __init__(self, *args, **kwargs):
""":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogWatcherBuilder:
"""A builder of log watchers"""
def __init__(self, *args, **kwargs):
""":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to watch to decid... | the_stack_v2_python_sparse | apetools/builders/subbuilders/logwatcherbuilders.py | russell-n/oldape | train | 0 |
e530f4bd6c0d89fcc03078e7d3044bfd7c2cd650 | [
"Light.__init__(self, 'SpotLight')\nself.position = position\nself.direction = direction\nself.p = p\nself.dir_ray = Ray(position, self.direction - self.position)\nself.a = a\nself.b = b\nself.c = c",
"d = shadowray.direction.length()\nf_att = np.clip(1 / (self.c + self.b * d + self.a * d * d), 0, 1)\ncos_angle =... | <|body_start_0|>
Light.__init__(self, 'SpotLight')
self.position = position
self.direction = direction
self.p = p
self.dir_ray = Ray(position, self.direction - self.position)
self.a = a
self.b = b
self.c = c
<|end_body_0|>
<|body_start_1|>
d = sha... | Class describing a spot light source | SpotLight | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpotLight:
"""Class describing a spot light source"""
def __init__(self, position: Vec3, direction: Vec3, p: int, a=0.02, b=0.1, c=0) -> None:
"""Constructor: param position: position of the light param direction: direction of the light param p: controls how much the spotlight is foc... | stack_v2_sparse_classes_36k_train_007988 | 1,416 | permissive | [
{
"docstring": "Constructor: param position: position of the light param direction: direction of the light param p: controls how much the spotlight is focussed params a, b, c: quadratic equation coefficients for ad^2 + bd + c",
"name": "__init__",
"signature": "def __init__(self, position: Vec3, directi... | 2 | stack_v2_sparse_classes_30k_test_000301 | Implement the Python class `SpotLight` described below.
Class description:
Class describing a spot light source
Method signatures and docstrings:
- def __init__(self, position: Vec3, direction: Vec3, p: int, a=0.02, b=0.1, c=0) -> None: Constructor: param position: position of the light param direction: direction of ... | Implement the Python class `SpotLight` described below.
Class description:
Class describing a spot light source
Method signatures and docstrings:
- def __init__(self, position: Vec3, direction: Vec3, p: int, a=0.02, b=0.1, c=0) -> None: Constructor: param position: position of the light param direction: direction of ... | 6fc0ccbc6fb24dcc2a8532aa22eb9574f1afdb3a | <|skeleton|>
class SpotLight:
"""Class describing a spot light source"""
def __init__(self, position: Vec3, direction: Vec3, p: int, a=0.02, b=0.1, c=0) -> None:
"""Constructor: param position: position of the light param direction: direction of the light param p: controls how much the spotlight is foc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpotLight:
"""Class describing a spot light source"""
def __init__(self, position: Vec3, direction: Vec3, p: int, a=0.02, b=0.1, c=0) -> None:
"""Constructor: param position: position of the light param direction: direction of the light param p: controls how much the spotlight is focussed params ... | the_stack_v2_python_sparse | pyrt/light/spotlight.py | martinchristen/pyRT | train | 79 |
71d82573a4fe623b874b4e915f79745a684ba3b9 | [
"self.nodes = set()\nself.edges = list()\nself.adjency_list = dict()",
"if node_name in self.nodes:\n print('ce node est deja dans le graphe')\n return False\nself.nodes.add(node_name)\nself.adjency_list[node_name] = list()",
"if not from_node in self.nodes or not to_node in self.nodes:\n raise NameErr... | <|body_start_0|>
self.nodes = set()
self.edges = list()
self.adjency_list = dict()
<|end_body_0|>
<|body_start_1|>
if node_name in self.nodes:
print('ce node est deja dans le graphe')
return False
self.nodes.add(node_name)
self.adjency_list[node_n... | This class is a new type for describing the graphs | Graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
"""This class is a new type for describing the graphs"""
def __init__(self):
"""this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge in the graph self.adjency_list is a dictionnary wich hav... | stack_v2_sparse_classes_36k_train_007989 | 1,911 | no_license | [
{
"docstring": "this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge in the graph self.adjency_list is a dictionnary wich have nodes as key and the node linked as values",
"name": "__init__",
"signature": "def __init... | 4 | null | Implement the Python class `Graph` described below.
Class description:
This class is a new type for describing the graphs
Method signatures and docstrings:
- def __init__(self): this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge... | Implement the Python class `Graph` described below.
Class description:
This class is a new type for describing the graphs
Method signatures and docstrings:
- def __init__(self): this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge... | 147773cc8871d74f1ec1d6bd03e3cce95e9490d1 | <|skeleton|>
class Graph:
"""This class is a new type for describing the graphs"""
def __init__(self):
"""this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge in the graph self.adjency_list is a dictionnary wich hav... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
"""This class is a new type for describing the graphs"""
def __init__(self):
"""this allow the graph to be create it is empty at the begin self.nodes is a set wich contains all the node self.edges is a list of every edge in the graph self.adjency_list is a dictionnary wich have nodes as ke... | the_stack_v2_python_sparse | theorie_des_graphes/TP2/Graph.py | porigonop/code_v2 | train | 0 |
df64285ffbd552fb2c301897099c1cd8cfcd36db | [
"try:\n user = self.context['user']\n reaction = ReactionComment.objects.get(user=user)\n reaction.delete()\n comment = self.context['comment']\n comment.reactions -= 1\n comment.save()\nexcept ReactionComment.DoesNotExist:\n return data",
"user = self.context['user']\ncomment = self.context[... | <|body_start_0|>
try:
user = self.context['user']
reaction = ReactionComment.objects.get(user=user)
reaction.delete()
comment = self.context['comment']
comment.reactions -= 1
comment.save()
except ReactionComment.DoesNotExist:
... | Reaction comment model serializer. | ReactionCommentModelSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReactionCommentModelSerializer:
"""Reaction comment model serializer."""
def validate(self, data):
"""Verify that the user's reaction does not exist yet."""
<|body_0|>
def create(self, data):
"""Create a reaction comment."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_007990 | 4,185 | no_license | [
{
"docstring": "Verify that the user's reaction does not exist yet.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Create a reaction comment.",
"name": "create",
"signature": "def create(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019248 | Implement the Python class `ReactionCommentModelSerializer` described below.
Class description:
Reaction comment model serializer.
Method signatures and docstrings:
- def validate(self, data): Verify that the user's reaction does not exist yet.
- def create(self, data): Create a reaction comment. | Implement the Python class `ReactionCommentModelSerializer` described below.
Class description:
Reaction comment model serializer.
Method signatures and docstrings:
- def validate(self, data): Verify that the user's reaction does not exist yet.
- def create(self, data): Create a reaction comment.
<|skeleton|>
class ... | fae5c0b2e388239e2e32a3fbf52aa7cfd48a7cbb | <|skeleton|>
class ReactionCommentModelSerializer:
"""Reaction comment model serializer."""
def validate(self, data):
"""Verify that the user's reaction does not exist yet."""
<|body_0|>
def create(self, data):
"""Create a reaction comment."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReactionCommentModelSerializer:
"""Reaction comment model serializer."""
def validate(self, data):
"""Verify that the user's reaction does not exist yet."""
try:
user = self.context['user']
reaction = ReactionComment.objects.get(user=user)
reaction.dele... | the_stack_v2_python_sparse | facebook/app/posts/serializers/reactions.py | ricagome/Api-Facebook-Clone | train | 0 |
56960237bbfa972b0867a7ec72430d459a3bf0e7 | [
"f = partial(rk4, t0=t0, tf=tf)\nF = np.empty((3, 3))\na = np.zeros(6)\nh = 0.0005\na[0] = h\nF[:, 0] = (f(s + a) - f(s - a))[0:3] / 2 / h\na[0], a[1] = (0, h)\nF[:, 1] = (f(s + a) - f(s - a))[0:3] / 2 / h\na[1], a[2] = (0, h)\nF[:, 2] = (f(s + a) - f(s - a))[0:3] / 2 / h\nreturn F",
"self.s = s\nself.t0 = t0\nse... | <|body_start_0|>
f = partial(rk4, t0=t0, tf=tf)
F = np.empty((3, 3))
a = np.zeros(6)
h = 0.0005
a[0] = h
F[:, 0] = (f(s + a) - f(s - a))[0:3] / 2 / h
a[0], a[1] = (0, h)
F[:, 1] = (f(s + a) - f(s - a))[0:3] / 2 / h
a[1], a[2] = (0, h)
F[:, ... | Kalman Filter class wrapper. | KalmanFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KalmanFilter:
"""Kalman Filter class wrapper."""
def __Jacobian(s, t0, tf):
"""Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time tf(float): the final time Returns: 3x3 numpy matrix: the t... | stack_v2_sparse_classes_36k_train_007991 | 2,932 | permissive | [
{
"docstring": "Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time tf(float): the final time Returns: 3x3 numpy matrix: the topleft half of the Jacobian of rk4(s,t0,tf)",
"name": "__Jacobian",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_001152 | Implement the Python class `KalmanFilter` described below.
Class description:
Kalman Filter class wrapper.
Method signatures and docstrings:
- def __Jacobian(s, t0, tf): Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time t... | Implement the Python class `KalmanFilter` described below.
Class description:
Kalman Filter class wrapper.
Method signatures and docstrings:
- def __Jacobian(s, t0, tf): Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time t... | 1aec8919ba42978e73aab4eaefe407adeb6287e9 | <|skeleton|>
class KalmanFilter:
"""Kalman Filter class wrapper."""
def __Jacobian(s, t0, tf):
"""Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time tf(float): the final time Returns: 3x3 numpy matrix: the t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KalmanFilter:
"""Kalman Filter class wrapper."""
def __Jacobian(s, t0, tf):
"""Numerically computes the Jacobian of rk4(s,t0,tf). Args: s(1x6 numpy array): the state vector at t0 [rx,ry,rz,vx,vy,vz] t0(float): the intial time tf(float): the final time Returns: 3x3 numpy matrix: the topleft half o... | the_stack_v2_python_sparse | orbitdeterminator/propagation/kalman_filter.py | aerospaceresearch/orbitdeterminator | train | 179 |
e4ff882ac432ed2ee43f9e7487b700100fccbea4 | [
"super(Felzenszwalb, self).__init__(paramlist)\nself.params['algorithm'] = 'Felzenszwalb'\nself.params['alpha2'] = 0.984\nself.params['alpha1'] = 0.09\nself.params['beta1'] = 0.92\nself.paramindexes = ['alpha1', 'alpha2', 'beta1']\nself.set_params(paramlist)",
"scale = self.params['alpha2'] * 1000\nsigma = self.p... | <|body_start_0|>
super(Felzenszwalb, self).__init__(paramlist)
self.params['algorithm'] = 'Felzenszwalb'
self.params['alpha2'] = 0.984
self.params['alpha1'] = 0.09
self.params['beta1'] = 0.92
self.paramindexes = ['alpha1', 'alpha2', 'beta1']
self.set_params(paraml... | Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels. Note: a colorspace of 'HSV' and a channel of 2 is a grayscale image. https://s... | Felzenszwalb | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Felzenszwalb:
"""Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels. Note: a colorspace of 'HSV' and a chan... | stack_v2_sparse_classes_36k_train_007992 | 29,598 | permissive | [
{
"docstring": "Get parameters from parameter list that are used in segmentation algorithm. Assign default values to these parameters.",
"name": "__init__",
"signature": "def __init__(self, paramlist=None)"
},
{
"docstring": "Evaluate segmentation algorithm on training image. Keyword arguments: ... | 2 | stack_v2_sparse_classes_30k_train_009861 | Implement the Python class `Felzenszwalb` described below.
Class description:
Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels.... | Implement the Python class `Felzenszwalb` described below.
Class description:
Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels.... | 9246b8b20510d4c89357a6764ed96b919eb92d5a | <|skeleton|>
class Felzenszwalb:
"""Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels. Note: a colorspace of 'HSV' and a chan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Felzenszwalb:
"""Perform Felzenszwalb segmentation algorithm. The felzenszwalb algorithms computes a graph based on the segmentation. Produces an oversegmentation of the multichannel using min-span tree. Returns an integer mask indicating the segment labels. Note: a colorspace of 'HSV' and a channel of 2 is a... | the_stack_v2_python_sparse | see/Segmentors.py | Deepak768/see-segment | train | 0 |
b41836b51d58ba563d95c93dd5cf8db56709b608 | [
"nums_len = len(nums)\nmax_i, max_j = (None, None)\ni = this_sum = max_sum = 0\nif max(nums) < 0:\n return max(nums)\nfor j in range(nums_len):\n this_sum += nums[j]\n if this_sum > max_sum:\n max_sum = this_sum\n max_i = i\n max_j = j\n elif this_sum < 0:\n i = j + 1\n ... | <|body_start_0|>
nums_len = len(nums)
max_i, max_j = (None, None)
i = this_sum = max_sum = 0
if max(nums) < 0:
return max(nums)
for j in range(nums_len):
this_sum += nums[j]
if this_sum > max_sum:
max_sum = this_sum
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
"""For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray2(self, nums):
""":type nums: List[int] :rtype: ... | stack_v2_sparse_classes_36k_train_007993 | 1,272 | no_license | [
{
"docstring": "For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int
-... | e16702d2b3ec4e5054baad56f4320bc3b31676ad | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
"""For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray2(self, nums):
""":type nums: List[int] :rtype: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray(self, nums):
"""For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. :type nums: List[int] :rtype: int"""
nums_len = len(nums)
max_i, max_j = (None, None)
i = this_sum = max_sum = 0
i... | the_stack_v2_python_sparse | leetcode/easy/Maximum_Subarray.py | SuperMartinYang/learning_algorithm | train | 0 | |
cd825a14a0684cc33991992235bda855781e5de3 | [
"from collections import Counter\nif not s or not words:\n return []\none_word = len(words[0])\nall_len = len(words) * one_word\nn = len(s)\nwords = Counter(words)\nres = []\nfor i in range(0, n - all_len + 1):\n tmp = s[i:i + all_len]\n c_tmp = []\n for j in range(0, all_len, one_word):\n c_tmp.... | <|body_start_0|>
from collections import Counter
if not s or not words:
return []
one_word = len(words[0])
all_len = len(words) * one_word
n = len(s)
words = Counter(words)
res = []
for i in range(0, n - all_len + 1):
tmp = s[i:i + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findSubstring(self, s, words):
""":type s: str :type words: List[str] :rtype: List[int]"""
<|body_0|>
def findSubstring(self, s, words):
""":type s: str :type words: List[str] :rtype: List[int]"""
<|body_1|>
def findSubstring(self, s, words... | stack_v2_sparse_classes_36k_train_007994 | 3,331 | no_license | [
{
"docstring": ":type s: str :type words: List[str] :rtype: List[int]",
"name": "findSubstring",
"signature": "def findSubstring(self, s, words)"
},
{
"docstring": ":type s: str :type words: List[str] :rtype: List[int]",
"name": "findSubstring",
"signature": "def findSubstring(self, s, w... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubstring(self, s, words): :type s: str :type words: List[str] :rtype: List[int]
- def findSubstring(self, s, words): :type s: str :type words: List[str] :rtype: List[int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubstring(self, s, words): :type s: str :type words: List[str] :rtype: List[int]
- def findSubstring(self, s, words): :type s: str :type words: List[str] :rtype: List[int... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def findSubstring(self, s, words):
""":type s: str :type words: List[str] :rtype: List[int]"""
<|body_0|>
def findSubstring(self, s, words):
""":type s: str :type words: List[str] :rtype: List[int]"""
<|body_1|>
def findSubstring(self, s, words... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findSubstring(self, s, words):
""":type s: str :type words: List[str] :rtype: List[int]"""
from collections import Counter
if not s or not words:
return []
one_word = len(words[0])
all_len = len(words) * one_word
n = len(s)
word... | the_stack_v2_python_sparse | 0030_HARD_Substring_with_Concatenation_of_All_Words.py | bingli8802/leetcode | train | 0 | |
d54babd0d28b817fdbb273332e3e271dbf524ba0 | [
"for i in range(len(dataset)):\n self.print_example(np.matrix(dataset[i][0]))\n print()",
"for i in range(example.shape[0]):\n for j in range(example.shape[1]):\n cell = example.item(i, j)\n if cell > 0:\n print('# ', end='')\n else:\n print('. ', end='')\n p... | <|body_start_0|>
for i in range(len(dataset)):
self.print_example(np.matrix(dataset[i][0]))
print()
<|end_body_0|>
<|body_start_1|>
for i in range(example.shape[0]):
for j in range(example.shape[1]):
cell = example.item(i, j)
if cell >... | AdalineTools | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdalineTools:
def print_all(self, dataset):
"""Prints all examples"""
<|body_0|>
def print_example(self, example):
"""Prints an example"""
<|body_1|>
def build_input_dataset(self, inputs):
"""Converts the dataset into a bidimensional dataset wher... | stack_v2_sparse_classes_36k_train_007995 | 5,959 | no_license | [
{
"docstring": "Prints all examples",
"name": "print_all",
"signature": "def print_all(self, dataset)"
},
{
"docstring": "Prints an example",
"name": "print_example",
"signature": "def print_example(self, example)"
},
{
"docstring": "Converts the dataset into a bidimensional data... | 5 | stack_v2_sparse_classes_30k_train_004382 | Implement the Python class `AdalineTools` described below.
Class description:
Implement the AdalineTools class.
Method signatures and docstrings:
- def print_all(self, dataset): Prints all examples
- def print_example(self, example): Prints an example
- def build_input_dataset(self, inputs): Converts the dataset into... | Implement the Python class `AdalineTools` described below.
Class description:
Implement the AdalineTools class.
Method signatures and docstrings:
- def print_all(self, dataset): Prints all examples
- def print_example(self, example): Prints an example
- def build_input_dataset(self, inputs): Converts the dataset into... | 2a4adef88508c6d9b134920f758044dece09a58e | <|skeleton|>
class AdalineTools:
def print_all(self, dataset):
"""Prints all examples"""
<|body_0|>
def print_example(self, example):
"""Prints an example"""
<|body_1|>
def build_input_dataset(self, inputs):
"""Converts the dataset into a bidimensional dataset wher... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdalineTools:
def print_all(self, dataset):
"""Prints all examples"""
for i in range(len(dataset)):
self.print_example(np.matrix(dataset[i][0]))
print()
def print_example(self, example):
"""Prints an example"""
for i in range(example.shape[0]):
... | the_stack_v2_python_sparse | SCC5809/ex1/src/adaline.py | damaresende/USP | train | 0 | |
7c8696e3572c04426f1718cbf7c61e37fe0df00b | [
"self.display_width = 1024\nself.display_height = 600\nself.char_width = 8\nself.char_height = 16\nself.text_width = self.display_width / self.char_width\nself.text_height = self.display_height / self.char_height\nself.font = ImageFont.truetype(fontfile, self.char_height)\nself.line_spacing = self.char_height",
"... | <|body_start_0|>
self.display_width = 1024
self.display_height = 600
self.char_width = 8
self.char_height = 16
self.text_width = self.display_width / self.char_width
self.text_height = self.display_height / self.char_height
self.font = ImageFont.truetype(fontfile,... | This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions. | ImageTextDisplayer | [
"BSD-2-Clause",
"BSD-2-Clause-Views"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageTextDisplayer:
"""This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions."""
def __init__(self, fontfile):
""":param fontfile: Path to the font to be used for the printed text :type fontfile: str"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_007996 | 4,688 | permissive | [
{
"docstring": ":param fontfile: Path to the font to be used for the printed text :type fontfile: str",
"name": "__init__",
"signature": "def __init__(self, fontfile)"
},
{
"docstring": "Draws the text inside an image :param imgfile: Path where the image with the written text should be saved :ty... | 2 | stack_v2_sparse_classes_30k_train_005905 | Implement the Python class `ImageTextDisplayer` described below.
Class description:
This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions.
Method signatures and docstrings:
- def __init__(self, fontfile): :param fontfile: Path to the font to be used for th... | Implement the Python class `ImageTextDisplayer` described below.
Class description:
This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions.
Method signatures and docstrings:
- def __init__(self, fontfile): :param fontfile: Path to the font to be used for th... | c2eb11e06bb2779445c7a0cd031716f0071ed6a2 | <|skeleton|>
class ImageTextDisplayer:
"""This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions."""
def __init__(self, fontfile):
""":param fontfile: Path to the font to be used for the printed text :type fontfile: str"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageTextDisplayer:
"""This class draws text inside an image to log terminal information onto the screen of baxter for fast debug sessions."""
def __init__(self, fontfile):
""":param fontfile: Path to the font to be used for the printed text :type fontfile: str"""
self.display_width = 102... | the_stack_v2_python_sparse | baxter_tasker/scripts/baxter_image_text_displayer.py | ysl208/Baxter_PbD | train | 1 |
b944d90d4784de8c2f92b8ac1bae26e5718db186 | [
"super(jconvEncoderNet, self).__init__()\nif len(in_dim) not in (1, 2, 3):\n raise ValueError('The input dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data')\ndim = 2 if len(in_dim) > 1 else 1\nc = in_dim[-1] if len(in_dim) > 2 else 1\nself.conv = ConvBlock(... | <|body_start_0|>
super(jconvEncoderNet, self).__init__()
if len(in_dim) not in (1, 2, 3):
raise ValueError('The input dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data')
dim = 2 if len(in_dim) > 1 else 1
c = in_dim[-1] i... | Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are an... | jconvEncoderNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class jconvEncoderNet:
"""Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimen... | stack_v2_sparse_classes_36k_train_007997 | 28,462 | permissive | [
{
"docstring": "Initializes network parameters",
"name": "__init__",
"signature": "def __init__(self, in_dim: Tuple[int], latent_dim: int=2, discrete_dim: List=[1], num_layers: int=2, hidden_dim: int=32, **kwargs: Union[float, bool]) -> None"
},
{
"docstring": "Forward pass",
"name": "forwar... | 2 | stack_v2_sparse_classes_30k_train_015789 | Implement the Python class `jconvEncoderNet` described below.
Class description:
Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (leng... | Implement the Python class `jconvEncoderNet` described below.
Class description:
Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (leng... | 6d187296074143d017ca8fc60302364cd946b180 | <|skeleton|>
class jconvEncoderNet:
"""Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class jconvEncoderNet:
"""Convolutional encoder/inference network for joint continuous and discrete distributions (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the fi... | the_stack_v2_python_sparse | atomai/nets/ed.py | pycroscopy/atomai | train | 157 |
5b9d3901786b8d61cee24384f1ffefda23cb2939 | [
"assert type(params) in [SimpleTunnelSurveyImplicitParams], 'params must be a SimpleTunnelParams, not {}'.format(type(params))\nself.tunnelParams = deepcopy(params)\nxOrigin = self.tunnelParams.meshXOrigin\nhx, hy, hz = (self.tunnelParams.hx, self.tunnelParams.hy, self.tunnelParams.hz)\nMesh.TensorMesh.__init__(sel... | <|body_start_0|>
assert type(params) in [SimpleTunnelSurveyImplicitParams], 'params must be a SimpleTunnelParams, not {}'.format(type(params))
self.tunnelParams = deepcopy(params)
xOrigin = self.tunnelParams.meshXOrigin
hx, hy, hz = (self.tunnelParams.hx, self.tunnelParams.hy, self.tunne... | SimpleTunnelMesh represents tunnel and its surroundings. | SimpleTunnelMesh | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleTunnelMesh:
"""SimpleTunnelMesh represents tunnel and its surroundings."""
def __init__(self, params):
"""SimpleTunnelMesh instance initialisation :param params:"""
<|body_0|>
def getCoreMesh(self):
"""Extracts and provides core mesh :return: indices of cor... | stack_v2_sparse_classes_36k_train_007998 | 14,228 | no_license | [
{
"docstring": "SimpleTunnelMesh instance initialisation :param params:",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "Extracts and provides core mesh :return: indices of core mesh, core mesh",
"name": "getCoreMesh",
"signature": "def getCoreMesh(self)... | 4 | stack_v2_sparse_classes_30k_train_020477 | Implement the Python class `SimpleTunnelMesh` described below.
Class description:
SimpleTunnelMesh represents tunnel and its surroundings.
Method signatures and docstrings:
- def __init__(self, params): SimpleTunnelMesh instance initialisation :param params:
- def getCoreMesh(self): Extracts and provides core mesh :r... | Implement the Python class `SimpleTunnelMesh` described below.
Class description:
SimpleTunnelMesh represents tunnel and its surroundings.
Method signatures and docstrings:
- def __init__(self, params): SimpleTunnelMesh instance initialisation :param params:
- def getCoreMesh(self): Extracts and provides core mesh :r... | 22bc1a0cad78369ac3d4bf12252b89fe95a22d21 | <|skeleton|>
class SimpleTunnelMesh:
"""SimpleTunnelMesh represents tunnel and its surroundings."""
def __init__(self, params):
"""SimpleTunnelMesh instance initialisation :param params:"""
<|body_0|>
def getCoreMesh(self):
"""Extracts and provides core mesh :return: indices of cor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleTunnelMesh:
"""SimpleTunnelMesh represents tunnel and its surroundings."""
def __init__(self, params):
"""SimpleTunnelMesh instance initialisation :param params:"""
assert type(params) in [SimpleTunnelSurveyImplicitParams], 'params must be a SimpleTunnelParams, not {}'.format(type(p... | the_stack_v2_python_sparse | Jirina/dc_tunnel_inversion/Tunnel_ParamMeshTools.py | GeoMop/geostab | train | 1 |
d575959e20fe50def422d1354ebddb2ded480835 | [
"self.res = 0\nself.out = []\n\ndef sub_path_sum(root, sum, cur_sum, out, res):\n if root is None or root.val is None:\n return\n cur_sum = cur_sum + root.val\n out.append(root)\n if cur_sum == sum:\n self.res += 1\n t = cur_sum\n for i in range(len(out)):\n t = t - out[i].val... | <|body_start_0|>
self.res = 0
self.out = []
def sub_path_sum(root, sum, cur_sum, out, res):
if root is None or root.val is None:
return
cur_sum = cur_sum + root.val
out.append(root)
if cur_sum == sum:
self.res += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def path_sum(self, root: TreeNode, sum: int) -> int:
"""note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:"""
<|body_0|>
def path_sum2(self, root: TreeNode, sum: int) -> int:
"""note: 找出树中所有节点和=sum的路径个数,dfs :param root: :return:"""
<|body_1|... | stack_v2_sparse_classes_36k_train_007999 | 2,735 | no_license | [
{
"docstring": "note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:",
"name": "path_sum",
"signature": "def path_sum(self, root: TreeNode, sum: int) -> int"
},
{
"docstring": "note: 找出树中所有节点和=sum的路径个数,dfs :param root: :return:",
"name": "path_sum2",
"signature": "def path_sum2(sel... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def path_sum(self, root: TreeNode, sum: int) -> int: note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:
- def path_sum2(self, root: TreeNode, sum: int) -> int: note: 找出树中... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def path_sum(self, root: TreeNode, sum: int) -> int: note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:
- def path_sum2(self, root: TreeNode, sum: int) -> int: note: 找出树中... | f7421522c437c952698736dbac8fb7ac6c0b8b88 | <|skeleton|>
class Solution:
def path_sum(self, root: TreeNode, sum: int) -> int:
"""note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:"""
<|body_0|>
def path_sum2(self, root: TreeNode, sum: int) -> int:
"""note: 找出树中所有节点和=sum的路径个数,dfs :param root: :return:"""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def path_sum(self, root: TreeNode, sum: int) -> int:
"""note: 找出树中所有节点和=sum的路径个数 :param root: :param sum: :return:"""
self.res = 0
self.out = []
def sub_path_sum(root, sum, cur_sum, out, res):
if root is None or root.val is None:
return
... | the_stack_v2_python_sparse | leetcode/437_path_sum.py | whitepaper2/data_beauty | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.