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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a89f117b870097cf0b490c843663f8c7a7cc9868 | [
"super(sppasStringFilterDialog, self).__init__(parent=parent, title='{:s} filter'.format(sg.__name__), style=wx.DEFAULT_FRAME_STYLE)\nself._create_content()\nself.CreateActions([wx.ID_CANCEL, wx.ID_OK])\nself.SetSize(wx.Size(380, 320))\nself.LayoutComponents()\nself.CenterOnParent()",
"idx = self.radiobox.GetSele... | <|body_start_0|>
super(sppasStringFilterDialog, self).__init__(parent=parent, title='{:s} filter'.format(sg.__name__), style=wx.DEFAULT_FRAME_STYLE)
self._create_content()
self.CreateActions([wx.ID_CANCEL, wx.ID_OK])
self.SetSize(wx.Size(380, 320))
self.LayoutComponents()
... | Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi | sppasStringFilterDialog | [
"MIT",
"GFDL-1.1-or-later",
"GPL-3.0-only",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sppasStringFilterDialog:
"""Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi"""
def __init__(self, parent):
... | stack_v2_sparse_classes_36k_train_013600 | 28,177 | permissive | [
{
"docstring": "Create a string filter dialog. :param parent: (wx.Window)",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Return the data defined by the user. Returns: (tuple) with: - function (str): one of the methods in Compare - values (list): patterns to fi... | 3 | stack_v2_sparse_classes_30k_train_016746 | Implement the Python class `sppasStringFilterDialog` described below.
Class description:
Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi
Meth... | Implement the Python class `sppasStringFilterDialog` described below.
Class description:
Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi
Meth... | 3167b65f576abcc27a8767d24c274a04712bd948 | <|skeleton|>
class sppasStringFilterDialog:
"""Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi"""
def __init__(self, parent):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class sppasStringFilterDialog:
"""Dialog to get a filter on a string. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2019 Brigitte Bigi"""
def __init__(self, parent):
"""Create a s... | the_stack_v2_python_sparse | sppas/sppas/src/ui/phoenix/page_files/associate.py | mirfan899/MTTS | train | 0 |
07b302e80722574318794d560b02edeeb70f94ec | [
"self.debug = debug\nself.logger = AntiVirusLogger(__name__, debug=self.debug)\nself._THRESHOLD = int(min_time) * 60\nself.modified_files = list()\nself._SALT = ':@/*&'\nself._SLEEP_TIME = 300\nself.os_name = utils.categorize_os()\nif config_path and self.os_name:\n self._CONFIG_PATH = config_path\n self.conf... | <|body_start_0|>
self.debug = debug
self.logger = AntiVirusLogger(__name__, debug=self.debug)
self._THRESHOLD = int(min_time) * 60
self.modified_files = list()
self._SALT = ':@/*&'
self._SLEEP_TIME = 300
self.os_name = utils.categorize_os()
if config_path ... | MonitorChanges class. | MonitorChanges | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorChanges:
"""MonitorChanges class."""
def __init__(self, debug=False, config_path=None, min_time=20, vt_api_key=None):
"""Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path min_time (int): Minutes before t... | stack_v2_sparse_classes_36k_train_013601 | 7,180 | permissive | [
{
"docstring": "Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path min_time (int): Minutes before to monitor vt_api_key (str): Virus Total API Key Raises: None Returns: None",
"name": "__init__",
"signature": "def __init__(self, de... | 5 | stack_v2_sparse_classes_30k_test_000849 | Implement the Python class `MonitorChanges` described below.
Class description:
MonitorChanges class.
Method signatures and docstrings:
- def __init__(self, debug=False, config_path=None, min_time=20, vt_api_key=None): Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Conf... | Implement the Python class `MonitorChanges` described below.
Class description:
MonitorChanges class.
Method signatures and docstrings:
- def __init__(self, debug=False, config_path=None, min_time=20, vt_api_key=None): Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Conf... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class MonitorChanges:
"""MonitorChanges class."""
def __init__(self, debug=False, config_path=None, min_time=20, vt_api_key=None):
"""Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path min_time (int): Minutes before t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MonitorChanges:
"""MonitorChanges class."""
def __init__(self, debug=False, config_path=None, min_time=20, vt_api_key=None):
"""Initialize MonitorChanges class. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path min_time (int): Minutes before to monitor vt_... | the_stack_v2_python_sparse | securetea/lib/antivirus/monitor/monitor_changes.py | rejahrehim/SecureTea-Project | train | 1 |
e9f2892feaad90c2739a565395d62a4126803eb9 | [
"form = PostForm(request.POST)\nif form.is_valid():\n form.save(commit=True)\n return redirect('/')\nelse:\n form.errors",
"reviewers = get_list_or_404(Review, movie=pk)\nposters = Post.objects.all()\nmovie = Movie.objects.get(id=pk)\naverage = Review.objects.filter(movie_id=pk).aggregate(Avg('rating'))\... | <|body_start_0|>
form = PostForm(request.POST)
if form.is_valid():
form.save(commit=True)
return redirect('/')
else:
form.errors
<|end_body_0|>
<|body_start_1|>
reviewers = get_list_or_404(Review, movie=pk)
posters = Post.objects.all()
... | MovieDetail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovieDetail:
def post(self, request, pk):
"""Allow a user to post a review about a movie"""
<|body_0|>
def get(self, request, pk):
"""Display the movie in detail if clicked on"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
form = PostForm(request.P... | stack_v2_sparse_classes_36k_train_013602 | 1,897 | no_license | [
{
"docstring": "Allow a user to post a review about a movie",
"name": "post",
"signature": "def post(self, request, pk)"
},
{
"docstring": "Display the movie in detail if clicked on",
"name": "get",
"signature": "def get(self, request, pk)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020745 | Implement the Python class `MovieDetail` described below.
Class description:
Implement the MovieDetail class.
Method signatures and docstrings:
- def post(self, request, pk): Allow a user to post a review about a movie
- def get(self, request, pk): Display the movie in detail if clicked on | Implement the Python class `MovieDetail` described below.
Class description:
Implement the MovieDetail class.
Method signatures and docstrings:
- def post(self, request, pk): Allow a user to post a review about a movie
- def get(self, request, pk): Display the movie in detail if clicked on
<|skeleton|>
class MovieDe... | 4cf7c9dc0986511f3c4b6c54c2b6d31fcfa45896 | <|skeleton|>
class MovieDetail:
def post(self, request, pk):
"""Allow a user to post a review about a movie"""
<|body_0|>
def get(self, request, pk):
"""Display the movie in detail if clicked on"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovieDetail:
def post(self, request, pk):
"""Allow a user to post a review about a movie"""
form = PostForm(request.POST)
if form.is_valid():
form.save(commit=True)
return redirect('/')
else:
form.errors
def get(self, request, pk):
... | the_stack_v2_python_sparse | movie/movieratings/views.py | joegotflow83/movie_ratings | train | 0 | |
11880cd44aa1d64196dce6fb7dd065e124fb4ef3 | [
"if i == n:\n result.append(list(map(''.join, board)))\n return\nfor j in range(n):\n if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags):\n cols.add(j)\n left_diags.add(j - i)\n right_diags.add(n - 1 - j - i)\n board[i][j] = 'Q'\n self.fin... | <|body_start_0|>
if i == n:
result.append(list(map(''.join, board)))
return
for j in range(n):
if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags):
cols.add(j)
left_diags.add(j - i)
right_... | Short and optimized version of the above algorithm. | SolutionShort | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionShort:
"""Short and optimized version of the above algorithm."""
def find_places(self, board, n, i, result, cols, left_diags, right_diags):
"""Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm."""
<|body_0|>
d... | stack_v2_sparse_classes_36k_train_013603 | 5,871 | no_license | [
{
"docstring": "Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm.",
"name": "find_places",
"signature": "def find_places(self, board, n, i, result, cols, left_diags, right_diags)"
},
{
"docstring": "Returns a list of boards, where each board... | 2 | stack_v2_sparse_classes_30k_train_003463 | Implement the Python class `SolutionShort` described below.
Class description:
Short and optimized version of the above algorithm.
Method signatures and docstrings:
- def find_places(self, board, n, i, result, cols, left_diags, right_diags): Finds all possible board n x n board combinations with n queens on it. Backt... | Implement the Python class `SolutionShort` described below.
Class description:
Short and optimized version of the above algorithm.
Method signatures and docstrings:
- def find_places(self, board, n, i, result, cols, left_diags, right_diags): Finds all possible board n x n board combinations with n queens on it. Backt... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class SolutionShort:
"""Short and optimized version of the above algorithm."""
def find_places(self, board, n, i, result, cols, left_diags, right_diags):
"""Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm."""
<|body_0|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolutionShort:
"""Short and optimized version of the above algorithm."""
def find_places(self, board, n, i, result, cols, left_diags, right_diags):
"""Finds all possible board n x n board combinations with n queens on it. Backtracking recursive algorithm."""
if i == n:
result.... | the_stack_v2_python_sparse | Backtracking/n_queens.py | vladn90/Algorithms | train | 0 |
04b7c2113be6d958028dbd4cc0a7d45adf80a1ba | [
"self.board = board\nself.word = word\nself.visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]\nfor i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(i, j, 0):\n return True\nreturn False",
"if index == len(self.word):\n return True\nif i < 0 ... | <|body_start_0|>
self.board = board
self.word = word
self.visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(i, j, 0):
return True
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""DFS Args: board: list[list[str]] word: str Return: bool"""
<|body_0|>
def dfs(self, i: int, j: int, index: int) -> bool:
"""Args: i: int j: int index: int Return: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_013604 | 1,297 | no_license | [
{
"docstring": "DFS Args: board: list[list[str]] word: str Return: bool",
"name": "exist",
"signature": "def exist(self, board, word)"
},
{
"docstring": "Args: i: int j: int index: int Return: bool",
"name": "dfs",
"signature": "def dfs(self, i: int, j: int, index: int) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): DFS Args: board: list[list[str]] word: str Return: bool
- def dfs(self, i: int, j: int, index: int) -> bool: Args: i: int j: int index: int Return: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): DFS Args: board: list[list[str]] word: str Return: bool
- def dfs(self, i: int, j: int, index: int) -> bool: Args: i: int j: int index: int Return: ... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""DFS Args: board: list[list[str]] word: str Return: bool"""
<|body_0|>
def dfs(self, i: int, j: int, index: int) -> bool:
"""Args: i: int j: int index: int Return: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def exist(self, board, word):
"""DFS Args: board: list[list[str]] word: str Return: bool"""
self.board = board
self.word = word
self.visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]
for i in range(len(board)):
for j in r... | the_stack_v2_python_sparse | code/79. 单词搜索.py | AiZhanghan/Leetcode | train | 0 | |
3c896406ca333a384eb4cfd37a4304202ce591e9 | [
"if model._meta.app_label in self.route_app_labels:\n return 'db1'\nreturn None",
"if model._meta.app_label in self.route_app_labels:\n return 'db1'\nreturn None",
"if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn None",
"if app_... | <|body_start_0|>
if model._meta.app_label in self.route_app_labels:
return 'db1'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label in self.route_app_labels:
return 'db1'
return None
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_lab... | MyDBRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyDBRouter:
def db_for_read(self, model, **hints):
"""建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:"""
<|body_0|>
def db_for_write(self, model, **hints):
"""建议用于写“模型”类型对象的数据库。"""
<|body_1|>
def allow_relation(self, obj1, obj2, ... | stack_v2_sparse_classes_36k_train_013605 | 1,710 | no_license | [
{
"docstring": "建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "建议用于写“模型”类型对象的数据库。",
"name": "db_for_write",
"signature": "def db_for_write(self, model, **hints)"
}... | 4 | stack_v2_sparse_classes_30k_train_004567 | Implement the Python class `MyDBRouter` described below.
Class description:
Implement the MyDBRouter class.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): 建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:
- def db_for_write(self, model, **hints): 建议用于写“模型”类型对象的数据库。
-... | Implement the Python class `MyDBRouter` described below.
Class description:
Implement the MyDBRouter class.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): 建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:
- def db_for_write(self, model, **hints): 建议用于写“模型”类型对象的数据库。
-... | 04d8f54a51ba45309795f0e36ab7f220ef9f59db | <|skeleton|>
class MyDBRouter:
def db_for_read(self, model, **hints):
"""建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:"""
<|body_0|>
def db_for_write(self, model, **hints):
"""建议用于写“模型”类型对象的数据库。"""
<|body_1|>
def allow_relation(self, obj1, obj2, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyDBRouter:
def db_for_read(self, model, **hints):
"""建议用于读取“模型”类型对象的数据库。 :param model: 模块信息 :param hints: 其它可使用的附加信息 :return:"""
if model._meta.app_label in self.route_app_labels:
return 'db1'
return None
def db_for_write(self, model, **hints):
"""建议用于写“模型”类型对... | the_stack_v2_python_sparse | Demo/demo/dbrouter.py | StarkTan/DjangoWeb | train | 0 | |
4f591ff1b4d2662d55479682e1cee2f827db8fb2 | [
"super().__init__(['Watout'], flows)\nself.failrate = 1e-05\nself.assoc_modes({'no_wat': [1.0, [1, 1, 1], 1000]})\n\"\\n in this function, no conditional faults are modelled, so it doesn't need to be included\\n \"",
"if self.has_fault('no_wat'):\n self.Watout.level = 0.0\nelse:\n self.Watout.... | <|body_start_0|>
super().__init__(['Watout'], flows)
self.failrate = 1e-05
self.assoc_modes({'no_wat': [1.0, [1, 1, 1], 1000]})
"\n in this function, no conditional faults are modelled, so it doesn't need to be included\n "
<|end_body_0|>
<|body_start_1|>
if self.h... | Import Water is the pipe with water going into the pump | ImportWater | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImportWater:
"""Import Water is the pipe with water going into the pump"""
def __init__(self, flows):
"""Here the only flows are the water flowing out"""
<|body_0|>
def behavior(self, time):
"""The behavior is that if the flow has a no_wat fault, the wate level g... | stack_v2_sparse_classes_36k_train_013606 | 13,659 | permissive | [
{
"docstring": "Here the only flows are the water flowing out",
"name": "__init__",
"signature": "def __init__(self, flows)"
},
{
"docstring": "The behavior is that if the flow has a no_wat fault, the wate level goes to zero",
"name": "behavior",
"signature": "def behavior(self, time)"
... | 2 | null | Implement the Python class `ImportWater` described below.
Class description:
Import Water is the pipe with water going into the pump
Method signatures and docstrings:
- def __init__(self, flows): Here the only flows are the water flowing out
- def behavior(self, time): The behavior is that if the flow has a no_wat fa... | Implement the Python class `ImportWater` described below.
Class description:
Import Water is the pipe with water going into the pump
Method signatures and docstrings:
- def __init__(self, flows): Here the only flows are the water flowing out
- def behavior(self, time): The behavior is that if the flow has a no_wat fa... | 2d87c415c036f44fe10310500788f5ab697e618d | <|skeleton|>
class ImportWater:
"""Import Water is the pipe with water going into the pump"""
def __init__(self, flows):
"""Here the only flows are the water flowing out"""
<|body_0|>
def behavior(self, time):
"""The behavior is that if the flow has a no_wat fault, the wate level g... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImportWater:
"""Import Water is the pipe with water going into the pump"""
def __init__(self, flows):
"""Here the only flows are the water flowing out"""
super().__init__(['Watout'], flows)
self.failrate = 1e-05
self.assoc_modes({'no_wat': [1.0, [1, 1, 1], 1000]})
... | the_stack_v2_python_sparse | pump example/ex_pump.py | DesignEngrLab/fmdtools | train | 10 |
8911003a171e5b9bce7ecf391d8210fadfe86eb7 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewInstanceDecisionItem()",
"from .access_review_instance_decision_item_resource import AccessReviewInstanceDecisionItemResource\nfrom .entity import Entity\nfrom .governance_insight import GovernanceInsight\nfrom .identity im... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AccessReviewInstanceDecisionItem()
<|end_body_0|>
<|body_start_1|>
from .access_review_instance_decision_item_resource import AccessReviewInstanceDecisionItemResource
from .entity import... | AccessReviewInstanceDecisionItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccessReviewInstanceDecisionItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInstanceDecisionItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminat... | stack_v2_sparse_classes_36k_train_013607 | 8,411 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: AccessReviewInstanceDecisionItem",
"name": "create_from_discriminator_value",
"signature": "def create_from_... | 3 | null | Implement the Python class `AccessReviewInstanceDecisionItem` described below.
Class description:
Implement the AccessReviewInstanceDecisionItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInstanceDecisionItem: Creates a new insta... | Implement the Python class `AccessReviewInstanceDecisionItem` described below.
Class description:
Implement the AccessReviewInstanceDecisionItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInstanceDecisionItem: Creates a new insta... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AccessReviewInstanceDecisionItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInstanceDecisionItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccessReviewInstanceDecisionItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInstanceDecisionItem:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c... | the_stack_v2_python_sparse | msgraph/generated/models/access_review_instance_decision_item.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
2275bb3ac505e1c2f83836bb1a13346cc516b341 | [
"self.throttle = Throttle(delay)\nself.retries = retries\nself.heads = heads\nself.proxies = proxies\nself.delay = delay\nself.timeout = timeout",
"print('下载的页面:', url)\ntry:\n self.throttle.wait(url)\n response = requests.get(url, headers=self.heads, proxies=self.proxies, timeout=self.timeout)\n if resp... | <|body_start_0|>
self.throttle = Throttle(delay)
self.retries = retries
self.heads = heads
self.proxies = proxies
self.delay = delay
self.timeout = timeout
<|end_body_0|>
<|body_start_1|>
print('下载的页面:', url)
try:
self.throttle.wait(url)
... | 下载类 | Downder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Downder:
"""下载类"""
def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
<|body_0|>
def download(self, url, is_json=False):
"""通过URL,获取页面"""
<|body_1|>
def write_csv(self, filename, all_list):
"""保存到CSV"""
... | stack_v2_sparse_classes_36k_train_013608 | 6,930 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30)"
},
{
"docstring": "通过URL,获取页面",
"name": "download",
"signature": "def download(self, url, is_json=False)"
},
{
"docstring": "保存到CSV",
"name": ... | 3 | null | Implement the Python class `Downder` described below.
Class description:
下载类
Method signatures and docstrings:
- def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30): 初始化
- def download(self, url, is_json=False): 通过URL,获取页面
- def write_csv(self, filename, all_list): 保存到CSV | Implement the Python class `Downder` described below.
Class description:
下载类
Method signatures and docstrings:
- def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30): 初始化
- def download(self, url, is_json=False): 通过URL,获取页面
- def write_csv(self, filename, all_list): 保存到CSV
<|skeleton|>
class ... | 173f3a5fa24176df4c53bd36771cc733a1221dfd | <|skeleton|>
class Downder:
"""下载类"""
def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
<|body_0|>
def download(self, url, is_json=False):
"""通过URL,获取页面"""
<|body_1|>
def write_csv(self, filename, all_list):
"""保存到CSV"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Downder:
"""下载类"""
def __init__(self, heads=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
self.throttle = Throttle(delay)
self.retries = retries
self.heads = heads
self.proxies = proxies
self.delay = delay
self.timeout = timeout
... | the_stack_v2_python_sparse | 0303system-yanchunwei/joker_work/core/down.py | Joker2018goon/myGitRepo | train | 1 |
0628918b542680705e4d3860ea42ce0d53fcf711 | [
"self.fullstate = None\nself.partialstate = None\nself.reward = 0\nself.ringsize = ringworld_size\nself.lowerbound = 0\nself.upperbound = self.ringsize - 1\nself.random_states_reward1 = [0]",
"if fullstate == 0:\n partialstate = 1\nelse:\n partialstate = 0\nreturn partialstate",
"np.random.seed(run)\nself... | <|body_start_0|>
self.fullstate = None
self.partialstate = None
self.reward = 0
self.ringsize = ringworld_size
self.lowerbound = 0
self.upperbound = self.ringsize - 1
self.random_states_reward1 = [0]
<|end_body_0|>
<|body_start_1|>
if fullstate == 0:
... | RingWorld | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RingWorld:
def __init__(self, ringworld_size):
"""Initialize parameters of the environment"""
<|body_0|>
def partialobservability(self, fullstate):
"""Convert full state to a partially observable state"""
<|body_1|>
def start(self, run):
"""Envir... | stack_v2_sparse_classes_36k_train_013609 | 2,072 | no_license | [
{
"docstring": "Initialize parameters of the environment",
"name": "__init__",
"signature": "def __init__(self, ringworld_size)"
},
{
"docstring": "Convert full state to a partially observable state",
"name": "partialobservability",
"signature": "def partialobservability(self, fullstate)... | 4 | stack_v2_sparse_classes_30k_train_001452 | Implement the Python class `RingWorld` described below.
Class description:
Implement the RingWorld class.
Method signatures and docstrings:
- def __init__(self, ringworld_size): Initialize parameters of the environment
- def partialobservability(self, fullstate): Convert full state to a partially observable state
- d... | Implement the Python class `RingWorld` described below.
Class description:
Implement the RingWorld class.
Method signatures and docstrings:
- def __init__(self, ringworld_size): Initialize parameters of the environment
- def partialobservability(self, fullstate): Convert full state to a partially observable state
- d... | 80bec60082a3690dfbf973121f26a997192f2886 | <|skeleton|>
class RingWorld:
def __init__(self, ringworld_size):
"""Initialize parameters of the environment"""
<|body_0|>
def partialobservability(self, fullstate):
"""Convert full state to a partially observable state"""
<|body_1|>
def start(self, run):
"""Envir... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RingWorld:
def __init__(self, ringworld_size):
"""Initialize parameters of the environment"""
self.fullstate = None
self.partialstate = None
self.reward = 0
self.ringsize = ringworld_size
self.lowerbound = 0
self.upperbound = self.ringsize - 1
se... | the_stack_v2_python_sparse | Environments/RingWorldEnvironment.py | architsakhadeo/Prediction-RL-experiments | train | 0 | |
6b44378f47e655cdd2e2de840859fccd852eb3df | [
"self._config = None\nif data_type:\n self._config = SimilarityScorerConfig(index_name, data_type)\nsuper().__init__(index_name, sketch_id, timeline_id=timeline_id)",
"if not self._config:\n return 'No data_type specified.'\nevents = self.event_stream(query_string=self._config.query, return_fields=[self._co... | <|body_start_0|>
self._config = None
if data_type:
self._config = SimilarityScorerConfig(index_name, data_type)
super().__init__(index_name, sketch_id, timeline_id=timeline_id)
<|end_body_0|>
<|body_start_1|>
if not self._config:
return 'No data_type specified.'
... | Score events based on Jaccard distance. | SimilarityScorer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimilarityScorer:
"""Score events based on Jaccard distance."""
def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None):
"""Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeli... | stack_v2_sparse_classes_36k_train_013610 | 5,064 | permissive | [
{
"docstring": "Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeline. data_type: Name of the data_type.",
"name": "__init__",
"signature": "def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None... | 2 | null | Implement the Python class `SimilarityScorer` described below.
Class description:
Score events based on Jaccard distance.
Method signatures and docstrings:
- def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id... | Implement the Python class `SimilarityScorer` described below.
Class description:
Score events based on Jaccard distance.
Method signatures and docstrings:
- def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None): Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class SimilarityScorer:
"""Score events based on Jaccard distance."""
def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None):
"""Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeli... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimilarityScorer:
"""Score events based on Jaccard distance."""
def __init__(self, index_name, sketch_id, timeline_id=None, data_type=None):
"""Initializes a similarity scorer. Args: index_name: OpenSearch index name. sketch_id: The ID of the sketch. timeline_id: The ID of the timeline. data_type... | the_stack_v2_python_sparse | timesketch/lib/analyzers/similarity_scorer.py | google/timesketch | train | 2,263 |
c42acce0f4d80ba9071d41a5b3bb335bc9ed908b | [
"if not triggers.trigger_mappings:\n triggers.build_mappings()\nfrom djax.models import ProfileRecord\npr, pr_created = ProfileRecord.objects.for_request(request)\nfor trigger in triggers.trigger_mappings:\n mo = trigger.regex.match(request.path[1:])\n if mo:\n trigger.fire(mo.groupdict(), request, ... | <|body_start_0|>
if not triggers.trigger_mappings:
triggers.build_mappings()
from djax.models import ProfileRecord
pr, pr_created = ProfileRecord.objects.for_request(request)
for trigger in triggers.trigger_mappings:
mo = trigger.regex.match(request.path[1:])
... | Middleware that applies triggermaps. | TriggerMiddleware | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerMiddleware:
"""Middleware that applies triggermaps."""
def process_request(self, request):
"""Processes the http request. Will fire triggers for matching request paths."""
<|body_0|>
def process_response(self, request, response):
"""If a profile guid is fo... | stack_v2_sparse_classes_36k_train_013611 | 1,368 | no_license | [
{
"docstring": "Processes the http request. Will fire triggers for matching request paths.",
"name": "process_request",
"signature": "def process_request(self, request)"
},
{
"docstring": "If a profile guid is found in the session, drop a cookie.",
"name": "process_response",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_000969 | Implement the Python class `TriggerMiddleware` described below.
Class description:
Middleware that applies triggermaps.
Method signatures and docstrings:
- def process_request(self, request): Processes the http request. Will fire triggers for matching request paths.
- def process_response(self, request, response): If... | Implement the Python class `TriggerMiddleware` described below.
Class description:
Middleware that applies triggermaps.
Method signatures and docstrings:
- def process_request(self, request): Processes the http request. Will fire triggers for matching request paths.
- def process_response(self, request, response): If... | c28f9524d8325372262d5fd50379161ff9eab078 | <|skeleton|>
class TriggerMiddleware:
"""Middleware that applies triggermaps."""
def process_request(self, request):
"""Processes the http request. Will fire triggers for matching request paths."""
<|body_0|>
def process_response(self, request, response):
"""If a profile guid is fo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TriggerMiddleware:
"""Middleware that applies triggermaps."""
def process_request(self, request):
"""Processes the http request. Will fire triggers for matching request paths."""
if not triggers.trigger_mappings:
triggers.build_mappings()
from djax.models import Profil... | the_stack_v2_python_sparse | djax/middleware.py | Axilent/Djax | train | 0 |
575080e28c8b56d4447a9b3c940e8898a84a55e8 | [
"PropagatorComputer.reset(self)\nself.id_text = 'DIAG'\nself.grad_exact = True",
"dyn = self.parent\ndyn.ensure_decomp_curr(k)\neig_vec = dyn.dyn_gen_eigenvectors[k]\nprop_eig_diag = np.diagflat(dyn.prop_eigen[k])\nprop = eig_vec.dot(prop_eig_diag).dot(eig_vec.conj().T)\nreturn prop",
"dyn = self.parent\ndyn.en... | <|body_start_0|>
PropagatorComputer.reset(self)
self.id_text = 'DIAG'
self.grad_exact = True
<|end_body_0|>
<|body_start_1|>
dyn = self.parent
dyn.ensure_decomp_curr(k)
eig_vec = dyn.dyn_gen_eigenvectors[k]
prop_eig_diag = np.diagflat(dyn.prop_eigen[k])
p... | Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator | PropCompDiag | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropCompDiag:
"""Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator"""
def reset(self):
"""reset any configuration data"""
<|body_0|>
def compute_propagator(self, k):
"""Calculates the exponentiation of the dynamics generat... | stack_v2_sparse_classes_36k_train_013612 | 11,982 | permissive | [
{
"docstring": "reset any configuration data",
"name": "reset",
"signature": "def reset(self)"
},
{
"docstring": "Calculates the exponentiation of the dynamics generator (H) As part of the calc the the eigen decomposition is required, which is reused in the propagator gradient calculation",
... | 3 | null | Implement the Python class `PropCompDiag` described below.
Class description:
Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator
Method signatures and docstrings:
- def reset(self): reset any configuration data
- def compute_propagator(self, k): Calculates the exponentiation of... | Implement the Python class `PropCompDiag` described below.
Class description:
Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator
Method signatures and docstrings:
- def reset(self): reset any configuration data
- def compute_propagator(self, k): Calculates the exponentiation of... | 0bf9b619ab30af7551467ee2388d0e3db641db14 | <|skeleton|>
class PropCompDiag:
"""Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator"""
def reset(self):
"""reset any configuration data"""
<|body_0|>
def compute_propagator(self, k):
"""Calculates the exponentiation of the dynamics generat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PropCompDiag:
"""Coumputes the propagator exponentiation using diagonalisation of of the dynamics generator"""
def reset(self):
"""reset any configuration data"""
PropagatorComputer.reset(self)
self.id_text = 'DIAG'
self.grad_exact = True
def compute_propagator(self, ... | the_stack_v2_python_sparse | qutip/control/propcomp.py | jrjohansson/qutip | train | 3 |
da5df7c4b12e564a55ccf05366c9d719b3ff5c98 | [
"if not os.path.exists(log_dir):\n os.mkdir(log_dir)\nlog_file = os.path.join(log_dir, 'upgrade_{0}.txt'.format(datetime.datetime.now().strftime('%Y_%m_%d__%H_%M')))\nself._log_file = log_file",
"formatted_message = 'ERROR: {0}{1}'.format(message, os.linesep)\nwith open(self._log_file, mode='a') as f:\n f.w... | <|body_start_0|>
if not os.path.exists(log_dir):
os.mkdir(log_dir)
log_file = os.path.join(log_dir, 'upgrade_{0}.txt'.format(datetime.datetime.now().strftime('%Y_%m_%d__%H_%M')))
self._log_file = log_file
<|end_body_0|>
<|body_start_1|>
formatted_message = 'ERROR: {0}{1}'.fo... | A local logging object which will write to the screen and a file | LocalLogger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalLogger:
"""A local logging object which will write to the screen and a file"""
def __init__(self, log_dir):
"""The logging directory in to which to write the log file Args: log_dir: the directory for the file"""
<|body_0|>
def error(self, message):
"""Write ... | stack_v2_sparse_classes_36k_train_013613 | 1,438 | no_license | [
{
"docstring": "The logging directory in to which to write the log file Args: log_dir: the directory for the file",
"name": "__init__",
"signature": "def __init__(self, log_dir)"
},
{
"docstring": "Write the message as an error (to standard err with ERROR in front of it) Args: message: message t... | 3 | stack_v2_sparse_classes_30k_train_021391 | Implement the Python class `LocalLogger` described below.
Class description:
A local logging object which will write to the screen and a file
Method signatures and docstrings:
- def __init__(self, log_dir): The logging directory in to which to write the log file Args: log_dir: the directory for the file
- def error(s... | Implement the Python class `LocalLogger` described below.
Class description:
A local logging object which will write to the screen and a file
Method signatures and docstrings:
- def __init__(self, log_dir): The logging directory in to which to write the log file Args: log_dir: the directory for the file
- def error(s... | 744f966037320945248030600b82d8fb9095a8a4 | <|skeleton|>
class LocalLogger:
"""A local logging object which will write to the screen and a file"""
def __init__(self, log_dir):
"""The logging directory in to which to write the log file Args: log_dir: the directory for the file"""
<|body_0|>
def error(self, message):
"""Write ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalLogger:
"""A local logging object which will write to the screen and a file"""
def __init__(self, log_dir):
"""The logging directory in to which to write the log file Args: log_dir: the directory for the file"""
if not os.path.exists(log_dir):
os.mkdir(log_dir)
lo... | the_stack_v2_python_sparse | src/local_logger.py | ISISComputingGroup/EPICS-upgrade | train | 0 |
e0c5688cbcaa72ef583ce4d6c15278546e7a7a4f | [
"if script_arguments is None:\n script_arguments = list()\nif dependent_pipelines is None and dependent_pipelines_ok_to_fail is None:\n raise ValueError('Must have some dependencies for dependency step')\nprefix_func = lambda p: p if not NAME_PREFIX else NAME_PREFIX + '_' + p\nargument_func = lambda x: [prefi... | <|body_start_0|>
if script_arguments is None:
script_arguments = list()
if dependent_pipelines is None and dependent_pipelines_ok_to_fail is None:
raise ValueError('Must have some dependencies for dependency step')
prefix_func = lambda p: p if not NAME_PREFIX else NAME_PR... | PipelineDependencies Step class that helps wait for other pipelines to finish | PipelineDependenciesStep | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PipelineDependenciesStep:
"""PipelineDependencies Step class that helps wait for other pipelines to finish"""
def __init__(self, id, pipeline_name, dependent_pipelines=None, dependent_pipelines_ok_to_fail=None, refresh_rate=300, start_date=None, script_arguments=None, **kwargs):
"""C... | stack_v2_sparse_classes_36k_train_013614 | 3,500 | permissive | [
{
"docstring": "Constructor for the QATransformStep class Args: sns_arn(str): sns topic arn for QA steps script_arguments(list of str): list of arguments to the script **kwargs(optional): Keyword arguments directly passed to base class",
"name": "__init__",
"signature": "def __init__(self, id, pipeline_... | 2 | null | Implement the Python class `PipelineDependenciesStep` described below.
Class description:
PipelineDependencies Step class that helps wait for other pipelines to finish
Method signatures and docstrings:
- def __init__(self, id, pipeline_name, dependent_pipelines=None, dependent_pipelines_ok_to_fail=None, refresh_rate=... | Implement the Python class `PipelineDependenciesStep` described below.
Class description:
PipelineDependencies Step class that helps wait for other pipelines to finish
Method signatures and docstrings:
- def __init__(self, id, pipeline_name, dependent_pipelines=None, dependent_pipelines_ok_to_fail=None, refresh_rate=... | 797cb719e6c2abeda0751ada3339c72bfb19c8f2 | <|skeleton|>
class PipelineDependenciesStep:
"""PipelineDependencies Step class that helps wait for other pipelines to finish"""
def __init__(self, id, pipeline_name, dependent_pipelines=None, dependent_pipelines_ok_to_fail=None, refresh_rate=300, start_date=None, script_arguments=None, **kwargs):
"""C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PipelineDependenciesStep:
"""PipelineDependencies Step class that helps wait for other pipelines to finish"""
def __init__(self, id, pipeline_name, dependent_pipelines=None, dependent_pipelines_ok_to_fail=None, refresh_rate=300, start_date=None, script_arguments=None, **kwargs):
"""Constructor fo... | the_stack_v2_python_sparse | dataduct/steps/pipeline_dependencies.py | EverFi/dataduct | train | 3 |
21137e88fd082d1f64668d566acb494e9cf17b1f | [
"attr_dict_without_msg = {cros_patch.ATTR_PROJECT_URL: 'https://host/chromite/tacos', cros_patch.ATTR_PROJECT: 'chromite/tacos', cros_patch.ATTR_REF: 'refs/changes/11/12345/4', cros_patch.ATTR_BRANCH: 'master', cros_patch.ATTR_REMOTE: 'cros-internal', cros_patch.ATTR_COMMIT: '7181e4b5e182b6f7d68461b04253de095bad74f... | <|body_start_0|>
attr_dict_without_msg = {cros_patch.ATTR_PROJECT_URL: 'https://host/chromite/tacos', cros_patch.ATTR_PROJECT: 'chromite/tacos', cros_patch.ATTR_REF: 'refs/changes/11/12345/4', cros_patch.ATTR_BRANCH: 'master', cros_patch.ATTR_REMOTE: 'cros-internal', cros_patch.ATTR_COMMIT: '7181e4b5e182b6f7d68... | Test of GerritFetchOnlyPatch. | TestGerritFetchOnlyPatch | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGerritFetchOnlyPatch:
"""Test of GerritFetchOnlyPatch."""
def testFromAttrDict(self):
"""Test whether FromAttrDict can handle with commit message."""
<|body_0|>
def testGetAttributeDict(self):
"""Test Whether GetAttributeDict can get the commit message proper... | stack_v2_sparse_classes_36k_train_013615 | 44,807 | permissive | [
{
"docstring": "Test whether FromAttrDict can handle with commit message.",
"name": "testFromAttrDict",
"signature": "def testFromAttrDict(self)"
},
{
"docstring": "Test Whether GetAttributeDict can get the commit message properly.",
"name": "testGetAttributeDict",
"signature": "def test... | 2 | null | Implement the Python class `TestGerritFetchOnlyPatch` described below.
Class description:
Test of GerritFetchOnlyPatch.
Method signatures and docstrings:
- def testFromAttrDict(self): Test whether FromAttrDict can handle with commit message.
- def testGetAttributeDict(self): Test Whether GetAttributeDict can get the ... | Implement the Python class `TestGerritFetchOnlyPatch` described below.
Class description:
Test of GerritFetchOnlyPatch.
Method signatures and docstrings:
- def testFromAttrDict(self): Test whether FromAttrDict can handle with commit message.
- def testGetAttributeDict(self): Test Whether GetAttributeDict can get the ... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class TestGerritFetchOnlyPatch:
"""Test of GerritFetchOnlyPatch."""
def testFromAttrDict(self):
"""Test whether FromAttrDict can handle with commit message."""
<|body_0|>
def testGetAttributeDict(self):
"""Test Whether GetAttributeDict can get the commit message proper... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGerritFetchOnlyPatch:
"""Test of GerritFetchOnlyPatch."""
def testFromAttrDict(self):
"""Test whether FromAttrDict can handle with commit message."""
attr_dict_without_msg = {cros_patch.ATTR_PROJECT_URL: 'https://host/chromite/tacos', cros_patch.ATTR_PROJECT: 'chromite/tacos', cros_pa... | the_stack_v2_python_sparse | third_party/chromite/lib/patch_unittest.py | metux/chromium-suckless | train | 5 |
3d53c1aec4a26c471e66d8c60b20d73e7b36de34 | [
"self.SUBJECT = 'MOSJA00288'\nsuper(OASEMailInitialPasswd, self).__init__(self.MAILACC, addr_to, self.SUBJECT, '', inquiry_url, login_url, charset)\nself.create_mail_text(user_name, passwd, expire_h)",
"self.MAILTEXT = get_message('MOSJA00289', self.lang_mode, showMsgId=False, user_name=user_name, passwd=passwd, ... | <|body_start_0|>
self.SUBJECT = 'MOSJA00288'
super(OASEMailInitialPasswd, self).__init__(self.MAILACC, addr_to, self.SUBJECT, '', inquiry_url, login_url, charset)
self.create_mail_text(user_name, passwd, expire_h)
<|end_body_0|>
<|body_start_1|>
self.MAILTEXT = get_message('MOSJA00289',... | [クラス概要] 初期パスワード通知メール | OASEMailInitialPasswd | [
"Apache-2.0",
"BSD-3-Clause",
"LGPL-3.0-only",
"MIT",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OASEMailInitialPasswd:
"""[クラス概要] 初期パスワード通知メール"""
def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str 初期パスワード expire... | stack_v2_sparse_classes_36k_train_013616 | 20,173 | permissive | [
{
"docstring": "[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str 初期パスワード expire_h : int パスワード有効期間(hour) inquiry_url : str お問い合わせ画面 login_url : str ログイン画面 charset : str 文字コード",
"name": "__init__",
"signature": "def __init__(self, addr_from, addr_t... | 2 | null | Implement the Python class `OASEMailInitialPasswd` described below.
Class description:
[クラス概要] 初期パスワード通知メール
Method signatures and docstrings:
- def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メ... | Implement the Python class `OASEMailInitialPasswd` described below.
Class description:
[クラス概要] 初期パスワード通知メール
Method signatures and docstrings:
- def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'): [メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メ... | c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94 | <|skeleton|>
class OASEMailInitialPasswd:
"""[クラス概要] 初期パスワード通知メール"""
def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str 初期パスワード expire... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OASEMailInitialPasswd:
"""[クラス概要] 初期パスワード通知メール"""
def __init__(self, addr_from, addr_to, user_name, passwd, expire_h, inquiry_url, login_url, charset='utf-8'):
"""[メソッド概要] 初期化処理 [引数] addr_from : str 送信者メールアドレス addr_to : str 宛先メールアドレス user_name : str 宛先ユーザ名 passwd : str 初期パスワード expire_h : int パスワー... | the_stack_v2_python_sparse | oase-root/libs/webcommonlibs/oase_mail.py | exastro-suite/oase | train | 10 |
5a71ac8b306679a91c2ca18261882ed348fbe8a3 | [
"super().__init__(master, tk, layout, True)\nself._update_grid(grid)\nself._update_align(align)\nself._width = width\nself._height = height\nself.visible = visible\nif enabled is None:\n self.enabled = master.enabled\nelse:\n self.enabled = enabled",
"if width is None:\n width = 0\nif height is None:\n ... | <|body_start_0|>
super().__init__(master, tk, layout, True)
self._update_grid(grid)
self._update_align(align)
self._width = width
self._height = height
self.visible = visible
if enabled is None:
self.enabled = master.enabled
else:
s... | ContainerWidget | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerWidget:
def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height):
"""The base class for a widget which is also a container e.g. `Box`, `ButtonGroup`"""
<|body_0|>
def _set_propagation(self, width, height):
"""Set the propagation v... | stack_v2_sparse_classes_36k_train_013617 | 23,387 | permissive | [
{
"docstring": "The base class for a widget which is also a container e.g. `Box`, `ButtonGroup`",
"name": "__init__",
"signature": "def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height)"
},
{
"docstring": "Set the propagation value of the tk widget dependent on the... | 2 | stack_v2_sparse_classes_30k_train_021562 | Implement the Python class `ContainerWidget` described below.
Class description:
Implement the ContainerWidget class.
Method signatures and docstrings:
- def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height): The base class for a widget which is also a container e.g. `Box`, `ButtonGroup... | Implement the Python class `ContainerWidget` described below.
Class description:
Implement the ContainerWidget class.
Method signatures and docstrings:
- def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height): The base class for a widget which is also a container e.g. `Box`, `ButtonGroup... | 0577996bac314390c03008c16c8d6a0534db6a81 | <|skeleton|>
class ContainerWidget:
def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height):
"""The base class for a widget which is also a container e.g. `Box`, `ButtonGroup`"""
<|body_0|>
def _set_propagation(self, width, height):
"""Set the propagation v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContainerWidget:
def __init__(self, master, tk, layout, grid, align, visible, enabled, width, height):
"""The base class for a widget which is also a container e.g. `Box`, `ButtonGroup`"""
super().__init__(master, tk, layout, True)
self._update_grid(grid)
self._update_align(ali... | the_stack_v2_python_sparse | guizero/base.py | lawsie/guizero | train | 388 | |
dcd0b41b10f70ee642b1a321967ede431da0f24c | [
"assignment = numpy.empty(data.shape[0], dtype=numpy.int_)\nassignmentCount = numpy.empty(centres.shape[0], dtype=numpy.int_)\nassignment[:] = -1\ncode = '\\n for (int i=0;i<maxIters;i++)\\n {\\n // Reassign features to clusters...\\n bool change = false;\\n for (int f=0;f<Ndata[0];f++)\\n {\\... | <|body_start_0|>
assignment = numpy.empty(data.shape[0], dtype=numpy.int_)
assignmentCount = numpy.empty(centres.shape[0], dtype=numpy.int_)
assignment[:] = -1
code = '\n for (int i=0;i<maxIters;i++)\n {\n // Reassign features to clusters...\n bool change = false;\n for... | This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable for large data sets, e.g. with at least 10k feature vectors, and will caus... | KMeans2 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KMeans2:
"""This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable for large data sets, e.g. with at least... | stack_v2_sparse_classes_36k_train_013618 | 5,672 | permissive | [
{
"docstring": "Internal method - does k-means on the data set as it is treated internally. Given the initial set of centres and a data matrix - the centres matrix is then updated to the new positions.",
"name": "__kmeans",
"signature": "def __kmeans(self, centres, data, minSize=3, maxIters=1024, assign... | 2 | null | Implement the Python class `KMeans2` described below.
Class description:
This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable ... | Implement the Python class `KMeans2` described below.
Class description:
This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable ... | bcddc22c2a97050d8e7a07021097388d447cf914 | <|skeleton|>
class KMeans2:
"""This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable for large data sets, e.g. with at least... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KMeans2:
"""This version of kmeans gets clever with its initialisation, running k-means on a subset of points, repeatedly, then combining the various runs, before ultimatly only doing k-means on the full dataset just once. This optimisation is only valuable for large data sets, e.g. with at least 10k feature ... | the_stack_v2_python_sparse | gmm/kmeans2.py | gareth1brown/hainesfork | train | 1 |
55b5e2f7bf8b0a8465c3027cc138873c0433ffad | [
"job_thread = JobThread(queue_name, sleep_time, from_right)\njob_thread.setDaemon(True)\njob_thread.start()\nself.threads[job_thread.getName()] = job_thread\nsys.stdout.write('start a job thread, name: %s, ident: %s, queue_name: %s\\n' % (job_thread.getName(), job_thread.ident, queue_name))",
"if not job_name in ... | <|body_start_0|>
job_thread = JobThread(queue_name, sleep_time, from_right)
job_thread.setDaemon(True)
job_thread.start()
self.threads[job_thread.getName()] = job_thread
sys.stdout.write('start a job thread, name: %s, ident: %s, queue_name: %s\n' % (job_thread.getName(), job_thre... | 管理工作线程, 开启/停止工作线程 | JobThreadManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobThreadManager:
"""管理工作线程, 开启/停止工作线程"""
def add(self, queue_name, sleep_time, from_right=True):
"""开启一个工作线程"""
<|body_0|>
def stop(self, job_name):
"""安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
job_thread... | stack_v2_sparse_classes_36k_train_013619 | 2,159 | no_license | [
{
"docstring": "开启一个工作线程",
"name": "add",
"signature": "def add(self, queue_name, sleep_time, from_right=True)"
},
{
"docstring": "安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出",
"name": "stop",
"signature": "def stop(self, job_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004825 | Implement the Python class `JobThreadManager` described below.
Class description:
管理工作线程, 开启/停止工作线程
Method signatures and docstrings:
- def add(self, queue_name, sleep_time, from_right=True): 开启一个工作线程
- def stop(self, job_name): 安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出 | Implement the Python class `JobThreadManager` described below.
Class description:
管理工作线程, 开启/停止工作线程
Method signatures and docstrings:
- def add(self, queue_name, sleep_time, from_right=True): 开启一个工作线程
- def stop(self, job_name): 安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出
<|skeleton|>
class JobThreadManager:
"""管理工作线程, 开启... | 05dae4225db1fedbe738d317bf44aca8604c9eed | <|skeleton|>
class JobThreadManager:
"""管理工作线程, 开启/停止工作线程"""
def add(self, queue_name, sleep_time, from_right=True):
"""开启一个工作线程"""
<|body_0|>
def stop(self, job_name):
"""安全的停止一个工作线程 正在转换中的时候,会等待转换完成后自动退出"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobThreadManager:
"""管理工作线程, 开启/停止工作线程"""
def add(self, queue_name, sleep_time, from_right=True):
"""开启一个工作线程"""
job_thread = JobThread(queue_name, sleep_time, from_right)
job_thread.setDaemon(True)
job_thread.start()
self.threads[job_thread.getName()] = job_thread... | the_stack_v2_python_sparse | Python/PythonC++Scala/script/.svn/pristine/55/55b5e2f7bf8b0a8465c3027cc138873c0433ffad.svn-base | cash2one/dataMining-1 | train | 0 |
b7bdefcd01e96623813c578eca00ecd52db87754 | [
"if USGS_USER != None and USGS_PASSWORD != None:\n self.username = USGS_USER\n self.password = USGS_PASSWORD\n self.host = 'https://earthexplorer.usgs.gov/inventory/json/v/%s' % usgs_version\n self.api_key = None\nelse:\n logger.error('Please add the usgs credentials to the .env file.')\n sys.exit... | <|body_start_0|>
if USGS_USER != None and USGS_PASSWORD != None:
self.username = USGS_USER
self.password = USGS_PASSWORD
self.host = 'https://earthexplorer.usgs.gov/inventory/json/v/%s' % usgs_version
self.api_key = None
else:
logger.error('Ple... | UsgsApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsgsApi:
def __init__(self):
"""This is the constructor, it creates an object that holds credentials to usgs portal."""
<|body_0|>
def _consume_api_requests(self, endpoint, payload=None):
"""Method to hide the http call from the user. This method hides the complexity... | stack_v2_sparse_classes_36k_train_013620 | 13,625 | no_license | [
{
"docstring": "This is the constructor, it creates an object that holds credentials to usgs portal.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Method to hide the http call from the user. This method hides the complexity of making a request to usgs, depending on w... | 5 | stack_v2_sparse_classes_30k_train_017357 | Implement the Python class `UsgsApi` described below.
Class description:
Implement the UsgsApi class.
Method signatures and docstrings:
- def __init__(self): This is the constructor, it creates an object that holds credentials to usgs portal.
- def _consume_api_requests(self, endpoint, payload=None): Method to hide t... | Implement the Python class `UsgsApi` described below.
Class description:
Implement the UsgsApi class.
Method signatures and docstrings:
- def __init__(self): This is the constructor, it creates an object that holds credentials to usgs portal.
- def _consume_api_requests(self, endpoint, payload=None): Method to hide t... | ab8073a4b45915ba51c718b5403795c44f9b0027 | <|skeleton|>
class UsgsApi:
def __init__(self):
"""This is the constructor, it creates an object that holds credentials to usgs portal."""
<|body_0|>
def _consume_api_requests(self, endpoint, payload=None):
"""Method to hide the http call from the user. This method hides the complexity... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UsgsApi:
def __init__(self):
"""This is the constructor, it creates an object that holds credentials to usgs portal."""
if USGS_USER != None and USGS_PASSWORD != None:
self.username = USGS_USER
self.password = USGS_PASSWORD
self.host = 'https://earthexplorer... | the_stack_v2_python_sparse | madmex/api/remote.py | ixime/antares3 | train | 0 | |
9eaf4a2089caa7e5889cc110a14f04799d66cc96 | [
"self.enter_general_tuangou()\ns_goods_title = self.setCollected(self.s_name)\nself.press_back_by_keycode()\nself.check_collcet_by_mtz(s_goods_title)",
"self.enter_general_tuangou()\nself.myClick(self.find_element('客服', *self.by_costomer_id))\nself.verify_customer_service(self.s_customer_service_text.replace(' ',... | <|body_start_0|>
self.enter_general_tuangou()
s_goods_title = self.setCollected(self.s_name)
self.press_back_by_keycode()
self.check_collcet_by_mtz(s_goods_title)
<|end_body_0|>
<|body_start_1|>
self.enter_general_tuangou()
self.myClick(self.find_element('客服', *self.by_c... | TPuTong | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TPuTong:
def test_collect(self):
"""普通团_收藏功能"""
<|body_0|>
def test_customer_service(self):
"""普通团_发送客服消息验证"""
<|body_1|>
def test_t_separately_buying(self):
"""普通团_去开团_单独购买"""
<|body_2|>
def test_group_buying(self):
"""普通团_去... | stack_v2_sparse_classes_36k_train_013621 | 1,635 | no_license | [
{
"docstring": "普通团_收藏功能",
"name": "test_collect",
"signature": "def test_collect(self)"
},
{
"docstring": "普通团_发送客服消息验证",
"name": "test_customer_service",
"signature": "def test_customer_service(self)"
},
{
"docstring": "普通团_去开团_单独购买",
"name": "test_t_separately_buying",
... | 4 | null | Implement the Python class `TPuTong` described below.
Class description:
Implement the TPuTong class.
Method signatures and docstrings:
- def test_collect(self): 普通团_收藏功能
- def test_customer_service(self): 普通团_发送客服消息验证
- def test_t_separately_buying(self): 普通团_去开团_单独购买
- def test_group_buying(self): 普通团_去开团_团购 | Implement the Python class `TPuTong` described below.
Class description:
Implement the TPuTong class.
Method signatures and docstrings:
- def test_collect(self): 普通团_收藏功能
- def test_customer_service(self): 普通团_发送客服消息验证
- def test_t_separately_buying(self): 普通团_去开团_单独购买
- def test_group_buying(self): 普通团_去开团_团购
<|ske... | b2066139eb0723eff69d971589b283b4b776c84c | <|skeleton|>
class TPuTong:
def test_collect(self):
"""普通团_收藏功能"""
<|body_0|>
def test_customer_service(self):
"""普通团_发送客服消息验证"""
<|body_1|>
def test_t_separately_buying(self):
"""普通团_去开团_单独购买"""
<|body_2|>
def test_group_buying(self):
"""普通团_去... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TPuTong:
def test_collect(self):
"""普通团_收藏功能"""
self.enter_general_tuangou()
s_goods_title = self.setCollected(self.s_name)
self.press_back_by_keycode()
self.check_collcet_by_mtz(s_goods_title)
def test_customer_service(self):
"""普通团_发送客服消息验证"""
sel... | the_stack_v2_python_sparse | TestCase/4_5/TC_tuan_gou/test_general_tuan.py | testerSunshine/auto_md | train | 4 | |
4772126b7c1ab188eb3e9b65ee1b6b5949f40c3e | [
"if not head:\n return None\ncurNode, nxtNode = (head, head)\nwhile nxtNode:\n while nxtNode and curNode.val == nxtNode.val:\n nxtNode = nxtNode.next\n curNode.next = nxtNode\n curNode = nxtNode\nreturn head",
"cur = head\nwhile cur and cur.next:\n first = cur\n second = cur.next\n whi... | <|body_start_0|>
if not head:
return None
curNode, nxtNode = (head, head)
while nxtNode:
while nxtNode and curNode.val == nxtNode.val:
nxtNode = nxtNode.next
curNode.next = nxtNode
curNode = nxtNode
return head
<|end_body_0|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deleteDuplicates(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def deleteDuplicatesB(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
r... | stack_v2_sparse_classes_36k_train_013622 | 1,280 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "deleteDuplicates",
"signature": "def deleteDuplicates(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "deleteDuplicatesB",
"signature": "def deleteDuplicatesB(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode
- def deleteDuplicatesB(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode
- def deleteDuplicatesB(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
... | 813235789ce422a3bab198317aafc46fbc61625e | <|skeleton|>
class Solution:
def deleteDuplicates(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def deleteDuplicatesB(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def deleteDuplicates(self, head):
""":type head: ListNode :rtype: ListNode"""
if not head:
return None
curNode, nxtNode = (head, head)
while nxtNode:
while nxtNode and curNode.val == nxtNode.val:
nxtNode = nxtNode.next
... | the_stack_v2_python_sparse | 16. LINKED LIST/83_remove_duplicates_from_linked_list/solution.py | kimmyoo/python_leetcode | train | 1 | |
f0ed601bf07b9b4ef490f9b3809ea095ffa03cce | [
"if not m or not n:\n return 0\ndp = [1] * m\nfor i in range(1, n):\n for i in range(1, m):\n dp[i] += dp[i - 1]\nreturn dp[-1]",
"dp = [1] * m\nfor i in range(1, n):\n for j in range(m):\n if j == 0:\n dp[j] = 1\n else:\n dp[j] = dp[j - 1] + dp[j]\nreturn dp[-1... | <|body_start_0|>
if not m or not n:
return 0
dp = [1] * m
for i in range(1, n):
for i in range(1, m):
dp[i] += dp[i - 1]
return dp[-1]
<|end_body_0|>
<|body_start_1|>
dp = [1] * m
for i in range(1, n):
for j in range(m)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniquePathsOld(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not m or not n:
ret... | stack_v2_sparse_classes_36k_train_013623 | 740 | no_license | [
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m, n)"
},
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePathsOld",
"signature": "def uniquePathsOld(self, m, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePathsOld(self, m, n): :type m: int :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniquePathsOld(self, m, n): :type m: int :type n: int :rtype: int
<|skeleton|>
class Solution:
def ... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniquePathsOld(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
if not m or not n:
return 0
dp = [1] * m
for i in range(1, n):
for i in range(1, m):
dp[i] += dp[i - 1]
return dp[-1]
def uniquePathsOld(self,... | the_stack_v2_python_sparse | cs_notes/dynamic_programming/unique_paths.py | hwc1824/LeetCodeSolution | train | 0 | |
0d89b6ad268c77f86a2d09380b09db92df2e67b7 | [
"super().__init__()\nif pre_nonlinear not in ('sigmoid', 'prelu', 'relu', 'tanh', 'linear'):\n raise ValueError('Not supporting pre_nonlinear={}'.format(pre_nonlinear))\nif nonlinear not in ('sigmoid', 'relu', 'tanh', 'linear'):\n raise ValueError('Not supporting nonlinear={}'.format(nonlinear))\nself.tcn = T... | <|body_start_0|>
super().__init__()
if pre_nonlinear not in ('sigmoid', 'prelu', 'relu', 'tanh', 'linear'):
raise ValueError('Not supporting pre_nonlinear={}'.format(pre_nonlinear))
if nonlinear not in ('sigmoid', 'relu', 'tanh', 'linear'):
raise ValueError('Not supportin... | TDSpeakerBeamExtractor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TDSpeakerBeamExtractor:
def __init__(self, input_dim: int, layer: int=8, stack: int=3, bottleneck_dim: int=128, hidden_dim: int=512, skip_dim: int=128, kernel: int=3, causal: bool=False, norm_type: str='gLN', pre_nonlinear: str='prelu', nonlinear: str='relu', i_adapt_layer: int=7, adapt_layer_ty... | stack_v2_sparse_classes_36k_train_013624 | 6,590 | permissive | [
{
"docstring": "Time-Domain SpeakerBeam Extractor. Args: input_dim: input feature dimension layer: int, number of layers in each stack stack: int, number of stacks bottleneck_dim: bottleneck dimension hidden_dim: number of convolution channel skip_dim: int, number of skip connection channels kernel: int, kernel... | 2 | stack_v2_sparse_classes_30k_train_014044 | Implement the Python class `TDSpeakerBeamExtractor` described below.
Class description:
Implement the TDSpeakerBeamExtractor class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, layer: int=8, stack: int=3, bottleneck_dim: int=128, hidden_dim: int=512, skip_dim: int=128, kernel: int=3, causal:... | Implement the Python class `TDSpeakerBeamExtractor` described below.
Class description:
Implement the TDSpeakerBeamExtractor class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, layer: int=8, stack: int=3, bottleneck_dim: int=128, hidden_dim: int=512, skip_dim: int=128, kernel: int=3, causal:... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class TDSpeakerBeamExtractor:
def __init__(self, input_dim: int, layer: int=8, stack: int=3, bottleneck_dim: int=128, hidden_dim: int=512, skip_dim: int=128, kernel: int=3, causal: bool=False, norm_type: str='gLN', pre_nonlinear: str='prelu', nonlinear: str='relu', i_adapt_layer: int=7, adapt_layer_ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TDSpeakerBeamExtractor:
def __init__(self, input_dim: int, layer: int=8, stack: int=3, bottleneck_dim: int=128, hidden_dim: int=512, skip_dim: int=128, kernel: int=3, causal: bool=False, norm_type: str='gLN', pre_nonlinear: str='prelu', nonlinear: str='relu', i_adapt_layer: int=7, adapt_layer_type: str='mul',... | the_stack_v2_python_sparse | espnet2/enh/extractor/td_speakerbeam_extractor.py | espnet/espnet | train | 7,242 | |
e6b5e8b219df706a9e9fc575954b05b4718d918b | [
"mod_dir = 'a/b/packages/apps/Settings'\nmock_isdir.return_value = True\nvscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir)\nself.assertFalse(mock_mkdir.called)\nmock_mkdir.mock_reset()\nmock_isdir.return_value = False\nvscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir)\n... | <|body_start_0|>
mod_dir = 'a/b/packages/apps/Settings'
mock_isdir.return_value = True
vscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir)
self.assertFalse(mock_mkdir.called)
mock_mkdir.mock_reset()
mock_isdir.return_value = False
vscode_nativ... | Unit tests for vscode_native_project_file_gen.py | VSCodeNativeProjectFileGenUnittests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VSCodeNativeProjectFileGenUnittests:
"""Unit tests for vscode_native_project_file_gen.py"""
def test_init(self, mock_isdir, mock_mkdir):
"""Test initializing VSCodeNativeProjectFileGenerator."""
<|body_0|>
def test_create_c_cpp_properties_dict(self, mock_isfile, mock_isd... | stack_v2_sparse_classes_36k_train_013625 | 3,203 | no_license | [
{
"docstring": "Test initializing VSCodeNativeProjectFileGenerator.",
"name": "test_init",
"signature": "def test_init(self, mock_isdir, mock_mkdir)"
},
{
"docstring": "Test _create_c_cpp_properties_dict with conditions.",
"name": "test_create_c_cpp_properties_dict",
"signature": "def te... | 2 | null | Implement the Python class `VSCodeNativeProjectFileGenUnittests` described below.
Class description:
Unit tests for vscode_native_project_file_gen.py
Method signatures and docstrings:
- def test_init(self, mock_isdir, mock_mkdir): Test initializing VSCodeNativeProjectFileGenerator.
- def test_create_c_cpp_properties_... | Implement the Python class `VSCodeNativeProjectFileGenUnittests` described below.
Class description:
Unit tests for vscode_native_project_file_gen.py
Method signatures and docstrings:
- def test_init(self, mock_isdir, mock_mkdir): Test initializing VSCodeNativeProjectFileGenerator.
- def test_create_c_cpp_properties_... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class VSCodeNativeProjectFileGenUnittests:
"""Unit tests for vscode_native_project_file_gen.py"""
def test_init(self, mock_isdir, mock_mkdir):
"""Test initializing VSCodeNativeProjectFileGenerator."""
<|body_0|>
def test_create_c_cpp_properties_dict(self, mock_isfile, mock_isd... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VSCodeNativeProjectFileGenUnittests:
"""Unit tests for vscode_native_project_file_gen.py"""
def test_init(self, mock_isdir, mock_mkdir):
"""Test initializing VSCodeNativeProjectFileGenerator."""
mod_dir = 'a/b/packages/apps/Settings'
mock_isdir.return_value = True
vscode_n... | the_stack_v2_python_sparse | tools/asuite/aidegen/vscode/vscode_native_project_file_gen_unittest.py | ZYHGOD-1/Aosp11 | train | 0 |
b5e40a44d65399784477a8c56c045e0d65e2ecb0 | [
"async def wrapper(admin: str=Depends(authenticate_admin), *args, **kwargs):\n logger.info('Admin access granted.')\n return await func(*args, **kwargs)\nwrapper.__signature__ = inspect.Signature(parameters=[*inspect.signature(func).parameters.values(), *filter(lambda p: p.kind not in (inspect.Parameter.VAR_P... | <|body_start_0|>
async def wrapper(admin: str=Depends(authenticate_admin), *args, **kwargs):
logger.info('Admin access granted.')
return await func(*args, **kwargs)
wrapper.__signature__ = inspect.Signature(parameters=[*inspect.signature(func).parameters.values(), *filter(lambda ... | [Endpoint authentication decorator.] | authentication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class authentication:
"""[Endpoint authentication decorator.]"""
def admin_required(func):
"""[Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]"""
<|body_0|>
def user_required(func):
"""[Sets a user authentication requirement.... | stack_v2_sparse_classes_36k_train_013626 | 2,466 | no_license | [
{
"docstring": "[Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]",
"name": "admin_required",
"signature": "def admin_required(func)"
},
{
"docstring": "[Sets a user authentication requirement. User has to exist in the users database and have a 'True' a... | 2 | stack_v2_sparse_classes_30k_train_002662 | Implement the Python class `authentication` described below.
Class description:
[Endpoint authentication decorator.]
Method signatures and docstrings:
- def admin_required(func): [Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]
- def user_required(func): [Sets a user authen... | Implement the Python class `authentication` described below.
Class description:
[Endpoint authentication decorator.]
Method signatures and docstrings:
- def admin_required(func): [Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]
- def user_required(func): [Sets a user authen... | e17daa214f4bc8394e9bc096aca6a04b0fba04e9 | <|skeleton|>
class authentication:
"""[Endpoint authentication decorator.]"""
def admin_required(func):
"""[Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]"""
<|body_0|>
def user_required(func):
"""[Sets a user authentication requirement.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class authentication:
"""[Endpoint authentication decorator.]"""
def admin_required(func):
"""[Sets an admin authentication requirement.] Args: func ([type]): [Function to be decorated.]"""
async def wrapper(admin: str=Depends(authenticate_admin), *args, **kwargs):
logger.info('Admi... | the_stack_v2_python_sparse | authentication/decorator.py | pesfahanian/ML_API | train | 6 |
a8c90bd1f109a271af58a5767da9b95bbcf07318 | [
"super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad)\nfor group in self.param_groups:\n for p in group['params']:\n state = self.state[p]\n state['step'] = 0\n state['shared_step'] = torch.zeros(1).share_memory_()\n state['... | <|body_start_0|>
super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad)
for group in self.param_groups:
for p in group['params']:
state = self.state[p]
state['step'] = 0
state['shared_s... | SharedAdam | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SharedAdam:
def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False):
"""arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ... | stack_v2_sparse_classes_36k_train_013627 | 23,572 | no_license | [
{
"docstring": "arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator, weight_decay is L2 penalty, and amsgrad is boolean weather to use AMSGrad. Adam is subclass of torch.optim.... | 2 | stack_v2_sparse_classes_30k_train_007811 | Implement the Python class `SharedAdam` described below.
Class description:
Implement the SharedAdam class.
Method signatures and docstrings:
- def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight... | Implement the Python class `SharedAdam` described below.
Class description:
Implement the SharedAdam class.
Method signatures and docstrings:
- def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight... | 6f38cfd121c504e78ecd4b7762e86f4825bb596d | <|skeleton|>
class SharedAdam:
def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False):
"""arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SharedAdam:
def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False):
"""arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator... | the_stack_v2_python_sparse | algorithm/a3c_breakout.py | corot/reinforcement-learning | train | 0 | |
905d1157a6e7807255b94c2f7173b41df030f00a | [
"hash_dict = {}\nif not strings:\n return []\nfor sub in strings:\n key = self.hash_key(sub)\n hash_dict[key] = hash_dict.get(key, []) + [sub]\nreturn map(sorted, hash_dict.values())",
"key = []\nfor ch in strs:\n idx = (ord(ch) - ord(strs[0])) % 26\n key.append(idx)\nreturn tuple(key)"
] | <|body_start_0|>
hash_dict = {}
if not strings:
return []
for sub in strings:
key = self.hash_key(sub)
hash_dict[key] = hash_dict.get(key, []) + [sub]
return map(sorted, hash_dict.values())
<|end_body_0|>
<|body_start_1|>
key = []
for ... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def groupStrings(self, strings):
""":type strings: List[str] :rtype: List[List[str]]"""
<|body_0|>
def hash_key(self, strs):
"""Produce the hash key with tuple list"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
hash_dict = {}
if ... | stack_v2_sparse_classes_36k_train_013628 | 636 | permissive | [
{
"docstring": ":type strings: List[str] :rtype: List[List[str]]",
"name": "groupStrings",
"signature": "def groupStrings(self, strings)"
},
{
"docstring": "Produce the hash key with tuple list",
"name": "hash_key",
"signature": "def hash_key(self, strs)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupStrings(self, strings): :type strings: List[str] :rtype: List[List[str]]
- def hash_key(self, strs): Produce the hash key with tuple list | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupStrings(self, strings): :type strings: List[str] :rtype: List[List[str]]
- def hash_key(self, strs): Produce the hash key with tuple list
<|skeleton|>
class Solution:
... | 86f1cb98de801f58c39d9a48ce9de12df7303d20 | <|skeleton|>
class Solution:
def groupStrings(self, strings):
""":type strings: List[str] :rtype: List[List[str]]"""
<|body_0|>
def hash_key(self, strs):
"""Produce the hash key with tuple list"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def groupStrings(self, strings):
""":type strings: List[str] :rtype: List[List[str]]"""
hash_dict = {}
if not strings:
return []
for sub in strings:
key = self.hash_key(sub)
hash_dict[key] = hash_dict.get(key, []) + [sub]
re... | the_stack_v2_python_sparse | 249-Group-Shifted-Strings/solution.py | Tanych/CodeTracking | train | 0 | |
0a34b4e70ba768e49d9059f8ff38047e599a854f | [
"super().__init__(**kwargs)\nself.allow_ipv4 = allow_ipv4\nself.resolve = resolve",
"value = super()._validate(cfg, value)\ntry:\n addr = IPv4Address(value)\nexcept:\n pass\nelse:\n if self.allow_ipv4:\n return str(addr)\n raise ValueError('value is not a valid DNS hostname')\nif self.resolve:\... | <|body_start_0|>
super().__init__(**kwargs)
self.allow_ipv4 = allow_ipv4
self.resolve = resolve
<|end_body_0|>
<|body_start_1|>
value = super()._validate(cfg, value)
try:
addr = IPv4Address(value)
except:
pass
else:
if self.all... | A field representing a network hostname or, optionally, a network address. | HostnameField | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostnameField:
"""A field representing a network hostname or, optionally, a network address."""
def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs):
""":param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4... | stack_v2_sparse_classes_36k_train_013629 | 4,387 | permissive | [
{
"docstring": ":param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4 address and raise a :class:`ValueError` if the resolution fails",
"name": "__init__",
"signature": "def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs)"
... | 2 | stack_v2_sparse_classes_30k_train_015227 | Implement the Python class `HostnameField` described below.
Class description:
A field representing a network hostname or, optionally, a network address.
Method signatures and docstrings:
- def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): :param allow_ipv4: allow both a hostname and an IPv... | Implement the Python class `HostnameField` described below.
Class description:
A field representing a network hostname or, optionally, a network address.
Method signatures and docstrings:
- def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs): :param allow_ipv4: allow both a hostname and an IPv... | 1499ff8f00a43a592571a10666823e125d5fbc49 | <|skeleton|>
class HostnameField:
"""A field representing a network hostname or, optionally, a network address."""
def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs):
""":param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostnameField:
"""A field representing a network hostname or, optionally, a network address."""
def __init__(self, *, allow_ipv4: bool=True, resolve: bool=False, **kwargs):
""":param allow_ipv4: allow both a hostname and an IPv4 address :param resolve: resolve hostnames to their IPv4 address and ... | the_stack_v2_python_sparse | cincoconfig/fields/net_field.py | ameily/cincoconfig | train | 6 |
2287f1a5337db874b0f9b0517964cb13ec1341c7 | [
"if not isinstance(text, list):\n text = [text]\nfor i in text:\n assert_that(page).contains(i)",
"if not isinstance(text, list):\n text = [text]\nfor i in text:\n assert_that(page).does_not_contain(i)",
"page = elem.text\nif not text:\n pass\nif mode not in ('vague', 'accurate'):\n raise Exce... | <|body_start_0|>
if not isinstance(text, list):
text = [text]
for i in text:
assert_that(page).contains(i)
<|end_body_0|>
<|body_start_1|>
if not isinstance(text, list):
text = [text]
for i in text:
assert_that(page).does_not_contain(i)
<|... | BaseAssert | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseAssert:
def assert_text_in_page(self, text, page):
"""判断文本在页面中存在,支持多个文本"""
<|body_0|>
def assert_text_not_in_page(self, text, page):
"""判断文本在页面中不存在,支持多个文本"""
<|body_1|>
def assert_text_in_elem(self, text, elem, mode='vague'):
"""判断元素包含文本,支持多个... | stack_v2_sparse_classes_36k_train_013630 | 3,059 | no_license | [
{
"docstring": "判断文本在页面中存在,支持多个文本",
"name": "assert_text_in_page",
"signature": "def assert_text_in_page(self, text, page)"
},
{
"docstring": "判断文本在页面中不存在,支持多个文本",
"name": "assert_text_not_in_page",
"signature": "def assert_text_not_in_page(self, text, page)"
},
{
"docstring": "判... | 5 | stack_v2_sparse_classes_30k_train_021645 | Implement the Python class `BaseAssert` described below.
Class description:
Implement the BaseAssert class.
Method signatures and docstrings:
- def assert_text_in_page(self, text, page): 判断文本在页面中存在,支持多个文本
- def assert_text_not_in_page(self, text, page): 判断文本在页面中不存在,支持多个文本
- def assert_text_in_elem(self, text, elem, m... | Implement the Python class `BaseAssert` described below.
Class description:
Implement the BaseAssert class.
Method signatures and docstrings:
- def assert_text_in_page(self, text, page): 判断文本在页面中存在,支持多个文本
- def assert_text_not_in_page(self, text, page): 判断文本在页面中不存在,支持多个文本
- def assert_text_in_elem(self, text, elem, m... | 0025cc46fa84db658987c9df109de4e5c3c4f5b9 | <|skeleton|>
class BaseAssert:
def assert_text_in_page(self, text, page):
"""判断文本在页面中存在,支持多个文本"""
<|body_0|>
def assert_text_not_in_page(self, text, page):
"""判断文本在页面中不存在,支持多个文本"""
<|body_1|>
def assert_text_in_elem(self, text, elem, mode='vague'):
"""判断元素包含文本,支持多个... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseAssert:
def assert_text_in_page(self, text, page):
"""判断文本在页面中存在,支持多个文本"""
if not isinstance(text, list):
text = [text]
for i in text:
assert_that(page).contains(i)
def assert_text_not_in_page(self, text, page):
"""判断文本在页面中不存在,支持多个文本"""
... | the_stack_v2_python_sparse | uiplatform/utils/common/BaseAssert.py | abao0713/erybjp | train | 0 | |
f972adbfb2fa76dc04b8297f6b35a36bb28b9a6b | [
"sensor = RedisSensor(self.mudpi, config)\nif sensor:\n sensor.connect(self.extension.connections[config['connection']])\n self.add_component(sensor)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('key'):\n raise ConfigError('Missing ... | <|body_start_0|>
sensor = RedisSensor(self.mudpi, config)
if sensor:
sensor.connect(self.extension.connections[config['connection']])
self.add_component(sensor)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [con... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load redis sensor component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the redis sensor config"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sensor = RedisSensor(self.mudpi, config)
... | stack_v2_sparse_classes_36k_train_013631 | 5,513 | permissive | [
{
"docstring": "Load redis sensor component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the redis sensor config",
"name": "validate",
"signature": "def validate(self, config)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002262 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load redis sensor component from configs
- def validate(self, config): Validate the redis sensor config | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load redis sensor component from configs
- def validate(self, config): Validate the redis sensor config
<|skeleton|>
class Interface:
def load(sel... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load redis sensor component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the redis sensor config"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Interface:
def load(self, config):
"""Load redis sensor component from configs"""
sensor = RedisSensor(self.mudpi, config)
if sensor:
sensor.connect(self.extension.connections[config['connection']])
self.add_component(sensor)
return True
def validat... | the_stack_v2_python_sparse | mudpi/extensions/redis/sensor.py | mistasp0ck/mudpi-core | train | 0 | |
78f64cda48389cade2691dcb55c09af8a9b7d185 | [
"memory = psutil.virtual_memory()\ndisk = psutil.disk_usage('/')\nstatus = {'cpu': self.get_average_cpu(), 'memory': {'total': memory.total, 'available': memory.available, 'percent': memory.percent, 'used': memory.used, 'free': memory.free}, 'disk': {'total': disk.total, 'used': disk.used, 'free': disk.free, 'perce... | <|body_start_0|>
memory = psutil.virtual_memory()
disk = psutil.disk_usage('/')
status = {'cpu': self.get_average_cpu(), 'memory': {'total': memory.total, 'available': memory.available, 'percent': memory.percent, 'used': memory.used, 'free': memory.free}, 'disk': {'total': disk.total, 'used': di... | Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage. | NodeStatus | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeStatus:
"""Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage."""
def get(self):
"""Returns the currant hardware usage of the node. :return: a json object with the current hardware usage of the node."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_013632 | 1,402 | permissive | [
{
"docstring": "Returns the currant hardware usage of the node. :return: a json object with the current hardware usage of the node.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Helper method to get an average cpu usage. :param loops: the number of iterations to sum up the ava... | 2 | null | Implement the Python class `NodeStatus` described below.
Class description:
Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage.
Method signatures and docstrings:
- def get(self): Returns the currant hardware usage of the node. :return: a json object with the cu... | Implement the Python class `NodeStatus` described below.
Class description:
Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage.
Method signatures and docstrings:
- def get(self): Returns the currant hardware usage of the node. :return: a json object with the cu... | d3f07d9d161d97ec2c19f66167dfb26eb9c6e616 | <|skeleton|>
class NodeStatus:
"""Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage."""
def get(self):
"""Returns the currant hardware usage of the node. :return: a json object with the current hardware usage of the node."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NodeStatus:
"""Give information about the current hardware usage of the node. This includes the cpu, memory and disk usage."""
def get(self):
"""Returns the currant hardware usage of the node. :return: a json object with the current hardware usage of the node."""
memory = psutil.virtual_m... | the_stack_v2_python_sparse | motey/communication/api_routes/nodestatus.py | Neoklosch/Motey | train | 0 |
9749640fcda24434b223602f0cfbe2dcc4ab07f7 | [
"assert isinstance(wrapper, ForwardWrapperBase)\nassert isinstance(self.container_type, Container)\ncontainer_tmp_var = wrapper.declarations.declare_variable(self.container_type.full_name, self.name + '_value', self.default_value)\nif self.direction & Parameter.DIRECTION_IN:\n wrapper.parse_params.add_parameter(... | <|body_start_0|>
assert isinstance(wrapper, ForwardWrapperBase)
assert isinstance(self.container_type, Container)
container_tmp_var = wrapper.declarations.declare_variable(self.container_type.full_name, self.name + '_value', self.default_value)
if self.direction & Parameter.DIRECTION_IN:... | Container handlers | ContainerRefParameter | [
"LGPL-2.1-only",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
<|body_0|>
def convert_c_to_python(self, wrapper):
"""Write some code before calling the Python method."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_013633 | 34,197 | permissive | [
{
"docstring": "parses python args to get C++ value",
"name": "convert_python_to_c",
"signature": "def convert_python_to_c(self, wrapper)"
},
{
"docstring": "Write some code before calling the Python method.",
"name": "convert_c_to_python",
"signature": "def convert_c_to_python(self, wra... | 2 | null | Implement the Python class `ContainerRefParameter` described below.
Class description:
Container handlers
Method signatures and docstrings:
- def convert_python_to_c(self, wrapper): parses python args to get C++ value
- def convert_c_to_python(self, wrapper): Write some code before calling the Python method. | Implement the Python class `ContainerRefParameter` described below.
Class description:
Container handlers
Method signatures and docstrings:
- def convert_python_to_c(self, wrapper): parses python args to get C++ value
- def convert_c_to_python(self, wrapper): Write some code before calling the Python method.
<|skele... | cbedcf671ba19fded26e4776c0e068f81f068dfd | <|skeleton|>
class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
<|body_0|>
def convert_c_to_python(self, wrapper):
"""Write some code before calling the Python method."""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContainerRefParameter:
"""Container handlers"""
def convert_python_to_c(self, wrapper):
"""parses python args to get C++ value"""
assert isinstance(wrapper, ForwardWrapperBase)
assert isinstance(self.container_type, Container)
container_tmp_var = wrapper.declarations.decla... | the_stack_v2_python_sparse | ns3/pybindgen-0.17.0.post57+nga6376f2/pybindgen/container.py | cyliustack/clusim | train | 7 |
ecf8987c17870b9818691d5a1434b9bb6c143743 | [
"user_id = request._request.uid\nwhich_model = Article if request.data.get('type', '') == 'article' else ArticleComment\nwhich_object = which_model.objects.filter(pk=request.data.get('id', None)).first()\nif not which_object:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nvalue = request.data.get... | <|body_start_0|>
user_id = request._request.uid
which_model = Article if request.data.get('type', '') == 'article' else ArticleComment
which_object = which_model.objects.filter(pk=request.data.get('id', None)).first()
if not which_object:
return self.error(errorcode.MSG_NO_DA... | VoteView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VoteView:
def post(self, request):
"""文章及其评论的投票"""
<|body_0|>
def delete(self, request):
"""撤销投票"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user_id = request._request.uid
which_model = Article if request.data.get('type', '') == 'article... | stack_v2_sparse_classes_36k_train_013634 | 12,861 | no_license | [
{
"docstring": "文章及其评论的投票",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "撤销投票",
"name": "delete",
"signature": "def delete(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001084 | Implement the Python class `VoteView` described below.
Class description:
Implement the VoteView class.
Method signatures and docstrings:
- def post(self, request): 文章及其评论的投票
- def delete(self, request): 撤销投票 | Implement the Python class `VoteView` described below.
Class description:
Implement the VoteView class.
Method signatures and docstrings:
- def post(self, request): 文章及其评论的投票
- def delete(self, request): 撤销投票
<|skeleton|>
class VoteView:
def post(self, request):
"""文章及其评论的投票"""
<|body_0|>
d... | 6a68fb207f43e5ed65299cc08535b35d5e934ead | <|skeleton|>
class VoteView:
def post(self, request):
"""文章及其评论的投票"""
<|body_0|>
def delete(self, request):
"""撤销投票"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VoteView:
def post(self, request):
"""文章及其评论的投票"""
user_id = request._request.uid
which_model = Article if request.data.get('type', '') == 'article' else ArticleComment
which_object = which_model.objects.filter(pk=request.data.get('id', None)).first()
if not which_objec... | the_stack_v2_python_sparse | apps/articles/views.py | Slowhalfframe/fanyijiang-API | train | 0 | |
b19cefc65c5b687d35d4d270965177846ffabd80 | [
"self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 3\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_allowed = 3\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.score_scale = 1.5\nself.initialize_dynamic_... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullet_allowed = 3
self.fleet_drop_speed = 10... | 存储游戏所有的设置的类 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储游戏所有的设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化游戏动态设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置和外星人点数"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_013635 | 1,505 | no_license | [
{
"docstring": "初始化游戏的静态设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化游戏动态设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置和外星人点数",
"name": "increase_speed",
"signa... | 3 | null | Implement the Python class `Settings` described below.
Class description:
存储游戏所有的设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化游戏动态设置
- def increase_speed(self): 提高速度设置和外星人点数 | Implement the Python class `Settings` described below.
Class description:
存储游戏所有的设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化游戏动态设置
- def increase_speed(self): 提高速度设置和外星人点数
<|skeleton|>
class Settings:
"""存储游戏所有的设置的类"""
def __init__(sel... | 968913d7b8b3baba2b755d9edcdacef850ab4b61 | <|skeleton|>
class Settings:
"""存储游戏所有的设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化游戏动态设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置和外星人点数"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Settings:
"""存储游戏所有的设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60, 60,... | the_stack_v2_python_sparse | PythonCrashCourse/alien_invasion/settings.py | joyc/python-book-test | train | 0 |
efb428d9486bdb290b34d883d07553d1290bad10 | [
"numOfDec = 0\nfor i in range(-len(nums) + 1, len(nums)):\n if nums[i] < nums[i - 1]:\n numOfDec += 1\nreturn numOfDec <= 2",
"numOfDec = 0\nfor i in range(len(nums)):\n if nums[i - 1] > nums[i]:\n numOfDec += 1\nreturn numOfDec < 2"
] | <|body_start_0|>
numOfDec = 0
for i in range(-len(nums) + 1, len(nums)):
if nums[i] < nums[i - 1]:
numOfDec += 1
return numOfDec <= 2
<|end_body_0|>
<|body_start_1|>
numOfDec = 0
for i in range(len(nums)):
if nums[i - 1] > nums[i]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def check(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def check2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
numOfDec = 0
for i in range(-len(nums) + 1, le... | stack_v2_sparse_classes_36k_train_013636 | 1,251 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "check",
"signature": "def check(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "check2",
"signature": "def check2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def check(self, nums): :type nums: List[int] :rtype: bool
- def check2(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def check(self, nums): :type nums: List[int] :rtype: bool
- def check2(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
def check(self, nums):
... | 813235789ce422a3bab198317aafc46fbc61625e | <|skeleton|>
class Solution:
def check(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def check2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def check(self, nums):
""":type nums: List[int] :rtype: bool"""
numOfDec = 0
for i in range(-len(nums) + 1, len(nums)):
if nums[i] < nums[i - 1]:
numOfDec += 1
return numOfDec <= 2
def check2(self, nums):
""":type nums: List[in... | the_stack_v2_python_sparse | 0.LIST AND ARRAY/1752_check_if_arrayIs_sorted_and_rotated/solution.py | kimmyoo/python_leetcode | train | 1 | |
0aef07203a53d9eaea9c9d881dcf14a762ff705d | [
"lookup = {}\nfor i, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target - num], i]\n lookup[num] = i",
"for i in nums:\n j = target - i\n tmp_nums_start_index = nums.index(i) + 1\n tmp_nums = nums[tmp_nums_start_index:]\n if j in tmp_nums:\n return [nums.i... | <|body_start_0|>
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
lookup[num] = i
<|end_body_0|>
<|body_start_1|>
for i in nums:
j = target - i
tmp_nums_start_index = nums.index... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_013637 | 781 | permissive | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum2",
"signature": "def twoSum2(self, nums, target)"
}... | 2 | stack_v2_sparse_classes_30k_train_005434 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | 4dc4e6642dc92f1983c13564cc0fd99917cab358 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
lookup[num] = i
def twoSum2(self... | the_stack_v2_python_sparse | Python/two-sum.py | kamyu104/LeetCode-Solutions | train | 4,549 | |
d314f685918c37a844c43fd4fdd339feef147c8d | [
"if not root:\n return ''\nstack = []\nnode = root\nans = []\nwhile node or stack:\n if node:\n ans.append(str(node.val))\n stack.append(node)\n node = node.left\n if not node:\n ans.append('null')\n else:\n node = stack.pop()\n node = node.right\n ... | <|body_start_0|>
if not root:
return ''
stack = []
node = root
ans = []
while node or stack:
if node:
ans.append(str(node.val))
stack.append(node)
node = node.left
if not node:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_013638 | 1,925 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | d506e07f9ce5a5e1506fe88ddf94dc7c54d35bcd | <|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 not root:
return ''
stack = []
node = root
ans = []
while node or stack:
if node:
ans.append(str(node.val))
... | the_stack_v2_python_sparse | 297_2.py | michaelhuo/pcp | train | 0 | |
146045f608202ad676bb0d6d9db814b5412bbf98 | [
"domains = list(self._client.list())\nif check:\n assert_that(domains, is_not(empty()))\nreturn domains",
"domain = self._client.find(name=name)\nif check:\n assert_that(domain.name, equal_to(name))\nreturn domain",
"domain = self._client.create(domain_name)\nif check:\n self.check_domain_presence(doma... | <|body_start_0|>
domains = list(self._client.list())
if check:
assert_that(domains, is_not(empty()))
return domains
<|end_body_0|>
<|body_start_1|>
domain = self._client.find(name=name)
if check:
assert_that(domain.name, equal_to(name))
return dom... | Domain steps. | DomainSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomainSteps:
"""Domain steps."""
def get_domains(self, check=True):
"""Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains"""
<|body_0|>
def get_domain(self, name, check=True):
"""Step to find domai... | stack_v2_sparse_classes_36k_train_013639 | 3,368 | no_license | [
{
"docstring": "Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains",
"name": "get_domains",
"signature": "def get_domains(self, check=True)"
},
{
"docstring": "Step to find domain. Args: name (str) - domain name Raises: NotFound: ... | 5 | null | Implement the Python class `DomainSteps` described below.
Class description:
Domain steps.
Method signatures and docstrings:
- def get_domains(self, check=True): Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains
- def get_domain(self, name, check=True... | Implement the Python class `DomainSteps` described below.
Class description:
Domain steps.
Method signatures and docstrings:
- def get_domains(self, check=True): Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains
- def get_domain(self, name, check=True... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class DomainSteps:
"""Domain steps."""
def get_domains(self, check=True):
"""Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains"""
<|body_0|>
def get_domain(self, name, check=True):
"""Step to find domai... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DomainSteps:
"""Domain steps."""
def get_domains(self, check=True):
"""Step to get domains. Args: check (bool): flag whether to check step or not Returns: list of objects: list of domains"""
domains = list(self._client.list())
if check:
assert_that(domains, is_not(empt... | the_stack_v2_python_sparse | stepler/keystone/steps/domains.py | Mirantis/stepler | train | 16 |
d5248ef4b524621538e7af886947d13b71a01b66 | [
"self.c_i = c_i\nself.x_steps = x_steps\nself.x_baseline = x_baseline\nloss_c = model.output[0][c_i]\ngrad_symbolic = K.gradients(loss_c, model.input)[0]\nself.iterate = K.function([model.input], grad_symbolic)\nself.multiByImBaseline = multiByImBaseline",
"self.Net = Net\nif self.x_baseline is None:\n self.x_... | <|body_start_0|>
self.c_i = c_i
self.x_steps = x_steps
self.x_baseline = x_baseline
loss_c = model.output[0][c_i]
grad_symbolic = K.gradients(loss_c, model.input)[0]
self.iterate = K.function([model.input], grad_symbolic)
self.multiByImBaseline = multiByImBaseline... | IntegratedGradient | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntegratedGradient:
def __init__(self, model, c_i, x_baseline=None, x_steps=50, multiByImBaseline=False):
"""Define the Integradted Mask class to return the smooth grad mask model : the deep model used Args: model : the deep model used c_i : the index of the class concerned x_baseline: B... | stack_v2_sparse_classes_36k_train_013640 | 9,618 | no_license | [
{
"docstring": "Define the Integradted Mask class to return the smooth grad mask model : the deep model used Args: model : the deep model used c_i : the index of the class concerned x_baseline: Baseline value used in integration. Defaults to 0. x_steps: Number of integrated steps between baseline and x. A Salie... | 2 | stack_v2_sparse_classes_30k_train_015866 | Implement the Python class `IntegratedGradient` described below.
Class description:
Implement the IntegratedGradient class.
Method signatures and docstrings:
- def __init__(self, model, c_i, x_baseline=None, x_steps=50, multiByImBaseline=False): Define the Integradted Mask class to return the smooth grad mask model :... | Implement the Python class `IntegratedGradient` described below.
Class description:
Implement the IntegratedGradient class.
Method signatures and docstrings:
- def __init__(self, model, c_i, x_baseline=None, x_steps=50, multiByImBaseline=False): Define the Integradted Mask class to return the smooth grad mask model :... | 60da35f58ffe9e24e99b6b20dd7a46b02815ad79 | <|skeleton|>
class IntegratedGradient:
def __init__(self, model, c_i, x_baseline=None, x_steps=50, multiByImBaseline=False):
"""Define the Integradted Mask class to return the smooth grad mask model : the deep model used Args: model : the deep model used c_i : the index of the class concerned x_baseline: B... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IntegratedGradient:
def __init__(self, model, c_i, x_baseline=None, x_steps=50, multiByImBaseline=False):
"""Define the Integradted Mask class to return the smooth grad mask model : the deep model used Args: model : the deep model used c_i : the index of the class concerned x_baseline: Baseline value ... | the_stack_v2_python_sparse | Classif_Paintings/saliencyMaps.py | ngonthier/Icono_Art_Analysis | train | 2 | |
93fa287d8e673dd274278ef31673bb2cdb52b300 | [
"base.Action.__init__(self, self.__loadAtlas)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__frame = frame",
"if len(atlases.listAtlases()) == 0:\n atlases.rescanAtlases()\nloadAtlas(self.__frame)"
] | <|body_start_0|>
base.Action.__init__(self, self.__loadAtlas)
self.__overlayList = overlayList
self.__displayCtx = displayCtx
self.__frame = frame
<|end_body_0|>
<|body_start_1|>
if len(atlases.listAtlases()) == 0:
atlases.rescanAtlases()
loadAtlas(self.__fra... | The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`. | LoadAtlasAction | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadAtlasAction:
"""The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`."""
def __init__(self, overlayList, displayCtx, frame):
... | stack_v2_sparse_classes_36k_train_013641 | 2,121 | permissive | [
{
"docstring": "Create a ``LoadAtlasAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.",
"name": "__init__",
"signature": "def __init__(self, overlayList, displayCtx, frame)"
},
{
"docstring": "Calls the :... | 2 | stack_v2_sparse_classes_30k_train_019134 | Implement the Python class `LoadAtlasAction` described below.
Class description:
The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`.
Method signatures and docstr... | Implement the Python class `LoadAtlasAction` described below.
Class description:
The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`.
Method signatures and docstr... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class LoadAtlasAction:
"""The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`."""
def __init__(self, overlayList, displayCtx, frame):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadAtlasAction:
"""The ``LoadAtlasAction`` prompts the user to select a FSL atlas specification file. This file is then passed to the :func:`.fsl.data.atlases.addAtlas` function, to add the atlas to the :class:`.AtlasRegistry`."""
def __init__(self, overlayList, displayCtx, frame):
"""Create a `... | the_stack_v2_python_sparse | fsleyes/actions/loadatlas.py | sanjayankur31/fsleyes | train | 1 |
be263f3855d4087a13aacdfc1243b523a7180875 | [
"if root is None:\n return True\nreturn self.__is_mirror(root.left, root.right)",
"if left is None and right is None:\n return True\nelif left is None or right is None:\n return False\nif left.val == right.val and self.__is_mirror(left.left, right.right) and self.__is_mirror(left.right, right.left):\n ... | <|body_start_0|>
if root is None:
return True
return self.__is_mirror(root.left, root.right)
<|end_body_0|>
<|body_start_1|>
if left is None and right is None:
return True
elif left is None or right is None:
return False
if left.val == right.v... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:"""
<|body_0|>
def __is_mirror(self, left: TreeNode, right: TreeNode) -> bool:
"""检查两个树是否镜像对象 :param left: :param right: :return:"""
... | stack_v2_sparse_classes_36k_train_013642 | 1,260 | no_license | [
{
"docstring": "思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root: TreeNode) -> bool"
},
{
"docstring": "检查两个树是否镜像对象 :param left: :param right: :return:",
"name": "__is_mirror",
"signature": "def __i... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root: TreeNode) -> bool: 思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:
- def __is_mirror(self, left: TreeNode, right: TreeNode) -... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root: TreeNode) -> bool: 思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:
- def __is_mirror(self, left: TreeNode, right: TreeNode) -... | 6708479302cca3ea3d930e6e80264f213ea29c5f | <|skeleton|>
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:"""
<|body_0|>
def __is_mirror(self, left: TreeNode, right: TreeNode) -> bool:
"""检查两个树是否镜像对象 :param left: :param right: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""思路: 1、镜像对称 => 根节点相同 2、左子树跟右子树镜像对称 3、[单独镜像对称] => 递归 :param root: :return:"""
if root is None:
return True
return self.__is_mirror(root.left, root.right)
def __is_mirror(self, left: TreeNode, right: TreeNode) ->... | the_stack_v2_python_sparse | Python/二叉树/Easy/leetcode_101.py | Gyczero/Leetcode_practice | train | 0 | |
d2c68330bbd2e9caab17bb0960cfc315aad6a439 | [
"def helper(nums, target, L, R):\n if R < L:\n return -1\n else:\n mid = (L + R) // 2\n if target == nums[mid]:\n return mid\n elif target > nums[mid]:\n return helper(nums, target, mid + 1, R)\n else:\n return helper(nums, target, L, mid - 1... | <|body_start_0|>
def helper(nums, target, L, R):
if R < L:
return -1
else:
mid = (L + R) // 2
if target == nums[mid]:
return mid
elif target > nums[mid]:
return helper(nums, target, mi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search_v1(self, nums: List[int], target: int):
"""Recursion."""
<|body_0|>
def search_v2(self, nums: List[int], target: int):
"""Loop."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def helper(nums, target, L, R):
if R < L... | stack_v2_sparse_classes_36k_train_013643 | 2,080 | no_license | [
{
"docstring": "Recursion.",
"name": "search_v1",
"signature": "def search_v1(self, nums: List[int], target: int)"
},
{
"docstring": "Loop.",
"name": "search_v2",
"signature": "def search_v2(self, nums: List[int], target: int)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search_v1(self, nums: List[int], target: int): Recursion.
- def search_v2(self, nums: List[int], target: int): Loop. | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search_v1(self, nums: List[int], target: int): Recursion.
- def search_v2(self, nums: List[int], target: int): Loop.
<|skeleton|>
class Solution:
def search_v1(self, nu... | 97a2386f5e3adbd7138fd123810c3232bdf7f622 | <|skeleton|>
class Solution:
def search_v1(self, nums: List[int], target: int):
"""Recursion."""
<|body_0|>
def search_v2(self, nums: List[int], target: int):
"""Loop."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def search_v1(self, nums: List[int], target: int):
"""Recursion."""
def helper(nums, target, L, R):
if R < L:
return -1
else:
mid = (L + R) // 2
if target == nums[mid]:
return mid
... | the_stack_v2_python_sparse | python3/sorting_and_search/binary_search.py | victorchu/algorithms | train | 0 | |
657893acf92692cc4b3de5707d3ad983154575a9 | [
"super().__init__(game, pos)\nself.image = self.game.imageLoader.item_img['heart']\nself.rect = self.image.get_rect()\nself.rect.center = self.pos\nself.hit_rect = self.rect",
"self.player.hp += 1\nself.game.soundLoader.get['heart'].play()\nsuper().collect()"
] | <|body_start_0|>
super().__init__(game, pos)
self.image = self.game.imageLoader.item_img['heart']
self.rect = self.image.get_rect()
self.rect.center = self.pos
self.hit_rect = self.rect
<|end_body_0|>
<|body_start_1|>
self.player.hp += 1
self.game.soundLoader.get... | This class is derived from ItemDrop class and contains settings for a dropped heart item. | heart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
... | stack_v2_sparse_classes_36k_train_013644 | 7,384 | no_license | [
{
"docstring": "__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y).",
"name": "__init__",
"signature": "def __init__(self, game, pos)"
},
{
"docstring": "heart class method to update after heart is collect... | 2 | stack_v2_sparse_classes_30k_train_008331 | Implement the Python class `heart` described below.
Class description:
This class is derived from ItemDrop class and contains settings for a dropped heart item.
Method signatures and docstrings:
- def __init__(self, game, pos): __init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. ... | Implement the Python class `heart` described below.
Class description:
This class is derived from ItemDrop class and contains settings for a dropped heart item.
Method signatures and docstrings:
- def __init__(self, game, pos): __init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. ... | 74524cd52988c4c3f720150a418ff283a8d05683 | <|skeleton|>
class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
super(... | the_stack_v2_python_sparse | Item.py | ImpulseLimited/momentus-proto | train | 0 |
f8b8ccda281ad161e3ecfb925c98a2e0f3bf53b1 | [
"self._id = _id\nself.name = name\nself.active_doc = active_doc\nself.context = context\nself.docs = docs",
"active_doc = None\nif self.active_doc is not None:\n active_doc = self.active_doc.to_dict(raw=False, with_details=True)\ndoclist = []\nfor doc in self.docs:\n doclist.append(doc.to_dict(raw=False, wi... | <|body_start_0|>
self._id = _id
self.name = name
self.active_doc = active_doc
self.context = context
self.docs = docs
<|end_body_0|>
<|body_start_1|>
active_doc = None
if self.active_doc is not None:
active_doc = self.active_doc.to_dict(raw=False, wit... | Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument). | ArthurProject | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArthurProject:
"""Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument)."""
def __init__(self, name='',... | stack_v2_sparse_classes_36k_train_013645 | 3,250 | permissive | [
{
"docstring": "Initializes ArthurProject instance. Args: name: Name of project. active_doc(ArthurDocument): Currently active document. context(str): Context associated with this project. _id(ObjectId): ID of this project (for database keeping). # docs: List of ArthurDocuments.",
"name": "__init__",
"si... | 4 | stack_v2_sparse_classes_30k_train_002532 | Implement the Python class `ArthurProject` described below.
Class description:
Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocumen... | Implement the Python class `ArthurProject` described below.
Class description:
Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocumen... | 7a581104141ee5f556e058b1276b4087a2921dfc | <|skeleton|>
class ArthurProject:
"""Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument)."""
def __init__(self, name='',... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArthurProject:
"""Object that wraps up an Arthur project. This is the server counterpart of js model's Project (and other models contained by it respectively e.g. ActiveDoc for this object's :attr:`active_doc` attribute, which is an instance of ArthurDocument)."""
def __init__(self, name='', active_doc=N... | the_stack_v2_python_sparse | libs/arthur/project.py | jaycode/Arthur.workspace | train | 0 |
6f97c9fe59b491b3f585e4695249f63f1543559a | [
"super().__init__(n_head, n_feat, dropout_rate)\nself.zero_triu = zero_triu\nself.linear_pos = nn.Linear(n_feat, n_feat, bias=False)\nself.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))\nself.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))\ntorch.nn.init.xavier_uniform_(self.pos_bias_u)\ntorch.... | <|body_start_0|>
super().__init__(n_head, n_feat, dropout_rate)
self.zero_triu = zero_triu
self.linear_pos = nn.Linear(n_feat, n_feat, bias=False)
self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))
self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))
... | Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. zero_triu (bool): Wheth... | LegacyRelPositionMultiHeadedAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LegacyRelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of feat... | stack_v2_sparse_classes_36k_train_013646 | 11,646 | permissive | [
{
"docstring": "Construct an RelPositionMultiHeadedAttention object.",
"name": "__init__",
"signature": "def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False)"
},
{
"docstring": "Compute relative positional encoding. Args: x (torch.Tensor): Input tensor (batch, head, time1, time2). R... | 3 | null | Implement the Python class `LegacyRelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of ... | Implement the Python class `LegacyRelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of ... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class LegacyRelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of feat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LegacyRelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transformer/attention.py | espnet/espnet | train | 7,242 |
e3a2d2eaf94301e359d8afbdb2790424dce14718 | [
"if 'id' in request.GET:\n project_id = 'new_app:exlottery:%s' % request.GET.get('related_page_id', 0)\n try:\n exlottery = app_models.Exlottery.objects.get(id=request.GET['id'])\n except:\n c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'second_navs': mall_export.get_promotion_and... | <|body_start_0|>
if 'id' in request.GET:
project_id = 'new_app:exlottery:%s' % request.GET.get('related_page_id', 0)
try:
exlottery = app_models.Exlottery.objects.get(id=request.GET['id'])
except:
c = RequestContext(request, {'first_nav_name': ... | Exlottery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exlottery:
def get(request):
"""响应GET"""
<|body_0|>
def api_put(request):
"""响应PUT"""
<|body_1|>
def api_post(request):
"""响应POST"""
<|body_2|>
def api_delete(request):
"""响应DELETE"""
<|body_3|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_013647 | 5,096 | no_license | [
{
"docstring": "响应GET",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "响应PUT",
"name": "api_put",
"signature": "def api_put(request)"
},
{
"docstring": "响应POST",
"name": "api_post",
"signature": "def api_post(request)"
},
{
"docstring": "响应DELET... | 4 | null | Implement the Python class `Exlottery` described below.
Class description:
Implement the Exlottery class.
Method signatures and docstrings:
- def get(request): 响应GET
- def api_put(request): 响应PUT
- def api_post(request): 响应POST
- def api_delete(request): 响应DELETE | Implement the Python class `Exlottery` described below.
Class description:
Implement the Exlottery class.
Method signatures and docstrings:
- def get(request): 响应GET
- def api_put(request): 响应PUT
- def api_post(request): 响应POST
- def api_delete(request): 响应DELETE
<|skeleton|>
class Exlottery:
def get(request):
... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class Exlottery:
def get(request):
"""响应GET"""
<|body_0|>
def api_put(request):
"""响应PUT"""
<|body_1|>
def api_post(request):
"""响应POST"""
<|body_2|>
def api_delete(request):
"""响应DELETE"""
<|body_3|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Exlottery:
def get(request):
"""响应GET"""
if 'id' in request.GET:
project_id = 'new_app:exlottery:%s' % request.GET.get('related_page_id', 0)
try:
exlottery = app_models.Exlottery.objects.get(id=request.GET['id'])
except:
c = R... | the_stack_v2_python_sparse | weapp/apps/customerized_apps/exlottery/exlottery.py | chengdg/weizoom | train | 1 | |
c8e603f6b43399cc855cdcd85f745a157135b6a7 | [
"if not head:\n return False\nslow = head\nfast = head.next\nwhile fast:\n if slow.val == fast.val:\n return True\n if not fast.next:\n break\n slow = slow.next\n fast = fast.next\nreturn False",
"if not head:\n return False\nwhile head:\n if head.val == 'sb':\n return Tr... | <|body_start_0|>
if not head:
return False
slow = head
fast = head.next
while fast:
if slow.val == fast.val:
return True
if not fast.next:
break
slow = slow.next
fast = fast.next
return Fa... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值"""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_013648 | 1,322 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值",
"name": "hasCycle1",
"signatu... | 2 | stack_v2_sparse_classes_30k_test_000898 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环
- def hasCycle1(self, head): :type head: ListNode :rtype... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环
- def hasCycle1(self, head): :type head: ListNode :rtype... | a3a1556abc5adb9325de54d64f9814e64b96db0f | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool 骚解法: 将头节点定义成一个固定值,判断是否会再遇到这个值"""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool 定义快慢指针 快指针走一步 慢指针走两步 如果两个指针指向同一节点,说明有环(相遇) 如果快指针走到头没有相遇,说明没有环"""
if not head:
return False
slow = head
fast = head.next
while fast:
if slow.val == fast.val:
... | the_stack_v2_python_sparse | DSD/linke_list/hascycle.py | BigerWANG/geek_algorithm | train | 0 | |
67b7e27747d56a06758c079e8c42866fc1f3abf3 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | LocalStorageServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listLocalStorage(self, request, context):
"""Storage"""
<|body_0|>
def getLocalStorage(self, request, context):
"""Missing associated documentation comment in .proto f... | stack_v2_sparse_classes_36k_train_013649 | 9,909 | permissive | [
{
"docstring": "Storage",
"name": "listLocalStorage",
"signature": "def listLocalStorage(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getLocalStorage",
"signature": "def getLocalStorage(self, request, context)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_001100 | Implement the Python class `LocalStorageServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def listLocalStorage(self, request, context): Storage
- def getLocalStorage(self, request, context): Missing associated documentatio... | Implement the Python class `LocalStorageServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def listLocalStorage(self, request, context): Storage
- def getLocalStorage(self, request, context): Missing associated documentatio... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class LocalStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listLocalStorage(self, request, context):
"""Storage"""
<|body_0|>
def getLocalStorage(self, request, context):
"""Missing associated documentation comment in .proto f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalStorageServiceServicer:
"""Missing associated documentation comment in .proto file."""
def listLocalStorage(self, request, context):
"""Storage"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError(... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/local/LocalStorageService_pb2_grpc.py | apache/airavata-mft | train | 23 |
640a387a08a022c98fdb7b8b5ae6a1f0e44d4ced | [
"if root is None:\n return 0\nreturn 1 + max(self.getHeight(root.left), self.getHeight(root.right))",
"if root is None:\n return 0\nlheight = self.getHeight(root.left)\nrheight = self.getHeight(root.right)\nldiameter = self.diameterOfBinaryTree(root.left)\nrdiameter = self.diameterOfBinaryTree(root.right)\n... | <|body_start_0|>
if root is None:
return 0
return 1 + max(self.getHeight(root.left), self.getHeight(root.right))
<|end_body_0|>
<|body_start_1|>
if root is None:
return 0
lheight = self.getHeight(root.left)
rheight = self.getHeight(root.right)
ldi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getHeight(self, root):
""":type root : TreeNode :rtype: int"""
<|body_0|>
def diameterOfBinaryTree(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
return 0
... | stack_v2_sparse_classes_36k_train_013650 | 1,124 | no_license | [
{
"docstring": ":type root : TreeNode :rtype: int",
"name": "getHeight",
"signature": "def getHeight(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "diameterOfBinaryTree",
"signature": "def diameterOfBinaryTree(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003538 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getHeight(self, root): :type root : TreeNode :rtype: int
- def diameterOfBinaryTree(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getHeight(self, root): :type root : TreeNode :rtype: int
- def diameterOfBinaryTree(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def getHe... | 9752533bc76ce5ecb881f61e33a3bc4b20dcf666 | <|skeleton|>
class Solution:
def getHeight(self, root):
""":type root : TreeNode :rtype: int"""
<|body_0|>
def diameterOfBinaryTree(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getHeight(self, root):
""":type root : TreeNode :rtype: int"""
if root is None:
return 0
return 1 + max(self.getHeight(root.left), self.getHeight(root.right))
def diameterOfBinaryTree(self, root):
""":type root: TreeNode :rtype: int"""
if ... | the_stack_v2_python_sparse | 543. Diameter of Binary Tree/543. Diameter of Binary Tree.py | 603lzy/LeetCode | train | 3 | |
c72252db737a7f07b77a9f9649a0309ad9367ae0 | [
"if self.end_date_field is None:\n raise ImproperlyConfigured('%s.end_date_field is required.' % self.__class__.__name__)\nreturn self.end_date_field",
"if self.uses_datetime_field:\n value = datetime.datetime.combine(value, datetime.time.min)\n if settings.USE_TZ:\n value = timezone.make_aware(va... | <|body_start_0|>
if self.end_date_field is None:
raise ImproperlyConfigured('%s.end_date_field is required.' % self.__class__.__name__)
return self.end_date_field
<|end_body_0|>
<|body_start_1|>
if self.uses_datetime_field:
value = datetime.datetime.combine(value, dateti... | Mixin class for views manipulating date-based data. | DateRangeMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateRangeMixin:
"""Mixin class for views manipulating date-based data."""
def get_end_date_field(self):
"""Get the name of the end date field to be used to filter by."""
<|body_0|>
def _make_date_lookup_arg(self, value):
"""Convert a date into a datetime when the... | stack_v2_sparse_classes_36k_train_013651 | 18,709 | permissive | [
{
"docstring": "Get the name of the end date field to be used to filter by.",
"name": "get_end_date_field",
"signature": "def get_end_date_field(self)"
},
{
"docstring": "Convert a date into a datetime when the date field is a DateTimeField. When time zone support is enabled, `date` is assumed t... | 3 | stack_v2_sparse_classes_30k_val_000062 | Implement the Python class `DateRangeMixin` described below.
Class description:
Mixin class for views manipulating date-based data.
Method signatures and docstrings:
- def get_end_date_field(self): Get the name of the end date field to be used to filter by.
- def _make_date_lookup_arg(self, value): Convert a date int... | Implement the Python class `DateRangeMixin` described below.
Class description:
Mixin class for views manipulating date-based data.
Method signatures and docstrings:
- def get_end_date_field(self): Get the name of the end date field to be used to filter by.
- def _make_date_lookup_arg(self, value): Convert a date int... | 88059b53a10fdce960442fcfd7470fded4cabb19 | <|skeleton|>
class DateRangeMixin:
"""Mixin class for views manipulating date-based data."""
def get_end_date_field(self):
"""Get the name of the end date field to be used to filter by."""
<|body_0|>
def _make_date_lookup_arg(self, value):
"""Convert a date into a datetime when the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DateRangeMixin:
"""Mixin class for views manipulating date-based data."""
def get_end_date_field(self):
"""Get the name of the end date field to be used to filter by."""
if self.end_date_field is None:
raise ImproperlyConfigured('%s.end_date_field is required.' % self.__class_... | the_stack_v2_python_sparse | shared/utils/views/daterange.py | sha-red/django-shared-utils | train | 0 |
918a37840139cef6422aa5776aab59600109422a | [
"self.kernel = kernel\nself.prototype_points = prototype_points\nself.weights = weights",
"n = X.shape[0]\nd = X.shape[1]\nr = self.prototype_points.shape[0]\nfx = np.zeros(n)\nk = self.kernel(X, self.prototype_points)\nfor j in range(n):\n val = 0\n for i in range(r):\n val = val + self.weights[i] *... | <|body_start_0|>
self.kernel = kernel
self.prototype_points = prototype_points
self.weights = weights
<|end_body_0|>
<|body_start_1|>
n = X.shape[0]
d = X.shape[1]
r = self.prototype_points.shape[0]
fx = np.zeros(n)
k = self.kernel(X, self.prototype_point... | Kernel_Machine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kernel_Machine:
def __init__(self, kernel, prototype_points, weights):
"""Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k prototype_points - an Rxd matrix with rows mu_1,...,mu_R weights - a vector of length R with entries w_... | stack_v2_sparse_classes_36k_train_013652 | 6,621 | no_license | [
{
"docstring": "Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k prototype_points - an Rxd matrix with rows mu_1,...,mu_R weights - a vector of length R with entries w_1,...,w_R",
"name": "__init__",
"signature": "def __init__(self, kernel, p... | 2 | stack_v2_sparse_classes_30k_train_011458 | Implement the Python class `Kernel_Machine` described below.
Class description:
Implement the Kernel_Machine class.
Method signatures and docstrings:
- def __init__(self, kernel, prototype_points, weights): Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k ... | Implement the Python class `Kernel_Machine` described below.
Class description:
Implement the Kernel_Machine class.
Method signatures and docstrings:
- def __init__(self, kernel, prototype_points, weights): Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k ... | 5bf9718eedd895e7722b76e5156f5fe940e4dad5 | <|skeleton|>
class Kernel_Machine:
def __init__(self, kernel, prototype_points, weights):
"""Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k prototype_points - an Rxd matrix with rows mu_1,...,mu_R weights - a vector of length R with entries w_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Kernel_Machine:
def __init__(self, kernel, prototype_points, weights):
"""Args: kernel(X1,X2) - a function return the cross-kernel matrix between rows of X1 and rows of X2 for kernel k prototype_points - an Rxd matrix with rows mu_1,...,mu_R weights - a vector of length R with entries w_1,...,w_R"""
... | the_stack_v2_python_sparse | hw4-kernels/kernel.py | 5183nischal/Machine-learning | train | 0 | |
c0c025936f70746d231f9811f21da929a43908db | [
"self.hand = hand\nself.hand_value = value\nself.deck = deck",
"val = 0\nnum_ace = 0\nfor card in self.hand:\n ltemp = card.split()\n if ltemp[0] in ['2', '3', '4', '5', '6', '7', '8', '9', '10']:\n val += int(ltemp[0])\n elif ltemp[0] in ['Jack', 'Queen', 'King']:\n val += 10\n else:\n ... | <|body_start_0|>
self.hand = hand
self.hand_value = value
self.deck = deck
<|end_body_0|>
<|body_start_1|>
val = 0
num_ace = 0
for card in self.hand:
ltemp = card.split()
if ltemp[0] in ['2', '3', '4', '5', '6', '7', '8', '9', '10']:
... | Hand | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hand:
def __init__(self, hand, value, deck):
"""Initilize hand"""
<|body_0|>
def cal_value(self):
"""This method can calculate hand values"""
<|body_1|>
def draw_card(self, n):
"""Draw one card from your deck"""
<|body_2|>
def displa... | stack_v2_sparse_classes_36k_train_013653 | 7,109 | no_license | [
{
"docstring": "Initilize hand",
"name": "__init__",
"signature": "def __init__(self, hand, value, deck)"
},
{
"docstring": "This method can calculate hand values",
"name": "cal_value",
"signature": "def cal_value(self)"
},
{
"docstring": "Draw one card from your deck",
"name... | 6 | stack_v2_sparse_classes_30k_train_013243 | Implement the Python class `Hand` described below.
Class description:
Implement the Hand class.
Method signatures and docstrings:
- def __init__(self, hand, value, deck): Initilize hand
- def cal_value(self): This method can calculate hand values
- def draw_card(self, n): Draw one card from your deck
- def display(se... | Implement the Python class `Hand` described below.
Class description:
Implement the Hand class.
Method signatures and docstrings:
- def __init__(self, hand, value, deck): Initilize hand
- def cal_value(self): This method can calculate hand values
- def draw_card(self, n): Draw one card from your deck
- def display(se... | 102d51f699cd9593ec6feb5596c0b22fa46ab3a8 | <|skeleton|>
class Hand:
def __init__(self, hand, value, deck):
"""Initilize hand"""
<|body_0|>
def cal_value(self):
"""This method can calculate hand values"""
<|body_1|>
def draw_card(self, n):
"""Draw one card from your deck"""
<|body_2|>
def displa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Hand:
def __init__(self, hand, value, deck):
"""Initilize hand"""
self.hand = hand
self.hand_value = value
self.deck = deck
def cal_value(self):
"""This method can calculate hand values"""
val = 0
num_ace = 0
for card in self.hand:
... | the_stack_v2_python_sparse | Com_prog1/ProjectFinal/games/game1.py | JaofourthsOhappy/comprog1 | train | 0 | |
9d33220f0ba307e0480edd04c522911ac9cdcf07 | [
"multiplier = global_params.width_coefficient\nif not multiplier:\n return filters\ndivisor = global_params.depth_divisor\nmin_depth = global_params.min_depth\nfilters *= multiplier\nmin_depth = min_depth or divisor\nnew_filters = max(min_depth, int(filters + divisor / 2) // divisor * divisor)\nif new_filters < ... | <|body_start_0|>
multiplier = global_params.width_coefficient
if not multiplier:
return filters
divisor = global_params.depth_divisor
min_depth = global_params.min_depth
filters *= multiplier
min_depth = min_depth or divisor
new_filters = max(min_depth... | EffUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EffUtils:
def round_filters(filters, global_params):
"""Calculate and round number of filters based on depth multiplier."""
<|body_0|>
def round_repeats(repeats, global_params):
"""Round number of filters based on depth multiplier."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_013654 | 10,604 | permissive | [
{
"docstring": "Calculate and round number of filters based on depth multiplier.",
"name": "round_filters",
"signature": "def round_filters(filters, global_params)"
},
{
"docstring": "Round number of filters based on depth multiplier.",
"name": "round_repeats",
"signature": "def round_re... | 2 | null | Implement the Python class `EffUtils` described below.
Class description:
Implement the EffUtils class.
Method signatures and docstrings:
- def round_filters(filters, global_params): Calculate and round number of filters based on depth multiplier.
- def round_repeats(repeats, global_params): Round number of filters b... | Implement the Python class `EffUtils` described below.
Class description:
Implement the EffUtils class.
Method signatures and docstrings:
- def round_filters(filters, global_params): Calculate and round number of filters based on depth multiplier.
- def round_repeats(repeats, global_params): Round number of filters b... | 15963b0d242867a4cc4d76445626dc8965509b2f | <|skeleton|>
class EffUtils:
def round_filters(filters, global_params):
"""Calculate and round number of filters based on depth multiplier."""
<|body_0|>
def round_repeats(repeats, global_params):
"""Round number of filters based on depth multiplier."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EffUtils:
def round_filters(filters, global_params):
"""Calculate and round number of filters based on depth multiplier."""
multiplier = global_params.width_coefficient
if not multiplier:
return filters
divisor = global_params.depth_divisor
min_depth = globa... | the_stack_v2_python_sparse | ppocr/modeling/backbones/rec_efficientb3_pren.py | PaddlePaddle/PaddleOCR | train | 34,195 | |
2929a13cc45e346a048ac4cc247ef81947a7b36f | [
"self.width_to_focal = dict()\nself.width_to_focal[1242] = 721.5377\nself.width_to_focal[1241] = 718.856\nself.width_to_focal[1224] = 707.0493\nself.width_to_focal[1238] = 718.3351\nself.predicted_disps = predicted_disps\nself.root_dir = root_dir\nwith open(filenames_file) as filenames:\n image_paths = sorted((o... | <|body_start_0|>
self.width_to_focal = dict()
self.width_to_focal[1242] = 721.5377
self.width_to_focal[1241] = 718.856
self.width_to_focal[1224] = 707.0493
self.width_to_focal[1238] = 718.3351
self.predicted_disps = predicted_disps
self.root_dir = root_dir
... | Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted disparities gt_path='../../data/vkitti/vkitti_1.3.1_depthgt/', filenames_file, min_depth... | EvaluateVKittiGT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluateVKittiGT:
"""Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted disparities gt_path='../../data/vkitti/vkitt... | stack_v2_sparse_classes_36k_train_013655 | 5,128 | no_license | [
{
"docstring": "Args: predicted_disps: (np.ndarray) predicted disparities after training gt_path: path of the ground truth filenames_file: filenames of the test images min_depth: minimum depth used in predicted disparity map max_depth: maximim depth used in predicted disparity map",
"name": "__init__",
... | 4 | stack_v2_sparse_classes_30k_test_000105 | Implement the Python class `EvaluateVKittiGT` described below.
Class description:
Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted dispa... | Implement the Python class `EvaluateVKittiGT` described below.
Class description:
Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted dispa... | 5da467e0e1bb2fbc34eb9dd71a57fd96090ccce8 | <|skeleton|>
class EvaluateVKittiGT:
"""Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted disparities gt_path='../../data/vkitti/vkitt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EvaluateVKittiGT:
"""Class that evaluates the VKITTI data set on the ground truth images How to use this class: Create an object of this class and then use the evaluate method to evaluate EvaluateVKittiGT( predicted_disps= np.array containing predicted disparities gt_path='../../data/vkitti/vkitti_1.3.1_depth... | the_stack_v2_python_sparse | eval/eval_vkitti_gt.py | braun-steven/atrous-monodepth | train | 1 |
86bb8e150a073f505cc8ccdef7240e736f27bb50 | [
"if IP_NOT_FOUND:\n return HttpResponseNotFound(IP_NOT_FOUND_MSG)\nreturn Response([{'ruleId': 0, 'ruleIp': blockedIp, 'ruleReason': 'string'}])",
"if IP_NOT_FOUND:\n return HttpResponseNotFound(IP_NOT_FOUND_MSG)\nif len(request.data) != 1:\n return HttpResponseBadRequest()\nreturn Response([{'ruleId': 0... | <|body_start_0|>
if IP_NOT_FOUND:
return HttpResponseNotFound(IP_NOT_FOUND_MSG)
return Response([{'ruleId': 0, 'ruleIp': blockedIp, 'ruleReason': 'string'}])
<|end_body_0|>
<|body_start_1|>
if IP_NOT_FOUND:
return HttpResponseNotFound(IP_NOT_FOUND_MSG)
if len(req... | [GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP | RtbhBlockedIp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RtbhBlockedIp:
"""[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP"""
def get(self, request, blockedIp, **kwargs):
""":param bl... | stack_v2_sparse_classes_36k_train_013656 | 4,134 | permissive | [
{
"docstring": ":param blockedIp: any ipv4",
"name": "get",
"signature": "def get(self, request, blockedIp, **kwargs)"
},
{
"docstring": ":param blockedIp: any ipv4",
"name": "put",
"signature": "def put(self, request, blockedIp, **kwargs)"
},
{
"docstring": ":param blockedIp: an... | 3 | stack_v2_sparse_classes_30k_train_014975 | Implement the Python class `RtbhBlockedIp` described below.
Class description:
[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP
Method signatures and docstrings:... | Implement the Python class `RtbhBlockedIp` described below.
Class description:
[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP
Method signatures and docstrings:... | 73e4ac0ced6c3ac46d24ac5c3feb01a1e88bd36b | <|skeleton|>
class RtbhBlockedIp:
"""[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP"""
def get(self, request, blockedIp, **kwargs):
""":param bl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RtbhBlockedIp:
"""[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP"""
def get(self, request, blockedIp, **kwargs):
""":param blockedIp: any ... | the_stack_v2_python_sparse | crusoe_act/act-component/rtbh-wrapper/rtbh_wrapper_project/views.py | wumingruiye/CRUSOE | train | 0 |
c584d949d24151ba2130fabbdc73ff211176a33c | [
"if len(postorder) == 0:\n return None\nhead = TreeNode(postorder[-1])\nstack = [head]\ni = len(postorder) - 2\nj = len(postorder) - 1\nwhile i >= 0:\n temp = None\n t = TreeNode(postorder[i])\n while stack and stack[-1].val == inorder[j]:\n temp = stack.pop()\n j -= 1\n if temp:\n ... | <|body_start_0|>
if len(postorder) == 0:
return None
head = TreeNode(postorder[-1])
stack = [head]
i = len(postorder) - 2
j = len(postorder) - 1
while i >= 0:
temp = None
t = TreeNode(postorder[i])
while stack and stack[-1].... | Solution | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1]) root.left = self.buildTree(inorder[:i], postorder[:i]) root.right = self.buildTree(inorder[i + 1... | stack_v2_sparse_classes_36k_train_013657 | 2,912 | permissive | [
{
"docstring": "if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1]) root.left = self.buildTree(inorder[:i], postorder[:i]) root.right = self.buildTree(inorder[i + 1:], postorder[i:-1]) return root",
"name": "buildTree",
"signature": "def buildTree(self... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1])... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1])... | 4ea4c1579c28308455be4dfa02bd45ebd88b2d0a | <|skeleton|>
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1]) root.left = self.buildTree(inorder[:i], postorder[:i]) root.right = self.buildTree(inorder[i + 1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
"""if not inorder or not postorder: return i = inorder.index(postorder[-1]) root = TreeNode(postorder[-1]) root.left = self.buildTree(inorder[:i], postorder[:i]) root.right = self.buildTree(inorder[i + 1:], postorder[... | the_stack_v2_python_sparse | src/trees/buildTree.py | way2arun/datastructures_algorithms | train | 1 | |
6e9c7eae847df960966145cbbbddab6412d57bfb | [
"self.request = request\nself.schema = schema\nself.mode = mode\nself.validators = validators",
"for validator in self.validators:\n error = validator(request=self.request, schema=self.schema, field=node.name, value=value, mode=self.mode)\n if error:\n raise colander.Invalid(node, error)"
] | <|body_start_0|>
self.request = request
self.schema = schema
self.mode = mode
self.validators = validators
<|end_body_0|>
<|body_start_1|>
for validator in self.validators:
error = validator(request=self.request, schema=self.schema, field=node.name, value=value, mode... | This wrapper is used internally to validate data using multiple validators | ValidatorsWrapper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidatorsWrapper:
"""This wrapper is used internally to validate data using multiple validators"""
def __init__(self, validators: typing.List[typing.Callable], request: typing.Any, schema, mode=None):
""":param validators: list of validator callables that accept following parameters... | stack_v2_sparse_classes_36k_train_013658 | 20,357 | permissive | [
{
"docstring": ":param validators: list of validator callables that accept following parameters: - ``request`` - request object - ``schema`` - dataclass schema - ``field`` - field name - ``value`` - value to be validated - ``mode`` - one of the following: ``'default'``, ``'edit'``, ``'edit-process'`` :param req... | 2 | stack_v2_sparse_classes_30k_train_005565 | Implement the Python class `ValidatorsWrapper` described below.
Class description:
This wrapper is used internally to validate data using multiple validators
Method signatures and docstrings:
- def __init__(self, validators: typing.List[typing.Callable], request: typing.Any, schema, mode=None): :param validators: lis... | Implement the Python class `ValidatorsWrapper` described below.
Class description:
This wrapper is used internally to validate data using multiple validators
Method signatures and docstrings:
- def __init__(self, validators: typing.List[typing.Callable], request: typing.Any, schema, mode=None): :param validators: lis... | 52f854d310fe196ec7fbce8bc0bebe8837f9bf9c | <|skeleton|>
class ValidatorsWrapper:
"""This wrapper is used internally to validate data using multiple validators"""
def __init__(self, validators: typing.List[typing.Callable], request: typing.Any, schema, mode=None):
""":param validators: list of validator callables that accept following parameters... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidatorsWrapper:
"""This wrapper is used internally to validate data using multiple validators"""
def __init__(self, validators: typing.List[typing.Callable], request: typing.Any, schema, mode=None):
""":param validators: list of validator callables that accept following parameters: - ``request... | the_stack_v2_python_sparse | inverter/dc2colander.py | morpframework/inverter | train | 1 |
609bbe9b5746cc531b44ce7089af343a05ce9a10 | [
"self.__config = config\nself.__section = section\nself.__options = options\nself.__guidata = guidata\nself.__initialised = True",
"if name not in ['_PreferencesSection__section', '_PreferencesSection__options', '_PreferencesSection__config', '_PreferencesSection__initialised', '_PreferencesSection__get_option', ... | <|body_start_0|>
self.__config = config
self.__section = section
self.__options = options
self.__guidata = guidata
self.__initialised = True
<|end_body_0|>
<|body_start_1|>
if name not in ['_PreferencesSection__section', '_PreferencesSection__options', '_PreferencesSecti... | Preferences Section Helper Class | _PreferencesSection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PreferencesSection:
"""Preferences Section Helper Class"""
def __init__(self, config, section, options, guidata):
"""Class constructor"""
<|body_0|>
def __getattr__(self, name):
"""Get attribute method overload for accesing options"""
<|body_1|>
def... | stack_v2_sparse_classes_36k_train_013659 | 10,591 | permissive | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, config, section, options, guidata)"
},
{
"docstring": "Get attribute method overload for accesing options",
"name": "__getattr__",
"signature": "def __getattr__(self, name)"
},
{
"docstring":... | 6 | stack_v2_sparse_classes_30k_train_020568 | Implement the Python class `_PreferencesSection` described below.
Class description:
Preferences Section Helper Class
Method signatures and docstrings:
- def __init__(self, config, section, options, guidata): Class constructor
- def __getattr__(self, name): Get attribute method overload for accesing options
- def __s... | Implement the Python class `_PreferencesSection` described below.
Class description:
Preferences Section Helper Class
Method signatures and docstrings:
- def __init__(self, config, section, options, guidata): Class constructor
- def __getattr__(self, name): Get attribute method overload for accesing options
- def __s... | 9f951a08770e99ffd701a1994ba948aa8014f2af | <|skeleton|>
class _PreferencesSection:
"""Preferences Section Helper Class"""
def __init__(self, config, section, options, guidata):
"""Class constructor"""
<|body_0|>
def __getattr__(self, name):
"""Get attribute method overload for accesing options"""
<|body_1|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _PreferencesSection:
"""Preferences Section Helper Class"""
def __init__(self, config, section, options, guidata):
"""Class constructor"""
self.__config = config
self.__section = section
self.__options = options
self.__guidata = guidata
self.__initialised =... | the_stack_v2_python_sparse | evogtk/gui/preferences.py | olivergs/evogtk | train | 0 |
07d39d7530a4dd154afea44342ab0e3960cf6d96 | [
"if len(l) <= 1:\n return l\nmid = len(l) // 2\nleft = self.merge_sort(l[:mid])\nright = self.merge_sort(l[mid:])\nreturn self.merge(left, right)",
"if not left:\n return right\nif not right:\n return left\nif left[0] < right[0]:\n return [left[0]] + self.merge(left[1:], right)\nreturn [right[0]] + se... | <|body_start_0|>
if len(l) <= 1:
return l
mid = len(l) // 2
left = self.merge_sort(l[:mid])
right = self.merge_sort(l[mid:])
return self.merge(left, right)
<|end_body_0|>
<|body_start_1|>
if not left:
return right
if not right:
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge_sort(self, l):
"""Sorts the input list using the merge sort algorithm."""
<|body_0|>
def merge(self, left, right):
"""Takes two sorted lists and returns a single sorted list by comparing the elements one at a time."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_013660 | 851 | permissive | [
{
"docstring": "Sorts the input list using the merge sort algorithm.",
"name": "merge_sort",
"signature": "def merge_sort(self, l)"
},
{
"docstring": "Takes two sorted lists and returns a single sorted list by comparing the elements one at a time.",
"name": "merge",
"signature": "def mer... | 2 | stack_v2_sparse_classes_30k_train_016985 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge_sort(self, l): Sorts the input list using the merge sort algorithm.
- def merge(self, left, right): Takes two sorted lists and returns a single sorted list by comparing... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge_sort(self, l): Sorts the input list using the merge sort algorithm.
- def merge(self, left, right): Takes two sorted lists and returns a single sorted list by comparing... | 980af3442afeef459468b381ec3a5505a4275a2e | <|skeleton|>
class Solution:
def merge_sort(self, l):
"""Sorts the input list using the merge sort algorithm."""
<|body_0|>
def merge(self, left, right):
"""Takes two sorted lists and returns a single sorted list by comparing the elements one at a time."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def merge_sort(self, l):
"""Sorts the input list using the merge sort algorithm."""
if len(l) <= 1:
return l
mid = len(l) // 2
left = self.merge_sort(l[:mid])
right = self.merge_sort(l[mid:])
return self.merge(left, right)
def merge(se... | the_stack_v2_python_sparse | Sorting/MergeSort.py | anilpai/leetcode | train | 0 | |
3db1d0be4ecb42b96f6d49ba71b43cfe5bd9f1b9 | [
"super(WindowedDataStore, self).__init__()\nif int(window_step) != window_step:\n raise ValueError('Must be an integer window_step for now, not %g.' % window_step)\nif window_width is None:\n window_width = int(3 * window_step)\nlogging.info('Initializing AudioDataStore with step of %d and width of %d.', wind... | <|body_start_0|>
super(WindowedDataStore, self).__init__()
if int(window_step) != window_step:
raise ValueError('Must be an integer window_step for now, not %g.' % window_step)
if window_width is None:
window_width = int(3 * window_step)
logging.info('Initializing... | Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows are separated by window_step samples. Note: t... | WindowedDataStore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows ... | stack_v2_sparse_classes_36k_train_013661 | 13,521 | permissive | [
{
"docstring": "Creates the storage object. Note: this class only handles integer step sizes, so downsampling by a non-integer rate (i.e. 22050 to 100hz) doesn't work. Args: window_step: How many frames to advance each time we grab some data. window_width: Width of the analysis window. If not set, then the defa... | 3 | stack_v2_sparse_classes_30k_train_000824 | Implement the Python class `WindowedDataStore` described below.
Class description:
Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window... | Implement the Python class `WindowedDataStore` described below.
Class description:
Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window... | ffe01f76a03ebbb99d8fec8bcb57247dd17084a7 | <|skeleton|>
class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows are separated... | the_stack_v2_python_sparse | telluride_decoding/result_store.py | google/telluride_decoding | train | 13 |
5884c9d06bb9947a11e2247472b18c5c2f5c5815 | [
"version = pcs.Field('version', 4, default=6)\ntraffic = pcs.Field('traffic_class', 8)\nflow = pcs.Field('flow', 20)\nlength = pcs.Field('length', 16)\nnext = pcs.Field('next_header', 8)\nhop = pcs.Field('hop', 8)\nsrc = pcs.StringField('src', 16 * 8)\ndst = pcs.StringField('dst', 16 * 8)\npcs.Packet.__init__(self,... | <|body_start_0|>
version = pcs.Field('version', 4, default=6)
traffic = pcs.Field('traffic_class', 8)
flow = pcs.Field('flow', 20)
length = pcs.Field('length', 16)
next = pcs.Field('next_header', 8)
hop = pcs.Field('hop', 8)
src = pcs.StringField('src', 16 * 8)
... | A class that contains the IPv6 header. All other data is chained on the end. | ipv6 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ipv6:
"""A class that contains the IPv6 header. All other data is chained on the end."""
def __init__(self, bytes=None):
"""IPv6 Packet from RFC 2460"""
<|body_0|>
def __str__(self):
"""Walk the entire packet and pretty print the values of the fields. Addresses a... | stack_v2_sparse_classes_36k_train_013662 | 7,919 | no_license | [
{
"docstring": "IPv6 Packet from RFC 2460",
"name": "__init__",
"signature": "def __init__(self, bytes=None)"
},
{
"docstring": "Walk the entire packet and pretty print the values of the fields. Addresses are printed if and only if they are set and not 0.",
"name": "__str__",
"signature"... | 4 | stack_v2_sparse_classes_30k_train_020294 | Implement the Python class `ipv6` described below.
Class description:
A class that contains the IPv6 header. All other data is chained on the end.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 Packet from RFC 2460
- def __str__(self): Walk the entire packet and pretty print the values of th... | Implement the Python class `ipv6` described below.
Class description:
A class that contains the IPv6 header. All other data is chained on the end.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 Packet from RFC 2460
- def __str__(self): Walk the entire packet and pretty print the values of th... | a070a39586b582fbeea72abf12bbfd812955ad81 | <|skeleton|>
class ipv6:
"""A class that contains the IPv6 header. All other data is chained on the end."""
def __init__(self, bytes=None):
"""IPv6 Packet from RFC 2460"""
<|body_0|>
def __str__(self):
"""Walk the entire packet and pretty print the values of the fields. Addresses a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ipv6:
"""A class that contains the IPv6 header. All other data is chained on the end."""
def __init__(self, bytes=None):
"""IPv6 Packet from RFC 2460"""
version = pcs.Field('version', 4, default=6)
traffic = pcs.Field('traffic_class', 8)
flow = pcs.Field('flow', 20)
... | the_stack_v2_python_sparse | src/pcs/packets/ipv6.py | bilouro/tcptest | train | 0 |
c02dc20e9e0c84b1eec4e24f2729b26e0afd166f | [
"logging.Handler.__init__(self)\nself.oqueue = out_queue\nself.session = None",
"try:\n e_inf = record.exc_info\n if e_inf:\n dummy = self.format(record)\n record.exc_info = None\n dummy\n record.handle = self.session.handle if self.session is not None else None\n if self.session ... | <|body_start_0|>
logging.Handler.__init__(self)
self.oqueue = out_queue
self.session = None
<|end_body_0|>
<|body_start_1|>
try:
e_inf = record.exc_info
if e_inf:
dummy = self.format(record)
record.exc_info = None
d... | Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it! | IPCLogHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPCLogHandler:
"""Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!"""
def __init__(self, out_queue):
"""Constructor method, requires multiprocessing.Pipe"""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_013663 | 2,168 | no_license | [
{
"docstring": "Constructor method, requires multiprocessing.Pipe",
"name": "__init__",
"signature": "def __init__(self, out_queue)"
},
{
"docstring": "emit log record via IPC output queue",
"name": "emit",
"signature": "def emit(self, record)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016483 | Implement the Python class `IPCLogHandler` described below.
Class description:
Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!
Method signatures and docstrings:
- def __init__(self, out_queue): Constructor method, re... | Implement the Python class `IPCLogHandler` described below.
Class description:
Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!
Method signatures and docstrings:
- def __init__(self, out_queue): Constructor method, re... | 7b03a35f12d2b7a10fa4709b09107935c6f14000 | <|skeleton|>
class IPCLogHandler:
"""Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!"""
def __init__(self, out_queue):
"""Constructor method, requires multiprocessing.Pipe"""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IPCLogHandler:
"""Log handler that sends the log up the 'event pipe'. This is a rather novel solution that seems overlooked in documentation or exisiting code, try it!"""
def __init__(self, out_queue):
"""Constructor method, requires multiprocessing.Pipe"""
logging.Handler.__init__(self)
... | the_stack_v2_python_sparse | bbs/ipc.py | jonny290/yos-x84 | train | 2 |
1bb69a91efb77ee151f70f2ba35860b4a4cbaaea | [
"dirpath_test_tree = os.path.join(dirpath_testdata, 'dir_with_prefixed_files')\ndetect_all_exp = '^.*$'\nactual_output = tuple(da.lwc.search._filepath_from_os_walk_filter(os_walk=os.walk(dirpath_test_tree), pathincl=[detect_all_exp], pathexcl=[]))\nexpected_output = (os.path.join(dirpath_test_tree, 'prefix00_file01... | <|body_start_0|>
dirpath_test_tree = os.path.join(dirpath_testdata, 'dir_with_prefixed_files')
detect_all_exp = '^.*$'
actual_output = tuple(da.lwc.search._filepath_from_os_walk_filter(os_walk=os.walk(dirpath_test_tree), pathincl=[detect_all_exp], pathexcl=[]))
expected_output = (os.path... | Specify the da.lwc.search._filepath_from_os_walk_filter function. | Specify_FilepathFromOsWalkFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Specify_FilepathFromOsWalkFilter:
"""Specify the da.lwc.search._filepath_from_os_walk_filter function."""
def it_detect_all_expression(self, dirpath_testdata):
"""Test the use of an expression to detect everything."""
<|body_0|>
def it_detect_prefix_expression(self, dirp... | stack_v2_sparse_classes_36k_train_013664 | 29,518 | permissive | [
{
"docstring": "Test the use of an expression to detect everything.",
"name": "it_detect_all_expression",
"signature": "def it_detect_all_expression(self, dirpath_testdata)"
},
{
"docstring": "Test the use of an expression to detect prefixes.",
"name": "it_detect_prefix_expression",
"sig... | 3 | null | Implement the Python class `Specify_FilepathFromOsWalkFilter` described below.
Class description:
Specify the da.lwc.search._filepath_from_os_walk_filter function.
Method signatures and docstrings:
- def it_detect_all_expression(self, dirpath_testdata): Test the use of an expression to detect everything.
- def it_det... | Implement the Python class `Specify_FilepathFromOsWalkFilter` described below.
Class description:
Specify the da.lwc.search._filepath_from_os_walk_filter function.
Method signatures and docstrings:
- def it_detect_all_expression(self, dirpath_testdata): Test the use of an expression to detect everything.
- def it_det... | 04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d | <|skeleton|>
class Specify_FilepathFromOsWalkFilter:
"""Specify the da.lwc.search._filepath_from_os_walk_filter function."""
def it_detect_all_expression(self, dirpath_testdata):
"""Test the use of an expression to detect everything."""
<|body_0|>
def it_detect_prefix_expression(self, dirp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Specify_FilepathFromOsWalkFilter:
"""Specify the da.lwc.search._filepath_from_os_walk_filter function."""
def it_detect_all_expression(self, dirpath_testdata):
"""Test the use of an expression to detect everything."""
dirpath_test_tree = os.path.join(dirpath_testdata, 'dir_with_prefixed_f... | the_stack_v2_python_sparse | a3_src/h70_internal/da/lwc/spec/spec_search.py | wtpayne/hiai | train | 5 |
530addee1d0e708c6cb58c382ecbc5158fb2aeb6 | [
"query = \"SELECT AML.DATE AS DATE,\\n \\tCASE\\n \\t\\t\\t\\t\\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\\n \\t\\t\\t\\t\\tWHEN INV.NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.NUMBER\\n \\t\\t\\t\\t\\tELSE AJ.NAME\\n \\tEND AS DESCRIPTION,\\n ... | <|body_start_0|>
query = "SELECT AML.DATE AS DATE,\n \tCASE\n \t\t\t\t\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\n \t\t\t\t\tWHEN INV.NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.NUMBER\n \t\t\t\t\tELSE AJ.NAME\n \tEND AS DESCRIPTION,\n \... | AccountFullReconcile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
<|body_0|>
def unlink(self):
"""When removing a full reconciliation, we choose to remove partial reconciliations also"""
<|body_1... | stack_v2_sparse_classes_36k_train_013665 | 5,368 | no_license | [
{
"docstring": "Returns report dictionary for currency difference report for reconcilation",
"name": "get_report_data",
"signature": "def get_report_data(self)"
},
{
"docstring": "When removing a full reconciliation, we choose to remove partial reconciliations also",
"name": "unlink",
"s... | 2 | stack_v2_sparse_classes_30k_train_009109 | Implement the Python class `AccountFullReconcile` described below.
Class description:
Implement the AccountFullReconcile class.
Method signatures and docstrings:
- def get_report_data(self): Returns report dictionary for currency difference report for reconcilation
- def unlink(self): When removing a full reconciliat... | Implement the Python class `AccountFullReconcile` described below.
Class description:
Implement the AccountFullReconcile class.
Method signatures and docstrings:
- def get_report_data(self): Returns report dictionary for currency difference report for reconcilation
- def unlink(self): When removing a full reconciliat... | c04e2b9730db07848c153d8245d2df65ec4e2c8f | <|skeleton|>
class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
<|body_0|>
def unlink(self):
"""When removing a full reconciliation, we choose to remove partial reconciliations also"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
query = "SELECT AML.DATE AS DATE,\n \tCASE\n \t\t\t\t\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\n \t... | the_stack_v2_python_sparse | currency_difference_invoice/models/account_partial_reconcile.py | aaltinisik/customaddons | train | 15 | |
70123cdfe89c079010d8ba51781a0fb58470ab36 | [
"if not os.path.isfile(DATABASE_FILE):\n sys.exit(DATABASE_FILE + ' does not exist.')\nroot = tk.Tk()\nroot.title('IMSIL Input Parameter Editor')\nroot.resizable(False, False)\nself.nb = ttk.Notebook(root, width=900, height=600)\nself.nb.grid(row=0, column=0, sticky='NESW')\nsqlite_master_table = SqliteMaster(DA... | <|body_start_0|>
if not os.path.isfile(DATABASE_FILE):
sys.exit(DATABASE_FILE + ' does not exist.')
root = tk.Tk()
root.title('IMSIL Input Parameter Editor')
root.resizable(False, False)
self.nb = ttk.Notebook(root, width=900, height=600)
self.nb.grid(row=0, c... | The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table. | ImsilInputParameterEditor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImsilInputParameterEditor:
"""The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table."""
def __init__(self, type_of_simulation, input_file_path):
"""In the initialization of the IMSIL Input Parameter Editor a notebook is adde... | stack_v2_sparse_classes_36k_train_013666 | 10,644 | no_license | [
{
"docstring": "In the initialization of the IMSIL Input Parameter Editor a notebook is added to the window. The SqliteMaster class is used to determinate the table names in the database. For each table name a new tab is added to the notebook. Each tab contains a Frame of the class DbFrame. If a path to an inpu... | 3 | stack_v2_sparse_classes_30k_train_006254 | Implement the Python class `ImsilInputParameterEditor` described below.
Class description:
The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table.
Method signatures and docstrings:
- def __init__(self, type_of_simulation, input_file_path): In the initializati... | Implement the Python class `ImsilInputParameterEditor` described below.
Class description:
The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table.
Method signatures and docstrings:
- def __init__(self, type_of_simulation, input_file_path): In the initializati... | 1f4f626e5d4999d4d6ae351944ef508a1e8a4967 | <|skeleton|>
class ImsilInputParameterEditor:
"""The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table."""
def __init__(self, type_of_simulation, input_file_path):
"""In the initialization of the IMSIL Input Parameter Editor a notebook is adde... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImsilInputParameterEditor:
"""The IMSIL Input Parameter Editor consists of a notebook with tabs, where each tab corresponds to a database table."""
def __init__(self, type_of_simulation, input_file_path):
"""In the initialization of the IMSIL Input Parameter Editor a notebook is added to the wind... | the_stack_v2_python_sparse | input_file_generator/main.py | hobler/imsil-gui | train | 1 |
4b87ed0ed26a18fa2ef261ce8731e61c4b73eeea | [
"self.system = system\nself.cpu = cpu\nself.memory = memory\nself.gpu = gpu",
"system = platform.platform()\ngpu = GPU.from_host()\nmemory = Memory.from_host()\ncpu = CPU.from_host()\nreturn SystemInfo(system=system, cpu=cpu, gpu=gpu, memory=memory)"
] | <|body_start_0|>
self.system = system
self.cpu = cpu
self.memory = memory
self.gpu = gpu
<|end_body_0|>
<|body_start_1|>
system = platform.platform()
gpu = GPU.from_host()
memory = Memory.from_host()
cpu = CPU.from_host()
return SystemInfo(system=... | System Information data object | SystemInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SystemInfo:
"""System Information data object"""
def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU):
"""Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info"""
<|body_0|>
def from_host():
"""Create SystemInfo obj... | stack_v2_sparse_classes_36k_train_013667 | 9,744 | permissive | [
{
"docstring": "Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info",
"name": "__init__",
"signature": "def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU)"
},
{
"docstring": "Create SystemInfo object from host data Returns: SystemInfo object",
... | 2 | stack_v2_sparse_classes_30k_train_001543 | Implement the Python class `SystemInfo` described below.
Class description:
System Information data object
Method signatures and docstrings:
- def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info
- def from_host(): ... | Implement the Python class `SystemInfo` described below.
Class description:
System Information data object
Method signatures and docstrings:
- def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU): Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info
- def from_host(): ... | a5388a45f71a949639b35cc5b990bd130d2d8164 | <|skeleton|>
class SystemInfo:
"""System Information data object"""
def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU):
"""Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info"""
<|body_0|>
def from_host():
"""Create SystemInfo obj... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SystemInfo:
"""System Information data object"""
def __init__(self, system: str, cpu: CPU, memory: Memory, gpu: GPU):
"""Args: system: name of operating system cpu: CPU info memory: Memory info gpu: GPU info"""
self.system = system
self.cpu = cpu
self.memory = memory
... | the_stack_v2_python_sparse | PyTorch/LanguageModeling/BERT/triton/runner/task.py | NVIDIA/DeepLearningExamples | train | 11,838 |
35a85c76e7700f5931164b55aab36face43126e6 | [
"self.business_name = business_name\nself.business_address = business_address\nself.contact = contact\nself.payer = payer",
"if dictionary is None:\n return None\nbusiness_name = dictionary.get('businessName')\nbusiness_address = RecipientAddress.from_dictionary(dictionary.get('businessAddress')) if dictionary... | <|body_start_0|>
self.business_name = business_name
self.business_address = business_address
self.contact = contact
self.payer = payer
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
business_name = dictionary.get('businessName')
bu... | Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Contact): TODO: type description here. payer (PayerId): TODO: type description here. | PatchRecipientRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatchRecipientRequest:
"""Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Contact): TODO: type description here. paye... | stack_v2_sparse_classes_36k_train_013668 | 2,605 | permissive | [
{
"docstring": "Constructor for the PatchRecipientRequest class",
"name": "__init__",
"signature": "def __init__(self, business_name=None, business_address=None, contact=None, payer=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dic... | 2 | stack_v2_sparse_classes_30k_train_017428 | Implement the Python class `PatchRecipientRequest` described below.
Class description:
Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Cont... | Implement the Python class `PatchRecipientRequest` described below.
Class description:
Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Cont... | e1ca52116aabfcdb2f36c24ebd866cf00bb5c6c9 | <|skeleton|>
class PatchRecipientRequest:
"""Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Contact): TODO: type description here. paye... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PatchRecipientRequest:
"""Implementation of the 'PatchRecipientRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. business_address (RecipientAddress): TODO: type description here. contact (Contact): TODO: type description here. payer (PayerId): ... | the_stack_v2_python_sparse | plastiqpublicapi/models/patch_recipient_request.py | jeffkynaston/sdk-spike-python-apimatic | train | 0 |
f187006e01fc57789e714d7778b7868779b7bbe4 | [
"try:\n updated_purchase_price = self.update_purchase_price()\nexcept Exception:\n return HttpResponseBadRequest()\nelse:\n return JsonResponse({'purchase_price': updated_purchase_price})",
"product_id = self.request.POST['product_id']\nupdated_purchase_price = self.request.POST['updated_purchase_price']... | <|body_start_0|>
try:
updated_purchase_price = self.update_purchase_price()
except Exception:
return HttpResponseBadRequest()
else:
return JsonResponse({'purchase_price': updated_purchase_price})
<|end_body_0|>
<|body_start_1|>
product_id = self.reque... | View for handling purchase price updates from the restock page. | UpdatePurchasePrice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdatePurchasePrice:
"""View for handling purchase price updates from the restock page."""
def post(self, *args, **kwargs):
"""Update purchase price."""
<|body_0|>
def update_purchase_price(self):
"""Update purchase price."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_013669 | 6,889 | no_license | [
{
"docstring": "Update purchase price.",
"name": "post",
"signature": "def post(self, *args, **kwargs)"
},
{
"docstring": "Update purchase price.",
"name": "update_purchase_price",
"signature": "def update_purchase_price(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001071 | Implement the Python class `UpdatePurchasePrice` described below.
Class description:
View for handling purchase price updates from the restock page.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Update purchase price.
- def update_purchase_price(self): Update purchase price. | Implement the Python class `UpdatePurchasePrice` described below.
Class description:
View for handling purchase price updates from the restock page.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Update purchase price.
- def update_purchase_price(self): Update purchase price.
<|skeleton|>
class... | ba51d4e304b1aeb296fa2fe16611c892fcdbd471 | <|skeleton|>
class UpdatePurchasePrice:
"""View for handling purchase price updates from the restock page."""
def post(self, *args, **kwargs):
"""Update purchase price."""
<|body_0|>
def update_purchase_price(self):
"""Update purchase price."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdatePurchasePrice:
"""View for handling purchase price updates from the restock page."""
def post(self, *args, **kwargs):
"""Update purchase price."""
try:
updated_purchase_price = self.update_purchase_price()
except Exception:
return HttpResponseBadReque... | the_stack_v2_python_sparse | restock/views.py | stcstores/stcadmin | train | 0 |
cf967a935018f6e82afc1273024f54b8213986bb | [
"logging.Handler.__init__(self)\nself.address = address\nself.port = port\nself.certfile = cert_path\nself.facility = facility\nself.level = log_level\nssl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\nssl_context.minimum_version = ssl.TLSVersion.TL... | <|body_start_0|>
logging.Handler.__init__(self)
self.address = address
self.port = port
self.certfile = cert_path
self.facility = facility
self.level = log_level
ssl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl_context = ssl.SSLContext(ssl.... | SyslogHandlerTLS | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyslogHandlerTLS:
def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool):
"""Initialize a handler."""
<|body_0|>
def emit(self, record):
"""Emit a record. The record is formatted, and then sent to the syslo... | stack_v2_sparse_classes_36k_train_013670 | 14,986 | permissive | [
{
"docstring": "Initialize a handler.",
"name": "__init__",
"signature": "def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool)"
},
{
"docstring": "Emit a record. The record is formatted, and then sent to the syslog server. If excepti... | 2 | stack_v2_sparse_classes_30k_test_000394 | Implement the Python class `SyslogHandlerTLS` described below.
Class description:
Implement the SyslogHandlerTLS class.
Method signatures and docstrings:
- def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): Initialize a handler.
- def emit(self, record... | Implement the Python class `SyslogHandlerTLS` described below.
Class description:
Implement the SyslogHandlerTLS class.
Method signatures and docstrings:
- def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): Initialize a handler.
- def emit(self, record... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class SyslogHandlerTLS:
def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool):
"""Initialize a handler."""
<|body_0|>
def emit(self, record):
"""Emit a record. The record is formatted, and then sent to the syslo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SyslogHandlerTLS:
def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool):
"""Initialize a handler."""
logging.Handler.__init__(self)
self.address = address
self.port = port
self.certfile = cert_path
se... | the_stack_v2_python_sparse | Packs/Syslog/Integrations/SyslogSender/SyslogSender.py | demisto/content | train | 1,023 | |
07db5c76f8aac07a9a4c0a16e881f0445785f65e | [
"self.lambtha = float(lambtha)\nif data is None:\n if self.lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\nelif type(data) is not list:\n raise TypeError('data must be a list')\nelif len(data) < 2:\n raise ValueError('data must contain multiple values')\nelse:\n self.data = ... | <|body_start_0|>
self.lambtha = float(lambtha)
if data is None:
if self.lambtha <= 0:
raise ValueError('lambtha must be a positive value')
elif type(data) is not list:
raise TypeError('data must be a list')
elif len(data) < 2:
raise Val... | class Poisson represents a poisson distribution | Poisson | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Poisson:
"""class Poisson represents a poisson distribution"""
def __init__(self, data=None, lambtha=1.0):
"""Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected number of n occurences in a given time frame"""
<|bod... | stack_v2_sparse_classes_36k_train_013671 | 2,022 | no_license | [
{
"docstring": "Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected number of n occurences in a given time frame",
"name": "__init__",
"signature": "def __init__(self, data=None, lambtha=1.0)"
},
{
"docstring": "Calculates the value of... | 3 | stack_v2_sparse_classes_30k_train_018396 | Implement the Python class `Poisson` described below.
Class description:
class Poisson represents a poisson distribution
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected numb... | Implement the Python class `Poisson` described below.
Class description:
class Poisson represents a poisson distribution
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected numb... | 8cd5e0f837a5c0facbf73647dcc9c6a3b1b1b9e0 | <|skeleton|>
class Poisson:
"""class Poisson represents a poisson distribution"""
def __init__(self, data=None, lambtha=1.0):
"""Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected number of n occurences in a given time frame"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Poisson:
"""class Poisson represents a poisson distribution"""
def __init__(self, data=None, lambtha=1.0):
"""Poisson class Args: data: is a list of the data to be used to estimate the distribution lambtha: is the expected number of n occurences in a given time frame"""
self.lambtha = flo... | the_stack_v2_python_sparse | math/0x03-probability/poisson.py | giovannyortegon/holbertonschool-machine_learning | train | 1 |
b993a301ea57d4417bd2d9c2c6551a2771b27794 | [
"self.antiBan = igAntiban(self)\nself.web_driver = obj.web_driver\nself.timeOfRun = obj.timeOfRun\nself.web_driver.find_element_by_xpath(\"//*[local-name()='nav' and contains(@class, 'NXc7H')]//a[img]\").click()\nsleep(2)\nself.post = self.web_driver.find_element_by_class_name('g47SY').text\nself.num = int(self.pos... | <|body_start_0|>
self.antiBan = igAntiban(self)
self.web_driver = obj.web_driver
self.timeOfRun = obj.timeOfRun
self.web_driver.find_element_by_xpath("//*[local-name()='nav' and contains(@class, 'NXc7H')]//a[img]").click()
sleep(2)
self.post = self.web_driver.find_element... | igProfile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class igProfile:
def __init__(self, obj):
"""Will open the profile and click on the first picture"""
<|body_0|>
def iterarPerfil(self):
"""Will do the iteration through perfil photos and save likes, hashtags and date."""
<|body_1|>
def compareLikesProfiles(sel... | stack_v2_sparse_classes_36k_train_013672 | 4,159 | no_license | [
{
"docstring": "Will open the profile and click on the first picture",
"name": "__init__",
"signature": "def __init__(self, obj)"
},
{
"docstring": "Will do the iteration through perfil photos and save likes, hashtags and date.",
"name": "iterarPerfil",
"signature": "def iterarPerfil(sel... | 3 | stack_v2_sparse_classes_30k_train_019903 | Implement the Python class `igProfile` described below.
Class description:
Implement the igProfile class.
Method signatures and docstrings:
- def __init__(self, obj): Will open the profile and click on the first picture
- def iterarPerfil(self): Will do the iteration through perfil photos and save likes, hashtags and... | Implement the Python class `igProfile` described below.
Class description:
Implement the igProfile class.
Method signatures and docstrings:
- def __init__(self, obj): Will open the profile and click on the first picture
- def iterarPerfil(self): Will do the iteration through perfil photos and save likes, hashtags and... | 8a35f6f95f1e1b4e1d050541518ce08aa536bba0 | <|skeleton|>
class igProfile:
def __init__(self, obj):
"""Will open the profile and click on the first picture"""
<|body_0|>
def iterarPerfil(self):
"""Will do the iteration through perfil photos and save likes, hashtags and date."""
<|body_1|>
def compareLikesProfiles(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class igProfile:
def __init__(self, obj):
"""Will open the profile and click on the first picture"""
self.antiBan = igAntiban(self)
self.web_driver = obj.web_driver
self.timeOfRun = obj.timeOfRun
self.web_driver.find_element_by_xpath("//*[local-name()='nav' and contains(@clas... | the_stack_v2_python_sparse | igProfile.py | yamf0/IGbotTesting | train | 0 | |
bafdf0eb0c2fca1f94e12fa8d402918d12a7326b | [
"try:\n return Parametros.objects.first()\nexcept Parametros.DoesNotExist:\n raise Http404",
"parametros = self.get_object()\ninstrucao_normativa_url = parametros.instrucao_normativa.url\nlog.info(f'Url da instrução normativa: {instrucao_normativa_url}')\nreturn Response(instrucao_normativa_url)"
] | <|body_start_0|>
try:
return Parametros.objects.first()
except Parametros.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
parametros = self.get_object()
instrucao_normativa_url = parametros.instrucao_normativa.url
log.info(f'Url da instrução n... | InstrucaoNormativaViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstrucaoNormativaViewSet:
def get_object(self):
"""Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instância do objeto parâmetros."""
<|body_0|>
def list(self, request, *args, **kwargs):
"""Busca o ... | stack_v2_sparse_classes_36k_train_013673 | 1,186 | permissive | [
{
"docstring": "Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instância do objeto parâmetros.",
"name": "get_object",
"signature": "def get_object(self)"
},
{
"docstring": "Busca o arquivo do edital e suas informações Raises: ... | 2 | null | Implement the Python class `InstrucaoNormativaViewSet` described below.
Class description:
Implement the InstrucaoNormativaViewSet class.
Method signatures and docstrings:
- def get_object(self): Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instân... | Implement the Python class `InstrucaoNormativaViewSet` described below.
Class description:
Implement the InstrucaoNormativaViewSet class.
Method signatures and docstrings:
- def get_object(self): Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instân... | bf8e0dc21ebc55554466d8de6608a047a59cc3e9 | <|skeleton|>
class InstrucaoNormativaViewSet:
def get_object(self):
"""Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instância do objeto parâmetros."""
<|body_0|>
def list(self, request, *args, **kwargs):
"""Busca o ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstrucaoNormativaViewSet:
def get_object(self):
"""Busca o objeto do modelo Parametros Raises: Http404: Quando objeto não encontrado Returns: Parametros (Parametros): Instância do objeto parâmetros."""
try:
return Parametros.objects.first()
except Parametros.DoesNotExist:
... | the_stack_v2_python_sparse | sme_uniforme_apps/core/api/viewsets/instrucao_normativa_viewset.py | prefeiturasp/SME-PortalUniforme-BackEnd | train | 0 | |
30b21a4399a3ecfde7ca48f354e6802cad5dbc45 | [
"super(FunctionComponent, self).__init__(opts)\nself.opts = opts\nself.options = opts.get('jira', {})\nself.res_params = opts.get('resilient', {})\nself.log = logging.getLogger(__name__)",
"self.opts = opts\nself.options = opts.get('jira', {})\nself.res_params = opts.get('resilient', {})",
"try:\n appDict = ... | <|body_start_0|>
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get('jira', {})
self.res_params = opts.get('resilient', {})
self.log = logging.getLogger(__name__)
<|end_body_0|>
<|body_start_1|>
self.opts = opts
self.options = ... | Component that implements Resilient function 'jirs_open_issue | FunctionComponent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'jirs_open_issue"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, save ... | stack_v2_sparse_classes_36k_train_013674 | 4,616 | permissive | [
{
"docstring": "constructor provides access to the configuration options",
"name": "__init__",
"signature": "def __init__(self, opts)"
},
{
"docstring": "Configuration options have changed, save new values",
"name": "_reload",
"signature": "def _reload(self, event, opts)"
},
{
"d... | 4 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'jirs_open_issue
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration option... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'jirs_open_issue
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration option... | 2e3c4b6102555517bad22bf87fa4a06341714166 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'jirs_open_issue"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, save ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that implements Resilient function 'jirs_open_issue"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get('jira', {}... | the_stack_v2_python_sparse | fn_jira/fn_jira/components/jira_open_issue.py | jjfallete/resilient-community-apps | train | 1 |
c4ccf1752680a47b6be2c06ac2209b125daa556e | [
"s1 = list(map(int, version1.split('.')))\ns2 = list(map(int, version2.split('.')))\nif len(s1) > len(s2):\n s2.extend([0] * (len(s1) - len(s2)))\nelif len(s1) < len(s2):\n s1.extend([0] * (len(s2) - len(s1)))\nif s1 > s2:\n return 1\nelif s1 < s2:\n return -1\nelse:\n return 0",
"s1 = list(map(int... | <|body_start_0|>
s1 = list(map(int, version1.split('.')))
s2 = list(map(int, version2.split('.')))
if len(s1) > len(s2):
s2.extend([0] * (len(s1) - len(s2)))
elif len(s1) < len(s2):
s1.extend([0] * (len(s2) - len(s1)))
if s1 > s2:
return 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def compareVersion(self, version1, version2):
""":type version1: str :type version2: str :rtype: int"""
<|body_0|>
def compareVersion_1(self, version1, version2):
""":type version1: str :type version2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_013675 | 3,635 | no_license | [
{
"docstring": ":type version1: str :type version2: str :rtype: int",
"name": "compareVersion",
"signature": "def compareVersion(self, version1, version2)"
},
{
"docstring": ":type version1: str :type version2: str :rtype: int",
"name": "compareVersion_1",
"signature": "def compareVersio... | 2 | stack_v2_sparse_classes_30k_train_018078 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compareVersion(self, version1, version2): :type version1: str :type version2: str :rtype: int
- def compareVersion_1(self, version1, version2): :type version1: str :type vers... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compareVersion(self, version1, version2): :type version1: str :type version2: str :rtype: int
- def compareVersion_1(self, version1, version2): :type version1: str :type vers... | 3d9e0ad2f6ed92ec969556f75d97c51ea4854719 | <|skeleton|>
class Solution:
def compareVersion(self, version1, version2):
""":type version1: str :type version2: str :rtype: int"""
<|body_0|>
def compareVersion_1(self, version1, version2):
""":type version1: str :type version2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def compareVersion(self, version1, version2):
""":type version1: str :type version2: str :rtype: int"""
s1 = list(map(int, version1.split('.')))
s2 = list(map(int, version2.split('.')))
if len(s1) > len(s2):
s2.extend([0] * (len(s1) - len(s2)))
eli... | the_stack_v2_python_sparse | Solutions/0165_compareVersion.py | YoupengLi/leetcode-sorting | train | 3 | |
009ea0f4a42c41623ce4702e25609313f2b708bd | [
"if gridImg:\n self._gridImg = helper.load_image(gridImg)\nelse:\n raise AssertionError('Missing background for ViewCard.')\ntemp_rect = self._gridImg.get_rect()\nif pos:\n temp_rect.move_ip(*pos)\nsuper().__init__(name=name, rect=temp_rect, **kwargs)\nif cardData:\n self._cardData = cardData\nelse:\n ... | <|body_start_0|>
if gridImg:
self._gridImg = helper.load_image(gridImg)
else:
raise AssertionError('Missing background for ViewCard.')
temp_rect = self._gridImg.get_rect()
if pos:
temp_rect.move_ip(*pos)
super().__init__(name=name, rect=temp_re... | A view element which renders a card. | ViewCard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewCard:
"""A view element which renders a card."""
def __init__(self, cardData, gridImg, oImg, xImg, iImg, name=None, pos=None, **kwargs):
"""Initializes ViewCard. Takes cardData to render from. Take gridImg as background and o/x/iImg as RPS symbols. Optional pos argument is (x, y)... | stack_v2_sparse_classes_36k_train_013676 | 2,978 | no_license | [
{
"docstring": "Initializes ViewCard. Takes cardData to render from. Take gridImg as background and o/x/iImg as RPS symbols. Optional pos argument is (x, y) tuple defining the top left corner to render at. Optional name argument for the name of the element",
"name": "__init__",
"signature": "def __init_... | 2 | stack_v2_sparse_classes_30k_train_005127 | Implement the Python class `ViewCard` described below.
Class description:
A view element which renders a card.
Method signatures and docstrings:
- def __init__(self, cardData, gridImg, oImg, xImg, iImg, name=None, pos=None, **kwargs): Initializes ViewCard. Takes cardData to render from. Take gridImg as background and... | Implement the Python class `ViewCard` described below.
Class description:
A view element which renders a card.
Method signatures and docstrings:
- def __init__(self, cardData, gridImg, oImg, xImg, iImg, name=None, pos=None, **kwargs): Initializes ViewCard. Takes cardData to render from. Take gridImg as background and... | 6f31be04143b1f43b4213eb57a0183aa4e8645ff | <|skeleton|>
class ViewCard:
"""A view element which renders a card."""
def __init__(self, cardData, gridImg, oImg, xImg, iImg, name=None, pos=None, **kwargs):
"""Initializes ViewCard. Takes cardData to render from. Take gridImg as background and o/x/iImg as RPS symbols. Optional pos argument is (x, y)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewCard:
"""A view element which renders a card."""
def __init__(self, cardData, gridImg, oImg, xImg, iImg, name=None, pos=None, **kwargs):
"""Initializes ViewCard. Takes cardData to render from. Take gridImg as background and o/x/iImg as RPS symbols. Optional pos argument is (x, y) tuple defini... | the_stack_v2_python_sparse | game/view/view_elements/view_card.py | VGAD/deadliest-date | train | 1 |
63d93f4050f11da5e904448b051f9612aeaf11cf | [
"self.pipeline = Pipeline()\nself.pipeline.add_node(component=retriever, name='Retriever', inputs=['Query'])\nself.pipeline.add_node(component=summarizer, name='Summarizer', inputs=['Retriever'])\nself.return_in_answer_format = return_in_answer_format",
"output = self.pipeline.run(query=query, params=params, debu... | <|body_start_0|>
self.pipeline = Pipeline()
self.pipeline.add_node(component=retriever, name='Retriever', inputs=['Query'])
self.pipeline.add_node(component=summarizer, name='Summarizer', inputs=['Retriever'])
self.return_in_answer_format = return_in_answer_format
<|end_body_0|>
<|body_... | Pipeline that retrieves documents for a query and then summarizes those documents. | SearchSummarizationPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retrie... | stack_v2_sparse_classes_36k_train_013677 | 18,541 | permissive | [
{
"docstring": ":param summarizer: Summarizer instance :param retriever: Retriever instance :param return_in_answer_format: Whether the results should be returned as documents (False) or in the answer format used in other QA pipelines (True). With the latter, you can use this pipeline as a \"drop-in replacement... | 2 | stack_v2_sparse_classes_30k_train_015814 | Implement the Python class `SearchSummarizationPipeline` described below.
Class description:
Pipeline that retrieves documents for a query and then summarizes those documents.
Method signatures and docstrings:
- def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=Fal... | Implement the Python class `SearchSummarizationPipeline` described below.
Class description:
Pipeline that retrieves documents for a query and then summarizes those documents.
Method signatures and docstrings:
- def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=Fal... | 6f6f2357fdef9e98850a7ffcd80f18b05aa7cfaf | <|skeleton|>
class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retrie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retriever: Retrieve... | the_stack_v2_python_sparse | haystack/pipelines/standard_pipelines.py | aantti/haystack | train | 0 |
0dccc3b361af0f0a8e8bd547a914d2b5d06e54b7 | [
"if isinstance(array, Iterable):\n obj = np.asarray(array).view(cls)\nelif isinstance(array, _vtk.vtkAbstractArray):\n obj = convert_array(array).view(cls)\n obj.VTKObject = array\nelse:\n raise TypeError(f'pyvista_ndarray got an invalid type {type(array)}. Expected an Iterable or vtk.vtkAbstractArray')... | <|body_start_0|>
if isinstance(array, Iterable):
obj = np.asarray(array).view(cls)
elif isinstance(array, _vtk.vtkAbstractArray):
obj = convert_array(array).view(cls)
obj.VTKObject = array
else:
raise TypeError(f'pyvista_ndarray got an invalid type... | A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataSet Input dataset. association : pyvista.core.utilities.arrays.FieldAssociation Fie... | pyvista_ndarray | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pyvista_ndarray:
"""A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataSet Input dataset. association : pyvista... | stack_v2_sparse_classes_36k_train_013678 | 4,156 | permissive | [
{
"docstring": "Allocate the array.",
"name": "__new__",
"signature": "def __new__(cls, array: Union[Iterable, _vtk.vtkAbstractArray], dataset=None, association=FieldAssociation.NONE)"
},
{
"docstring": "Finalize array (associate with parent metadata).",
"name": "__array_finalize__",
"si... | 4 | stack_v2_sparse_classes_30k_train_011965 | Implement the Python class `pyvista_ndarray` described below.
Class description:
A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataS... | Implement the Python class `pyvista_ndarray` described below.
Class description:
A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataS... | 1b450b23340f367315fc914075d551e0a4df8cc3 | <|skeleton|>
class pyvista_ndarray:
"""A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataSet Input dataset. association : pyvista... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pyvista_ndarray:
"""A ndarray which references the owning dataset and the underlying vtkArray. This array can be acted upon just like a :class:`numpy.ndarray`. Parameters ---------- array : Iterable or vtk.vtkAbstractArray Array like. dataset : pyvista.DataSet Input dataset. association : pyvista.core.utiliti... | the_stack_v2_python_sparse | pyvista/core/pyvista_ndarray.py | pyvista/pyvista | train | 1,885 |
8b6c6f48a0e6a2f10091c9ec9326d4992bd110e9 | [
"self.domain = domain\nself.cliques = cliques\nself.variables = set()\nfor vs, matrix in cliques:\n self.variables.update(vs)",
"p = 1.0\nfor var, pot in self.cliques:\n if 0 < len(var) < 2:\n p *= pot[configuration[var[0]]]\n else:\n p *= pot[configuration[var[0]], configuration[var[1]]]\n... | <|body_start_0|>
self.domain = domain
self.cliques = cliques
self.variables = set()
for vs, matrix in cliques:
self.variables.update(vs)
<|end_body_0|>
<|body_start_1|>
p = 1.0
for var, pot in self.cliques:
if 0 < len(var) < 2:
p *... | Mrf | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mrf:
def __init__(self, domain, cliques):
"""Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)"""
<|body_0|>
def get_potential(self, configuration):
"""Return the potential (unnormalized) of the given variable configurati... | stack_v2_sparse_classes_36k_train_013679 | 3,913 | no_license | [
{
"docstring": "Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)",
"name": "__init__",
"signature": "def __init__(self, domain, cliques)"
},
{
"docstring": "Return the potential (unnormalized) of the given variable configuration)",
"name": "get_... | 5 | stack_v2_sparse_classes_30k_train_017340 | Implement the Python class `Mrf` described below.
Class description:
Implement the Mrf class.
Method signatures and docstrings:
- def __init__(self, domain, cliques): Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)
- def get_potential(self, configuration): Return the po... | Implement the Python class `Mrf` described below.
Class description:
Implement the Mrf class.
Method signatures and docstrings:
- def __init__(self, domain, cliques): Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)
- def get_potential(self, configuration): Return the po... | 2306f925f2932d2c0bde0ded15196be9597540f8 | <|skeleton|>
class Mrf:
def __init__(self, domain, cliques):
"""Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)"""
<|body_0|>
def get_potential(self, configuration):
"""Return the potential (unnormalized) of the given variable configurati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mrf:
def __init__(self, domain, cliques):
"""Domain: Values that the variables can take Cliques: List of tuples (variables,potential_matrix)"""
self.domain = domain
self.cliques = cliques
self.variables = set()
for vs, matrix in cliques:
self.variables.updat... | the_stack_v2_python_sparse | berni/Uebung 6.py | anhDean/AI_Assignments | train | 0 | |
c71759814ddeb2daf720e63553021d0e9706a821 | [
"rcts = sorted(self._getReactorTypes(), key=attrgetter('shortName'))\nnotWorkingReactors = ''\nfor r in rcts:\n try:\n namedModule(r.moduleName)\n self.messageOutput.write(' {:<4}\\t{}\\n'.format(r.shortName, r.description))\n except ImportError as e:\n notWorkingReactors += ' !{:<4... | <|body_start_0|>
rcts = sorted(self._getReactorTypes(), key=attrgetter('shortName'))
notWorkingReactors = ''
for r in rcts:
try:
namedModule(r.moduleName)
self.messageOutput.write(' {:<4}\t{}\n'.format(r.shortName, r.description))
except... | Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key. | ReactorSelectionMixin | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReactorSelectionMixin:
"""Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key."""
def opt_help_reactors(self):
"""Display a list of possibly available reactor names."... | stack_v2_sparse_classes_36k_train_013680 | 23,270 | permissive | [
{
"docstring": "Display a list of possibly available reactor names.",
"name": "opt_help_reactors",
"signature": "def opt_help_reactors(self)"
},
{
"docstring": "Which reactor to use (see --help-reactors for a list of possibilities)",
"name": "opt_reactor",
"signature": "def opt_reactor(s... | 2 | null | Implement the Python class `ReactorSelectionMixin` described below.
Class description:
Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key.
Method signatures and docstrings:
- def opt_help_reactors(se... | Implement the Python class `ReactorSelectionMixin` described below.
Class description:
Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key.
Method signatures and docstrings:
- def opt_help_reactors(se... | 5cee0a8c4180a3108538b4e4ce945a18726595a6 | <|skeleton|>
class ReactorSelectionMixin:
"""Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key."""
def opt_help_reactors(self):
"""Display a list of possibly available reactor names."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReactorSelectionMixin:
"""Provides options for selecting a reactor to install. If a reactor is installed, the short name which was used to locate it is saved as the value for the C{"reactor"} key."""
def opt_help_reactors(self):
"""Display a list of possibly available reactor names."""
rc... | the_stack_v2_python_sparse | venv/Lib/site-packages/twisted/application/app.py | zoelesv/Smathchat | train | 9 |
bb87d193cd44d6f2e57a864f11a638898a649baa | [
"name = request.query_params.get('name', None)\nsimilar_search = request.query_params.get('similar_search', None)\nparams = request.query_params.get(self.search_param, '')\nreturn name or similar_search or params",
"name = self.get_search_terms(request)\nname_cut = get_name_cut(name)\nif not name or not name_cut:... | <|body_start_0|>
name = request.query_params.get('name', None)
similar_search = request.query_params.get('similar_search', None)
params = request.query_params.get(self.search_param, '')
return name or similar_search or params
<|end_body_0|>
<|body_start_1|>
name = self.get_searc... | 检索 Name 的时候,contains 结合 similar search | NameSearchFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NameSearchFilter:
"""检索 Name 的时候,contains 结合 similar search"""
def get_search_terms(self, request):
"""Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited."""
<|body_0|>
def filter_queryset(self, request, queryset, view):
... | stack_v2_sparse_classes_36k_train_013681 | 3,204 | no_license | [
{
"docstring": "Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited.",
"name": "get_search_terms",
"signature": "def get_search_terms(self, request)"
},
{
"docstring": "Return queryset annotate s as Similarity similarity=TrigramSimilarity('name_cut... | 2 | null | Implement the Python class `NameSearchFilter` described below.
Class description:
检索 Name 的时候,contains 结合 similar search
Method signatures and docstrings:
- def get_search_terms(self, request): Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited.
- def filter_queryset(s... | Implement the Python class `NameSearchFilter` described below.
Class description:
检索 Name 的时候,contains 结合 similar search
Method signatures and docstrings:
- def get_search_terms(self, request): Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited.
- def filter_queryset(s... | b31a3eeb2d74935edf71d1a5fb7dfca190d2abe1 | <|skeleton|>
class NameSearchFilter:
"""检索 Name 的时候,contains 结合 similar search"""
def get_search_terms(self, request):
"""Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited."""
<|body_0|>
def filter_queryset(self, request, queryset, view):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NameSearchFilter:
"""检索 Name 的时候,contains 结合 similar search"""
def get_search_terms(self, request):
"""Search terms are set by a ?search=... query parameter, and may be comma and/or whitespace delimited."""
name = request.query_params.get('name', None)
similar_search = request.que... | the_stack_v2_python_sparse | django/filters.py | lroolle/CodingInPython | train | 1 |
986abc48ff204959bb8d673c979305e499317b37 | [
"self.normalizer.apply(shot)\nif self.is_inference:\n to_augment_str = self.to_augment_str\nelif self.conf['data']['augment_during_training']:\n to_augment_str = random.choice([x.description for x in shot.signals])\nelse:\n to_augment_str = None\nif to_augment_str is not None:\n for i, sig in enumerate(... | <|body_start_0|>
self.normalizer.apply(shot)
if self.is_inference:
to_augment_str = self.to_augment_str
elif self.conf['data']['augment_during_training']:
to_augment_str = random.choice([x.description for x in shot.signals])
else:
to_augment_str = None... | Augmentator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Augmentator:
def apply(self, shot):
"""The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a time) is augmented based on the string supplied in the config file. During training, augment a random... | stack_v2_sparse_classes_36k_train_013682 | 5,073 | no_license | [
{
"docstring": "The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a time) is augmented based on the string supplied in the config file. During training, augment a random signal (again, one at a time) or do not augmen... | 2 | stack_v2_sparse_classes_30k_val_000493 | Implement the Python class `Augmentator` described below.
Class description:
Implement the Augmentator class.
Method signatures and docstrings:
- def apply(self, shot): The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a t... | Implement the Python class `Augmentator` described below.
Class description:
Implement the Augmentator class.
Method signatures and docstrings:
- def apply(self, shot): The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a t... | b13dbed1883730d971dfe87fc1bc44e368840083 | <|skeleton|>
class Augmentator:
def apply(self, shot):
"""The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a time) is augmented based on the string supplied in the config file. During training, augment a random... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Augmentator:
def apply(self, shot):
"""The purpose of the method is to apply normalization to a shot and then optionally apply augmentation. During inference, a specific signal (one at a time) is augmented based on the string supplied in the config file. During training, augment a random signal (again... | the_stack_v2_python_sparse | plasma/preprocessor/augment.py | PPPLDeepLearning/plasma-python | train | 84 | |
a8241398debc19315baae079557560fd4e858535 | [
"self.rules.add(rule_name)\nfor member in members:\n if member.id not in self.members:\n self.members[member.id] = member\nfor message in messages:\n if message.id not in self.messages:\n self.messages[message.id] = message\n destination = message.guild.get_channel(Channels.attachment_log... | <|body_start_0|>
self.rules.add(rule_name)
for member in members:
if member.id not in self.members:
self.members[member.id] = member
for message in messages:
if message.id not in self.messages:
self.messages[message.id] = message
... | Represents a Deletion Context for a single spam event. | DeletionContext | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeletionContext:
"""Represents a Deletion Context for a single spam event."""
async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None:
"""Adds new rule violation events to the deletion context."""
<|body_0|>
async def upload_me... | stack_v2_sparse_classes_36k_train_013683 | 12,281 | permissive | [
{
"docstring": "Adds new rule violation events to the deletion context.",
"name": "add",
"signature": "async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None"
},
{
"docstring": "Method that takes care of uploading the queue and posting modlog alert.",... | 2 | stack_v2_sparse_classes_30k_train_019024 | Implement the Python class `DeletionContext` described below.
Class description:
Represents a Deletion Context for a single spam event.
Method signatures and docstrings:
- async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None: Adds new rule violation events to the deletio... | Implement the Python class `DeletionContext` described below.
Class description:
Represents a Deletion Context for a single spam event.
Method signatures and docstrings:
- async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None: Adds new rule violation events to the deletio... | 232cc68b0a0ef210027beacb9b4f50ffeeaddd00 | <|skeleton|>
class DeletionContext:
"""Represents a Deletion Context for a single spam event."""
async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None:
"""Adds new rule violation events to the deletion context."""
<|body_0|>
async def upload_me... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeletionContext:
"""Represents a Deletion Context for a single spam event."""
async def add(self, rule_name: str, members: Iterable[Member], messages: Iterable[Message]) -> None:
"""Adds new rule violation events to the deletion context."""
self.rules.add(rule_name)
for member in ... | the_stack_v2_python_sparse | bot/cogs/antispam.py | pormes/bot | train | 2 |
8b8353352bba8255c7dc5e99819f55d681c8157f | [
"self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(X_init, X_init)",
"sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T)\nK = self.sigma_f ** 2 * np.exp(-0.5 / self.l ** 2 * sqdist)\nreturn K",
"K_inv = np.linalg.inv(self.K)\nK_s = sel... | <|body_start_0|>
self.X = X_init
self.Y = Y_init
self.l = l
self.sigma_f = sigma_f
self.K = self.kernel(X_init, X_init)
<|end_body_0|>
<|body_start_1|>
sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T)
K = self.sigma_f ** 2 * ... | Class that represents a noiseless 1D Gaussian process | GaussianProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function - Y_init is a num... | stack_v2_sparse_classes_36k_train_013684 | 3,482 | no_license | [
{
"docstring": "Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function - Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the black-box function for each input in X_init - t is the number of initial samples - l ... | 4 | null | Implement the Python class `GaussianProcess` described below.
Class description:
Class that represents a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs alre... | Implement the Python class `GaussianProcess` described below.
Class description:
Class that represents a noiseless 1D Gaussian process
Method signatures and docstrings:
- def __init__(self, X_init, Y_init, l=1, sigma_f=1): Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs alre... | fc2cec306961f7ca2448965ddd3a2f656bbe10c7 | <|skeleton|>
class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function - Y_init is a num... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GaussianProcess:
"""Class that represents a noiseless 1D Gaussian process"""
def __init__(self, X_init, Y_init, l=1, sigma_f=1):
"""Constructor Arguments: - X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function - Y_init is a numpy.ndarray of... | the_stack_v2_python_sparse | unsupervised_learning/0x03-hyperparameter_tuning/2-gp.py | dalexach/holbertonschool-machine_learning | train | 2 |
dea4f6ae35cc301bf4a0dd28cf94934a513af907 | [
"if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):\n self.get_response = get_response\nelse:\n raise MiddlewareNotUsed()",
"try:\n if RESEARCH_ACTIVE:\n self.process_request(request)\nexcept LoginRequired:\n messages.warning(request, 'You need to be logged in to access this pag... | <|body_start_0|>
if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):
self.get_response = get_response
else:
raise MiddlewareNotUsed()
<|end_body_0|>
<|body_start_1|>
try:
if RESEARCH_ACTIVE:
self.process_request(request)
... | Middleware used with research application. | ResearchMiddleware | [
"MIT",
"AGPL-3.0-only",
"ISC",
"LGPL-2.1-or-later",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_36k_train_013685 | 4,205 | permissive | [
{
"docstring": "One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing.",
"name": "__init__",
"signature": "def __init__(self, get_response)"
},
{
"docstring": "Logic for middleware.",
"name": "__call__",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_003464 | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | 5b668eb66449e2ebaeb2177237b9a55a14d69efb | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
if not settings.PRODUCTION_ENVIRONMENT and (not settin... | the_stack_v2_python_sparse | codewof/research/middleware/ResearchMiddleware.py | uccser/codewof | train | 7 |
fbbb0d6a9f0ee144b78aecc0f1a0cd0bad3c45ad | [
"self._data = data\nself._detail = kwargs.get('detail', False)\nself._current_data = self._data",
"data = self._current_data\nkwargs = dict()\nkwargs['name'] = data.name\nreturn kwargs",
"info = list()\nassert isinstance(self._detail, bool)\nis_iterable = isinstance(self._data, Iterable)\nif not self._data:\n ... | <|body_start_0|>
self._data = data
self._detail = kwargs.get('detail', False)
self._current_data = self._data
<|end_body_0|>
<|body_start_1|>
data = self._current_data
kwargs = dict()
kwargs['name'] = data.name
return kwargs
<|end_body_1|>
<|body_start_2|>
... | 序列化器基类 | BaseSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseSerializer:
"""序列化器基类"""
def __init__(self, data=None, **kwargs):
"""* 参数 ** detail - 详细信息 [bool]"""
<|body_0|>
def data_info(self, *args):
"""简要信息 * 返回字段 ** name"""
<|body_1|>
def data(self):
"""返回数据"""
<|body_2|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_013686 | 12,928 | no_license | [
{
"docstring": "* 参数 ** detail - 详细信息 [bool]",
"name": "__init__",
"signature": "def __init__(self, data=None, **kwargs)"
},
{
"docstring": "简要信息 * 返回字段 ** name",
"name": "data_info",
"signature": "def data_info(self, *args)"
},
{
"docstring": "返回数据",
"name": "data",
"sig... | 3 | stack_v2_sparse_classes_30k_train_007152 | Implement the Python class `BaseSerializer` described below.
Class description:
序列化器基类
Method signatures and docstrings:
- def __init__(self, data=None, **kwargs): * 参数 ** detail - 详细信息 [bool]
- def data_info(self, *args): 简要信息 * 返回字段 ** name
- def data(self): 返回数据 | Implement the Python class `BaseSerializer` described below.
Class description:
序列化器基类
Method signatures and docstrings:
- def __init__(self, data=None, **kwargs): * 参数 ** detail - 详细信息 [bool]
- def data_info(self, *args): 简要信息 * 返回字段 ** name
- def data(self): 返回数据
<|skeleton|>
class BaseSerializer:
"""序列化器基类"""... | 639f11a91ee6e8b72883300cbf297ef4c0494d52 | <|skeleton|>
class BaseSerializer:
"""序列化器基类"""
def __init__(self, data=None, **kwargs):
"""* 参数 ** detail - 详细信息 [bool]"""
<|body_0|>
def data_info(self, *args):
"""简要信息 * 返回字段 ** name"""
<|body_1|>
def data(self):
"""返回数据"""
<|body_2|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseSerializer:
"""序列化器基类"""
def __init__(self, data=None, **kwargs):
"""* 参数 ** detail - 详细信息 [bool]"""
self._data = data
self._detail = kwargs.get('detail', False)
self._current_data = self._data
def data_info(self, *args):
"""简要信息 * 返回字段 ** name"""
... | the_stack_v2_python_sparse | ivmware/serializers.py | caijb007/itmsp | train | 0 |
5888a0f645d40a3f46b1ce61a5b8e82af6d9bcb6 | [
"mmax = {'max': 0}\n\ndef dfs(node, cnt):\n if node:\n cnt += 1\n else:\n return\n if not node.left and (not node.right):\n mmax['max'] = max(mmax['max'], cnt)\n if node.left:\n dfs(node.left, cnt)\n if node.right:\n dfs(node.right, cnt)\ndfs(root, 0)\nreturn mmax['... | <|body_start_0|>
mmax = {'max': 0}
def dfs(node, cnt):
if node:
cnt += 1
else:
return
if not node.left and (not node.right):
mmax['max'] = max(mmax['max'], cnt)
if node.left:
dfs(node.left, c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def rewrite2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
mmax = {'max': 0}
def dfs(node, cnt):
... | stack_v2_sparse_classes_36k_train_013687 | 1,811 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "rewrite2",
"signature": "def rewrite2(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008243 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): :type root: TreeNode :rtype: int
- def rewrite2(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): :type root: TreeNode :rtype: int
- def rewrite2(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def maxDepth(self, root... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def rewrite2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
mmax = {'max': 0}
def dfs(node, cnt):
if node:
cnt += 1
else:
return
if not node.left and (not node.right):
mmax['max'] = max(... | the_stack_v2_python_sparse | co_linkedin/104_Maximum_Depth_of_Binary_Tree.py | vsdrun/lc_public | train | 6 | |
05c6a16e2e90ef3ed826d62246bf1ed2bc4b44d5 | [
"super(LBHelpFormatter, self).__init__(prog, indent_increment, max_help_position, width)\n\ndef get_db_commands_list():\n try:\n from cli.command import db\n return db.get_db_commands_list()\n except:\n return []\nself.db_commands = get_db_commands_list()\nself.formatting_db = True",
"d... | <|body_start_0|>
super(LBHelpFormatter, self).__init__(prog, indent_increment, max_help_position, width)
def get_db_commands_list():
try:
from cli.command import db
return db.get_db_commands_list()
except:
return []
self.db... | A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands. | LBHelpFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LBHelpFormatter:
"""A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands."""
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):
"""Call super and then keep a list of the db commands to be... | stack_v2_sparse_classes_36k_train_013688 | 6,176 | no_license | [
{
"docstring": "Call super and then keep a list of the db commands to be used later.",
"name": "__init__",
"signature": "def __init__(self, prog, indent_increment=2, max_help_position=24, width=None)"
},
{
"docstring": "A method to sort the commands so that the db commands show first in the list... | 3 | stack_v2_sparse_classes_30k_val_000342 | Implement the Python class `LBHelpFormatter` described below.
Class description:
A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands.
Method signatures and docstrings:
- def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):... | Implement the Python class `LBHelpFormatter` described below.
Class description:
A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands.
Method signatures and docstrings:
- def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):... | db567686e37a1bc7932dc663b5742e50ce99f11d | <|skeleton|>
class LBHelpFormatter:
"""A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands."""
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):
"""Call super and then keep a list of the db commands to be... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LBHelpFormatter:
"""A help formatter that sorts the commands in the list and shows a separated section for db commands versus other commands."""
def __init__(self, prog, indent_increment=2, max_help_position=24, width=None):
"""Call super and then keep a list of the db commands to be used later."... | the_stack_v2_python_sparse | lib/logicblox/lib/python/cli/lbparser.py | croft/netgen | train | 0 |
12f6d297a51620e72d78390169a7d4db9818e091 | [
"self.robot = robot\nself.us = ev3.UltrasonicSensor('in3')\nself.us.mode = 'US-DIST-CM'\nself.state = 'seeking'\nself.robot.forward(0.3)",
"if self.state == 'seeking' and self.us.distance_centimeters <= 10:\n self.state = 'found'\n self.robot.stop()\nelif self.state == 'found' and self.us.distance_centimete... | <|body_start_0|>
self.robot = robot
self.us = ev3.UltrasonicSensor('in3')
self.us.mode = 'US-DIST-CM'
self.state = 'seeking'
self.robot.forward(0.3)
<|end_body_0|>
<|body_start_1|>
if self.state == 'seeking' and self.us.distance_centimeters <= 10:
self.state ... | This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction. | ExitCrowdBehavior | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExitCrowdBehavior:
"""This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction."""
def __init__(self, robot=None):
"""Set up robot and sensors"""
<|body_0|>
def run(self):
"""The robot w... | stack_v2_sparse_classes_36k_train_013689 | 6,005 | no_license | [
{
"docstring": "Set up robot and sensors",
"name": "__init__",
"signature": "def __init__(self, robot=None)"
},
{
"docstring": "The robot will run toward until found an object, and try to keep a certain distance with that object",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012661 | Implement the Python class `ExitCrowdBehavior` described below.
Class description:
This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up robot and sensors
- def r... | Implement the Python class `ExitCrowdBehavior` described below.
Class description:
This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction.
Method signatures and docstrings:
- def __init__(self, robot=None): Set up robot and sensors
- def r... | 59bd3e0825e8009ba60ad629962944f135e79c88 | <|skeleton|>
class ExitCrowdBehavior:
"""This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction."""
def __init__(self, robot=None):
"""Set up robot and sensors"""
<|body_0|>
def run(self):
"""The robot w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExitCrowdBehavior:
"""This behaviour should turn in place when an obstacle is too close. When there is no Obstacle it should move forward in that direction."""
def __init__(self, robot=None):
"""Set up robot and sensors"""
self.robot = robot
self.us = ev3.UltrasonicSensor('in3')
... | the_stack_v2_python_sparse | fsmCodeA.py | dletk/COMP380-Spring-2018 | train | 0 |
ed1fdfdc825acc0e549477a53a252486b8e0184d | [
"self._logger.debug('%s called with context %s', self.__class__.__name__, context)\nassert isinstance(context.message, KeylistUpdateResponse)\nif not context.connection_ready:\n raise HandlerException('Invalid mediation request: no active connection')\nmgr = MediationManager(context.profile)\nawait mgr.store_upd... | <|body_start_0|>
self._logger.debug('%s called with context %s', self.__class__.__name__, context)
assert isinstance(context.message, KeylistUpdateResponse)
if not context.connection_ready:
raise HandlerException('Invalid mediation request: no active connection')
mgr = Mediat... | Handler for keylist-update-response message. | KeylistUpdateResponseHandler | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeylistUpdateResponseHandler:
"""Handler for keylist-update-response message."""
async def handle(self, context: RequestContext, responder: BaseResponder):
"""Handle keylist-update-response message."""
<|body_0|>
async def notify_keylist_updated(self, profile: Profile, c... | stack_v2_sparse_classes_36k_train_013690 | 2,690 | permissive | [
{
"docstring": "Handle keylist-update-response message.",
"name": "handle",
"signature": "async def handle(self, context: RequestContext, responder: BaseResponder)"
},
{
"docstring": "Notify of keylist update response received.",
"name": "notify_keylist_updated",
"signature": "async def ... | 2 | null | Implement the Python class `KeylistUpdateResponseHandler` described below.
Class description:
Handler for keylist-update-response message.
Method signatures and docstrings:
- async def handle(self, context: RequestContext, responder: BaseResponder): Handle keylist-update-response message.
- async def notify_keylist_u... | Implement the Python class `KeylistUpdateResponseHandler` described below.
Class description:
Handler for keylist-update-response message.
Method signatures and docstrings:
- async def handle(self, context: RequestContext, responder: BaseResponder): Handle keylist-update-response message.
- async def notify_keylist_u... | 39cac36d8937ce84a9307ce100aaefb8bc05ec04 | <|skeleton|>
class KeylistUpdateResponseHandler:
"""Handler for keylist-update-response message."""
async def handle(self, context: RequestContext, responder: BaseResponder):
"""Handle keylist-update-response message."""
<|body_0|>
async def notify_keylist_updated(self, profile: Profile, c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KeylistUpdateResponseHandler:
"""Handler for keylist-update-response message."""
async def handle(self, context: RequestContext, responder: BaseResponder):
"""Handle keylist-update-response message."""
self._logger.debug('%s called with context %s', self.__class__.__name__, context)
... | the_stack_v2_python_sparse | aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/keylist_update_response_handler.py | hyperledger/aries-cloudagent-python | train | 370 |
1d492ad9b8da5b38b0a98509c168a87c1adf24ec | [
"self.nums = nums\nself.n = len(nums)\nself.sum_muns = [0] * (self.n + 1)",
"for k in range(self.n):\n self.sum_muns[k + 1] = self.sum_muns[k] + self.nums[k]\nreturn self.sum_muns[j + 1] - self.sum_muns[i]"
] | <|body_start_0|>
self.nums = nums
self.n = len(nums)
self.sum_muns = [0] * (self.n + 1)
<|end_body_0|>
<|body_start_1|>
for k in range(self.n):
self.sum_muns[k + 1] = self.sum_muns[k] + self.nums[k]
return self.sum_muns[j + 1] - self.sum_muns[i]
<|end_body_1|>
| NumArray1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray1:
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.n = len(nums)
self.s... | stack_v2_sparse_classes_36k_train_013691 | 1,030 | 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 `NumArray1` described below.
Class description:
Implement the NumArray1 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 `NumArray1` described below.
Class description:
Implement the NumArray1 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 NumArray1:
def __init__(self, nums):
... | c55b0cfd2967a2221c27ed738e8de15034775945 | <|skeleton|>
class NumArray1:
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 NumArray1:
def __init__(self, nums):
""":type nums: List[int]"""
self.nums = nums
self.n = len(nums)
self.sum_muns = [0] * (self.n + 1)
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
for k in range(self.n):
self.sum_muns[k... | the_stack_v2_python_sparse | PycharmProjects/segmentTree/leetcode303_3.py | crystal30/DataStructure | train | 0 | |
72c8fceeef23a4e6e05622e250e9fe5af02d2bb2 | [
"dd1 = {}\ndd2 = {}\nstr_list = str.split(' ')\nif len(pattern) != len(str_list):\n return False\nfor i in range(len(pattern)):\n if pattern[i] not in dd1 and str_list[i] not in dd2:\n dd1[pattern[i]] = str_list[i]\n dd2[str_list[i]] = pattern[i]\n elif pattern[i] in dd1 and dd1[pattern[i]] !... | <|body_start_0|>
dd1 = {}
dd2 = {}
str_list = str.split(' ')
if len(pattern) != len(str_list):
return False
for i in range(len(pattern)):
if pattern[i] not in dd1 and str_list[i] not in dd2:
dd1[pattern[i]] = str_list[i]
dd2... | 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 wordPattern2(self, pattern, s):
... | stack_v2_sparse_classes_36k_train_013692 | 2,239 | 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 | stack_v2_sparse_classes_30k_train_001547 | 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... | c55b0cfd2967a2221c27ed738e8de15034775945 | <|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 wordPattern2(self, pattern, s):
... | 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"""
dd1 = {}
dd2 = {}
str_list = str.split(' ')
if len(pattern) != len(str_list):
return False
for i in range(len(pattern)):
if pattern[i] not... | the_stack_v2_python_sparse | PycharmProjects/leetcode/Find/WordPattern290.py | crystal30/DataStructure | train | 0 | |
e48d4e52dc104d9ce8cd3e3b72a0896d88d8f4d7 | [
"time_elements_tuple = self._GetValueFromStructure(structure, 'date_time')\n_, month, day_of_month, hours, minutes, seconds, year = time_elements_tuple\nmonth = timelib.MONTH_DICT.get(month.lower(), 0)\nreturn (year, month, day_of_month, hours, minutes, seconds)",
"time_elements_tuple = self._GetTimeElementsTuple... | <|body_start_0|>
time_elements_tuple = self._GetValueFromStructure(structure, 'date_time')
_, month, day_of_month, hours, minutes, seconds, year = time_elements_tuple
month = timelib.MONTH_DICT.get(month.lower(), 0)
return (year, month, day_of_month, hours, minutes, seconds)
<|end_body_0... | Parses a vsftpd log. | VsftpdLogParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VsftpdLogParser:
"""Parses a vsftpd log."""
def _GetTimeElementsTuple(self, structure):
"""Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int)... | stack_v2_sparse_classes_36k_train_013693 | 5,343 | permissive | [
{
"docstring": "Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int): year. month (int): month, where 1 represents January. day_of_month (int): day of month, where 1 is th... | 4 | null | Implement the Python class `VsftpdLogParser` described below.
Class description:
Parses a vsftpd log.
Method signatures and docstrings:
- def _GetTimeElementsTuple(self, structure): Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of... | Implement the Python class `VsftpdLogParser` described below.
Class description:
Parses a vsftpd log.
Method signatures and docstrings:
- def _GetTimeElementsTuple(self, structure): Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of... | c69b2952b608cfce47ff8fd0d1409d856be35cb1 | <|skeleton|>
class VsftpdLogParser:
"""Parses a vsftpd log."""
def _GetTimeElementsTuple(self, structure):
"""Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VsftpdLogParser:
"""Parses a vsftpd log."""
def _GetTimeElementsTuple(self, structure):
"""Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int): year. month... | the_stack_v2_python_sparse | plaso/parsers/vsftpd.py | cyb3rfox/plaso | train | 3 |
3eee3c20521da9edd15910b1581b27b1cb60cd9a | [
"super(SplitterBlock, self).__init__()\nassert len(sections) == 2\nself.sections = sections\nself.header['out_1'] = {}\nself.header['out_1']['dtype'] = str(np.float32)\nself.header['out_1']['nbit'] = 32\nself.header['out_1']['shape'] = sections[0]\nself.header['out_2'] = self.header['out_1']\nself.header['out_2']['... | <|body_start_0|>
super(SplitterBlock, self).__init__()
assert len(sections) == 2
self.sections = sections
self.header['out_1'] = {}
self.header['out_1']['dtype'] = str(np.float32)
self.header['out_1']['nbit'] = 32
self.header['out_1']['shape'] = sections[0]
... | Block which splits up a ring into two | SplitterBlock | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SplitterBlock:
"""Block which splits up a ring into two"""
def __init__(self, sections):
"""@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices."""
<|body_0|>
def load_settings(sel... | stack_v2_sparse_classes_36k_train_013694 | 49,813 | permissive | [
{
"docstring": "@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices.",
"name": "__init__",
"signature": "def __init__(self, sections)"
},
{
"docstring": "Set the gulp sizes appropriate to the input ring",
... | 3 | null | Implement the Python class `SplitterBlock` described below.
Class description:
Block which splits up a ring into two
Method signatures and docstrings:
- def __init__(self, sections): @param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing ... | Implement the Python class `SplitterBlock` described below.
Class description:
Block which splits up a ring into two
Method signatures and docstrings:
- def __init__(self, sections): @param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing ... | 5a93e5d4e906694cf754ac4f1015640a710ffc02 | <|skeleton|>
class SplitterBlock:
"""Block which splits up a ring into two"""
def __init__(self, sections):
"""@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices."""
<|body_0|>
def load_settings(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SplitterBlock:
"""Block which splits up a ring into two"""
def __init__(self, sections):
"""@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices."""
super(SplitterBlock, self).__init__()
asse... | the_stack_v2_python_sparse | python/bifrost/block.py | ledatelescope/bifrost | train | 66 |
8af86c13c01f18ab13e5e040eb7a515aa1d1164d | [
"self.initial_registration_date = APIHelper.RFC3339DateTime(initial_registration_date) if initial_registration_date else None\nself.registration_status = registration_status\nself.validation_sources = validation_sources\nself.last_update_date = APIHelper.RFC3339DateTime(last_update_date) if last_update_date else No... | <|body_start_0|>
self.initial_registration_date = APIHelper.RFC3339DateTime(initial_registration_date) if initial_registration_date else None
self.registration_status = registration_status
self.validation_sources = validation_sources
self.last_update_date = APIHelper.RFC3339DateTime(last... | Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources (string): TODO: type description here. last_update_date (datetime): TODO: type de... | LeiRegistration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeiRegistration:
"""Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources (string): TODO: type description here.... | stack_v2_sparse_classes_36k_train_013695 | 4,182 | permissive | [
{
"docstring": "Constructor for the LeiRegistration class",
"name": "__init__",
"signature": "def __init__(self, initial_registration_date=None, registration_status=None, validation_sources=None, last_update_date=None, next_renewal_date=None, managing_lou=None, additional_properties={})"
},
{
"d... | 2 | null | Implement the Python class `LeiRegistration` described below.
Class description:
Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources... | Implement the Python class `LeiRegistration` described below.
Class description:
Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class LeiRegistration:
"""Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources (string): TODO: type description here.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LeiRegistration:
"""Implementation of the 'LeiRegistration' model. TODO: type model description here. Attributes: initial_registration_date (datetime): TODO: type description here. registration_status (string): TODO: type description here. validation_sources (string): TODO: type description here. last_update_... | the_stack_v2_python_sparse | idfy_rest_client/models/lei_registration.py | dealflowteam/Idfy | train | 0 |
e20d9afacde53b3f45d9ad17f983905e39d6c943 | [
"items: List[Dict[str, Any]] = []\nitems = SpecialItems.IDs(self, items)\nUtility.WriteFile(self, f'{self.eXAssets}/specialItems.json', items)\nlog.info(f'Compiled {len(items):,} Special Items')",
"ids: List[Dict[str, Any]] = Utility.ReadCSV(self, f'{self.iXAssets}/loot/special_ids.csv', SpecialIDs)\nif ids is No... | <|body_start_0|>
items: List[Dict[str, Any]] = []
items = SpecialItems.IDs(self, items)
Utility.WriteFile(self, f'{self.eXAssets}/specialItems.json', items)
log.info(f'Compiled {len(items):,} Special Items')
<|end_body_0|>
<|body_start_1|>
ids: List[Dict[str, Any]] = Utility.Rea... | Special Item XAssets. | SpecialItems | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecialItems:
"""Special Item XAssets."""
def Compile(self: Any) -> None:
"""Compile the Special Item XAssets."""
<|body_0|>
def IDs(self: Any, items: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Compile the loot/special_ids.csv XAsset."""
<|body_1|>... | stack_v2_sparse_classes_36k_train_013696 | 1,662 | permissive | [
{
"docstring": "Compile the Special Item XAssets.",
"name": "Compile",
"signature": "def Compile(self: Any) -> None"
},
{
"docstring": "Compile the loot/special_ids.csv XAsset.",
"name": "IDs",
"signature": "def IDs(self: Any, items: List[Dict[str, Any]]) -> List[Dict[str, Any]]"
}
] | 2 | stack_v2_sparse_classes_30k_train_000070 | Implement the Python class `SpecialItems` described below.
Class description:
Special Item XAssets.
Method signatures and docstrings:
- def Compile(self: Any) -> None: Compile the Special Item XAssets.
- def IDs(self: Any, items: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Compile the loot/special_ids.csv XAsset. | Implement the Python class `SpecialItems` described below.
Class description:
Special Item XAssets.
Method signatures and docstrings:
- def Compile(self: Any) -> None: Compile the Special Item XAssets.
- def IDs(self: Any, items: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Compile the loot/special_ids.csv XAsset.
... | 82d3198a64eb2905e96dd536ce2f0acb52f9ce77 | <|skeleton|>
class SpecialItems:
"""Special Item XAssets."""
def Compile(self: Any) -> None:
"""Compile the Special Item XAssets."""
<|body_0|>
def IDs(self: Any, items: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Compile the loot/special_ids.csv XAsset."""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecialItems:
"""Special Item XAssets."""
def Compile(self: Any) -> None:
"""Compile the Special Item XAssets."""
items: List[Dict[str, Any]] = []
items = SpecialItems.IDs(self, items)
Utility.WriteFile(self, f'{self.eXAssets}/specialItems.json', items)
log.info(f'... | the_stack_v2_python_sparse | ModernWarfare/XAssets/specialItems.py | dbuentello/Hyde | train | 0 |
bca8a8d041a6db7d73cb2790fb6933cd5eee0437 | [
"try:\n if cb is None:\n eval('cb = _py_init_%s' % klass)\nexcept Exception as err:\n _msg = _PyAthenaBindingsCatalog.msg\n _msg.error('Problem registering callback for [%s]', klass)\n _msg.error('Exception: %s', err)\n cb = lambda: None\n_PyAthenaBindingsCatalog.instances[klass] = cb\nreturn"... | <|body_start_0|>
try:
if cb is None:
eval('cb = _py_init_%s' % klass)
except Exception as err:
_msg = _PyAthenaBindingsCatalog.msg
_msg.error('Problem registering callback for [%s]', klass)
_msg.error('Exception: %s', err)
cb = ... | Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ? | _PyAthenaBindingsCatalog | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PyAthenaBindingsCatalog:
"""Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ?"""
def register(klass, cb=None):
"""Register a class name `klass` with an initialization method. If no callback method has been given, the defaul... | stack_v2_sparse_classes_36k_train_013697 | 31,587 | permissive | [
{
"docstring": "Register a class name `klass` with an initialization method. If no callback method has been given, the default is to call: _py_init_<klass>()",
"name": "register",
"signature": "def register(klass, cb=None)"
},
{
"docstring": "Initialize the python binding with the callback previ... | 2 | null | Implement the Python class `_PyAthenaBindingsCatalog` described below.
Class description:
Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ?
Method signatures and docstrings:
- def register(klass, cb=None): Register a class name `klass` with an initialization... | Implement the Python class `_PyAthenaBindingsCatalog` described below.
Class description:
Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ?
Method signatures and docstrings:
- def register(klass, cb=None): Register a class name `klass` with an initialization... | 354f92551294f7be678aebcd7b9d67d2c4448176 | <|skeleton|>
class _PyAthenaBindingsCatalog:
"""Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ?"""
def register(klass, cb=None):
"""Register a class name `klass` with an initialization method. If no callback method has been given, the defaul... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _PyAthenaBindingsCatalog:
"""Placeholder class to register callbacks for 'pythonizations' of C++ classes. FIXME: find a better mechanism ?"""
def register(klass, cb=None):
"""Register a class name `klass` with an initialization method. If no callback method has been given, the default is to call:... | the_stack_v2_python_sparse | Control/AthenaPython/python/Bindings.py | strigazi/athena | train | 0 |
ec8c816392bf503aab623ed2e3234e7e0d20136e | [
"if 'scraped_items' not in spider.state:\n spider.state['scraped_items'] = []\nspider.state['scraped_items'].append(item)\nreturn item",
"source = get_or_create_source(spider)\ndb_items = source.rides.filter(is_expired=False)\nfor db_item in db_items:\n if spider.is_expired(db_item, spider.state['scraped_it... | <|body_start_0|>
if 'scraped_items' not in spider.state:
spider.state['scraped_items'] = []
spider.state['scraped_items'].append(item)
return item
<|end_body_0|>
<|body_start_1|>
source = get_or_create_source(spider)
db_items = source.rides.filter(is_expired=False)
... | CheckExpiredPipeline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckExpiredPipeline:
def process_item(self, item, spider):
"""Save original ad url of each scraped item"""
<|body_0|>
def close_spider(self, spider):
"""Mark expired ads of particular ad source (spider)."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_013698 | 3,164 | no_license | [
{
"docstring": "Save original ad url of each scraped item",
"name": "process_item",
"signature": "def process_item(self, item, spider)"
},
{
"docstring": "Mark expired ads of particular ad source (spider).",
"name": "close_spider",
"signature": "def close_spider(self, spider)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008009 | Implement the Python class `CheckExpiredPipeline` described below.
Class description:
Implement the CheckExpiredPipeline class.
Method signatures and docstrings:
- def process_item(self, item, spider): Save original ad url of each scraped item
- def close_spider(self, spider): Mark expired ads of particular ad source... | Implement the Python class `CheckExpiredPipeline` described below.
Class description:
Implement the CheckExpiredPipeline class.
Method signatures and docstrings:
- def process_item(self, item, spider): Save original ad url of each scraped item
- def close_spider(self, spider): Mark expired ads of particular ad source... | 3d6c82e18ad51db5f8b58f1f258e0f64248fccc9 | <|skeleton|>
class CheckExpiredPipeline:
def process_item(self, item, spider):
"""Save original ad url of each scraped item"""
<|body_0|>
def close_spider(self, spider):
"""Mark expired ads of particular ad source (spider)."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckExpiredPipeline:
def process_item(self, item, spider):
"""Save original ad url of each scraped item"""
if 'scraped_items' not in spider.state:
spider.state['scraped_items'] = []
spider.state['scraped_items'].append(item)
return item
def close_spider(self, ... | the_stack_v2_python_sparse | carpool_news/ride_scraper/ride_scraper/pipelines.py | tomasra/carpool_news | train | 0 | |
c11ddca4ebe75dd6eb6bfc5478f6a4c904ab635c | [
"items = PublicOrganization.objects.all()\nfor item in items.all():\n item.delete()",
"try:\n return PublicOrganization.objects.get(pk=int_or_none(pk))\nexcept PublicOrganization.DoesNotExist:\n return None"
] | <|body_start_0|>
items = PublicOrganization.objects.all()
for item in items.all():
item.delete()
<|end_body_0|>
<|body_start_1|>
try:
return PublicOrganization.objects.get(pk=int_or_none(pk))
except PublicOrganization.DoesNotExist:
return None
<|end_b... | PublicOrganizationManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublicOrganizationManager:
def delete_all(self):
"""Helper function which will delete all the HouseSections in DB."""
<|body_0|>
def get_by_pk_or_none(self, pk):
"""Helper function which gets the HouseSection object by PK parameter or returns None result."""
... | stack_v2_sparse_classes_36k_train_013699 | 13,440 | permissive | [
{
"docstring": "Helper function which will delete all the HouseSections in DB.",
"name": "delete_all",
"signature": "def delete_all(self)"
},
{
"docstring": "Helper function which gets the HouseSection object by PK parameter or returns None result.",
"name": "get_by_pk_or_none",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_009385 | Implement the Python class `PublicOrganizationManager` described below.
Class description:
Implement the PublicOrganizationManager class.
Method signatures and docstrings:
- def delete_all(self): Helper function which will delete all the HouseSections in DB.
- def get_by_pk_or_none(self, pk): Helper function which ge... | Implement the Python class `PublicOrganizationManager` described below.
Class description:
Implement the PublicOrganizationManager class.
Method signatures and docstrings:
- def delete_all(self): Helper function which will delete all the HouseSections in DB.
- def get_by_pk_or_none(self, pk): Helper function which ge... | 053973b5ff0b997c52bfaca8daf8e07db64a877c | <|skeleton|>
class PublicOrganizationManager:
def delete_all(self):
"""Helper function which will delete all the HouseSections in DB."""
<|body_0|>
def get_by_pk_or_none(self, pk):
"""Helper function which gets the HouseSection object by PK parameter or returns None result."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PublicOrganizationManager:
def delete_all(self):
"""Helper function which will delete all the HouseSections in DB."""
items = PublicOrganization.objects.all()
for item in items.all():
item.delete()
def get_by_pk_or_none(self, pk):
"""Helper function which gets ... | the_stack_v2_python_sparse | foundation_public/models/organization.py | smegurus/smegurus-django | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.