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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a8efbc73aaff963afd561b5eb55d0e36e13b4dd4 | [
"self.people = mapper.get_all_people()\nself.date = date\nself.already_prescheduled = False",
"if not self.already_prescheduled:\n self.__pre_schedule_free_weekends()\n self.already_prescheduled = True",
"weekends = calendar_utils.get_weekends(self.date)\nrandom.shuffle(weekends)\npeople = []\nfor person ... | <|body_start_0|>
self.people = mapper.get_all_people()
self.date = date
self.already_prescheduled = False
<|end_body_0|>
<|body_start_1|>
if not self.already_prescheduled:
self.__pre_schedule_free_weekends()
self.already_prescheduled = True
<|end_body_1|>
<|body... | PreSchedulerModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PreSchedulerModule:
def __init__(self, mapper, workers, date, logger):
"""The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper: a mapper object @param date: a datetime.date object, that has the correct month and year"""
<|body... | stack_v2_sparse_classes_36k_train_015000 | 2,602 | no_license | [
{
"docstring": "The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper: a mapper object @param date: a datetime.date object, that has the correct month and year",
"name": "__init__",
"signature": "def __init__(self, mapper, workers, date, logger)"
},... | 5 | null | Implement the Python class `PreSchedulerModule` described below.
Class description:
Implement the PreSchedulerModule class.
Method signatures and docstrings:
- def __init__(self, mapper, workers, date, logger): The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper:... | Implement the Python class `PreSchedulerModule` described below.
Class description:
Implement the PreSchedulerModule class.
Method signatures and docstrings:
- def __init__(self, mapper, workers, date, logger): The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper:... | 781ce419b51b5bd99bbd1b155c03843cb434cb8c | <|skeleton|>
class PreSchedulerModule:
def __init__(self, mapper, workers, date, logger):
"""The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper: a mapper object @param date: a datetime.date object, that has the correct month and year"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PreSchedulerModule:
def __init__(self, mapper, workers, date, logger):
"""The default constructor. Only the parameters listed bellow are used, the rest are discarded. @param mapper: a mapper object @param date: a datetime.date object, that has the correct month and year"""
self.people = mapper... | the_stack_v2_python_sparse | scheduler/modules/prescheduler.py | mcepar1/Scheduler | train | 0 | |
9b79995109b8357e190639140342e3a94ec5b2de | [
"self.mod_dir = mod_dir\nconfig_dir = os.path.join(mod_dir, constant.VSCODE_CONFIG_DIR)\nif not os.path.isdir(config_dir):\n os.mkdir(config_dir)\nself.config_dir = config_dir",
"native_mod_info = native_module_info.NativeModuleInfo()\nroot_dir = common_util.get_android_root_dir()\nmod_names = native_mod_info.... | <|body_start_0|>
self.mod_dir = mod_dir
config_dir = os.path.join(mod_dir, constant.VSCODE_CONFIG_DIR)
if not os.path.isdir(config_dir):
os.mkdir(config_dir)
self.config_dir = config_dir
<|end_body_0|>
<|body_start_1|>
native_mod_info = native_module_info.NativeModul... | VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path. | VSCodeNativeProjectFileGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VSCodeNativeProjectFileGenerator:
"""VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path."""
def __init__(self, mod_dir):
"""VSCodeNativeProjectFileGenerator initialize. Args: mod_dir:... | stack_v2_sparse_classes_36k_train_015001 | 5,145 | no_license | [
{
"docstring": "VSCodeNativeProjectFileGenerator initialize. Args: mod_dir: An absolute path of native project directory.",
"name": "__init__",
"signature": "def __init__(self, mod_dir)"
},
{
"docstring": "Generates c_cpp_properties.json file for VSCode project.",
"name": "generate_c_cpp_pro... | 3 | null | Implement the Python class `VSCodeNativeProjectFileGenerator` described below.
Class description:
VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path.
Method signatures and docstrings:
- def __init__(self, mod_dir): VS... | Implement the Python class `VSCodeNativeProjectFileGenerator` described below.
Class description:
VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path.
Method signatures and docstrings:
- def __init__(self, mod_dir): VS... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class VSCodeNativeProjectFileGenerator:
"""VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path."""
def __init__(self, mod_dir):
"""VSCodeNativeProjectFileGenerator initialize. Args: mod_dir:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VSCodeNativeProjectFileGenerator:
"""VSCode native project file generator. Attributes: mod_dir: A string of native project path. config_dir: A string of native project's configuration path."""
def __init__(self, mod_dir):
"""VSCodeNativeProjectFileGenerator initialize. Args: mod_dir: An absolute ... | the_stack_v2_python_sparse | tools/asuite/aidegen/vscode/vscode_native_project_file_gen.py | ZYHGOD-1/Aosp11 | train | 0 |
d4449befbd6ddfe57417200833fd6a184fbd1138 | [
"import Cheat\nres = Cheat.cheatclass.cheatT(self)\nexp = Cheat.cheatclass.cheatingR(self)\nself.assertTrue(res, exp)",
"import Cheat\nres = Cheat.cheatclass.cheatF(self)\nexp = Cheat.cheatclass.cheatingR(self)\nself.assertFalse(res, exp)"
] | <|body_start_0|>
import Cheat
res = Cheat.cheatclass.cheatT(self)
exp = Cheat.cheatclass.cheatingR(self)
self.assertTrue(res, exp)
<|end_body_0|>
<|body_start_1|>
import Cheat
res = Cheat.cheatclass.cheatF(self)
exp = Cheat.cheatclass.cheatingR(self)
self... | Unittest for cheatclass | cheattest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class cheattest:
"""Unittest for cheatclass"""
def testcheatTrue(self):
""""Tests if cehat == true"""
<|body_0|>
def testcheatFalse(self):
"""test if cheat == False"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import Cheat
res = Cheat.cheat... | stack_v2_sparse_classes_36k_train_015002 | 571 | permissive | [
{
"docstring": "\"Tests if cehat == true",
"name": "testcheatTrue",
"signature": "def testcheatTrue(self)"
},
{
"docstring": "test if cheat == False",
"name": "testcheatFalse",
"signature": "def testcheatFalse(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000223 | Implement the Python class `cheattest` described below.
Class description:
Unittest for cheatclass
Method signatures and docstrings:
- def testcheatTrue(self): "Tests if cehat == true
- def testcheatFalse(self): test if cheat == False | Implement the Python class `cheattest` described below.
Class description:
Unittest for cheatclass
Method signatures and docstrings:
- def testcheatTrue(self): "Tests if cehat == true
- def testcheatFalse(self): test if cheat == False
<|skeleton|>
class cheattest:
"""Unittest for cheatclass"""
def testcheat... | 73a8962c762ff48da331c9212f10676f066ed940 | <|skeleton|>
class cheattest:
"""Unittest for cheatclass"""
def testcheatTrue(self):
""""Tests if cehat == true"""
<|body_0|>
def testcheatFalse(self):
"""test if cheat == False"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class cheattest:
"""Unittest for cheatclass"""
def testcheatTrue(self):
""""Tests if cehat == true"""
import Cheat
res = Cheat.cheatclass.cheatT(self)
exp = Cheat.cheatclass.cheatingR(self)
self.assertTrue(res, exp)
def testcheatFalse(self):
"""test if cheat... | the_stack_v2_python_sparse | methoddice/testcheat.py | JohanK91/MethodDice | train | 0 |
a591571acff2ee07d7ee6ae64f0694641794ef90 | [
"self.lst = []\nself.size = size\nself.l = 0\nself.sum_w = 0",
"if len(self.lst) >= self.size:\n self.sum_w -= self.lst[self.l]\n self.l += 1\nself.lst.append(val)\nself.sum_w += val\nreturn float(self.sum_w) / (len(self.lst) - self.l)"
] | <|body_start_0|>
self.lst = []
self.size = size
self.l = 0
self.sum_w = 0
<|end_body_0|>
<|body_start_1|>
if len(self.lst) >= self.size:
self.sum_w -= self.lst[self.l]
self.l += 1
self.lst.append(val)
self.sum_w += val
return float... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.lst = []
self.size = siz... | stack_v2_sparse_classes_36k_train_015003 | 759 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | null | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 9126c2089e41d4d7fd3a204115eba2b5074076ad | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.lst = []
self.size = size
self.l = 0
self.sum_w = 0
def next(self, val):
""":type val: int :rtype: float"""
if len(self.lst) >= self.size:
... | the_stack_v2_python_sparse | 346_Moving Average from Data Stream.py | Shwan-Yu/Data_Structures_and_Algorithms | train | 0 | |
4b17b27a3b33d12e5e775346b68a6d6d574334bc | [
"super().__init__(**kwargs)\nself.factory = factory\nself.chapter_slug = self.content_path\nself.chapter_number = chapter_number",
"chapter_structure = self.load_yaml_file(self.structure_file_path)\nsections = chapter_structure.get('sections', None)\nif sections is None:\n raise MissingRequiredFieldError(self.... | <|body_start_0|>
super().__init__(**kwargs)
self.factory = factory
self.chapter_slug = self.content_path
self.chapter_number = chapter_number
<|end_body_0|>
<|body_start_1|>
chapter_structure = self.load_yaml_file(self.structure_file_path)
sections = chapter_structure.ge... | Custom loader for loading chapters. | ChaptersLoader | [
"CC-BY-NC-SA-4.0",
"BSD-3-Clause",
"CC0-1.0",
"ISC",
"Unlicense",
"LicenseRef-scancode-secret-labs-2011",
"WTFPL",
"Apache-2.0",
"LGPL-3.0-only",
"MIT",
"CC-BY-SA-4.0",
"LicenseRef-scancode-public-domain",
"CC-BY-NC-2.5",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChaptersLoader:
"""Custom loader for loading chapters."""
def __init__(self, factory, chapter_number, **kwargs):
"""Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders."""
<|body_0|>
def load(self):
"""Load th... | stack_v2_sparse_classes_36k_train_015004 | 3,710 | permissive | [
{
"docstring": "Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders.",
"name": "__init__",
"signature": "def __init__(self, factory, chapter_number, **kwargs)"
},
{
"docstring": "Load the content for a chapter. Raises: MissingRequiredFieldErr... | 2 | stack_v2_sparse_classes_30k_val_001119 | Implement the Python class `ChaptersLoader` described below.
Class description:
Custom loader for loading chapters.
Method signatures and docstrings:
- def __init__(self, factory, chapter_number, **kwargs): Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders.
- de... | Implement the Python class `ChaptersLoader` described below.
Class description:
Custom loader for loading chapters.
Method signatures and docstrings:
- def __init__(self, factory, chapter_number, **kwargs): Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders.
- de... | ea3281ec6f4d17538f6d3cf6f88d74fa54581b34 | <|skeleton|>
class ChaptersLoader:
"""Custom loader for loading chapters."""
def __init__(self, factory, chapter_number, **kwargs):
"""Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders."""
<|body_0|>
def load(self):
"""Load th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChaptersLoader:
"""Custom loader for loading chapters."""
def __init__(self, factory, chapter_number, **kwargs):
"""Create the loader for loading a Chapter. Args: factory (LoaderFactory): Object for creating other loaders."""
super().__init__(**kwargs)
self.factory = factory
... | the_stack_v2_python_sparse | csfieldguide/chapters/management/commands/_ChaptersLoader.py | uccser/cs-field-guide | train | 364 |
ca4f73c0708fcd8d86875cdae063c88eef86c9d3 | [
"self.left = None\nself.right = None\nself.data = data\nself.parent = parent",
"if data < self.data:\n if self.left is None:\n self.left = Node(data, self)\n else:\n self.left.insert(data)\nelif data > self.data:\n if self.right is None:\n self.right = Node(data, self)\n else:\n ... | <|body_start_0|>
self.left = None
self.right = None
self.data = data
self.parent = parent
<|end_body_0|>
<|body_start_1|>
if data < self.data:
if self.left is None:
self.left = Node(data, self)
else:
self.left.insert(data)
... | Tree node: left and right child + data which can be any object | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
"""Tree node: left and right child + data which can be any object"""
def __init__(self, data, parent):
"""Node constructor @param data node data object"""
<|body_0|>
def insert(self, data):
"""Insert new node with data @param data node data object to insert... | stack_v2_sparse_classes_36k_train_015005 | 2,595 | no_license | [
{
"docstring": "Node constructor @param data node data object",
"name": "__init__",
"signature": "def __init__(self, data, parent)"
},
{
"docstring": "Insert new node with data @param data node data object to insert",
"name": "insert",
"signature": "def insert(self, data)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_007275 | Implement the Python class `Node` described below.
Class description:
Tree node: left and right child + data which can be any object
Method signatures and docstrings:
- def __init__(self, data, parent): Node constructor @param data node data object
- def insert(self, data): Insert new node with data @param data node ... | Implement the Python class `Node` described below.
Class description:
Tree node: left and right child + data which can be any object
Method signatures and docstrings:
- def __init__(self, data, parent): Node constructor @param data node data object
- def insert(self, data): Insert new node with data @param data node ... | ec3a9afab657861d471550ca8fcb4b2a269cf46b | <|skeleton|>
class Node:
"""Tree node: left and right child + data which can be any object"""
def __init__(self, data, parent):
"""Node constructor @param data node data object"""
<|body_0|>
def insert(self, data):
"""Insert new node with data @param data node data object to insert... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Node:
"""Tree node: left and right child + data which can be any object"""
def __init__(self, data, parent):
"""Node constructor @param data node data object"""
self.left = None
self.right = None
self.data = data
self.parent = parent
def insert(self, data):
... | the_stack_v2_python_sparse | Medium/c11 Lowest Common Ancestor.py | mgorgei/codeeval | train | 1 |
7195c0485aa154e86e756e7b8b64738fd754e9ae | [
"if len(nums) == 0:\n return []\nans = []\nfor i in range(len(nums) - k + 1):\n ans.append(max(nums[i:i + k]))\nreturn ans",
"if len(nums) == 0:\n return []\nans = []\nfor i in range(len(nums) - k + 1):\n ans.append(max(nums[i:i + k]))\n return ans"
] | <|body_start_0|>
if len(nums) == 0:
return []
ans = []
for i in range(len(nums) - k + 1):
ans.append(max(nums[i:i + k]))
return ans
<|end_body_0|>
<|body_start_1|>
if len(nums) == 0:
return []
ans = []
for i in range(len(nums) ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。"""
<|body_0|>
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""暴力切片法 优化 条件1:假设当前滑动窗口的最大值为x,当进行滑动时会有一个一个元素进入,首先比较退出... | stack_v2_sparse_classes_36k_train_015006 | 5,152 | no_license | [
{
"docstring": "暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。",
"name": "maxSlidingWindow",
"signature": "def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]"
},
{
"docstring": "暴力切片法 优化 条件1:假设当前滑动窗口的最大值为x,当进行滑动时会有一个一个元素进入,首先比较退出的 元素是否为最大的元素,如果是的话,则需要重新找到新窗口的最大值 条件2:如果进入的元素p... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。
- def maxSlidingWindow(self, nums: List[int], k: int) -> L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。
- def maxSlidingWindow(self, nums: List[int], k: int) -> L... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。"""
<|body_0|>
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""暴力切片法 优化 条件1:假设当前滑动窗口的最大值为x,当进行滑动时会有一个一个元素进入,首先比较退出... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
"""暴力切片法 这种方法在面试会被pass...... 因为这种滑动窗口每次在取max无法降低重复操作。。。。"""
if len(nums) == 0:
return []
ans = []
for i in range(len(nums) - k + 1):
ans.append(max(nums[i:i + k]))
return... | the_stack_v2_python_sparse | 剑指offer/PythonVersion/59_1_滑动窗口最大值.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
da2a60615d8053d27dfda14609b8935dd4f1fd41 | [
"self.limit = limit_time\nself.max_depth = max_depth\nif weight < 0 or weight > 1:\n raise ValueError()\nself.weight = weight",
"def evaluator(node):\n return self.weight * node.path_cost + (1 - self.weight) * heuristic.evaluate(node.state)\n\ndef queue_generator():\n return PriorityQueue(evaluator)\nsea... | <|body_start_0|>
self.limit = limit_time
self.max_depth = max_depth
if weight < 0 or weight > 1:
raise ValueError()
self.weight = weight
<|end_body_0|>
<|body_start_1|>
def evaluator(node):
return self.weight * node.path_cost + (1 - self.weight) * heurist... | Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed. | AStarWeightHelp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AStarWeightHelp:
"""Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed."""
def __init__(self, weight, limit_time=infinity, max_depth=infinity):
"""Constructs the A* search. Optionally, a maximum depth may be provide... | stack_v2_sparse_classes_36k_train_015007 | 5,669 | no_license | [
{
"docstring": "Constructs the A* search. Optionally, a maximum depth may be provided at which to stop looking for the goal state. Given weight = 1/2, this algorithm is idnetical to A*",
"name": "__init__",
"signature": "def __init__(self, weight, limit_time=infinity, max_depth=infinity)"
},
{
"... | 2 | stack_v2_sparse_classes_30k_train_014458 | Implement the Python class `AStarWeightHelp` described below.
Class description:
Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed.
Method signatures and docstrings:
- def __init__(self, weight, limit_time=infinity, max_depth=infinity): Constructs ... | Implement the Python class `AStarWeightHelp` described below.
Class description:
Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed.
Method signatures and docstrings:
- def __init__(self, weight, limit_time=infinity, max_depth=infinity): Constructs ... | 656f76259e12c7303600671278a51e7b75a83770 | <|skeleton|>
class AStarWeightHelp:
"""Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed."""
def __init__(self, weight, limit_time=infinity, max_depth=infinity):
"""Constructs the A* search. Optionally, a maximum depth may be provide... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AStarWeightHelp:
"""Implementation of the A* search algorithm for the Problem. It may also take a maximum depth at which to stop, if needed."""
def __init__(self, weight, limit_time=infinity, max_depth=infinity):
"""Constructs the A* search. Optionally, a maximum depth may be provided at which to... | the_stack_v2_python_sparse | Artificial Intelligence/AI Multi Robot/Multi_robot/src/search/astar_weight.py | saedmansour/University-Code | train | 0 |
3f48cfcdc7dee7908eca0ab12721f1105b707ad0 | [
"backend = self.get_backend_for_app(app_id)\nauth_client = get_backend_authenticated_client(request.user.username, backend)\ndomains = auth_client.get_application_domains(app_id)\nreturn self.respond_multiple(domains)",
"domain = json.loads(request.body)['domain']\nbackend = self.get_backend_for_app(app_id)\nauth... | <|body_start_0|>
backend = self.get_backend_for_app(app_id)
auth_client = get_backend_authenticated_client(request.user.username, backend)
domains = auth_client.get_application_domains(app_id)
return self.respond_multiple(domains)
<|end_body_0|>
<|body_start_1|>
domain = json.lo... | AppDomainsApiView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppDomainsApiView:
def get(self, request, app_id):
"""Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse"""
<|body_0|>
def post(self, request, app_id):
... | stack_v2_sparse_classes_36k_train_015008 | 1,494 | no_license | [
{
"docstring": "Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse",
"name": "get",
"signature": "def get(self, request, app_id)"
},
{
"docstring": "Add a domain to this app The... | 2 | stack_v2_sparse_classes_30k_train_009757 | Implement the Python class `AppDomainsApiView` described below.
Class description:
Implement the AppDomainsApiView class.
Method signatures and docstrings:
- def get(self, request, app_id): Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of... | Implement the Python class `AppDomainsApiView` described below.
Class description:
Implement the AppDomainsApiView class.
Method signatures and docstrings:
- def get(self, request, app_id): Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of... | df2bbc2c0f7b593930a5c5bc038232f66394f8c5 | <|skeleton|>
class AppDomainsApiView:
def get(self, request, app_id):
"""Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse"""
<|body_0|>
def post(self, request, app_id):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppDomainsApiView:
def get(self, request, app_id):
"""Get the domains associated with this app :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse"""
backend = self.get_backend_for_app(app_id)
auth_client = ge... | the_stack_v2_python_sparse | web/api_server/api/app_domains_api_view.py | TigerAppsOrg/TigerHost | train | 0 | |
9c0c3b64e469c154e4385b71e27e8bd3a22eebf6 | [
"bundle_uuid = self.get_query_argument('bundle_uuid', default=None)\nlimit = int(self.get_query_argument('limit', default=1000))\nskip = int(self.get_query_argument('skip', default=0))\nquery: Dict[str, Any] = {'bundle_uuid': bundle_uuid}\nprojection: Dict[str, bool] = {'_id': False}\nresults = []\nlogging.debug(f'... | <|body_start_0|>
bundle_uuid = self.get_query_argument('bundle_uuid', default=None)
limit = int(self.get_query_argument('limit', default=1000))
skip = int(self.get_query_argument('skip', default=0))
query: Dict[str, Any] = {'bundle_uuid': bundle_uuid}
projection: Dict[str, bool] ... | MetadataHandler handles collection level routes for Metadata. | MetadataHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetadataHandler:
"""MetadataHandler handles collection level routes for Metadata."""
async def get(self) -> None:
"""Handle GET /Metadata."""
<|body_0|>
async def delete(self) -> None:
"""Handle DELETE /Metadata?bundle_uuid={uuid}."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_015009 | 42,572 | permissive | [
{
"docstring": "Handle GET /Metadata.",
"name": "get",
"signature": "async def get(self) -> None"
},
{
"docstring": "Handle DELETE /Metadata?bundle_uuid={uuid}.",
"name": "delete",
"signature": "async def delete(self) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_009467 | Implement the Python class `MetadataHandler` described below.
Class description:
MetadataHandler handles collection level routes for Metadata.
Method signatures and docstrings:
- async def get(self) -> None: Handle GET /Metadata.
- async def delete(self) -> None: Handle DELETE /Metadata?bundle_uuid={uuid}. | Implement the Python class `MetadataHandler` described below.
Class description:
MetadataHandler handles collection level routes for Metadata.
Method signatures and docstrings:
- async def get(self) -> None: Handle GET /Metadata.
- async def delete(self) -> None: Handle DELETE /Metadata?bundle_uuid={uuid}.
<|skeleto... | 12719efa84be2281debe98a18c69bbe7a6d0f399 | <|skeleton|>
class MetadataHandler:
"""MetadataHandler handles collection level routes for Metadata."""
async def get(self) -> None:
"""Handle GET /Metadata."""
<|body_0|>
async def delete(self) -> None:
"""Handle DELETE /Metadata?bundle_uuid={uuid}."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MetadataHandler:
"""MetadataHandler handles collection level routes for Metadata."""
async def get(self) -> None:
"""Handle GET /Metadata."""
bundle_uuid = self.get_query_argument('bundle_uuid', default=None)
limit = int(self.get_query_argument('limit', default=1000))
skip... | the_stack_v2_python_sparse | lta/rest_server.py | blinkdog/lta | train | 0 |
aacaa606f9e2e1a0c829474c5fea657a3adfe5a8 | [
"\"\"\"\n 1. 夾擠. 總coins和 == [0 , k, n] + [0, x, k] + [k, y, n]\n 2. 也就是,若要算[0,k,n] 則表示 0~k中間已經被pop掉,而我們要最大的.\n 3. k~n中間也被pop掉,我們要最大的.\n 3. 有 左右上下限時,create matrix(m*n) m as 左限, n as 右限.\n \"\"\"\nfrom __builtin__ import xrange\nnums = [1] + nums + [1]\nn = len(nums)\ndp = [[0] * n ... | <|body_start_0|>
"""
1. 夾擠. 總coins和 == [0 , k, n] + [0, x, k] + [k, y, n]
2. 也就是,若要算[0,k,n] 則表示 0~k中間已經被pop掉,而我們要最大的.
3. k~n中間也被pop掉,我們要最大的.
3. 有 左右上下限時,create matrix(m*n) m as 左限, n as 右限.
"""
from __builtin__ import xrange... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxCoins(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rewrite(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
1. 夾擠. 總coins和 == [0 , k, n] + [... | stack_v2_sparse_classes_36k_train_015010 | 3,074 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxCoins",
"signature": "def maxCoins(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rewrite",
"signature": "def rewrite(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxCoins(self, nums): :type nums: List[int] :rtype: int
- def rewrite(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxCoins(self, nums): :type nums: List[int] :rtype: int
- def rewrite(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxCoins(self, num... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def maxCoins(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rewrite(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxCoins(self, nums):
""":type nums: List[int] :rtype: int"""
"""
1. 夾擠. 總coins和 == [0 , k, n] + [0, x, k] + [k, y, n]
2. 也就是,若要算[0,k,n] 則表示 0~k中間已經被pop掉,而我們要最大的.
3. k~n中間也被pop掉,我們要最大的.
3. 有 左右上下限時,create matrix(m*n)... | the_stack_v2_python_sparse | dp/312_Burst_Balloons.py | vsdrun/lc_public | train | 6 | |
e32dd38bec112369a53caf2b775e3f6a0665dee2 | [
"if not nums:\n return 0\nactive = []\nfor num in nums:\n if not active:\n active.append(num)\n continue\n if num <= active[0]:\n active[0] = num\n elif num > active[-1]:\n active.append(num)\n else:\n i = 0\n while i < len(active) and num > active[i]:\n ... | <|body_start_0|>
if not nums:
return 0
active = []
for num in nums:
if not active:
active.append(num)
continue
if num <= active[0]:
active[0] = num
elif num > active[-1]:
active.append... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def lengthOfLIS_DP(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return 0
... | stack_v2_sparse_classes_36k_train_015011 | 3,192 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "lengthOfLIS_DP",
"signature": "def lengthOfLIS_DP(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001296 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def lengthOfLIS_DP(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def lengthOfLIS_DP(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | d308e0e41c288f23a846b8505e572943d30b1392 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def lengthOfLIS_DP(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 0
active = []
for num in nums:
if not active:
active.append(num)
continue
if num <= active[0]:
... | the_stack_v2_python_sparse | python/300_Longest_Increasing_Subsequence.py | HankerZheng/LeetCode-Problems | train | 2 | |
cd8bef09dad13b5d09caf15c25b217c00d78559d | [
"url = TOKEN_REVOKE_ENDPOINT % credentials.access_token\nhttp = httplib2.Http()\ncredentials.authorize(http)\nresult = http.request(url, 'GET')[0]\nif result['status'] != '200':\n raise RevokeException",
"try:\n user = self.get_user_from_session()\n credentials = user.google_credentials\n del self.ses... | <|body_start_0|>
url = TOKEN_REVOKE_ENDPOINT % credentials.access_token
http = httplib2.Http()
credentials.authorize(http)
result = http.request(url, 'GET')[0]
if result['status'] != '200':
raise RevokeException
<|end_body_0|>
<|body_start_1|>
try:
... | Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect | DisconnectHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DisconnectHandler:
"""Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect"""
def revoke_token(credentials):
"""Revoke the given access token, and consequently any other acce... | stack_v2_sparse_classes_36k_train_015012 | 32,317 | no_license | [
{
"docstring": "Revoke the given access token, and consequently any other access tokens and refresh tokens issued for this user to this app. Essentially this operation disconnects a user from the app, but keeps their app activities alive in Google. The same user can later come back to the app, sign-in, re-conse... | 2 | stack_v2_sparse_classes_30k_train_014329 | Implement the Python class `DisconnectHandler` described below.
Class description:
Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect
Method signatures and docstrings:
- def revoke_token(credentials): Revok... | Implement the Python class `DisconnectHandler` described below.
Class description:
Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect
Method signatures and docstrings:
- def revoke_token(credentials): Revok... | f236a8cd20af89e889caf1049217fdbb5c45e536 | <|skeleton|>
class DisconnectHandler:
"""Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect"""
def revoke_token(credentials):
"""Revoke the given access token, and consequently any other acce... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DisconnectHandler:
"""Provides an API to disconnect users from Photohunt. This handler provides the /api/disconnect endpoint, and exposes the following operations: POST /api/disconnect"""
def revoke_token(credentials):
"""Revoke the given access token, and consequently any other access tokens and... | the_stack_v2_python_sparse | handlers.py | creationexus/django-x | train | 0 |
641bdc404737c9f307fee4ca50bab79d1b738d48 | [
"super().__init__()\nself._floors = {}\nself._flooded_floors: Dict[str, float] = dict()",
"super().init_scene(scene, layout)\nself._floors = FloorplanFlood._FLOOD_DATA[scene[0]]\nfor i in range(len(self._floors)):\n floor = self._floors[str(i + 1)]\n floor_name = floor['name']\n floor_id = Controller.get... | <|body_start_0|>
super().__init__()
self._floors = {}
self._flooded_floors: Dict[str, float] = dict()
<|end_body_0|>
<|body_start_1|>
super().init_scene(scene, layout)
self._floors = FloorplanFlood._FLOOD_DATA[scene[0]]
for i in range(len(self._floors)):
floo... | Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md). | FloorplanFlood | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FloorplanFlood:
"""Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md)."""
def __init__(self):
"""(no parameters)"""
<|body_0|>
def... | stack_v2_sparse_classes_36k_train_015013 | 4,014 | permissive | [
{
"docstring": "(no parameters)",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Set commands to initialize the scene. On the next frame, the scene will be initialized. Valid scenes and layouts: | `scene` | `layout` | | --- | --- | | 1a, 1b, or 1c | 0, 1, or 2 | | 2a, 2... | 4 | null | Implement the Python class `FloorplanFlood` described below.
Class description:
Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md).
Method signatures and docstrings:
- def __ini... | Implement the Python class `FloorplanFlood` described below.
Class description:
Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md).
Method signatures and docstrings:
- def __ini... | 9df96fba455b327bb360d8dd5886d8754046c690 | <|skeleton|>
class FloorplanFlood:
"""Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md)."""
def __init__(self):
"""(no parameters)"""
<|body_0|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FloorplanFlood:
"""Initialize a scene populated by objects in pre-scripted layouts. Then, create a set of flood objects for each floor section in the floorplan. This is a subclass of [`Floorplan`](floorplan.md)."""
def __init__(self):
"""(no parameters)"""
super().__init__()
self.... | the_stack_v2_python_sparse | Python/tdw/add_ons/floorplan_flood.py | threedworld-mit/tdw | train | 427 |
a55fe2eacead91f0973ce740dea2fa80d7de197c | [
"status = ErrorCode.SUCCESS\ntry:\n profile = DotDict()\n corp = QueryHelper.get_corp_by_cid(self.current_user.cid, self.db)\n if not corp:\n status = ErrorCode.LOGIN_AGAIN\n logging.error('[UWEB] Corp does not exist, redirect to login.html. cid: %s.', self.current_user.cid)\n self.wri... | <|body_start_0|>
status = ErrorCode.SUCCESS
try:
profile = DotDict()
corp = QueryHelper.get_corp_by_cid(self.current_user.cid, self.db)
if not corp:
status = ErrorCode.LOGIN_AGAIN
logging.error('[UWEB] Corp does not exist, redirect to l... | ProfileCorpHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileCorpHandler:
def get(self):
"""Display profile of current corp."""
<|body_0|>
def put(self):
"""Modify profile of current corp."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
status = ErrorCode.SUCCESS
try:
profile = DotD... | stack_v2_sparse_classes_36k_train_015014 | 8,584 | no_license | [
{
"docstring": "Display profile of current corp.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Modify profile of current corp.",
"name": "put",
"signature": "def put(self)"
}
] | 2 | null | Implement the Python class `ProfileCorpHandler` described below.
Class description:
Implement the ProfileCorpHandler class.
Method signatures and docstrings:
- def get(self): Display profile of current corp.
- def put(self): Modify profile of current corp. | Implement the Python class `ProfileCorpHandler` described below.
Class description:
Implement the ProfileCorpHandler class.
Method signatures and docstrings:
- def get(self): Display profile of current corp.
- def put(self): Modify profile of current corp.
<|skeleton|>
class ProfileCorpHandler:
def get(self):
... | 3b095a325581b1fc48497c234f0ad55e928586a1 | <|skeleton|>
class ProfileCorpHandler:
def get(self):
"""Display profile of current corp."""
<|body_0|>
def put(self):
"""Modify profile of current corp."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileCorpHandler:
def get(self):
"""Display profile of current corp."""
status = ErrorCode.SUCCESS
try:
profile = DotDict()
corp = QueryHelper.get_corp_by_cid(self.current_user.cid, self.db)
if not corp:
status = ErrorCode.LOGIN_AGA... | the_stack_v2_python_sparse | apps/uweb/handlers/profile.py | jcsy521/ydws | train | 0 | |
24081bea73b4c503c2ea7969c412baef7baf5858 | [
"self.n_inputs = n_inputs\nself.n_hiddens = n_hiddens\nself.s_act = s_act\nself.t_act = t_act\nself.n_layers = n_layers\nself.batch_norm = batch_norm\nself.input = tt.matrix('x')\nself.u = self.input\nlogdet_dudx = 0.0\nmask = theano.shared(np.arange(n_inputs, dtype=dtype) % 2, borrow=True)\nself.layers = []\nself.... | <|body_start_0|>
self.n_inputs = n_inputs
self.n_hiddens = n_hiddens
self.s_act = s_act
self.t_act = t_act
self.n_layers = n_layers
self.batch_norm = batch_norm
self.input = tt.matrix('x')
self.u = self.input
logdet_dudx = 0.0
mask = theano... | Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016 | RealNVP | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RealNVP:
"""Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016"""
def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True):
"""Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coup... | stack_v2_sparse_classes_36k_train_015015 | 15,147 | permissive | [
{
"docstring": "Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coupling layers :param s_act: string, activation function for the scale net :param t_act: string, activation function for the translate net :param n_layers: int, number of coupling lay... | 4 | stack_v2_sparse_classes_30k_train_009155 | Implement the Python class `RealNVP` described below.
Class description:
Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016
Method signatures and docstrings:
- def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): Constructor. :param n_inputs: int, number of inputs :param ... | Implement the Python class `RealNVP` described below.
Class description:
Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016
Method signatures and docstrings:
- def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True): Constructor. :param n_inputs: int, number of inputs :param ... | d5fa619db637d19f0c3018aeb1431f657dd533bf | <|skeleton|>
class RealNVP:
"""Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016"""
def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True):
"""Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coup... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RealNVP:
"""Real NVP, see Dinh et al, "Density estimation using Real NVP", 2016"""
def __init__(self, n_inputs, n_hiddens, s_act, t_act, n_layers, batch_norm=True):
"""Constructor. :param n_inputs: int, number of inputs :param n_hiddens: list of hidden widths for the nets in the coupling layers :... | the_stack_v2_python_sparse | ml/models/nvps.py | gpapamak/maf | train | 199 |
ec2d55376d7d5bb81e6702be7f9627d3f080227d | [
"self.files_and_folders_info = files_and_folders_info\nself.name = name\nself.source_object_info = source_object_info",
"if dictionary is None:\n return None\nname = dictionary.get('name')\nfiles_and_folders_info = None\nif dictionary.get('filesAndFoldersInfo') != None:\n files_and_folders_info = list()\n ... | <|body_start_0|>
self.files_and_folders_info = files_and_folders_info
self.name = name
self.source_object_info = source_object_info
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
name = dictionary.get('name')
files_and_folders_info = None
... | Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FileAndFoldersInformation): Specifies the absolute paths for list of files and folders to downlo... | DownloadFilesAndFoldersParameters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DownloadFilesAndFoldersParameters:
"""Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FileAndFoldersInformation): Specifi... | stack_v2_sparse_classes_36k_train_015016 | 3,112 | permissive | [
{
"docstring": "Constructor for the DownloadFilesAndFoldersParameters class",
"name": "__init__",
"signature": "def __init__(self, name=None, files_and_folders_info=None, source_object_info=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary... | 2 | stack_v2_sparse_classes_30k_train_008102 | Implement the Python class `DownloadFilesAndFoldersParameters` described below.
Class description:
Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list... | Implement the Python class `DownloadFilesAndFoldersParameters` described below.
Class description:
Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list... | 07c5adee58810979780679065250d82b4b2cdaab | <|skeleton|>
class DownloadFilesAndFoldersParameters:
"""Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FileAndFoldersInformation): Specifi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DownloadFilesAndFoldersParameters:
"""Implementation of the 'Download Files And Folders Parameters.' model. DownloadFilesAndFoldersParams holds the information to create a task for downloading list of files or folders Attributes: files_and_folders_info (list of FileAndFoldersInformation): Specifies the absolu... | the_stack_v2_python_sparse | cohesity_management_sdk/models/download_files_and_folders_parameters.py | hemanshu-cohesity/management-sdk-python | train | 0 |
fa3e6118e72ddd0ba60b2666a00127b077c3e9cd | [
"super().__init__()\nload_wkv_kernel(context_size)\nself.time_shift = torch.nn.ZeroPad2d((0, 0, 1, -1))\nself.time_decay = torch.nn.Parameter(torch.empty(attention_size))\nself.time_first = torch.nn.Parameter(torch.empty(attention_size))\nself.time_mix_key = torch.nn.Parameter(torch.empty(1, 1, size))\nself.time_mi... | <|body_start_0|>
super().__init__()
load_wkv_kernel(context_size)
self.time_shift = torch.nn.ZeroPad2d((0, 0, 1, -1))
self.time_decay = torch.nn.Parameter(torch.empty(attention_size))
self.time_first = torch.nn.Parameter(torch.empty(attention_size))
self.time_mix_key = to... | SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture. | SelfAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture."""
def __init__(self, size: int, attention_size: int, c... | stack_v2_sparse_classes_36k_train_015017 | 11,396 | permissive | [
{
"docstring": "Construct a SelfAttention object.",
"name": "__init__",
"signature": "def __init__(self, size: int, attention_size: int, context_size: int, block_id: int, num_blocks: int) -> None"
},
{
"docstring": "Reset module parameters. Args: size: Block size. attention_size: Attention hidde... | 4 | null | Implement the Python class `SelfAttention` described below.
Class description:
SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture.
Method signatures an... | Implement the Python class `SelfAttention` described below.
Class description:
SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture.
Method signatures an... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class SelfAttention:
"""SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture."""
def __init__(self, size: int, attention_size: int, c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelfAttention:
"""SelfAttention module definition. Args: size: Input/Output size. attention_size: Attention hidden size. context_size: Context size for WKV kernel. block_id: Block index. num_blocks: Number of blocks in the architecture."""
def __init__(self, size: int, attention_size: int, context_size: ... | the_stack_v2_python_sparse | espnet2/asr_transducer/decoder/modules/rwkv/attention.py | espnet/espnet | train | 7,242 |
6686b9ffc6573f146a957b5eb063297d49c57622 | [
"result = {'result': 'NG', 'content': ''}\nctrl_doc = CtrlDsDoc()\ndoc_data = ctrl_doc.get_ds_doc(doc_id)\nif doc_data:\n result['result'] = 'OK'\n result['content'] = doc_data\nelse:\n result['error'] = '该文档不存在!'\nreturn result",
"data_json = request.get_json()\nresult = {'result': 'NG', 'error': ''}\nd... | <|body_start_0|>
result = {'result': 'NG', 'content': ''}
ctrl_doc = CtrlDsDoc()
doc_data = ctrl_doc.get_ds_doc(doc_id)
if doc_data:
result['result'] = 'OK'
result['content'] = doc_data
else:
result['error'] = '该文档不存在!'
return result
<|... | ApiNewDSDoc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiNewDSDoc:
def get(self, doc_id):
"""查看基本/详细设计信息 :param doc_id: :return:"""
<|body_0|>
def post(self):
"""新增设计文档 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'content': ''}
ctrl_doc = CtrlDsDoc()
... | stack_v2_sparse_classes_36k_train_015018 | 31,026 | no_license | [
{
"docstring": "查看基本/详细设计信息 :param doc_id: :return:",
"name": "get",
"signature": "def get(self, doc_id)"
},
{
"docstring": "新增设计文档 :return:",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007883 | Implement the Python class `ApiNewDSDoc` described below.
Class description:
Implement the ApiNewDSDoc class.
Method signatures and docstrings:
- def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return:
- def post(self): 新增设计文档 :return: | Implement the Python class `ApiNewDSDoc` described below.
Class description:
Implement the ApiNewDSDoc class.
Method signatures and docstrings:
- def get(self, doc_id): 查看基本/详细设计信息 :param doc_id: :return:
- def post(self): 新增设计文档 :return:
<|skeleton|>
class ApiNewDSDoc:
def get(self, doc_id):
"""查看基本/详细... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiNewDSDoc:
def get(self, doc_id):
"""查看基本/详细设计信息 :param doc_id: :return:"""
<|body_0|>
def post(self):
"""新增设计文档 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiNewDSDoc:
def get(self, doc_id):
"""查看基本/详细设计信息 :param doc_id: :return:"""
result = {'result': 'NG', 'content': ''}
ctrl_doc = CtrlDsDoc()
doc_data = ctrl_doc.get_ds_doc(doc_id)
if doc_data:
result['result'] = 'OK'
result['content'] = doc_data... | the_stack_v2_python_sparse | Source/collaboration_2/app/api_1_0/api_ds_doc.py | lsn1183/web_project | train | 0 | |
5fabb7562b0e576b9f489e150a1107b50debb3da | [
"if s == s[::-1]:\n return s\nmax_len = 1\nres = s[0]\nprint(res)\nfor i in range(len(s) - 1):\n for j in range(i + 1, len(s)):\n if j - i + 1 > max_len and s[i:j + 1] == s[i:j + 1][::-1]:\n max_len = j - i + 1\n res = s[i:i + max_len]\nreturn res",
"start_index = 0\nmax_len = 0... | <|body_start_0|>
if s == s[::-1]:
return s
max_len = 1
res = s[0]
print(res)
for i in range(len(s) - 1):
for j in range(i + 1, len(s)):
if j - i + 1 > max_len and s[i:j + 1] == s[i:j + 1][::-1]:
max_len = j - i + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def force(self, s):
"""暴力求解"""
<|body_0|>
def longestPalindaRome(self, s):
"""动态规划"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if s == s[::-1]:
return s
max_len = 1
res = s[0]
print(res)
for ... | stack_v2_sparse_classes_36k_train_015019 | 1,467 | no_license | [
{
"docstring": "暴力求解",
"name": "force",
"signature": "def force(self, s)"
},
{
"docstring": "动态规划",
"name": "longestPalindaRome",
"signature": "def longestPalindaRome(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020124 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def force(self, s): 暴力求解
- def longestPalindaRome(self, s): 动态规划 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def force(self, s): 暴力求解
- def longestPalindaRome(self, s): 动态规划
<|skeleton|>
class Solution:
def force(self, s):
"""暴力求解"""
<|body_0|>
def longestPali... | 4ad5af3dbac4ad909a97b398dc2822147878a693 | <|skeleton|>
class Solution:
def force(self, s):
"""暴力求解"""
<|body_0|>
def longestPalindaRome(self, s):
"""动态规划"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def force(self, s):
"""暴力求解"""
if s == s[::-1]:
return s
max_len = 1
res = s[0]
print(res)
for i in range(len(s) - 1):
for j in range(i + 1, len(s)):
if j - i + 1 > max_len and s[i:j + 1] == s[i:j + 1][::-1]:
... | the_stack_v2_python_sparse | longestPalindRome.py | jiaqianjing/leetcode | train | 0 | |
e7a4d250251990927c740af6e38f019b72b7430e | [
"if self.doctype:\n yield '<!doctype html{}>'.format(self.doctypes[self.doctype])\nyield from super().header()\nyield '<html>'\nreturn",
"if isinstance(document, str):\n yield document\n return\nif isinstance(document, Exception):\n yield str(document)\n return\nyield from super().body(document=doc... | <|body_start_0|>
if self.doctype:
yield '<!doctype html{}>'.format(self.doctypes[self.doctype])
yield from super().header()
yield '<html>'
return
<|end_body_0|>
<|body_start_1|>
if isinstance(document, str):
yield document
return
if is... | Support for HTML | HTML | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTML:
"""Support for HTML"""
def header(self):
"""Layout the {document} using my stationery for the header"""
<|body_0|>
def body(self, document=(), **kwds):
"""The body of the document"""
<|body_1|>
def footer(self):
"""Layout the {document}... | stack_v2_sparse_classes_36k_train_015020 | 2,137 | permissive | [
{
"docstring": "Layout the {document} using my stationery for the header",
"name": "header",
"signature": "def header(self)"
},
{
"docstring": "The body of the document",
"name": "body",
"signature": "def body(self, document=(), **kwds)"
},
{
"docstring": "Layout the {document} u... | 3 | stack_v2_sparse_classes_30k_train_021586 | Implement the Python class `HTML` described below.
Class description:
Support for HTML
Method signatures and docstrings:
- def header(self): Layout the {document} using my stationery for the header
- def body(self, document=(), **kwds): The body of the document
- def footer(self): Layout the {document} using my stati... | Implement the Python class `HTML` described below.
Class description:
Support for HTML
Method signatures and docstrings:
- def header(self): Layout the {document} using my stationery for the header
- def body(self, document=(), **kwds): The body of the document
- def footer(self): Layout the {document} using my stati... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class HTML:
"""Support for HTML"""
def header(self):
"""Layout the {document} using my stationery for the header"""
<|body_0|>
def body(self, document=(), **kwds):
"""The body of the document"""
<|body_1|>
def footer(self):
"""Layout the {document}... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HTML:
"""Support for HTML"""
def header(self):
"""Layout the {document} using my stationery for the header"""
if self.doctype:
yield '<!doctype html{}>'.format(self.doctypes[self.doctype])
yield from super().header()
yield '<html>'
return
def body(... | the_stack_v2_python_sparse | packages/pyre/weaver/HTML.py | pyre/pyre | train | 27 |
ebe0d2a359bd04434f81a606ddb1f32b57802455 | [
"cred_json = config.get('credentials')\ncreds = Credentials(token=cred_json.get('access_token'), refresh_token=cred_json.get('refresh_token'), token_uri=cred_json.get('token_uri'), client_id=cred_json.get('client_id'), client_secret=cred_json.get('client_secret'))\nreturn creds",
"try:\n dbm_service = build('d... | <|body_start_0|>
cred_json = config.get('credentials')
creds = Credentials(token=cred_json.get('access_token'), refresh_token=cred_json.get('refresh_token'), token_uri=cred_json.get('token_uri'), client_id=cred_json.get('client_id'), client_secret=cred_json.get('client_secret'))
return creds
<|e... | SourceDV360 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"Elastic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourceDV360:
def get_credentials(self, config: json) -> Credentials:
"""Get the credentials from the config file and returns them as a Credentials object"""
<|body_0|>
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
"... | stack_v2_sparse_classes_36k_train_015021 | 6,990 | permissive | [
{
"docstring": "Get the credentials from the config file and returns them as a Credentials object",
"name": "get_credentials",
"signature": "def get_credentials(self, config: json) -> Credentials"
},
{
"docstring": "Tests if the input configuration can be used to successfully connect to the inte... | 4 | stack_v2_sparse_classes_30k_train_019269 | Implement the Python class `SourceDV360` described below.
Class description:
Implement the SourceDV360 class.
Method signatures and docstrings:
- def get_credentials(self, config: json) -> Credentials: Get the credentials from the config file and returns them as a Credentials object
- def check_connection(self, logge... | Implement the Python class `SourceDV360` described below.
Class description:
Implement the SourceDV360 class.
Method signatures and docstrings:
- def get_credentials(self, config: json) -> Credentials: Get the credentials from the config file and returns them as a Credentials object
- def check_connection(self, logge... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class SourceDV360:
def get_credentials(self, config: json) -> Credentials:
"""Get the credentials from the config file and returns them as a Credentials object"""
<|body_0|>
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SourceDV360:
def get_credentials(self, config: json) -> Credentials:
"""Get the credentials from the config file and returns them as a Credentials object"""
cred_json = config.get('credentials')
creds = Credentials(token=cred_json.get('access_token'), refresh_token=cred_json.get('refre... | the_stack_v2_python_sparse | dts/airbyte/airbyte-integrations/connectors/source-dv-360/source_dv_360/source.py | alldatacenter/alldata | train | 774 | |
6e21041c69338a7111dcc3d4b036d2c4ca2e2e44 | [
"if identifier.startswith('T'):\n return ({'message': babel('No information on temp registrations.')}, 200)\nbusiness = Business.find_by_identifier(identifier)\nif not business:\n return (jsonify({'message': f'{identifier} not found'}), HTTPStatus.NOT_FOUND)\nif not authorized(identifier, jwt, action=['view']... | <|body_start_0|>
if identifier.startswith('T'):
return ({'message': babel('No information on temp registrations.')}, 200)
business = Business.find_by_identifier(identifier)
if not business:
return (jsonify({'message': f'{identifier} not found'}), HTTPStatus.NOT_FOUND)
... | Meta information about the overall service. | BusinessResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
<|body_0|>
def post():
"""Create a valid filing, else error out."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_015022 | 4,386 | permissive | [
{
"docstring": "Return a JSON object with meta information about the Service.",
"name": "get",
"signature": "def get(identifier: str)"
},
{
"docstring": "Create a valid filing, else error out.",
"name": "post",
"signature": "def post()"
}
] | 2 | stack_v2_sparse_classes_30k_train_007775 | Implement the Python class `BusinessResource` described below.
Class description:
Meta information about the overall service.
Method signatures and docstrings:
- def get(identifier: str): Return a JSON object with meta information about the Service.
- def post(): Create a valid filing, else error out. | Implement the Python class `BusinessResource` described below.
Class description:
Meta information about the overall service.
Method signatures and docstrings:
- def get(identifier: str): Return a JSON object with meta information about the Service.
- def post(): Create a valid filing, else error out.
<|skeleton|>
c... | d90f11a7b14411b02c07fe97d2c1fc31cd4a9b32 | <|skeleton|>
class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
<|body_0|>
def post():
"""Create a valid filing, else error out."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BusinessResource:
"""Meta information about the overall service."""
def get(identifier: str):
"""Return a JSON object with meta information about the Service."""
if identifier.startswith('T'):
return ({'message': babel('No information on temp registrations.')}, 200)
bu... | the_stack_v2_python_sparse | legal-api/src/legal_api/resources/v1/business/business.py | bcgov/lear | train | 13 |
14ab87d8c52996b15862b001650183b42ab08eea | [
"if num // 10 == 0:\n return num\nr = 0\nwhile num // 10 != 0:\n r += num % 10\n num = num // 10\nreturn self.addDigits(r + num)",
"while num // 10 != 0:\n r = 0\n while num // 10 != 0:\n r += num % 10\n num = num // 10\n num = r + num\nreturn num"
] | <|body_start_0|>
if num // 10 == 0:
return num
r = 0
while num // 10 != 0:
r += num % 10
num = num // 10
return self.addDigits(r + num)
<|end_body_0|>
<|body_start_1|>
while num // 10 != 0:
r = 0
while num // 10 != 0:
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addDigits(self, num: int) -> int:
"""DFS : 36 ms"""
<|body_0|>
def addDigits(self, num):
"""recursion: 32 ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if num // 10 == 0:
return num
r = 0
while num // 1... | stack_v2_sparse_classes_36k_train_015023 | 1,369 | permissive | [
{
"docstring": "DFS : 36 ms",
"name": "addDigits",
"signature": "def addDigits(self, num: int) -> int"
},
{
"docstring": "recursion: 32 ms",
"name": "addDigits",
"signature": "def addDigits(self, num)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001775 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addDigits(self, num: int) -> int: DFS : 36 ms
- def addDigits(self, num): recursion: 32 ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addDigits(self, num: int) -> int: DFS : 36 ms
- def addDigits(self, num): recursion: 32 ms
<|skeleton|>
class Solution:
def addDigits(self, num: int) -> int:
""... | 65549f72c565d9f11641c86d6cef9c7988805817 | <|skeleton|>
class Solution:
def addDigits(self, num: int) -> int:
"""DFS : 36 ms"""
<|body_0|>
def addDigits(self, num):
"""recursion: 32 ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addDigits(self, num: int) -> int:
"""DFS : 36 ms"""
if num // 10 == 0:
return num
r = 0
while num // 10 != 0:
r += num % 10
num = num // 10
return self.addDigits(r + num)
def addDigits(self, num):
"""recursi... | the_stack_v2_python_sparse | src/258.add-digits.py | wisesky/LeetCode-Practice | train | 0 | |
426b8b52dbe77606a7859c50635fd81da02f943a | [
"super(TurbiniaCeleryWorker, self).__init__()\njob_manager.JobsManager.DeregisterJobs(jobs_denylist, jobs_allowlist)\ndisabled_jobs = list(config.DISABLED_JOBS) if config.DISABLED_JOBS else []\ndisabled_jobs = [j.lower() for j in disabled_jobs]\nif jobs_allowlist:\n disabled_jobs = list(set(disabled_jobs) - set(... | <|body_start_0|>
super(TurbiniaCeleryWorker, self).__init__()
job_manager.JobsManager.DeregisterJobs(jobs_denylist, jobs_allowlist)
disabled_jobs = list(config.DISABLED_JOBS) if config.DISABLED_JOBS else []
disabled_jobs = [j.lower() for j in disabled_jobs]
if jobs_allowlist:
... | Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app | TurbiniaCeleryWorker | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TurbiniaCeleryWorker:
"""Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app"""
def __init__(self, jobs_denylist=None, jobs_allowlist=None):
"""Initialization for celery worker. Args: jobs_denylist (Optional[list[str]]): Jobs we will exclude from running ... | stack_v2_sparse_classes_36k_train_015024 | 46,828 | permissive | [
{
"docstring": "Initialization for celery worker. Args: jobs_denylist (Optional[list[str]]): Jobs we will exclude from running jobs_allowlist (Optional[list[str]]): The only Jobs we will include to run",
"name": "__init__",
"signature": "def __init__(self, jobs_denylist=None, jobs_allowlist=None)"
},
... | 2 | stack_v2_sparse_classes_30k_train_000245 | Implement the Python class `TurbiniaCeleryWorker` described below.
Class description:
Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app
Method signatures and docstrings:
- def __init__(self, jobs_denylist=None, jobs_allowlist=None): Initialization for celery worker. Args: jobs_denylist ... | Implement the Python class `TurbiniaCeleryWorker` described below.
Class description:
Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app
Method signatures and docstrings:
- def __init__(self, jobs_denylist=None, jobs_allowlist=None): Initialization for celery worker. Args: jobs_denylist ... | e73717549c6919e869ce4963449c36f227e3ccd6 | <|skeleton|>
class TurbiniaCeleryWorker:
"""Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app"""
def __init__(self, jobs_denylist=None, jobs_allowlist=None):
"""Initialization for celery worker. Args: jobs_denylist (Optional[list[str]]): Jobs we will exclude from running ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TurbiniaCeleryWorker:
"""Turbinia Celery Worker class. Attributes: worker (celery.app): Celery worker app"""
def __init__(self, jobs_denylist=None, jobs_allowlist=None):
"""Initialization for celery worker. Args: jobs_denylist (Optional[list[str]]): Jobs we will exclude from running jobs_allowlis... | the_stack_v2_python_sparse | turbinia/client.py | Ash515/turbinia | train | 6 |
1b7f7a781a846c0a13ccfe7431fbc1f0d264326f | [
"self._init_fn = jax.jit(init_fn, device=self._device)\nself._apply_fn = apply_fn\nself._sample_fn = jax.jit(self._sample, device=self._device)",
"batch_size, sample_len = x.shape\n\ndef one_step(params, state, rng, i, x):\n step_sample = jax.lax.dynamic_slice(x, [0, i], [batch_size, 1])\n rng, rng_ = jax.r... | <|body_start_0|>
self._init_fn = jax.jit(init_fn, device=self._device)
self._apply_fn = apply_fn
self._sample_fn = jax.jit(self._sample, device=self._device)
<|end_body_0|>
<|body_start_1|>
batch_size, sample_len = x.shape
def one_step(params, state, rng, i, x):
ste... | Sampling from the TransformerXL model. | TransformerXLSampler | [
"CC-BY-SA-4.0",
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerXLSampler:
"""Sampling from the TransformerXL model."""
def _jit_model(self, init_fn, apply_fn):
"""Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`."""
<|body_0|>
def _sample(self, params: Mapping[str, Any], state: Mapping[str, Any], rng: jn... | stack_v2_sparse_classes_36k_train_015025 | 12,853 | permissive | [
{
"docstring": "Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.",
"name": "_jit_model",
"signature": "def _jit_model(self, init_fn, apply_fn)"
},
{
"docstring": "Generate unconditional samples. Args: params: parameters of the transformer. state: state of the transformer. rng:... | 3 | null | Implement the Python class `TransformerXLSampler` described below.
Class description:
Sampling from the TransformerXL model.
Method signatures and docstrings:
- def _jit_model(self, init_fn, apply_fn): Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.
- def _sample(self, params: Mapping[str, Any], s... | Implement the Python class `TransformerXLSampler` described below.
Class description:
Sampling from the TransformerXL model.
Method signatures and docstrings:
- def _jit_model(self, init_fn, apply_fn): Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`.
- def _sample(self, params: Mapping[str, Any], s... | a6ef8053380d6aa19aaae14b93f013ae9762d057 | <|skeleton|>
class TransformerXLSampler:
"""Sampling from the TransformerXL model."""
def _jit_model(self, init_fn, apply_fn):
"""Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`."""
<|body_0|>
def _sample(self, params: Mapping[str, Any], state: Mapping[str, Any], rng: jn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerXLSampler:
"""Sampling from the TransformerXL model."""
def _jit_model(self, init_fn, apply_fn):
"""Jit `init_fn` and `apply_fn`, the latter is used in `self._sample`."""
self._init_fn = jax.jit(init_fn, device=self._device)
self._apply_fn = apply_fn
self._sampl... | the_stack_v2_python_sparse | wikigraphs/wikigraphs/model/sampler.py | sethuramanio/deepmind-research | train | 1 |
7f4877bf798f62680318bfa8d1db725a08edb056 | [
"super(MainDashboard, self).__init__(parent, **props)\nself.state = {}\nself.status = StringVar()\nself.dashboard = Frame(self, bg=BG_COLOR, frame=self.parent_frame, width=self.width, height=self.height)\nself.label = Label(self, self.status, frame=self.dashboard, bg=BG_COLOR, foreground=TEXT_COLOR, font=('Helvetic... | <|body_start_0|>
super(MainDashboard, self).__init__(parent, **props)
self.state = {}
self.status = StringVar()
self.dashboard = Frame(self, bg=BG_COLOR, frame=self.parent_frame, width=self.width, height=self.height)
self.label = Label(self, self.status, frame=self.dashboard, bg=... | MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current title of the main dashboard. dashboard (react.widget_wrappers.Frame): The frame whe... | MainDashboard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainDashboard:
"""MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current title of the main dashboard. dashboard (re... | stack_v2_sparse_classes_36k_train_015026 | 2,783 | no_license | [
{
"docstring": "Main Dashboard Component constructor. Args: parent (react.component.Component): The component that should contain the main dashboard. frame (react.widget_wrappers.Frame, optional): The Frame where the main dashboard should be placed. If no frame is specified, then the default frame is considered... | 2 | stack_v2_sparse_classes_30k_train_014818 | Implement the Python class `MainDashboard` described below.
Class description:
MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current tit... | Implement the Python class `MainDashboard` described below.
Class description:
MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current tit... | e689a133fd13e534281cc3a1b63a280964eacb5e | <|skeleton|>
class MainDashboard:
"""MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current title of the main dashboard. dashboard (re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MainDashboard:
"""MainDashboard Component. The React Component that contains either the GUI's plot or a waiting screen if the device is not connected or the .hive file is not ready. Attributes: status (react.widget_wrappers.StringVar): Stores the current title of the main dashboard. dashboard (react.widget_wr... | the_stack_v2_python_sparse | driver/src/components/main_dashboard.py | mauesrog/temp | train | 0 |
8c37e3b6277ee53876295c046b6a502078772b1e | [
"if not len(subscribe_list) == 1 and 'kl' in subscribe_list[0]:\n raise ValueError\nsuper(DonchianChannelBatch, self).__init__(subscribe_list, duplicate)\nself._map_to_channels(param_list, suffix=subscribe_list[0].split(':')[-1])\nself.tag = 'don'\nself.window_widths = self.param_dict['window_widths']\nself.long... | <|body_start_0|>
if not len(subscribe_list) == 1 and 'kl' in subscribe_list[0]:
raise ValueError
super(DonchianChannelBatch, self).__init__(subscribe_list, duplicate)
self._map_to_channels(param_list, suffix=subscribe_list[0].split(':')[-1])
self.tag = 'don'
self.wind... | Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t = close_t - HH_{t-1} down_control_t = LL_{t-1} - close_t Open long position at up_break_... | DonchianChannelBatch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DonchianChannelBatch:
"""Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t = close_t - HH_{t-1} down_control_t = LL... | stack_v2_sparse_classes_36k_train_015027 | 4,335 | no_license | [
{
"docstring": ":param subscribe_list: :param param_list:",
"name": "__init__",
"signature": "def __init__(self, subscribe_list, param_list, duplicate=1)"
},
{
"docstring": "on receiving a bar message. :param message: :return:",
"name": "on_message",
"signature": "def on_message(self, me... | 2 | stack_v2_sparse_classes_30k_train_012459 | Implement the Python class `DonchianChannelBatch` described below.
Class description:
Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t =... | Implement the Python class `DonchianChannelBatch` described below.
Class description:
Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t =... | dd191a9830ecfa7a8bef646854bbce3c7b7c07bf | <|skeleton|>
class DonchianChannelBatch:
"""Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t = close_t - HH_{t-1} down_control_t = LL... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DonchianChannelBatch:
"""Implementation of Donchian channel with a threshold that avoids breaking through too much. Signal Algorithm: Denote HH := max{high, 20}; LL := min{low, 20} up_break_t = high_t - HH_{t-1} down_break_t = LL_{t-1} - low_t up_control_t = close_t - HH_{t-1} down_control_t = LL_{t-1} - clos... | the_stack_v2_python_sparse | signals/donchian_channel.py | wenhangz/Athena | train | 0 |
de91f1e729fd95136a37e58dd249d7b30aa5468c | [
"ans = []\n\ndef do_it(node):\n if node is None:\n ans.append('#')\n return None\n ans.append(str(node.val))\n do_it(node.left)\n do_it(node.right)\ndo_it(root)\nreturn ','.join(ans)",
"def do_it():\n cur_val = next(vals)\n if cur_val == '#':\n return None\n node = TreeNo... | <|body_start_0|>
ans = []
def do_it(node):
if node is None:
ans.append('#')
return None
ans.append(str(node.val))
do_it(node.left)
do_it(node.right)
do_it(root)
return ','.join(ans)
<|end_body_0|>
<|body_st... | 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_015028 | 2,741 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_017048 | 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:... | d71e725d779d7b45402893b311939c2cce60fbca | <|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"""
ans = []
def do_it(node):
if node is None:
ans.append('#')
return None
ans.append(str(node.val))
do_it(node.l... | the_stack_v2_python_sparse | algorithm/0297Serialize_and_Deserialize_Binary_Tree.py | xkoma001/leetcode | train | 0 | |
c9105be84266e37810cd3ec86e9823d77b0504cb | [
"super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",
"seq_len = x.s... | <|body_start_0|>
super().__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(target_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, dm)
self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]
self.d... | Decoder class | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""Decoder class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: number of hidden units in the fully connected layer target_vo... | stack_v2_sparse_classes_36k_train_015029 | 2,350 | no_license | [
{
"docstring": "Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: number of hidden units in the fully connected layer target_vocab: size of the target vocabulary max_seq_len: maximum sequence length possible drop_rate: dropout rate",
"name": "__in... | 2 | null | Implement the Python class `Decoder` described below.
Class description:
Decoder class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: numb... | Implement the Python class `Decoder` described below.
Class description:
Decoder class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: numb... | 7f9a040f23eda32c5aa154c991c930a01b490f0f | <|skeleton|>
class Decoder:
"""Decoder class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: number of hidden units in the fully connected layer target_vo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Decoder:
"""Decoder class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Init method Args: N: number of blocks in the encode dm: dimensionality of the model h: number of heads hidden: number of hidden units in the fully connected layer target_vocab: size of ... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/10-transformer_decoder.py | dbaroli/holbertonschool-machine_learning | train | 0 |
c0289200fddaccd13dee700f8008b75233c74de2 | [
"u_id = request.user.id\nmesgs = Message.objects.filter(Q(recipient=u_id) | Q(sender=u_id)).exclude(~Q(parent_msg=None)).order_by('-sent_at')\ncontext_data = {'breadcrumbs': [{'name': 'Merchant', 'url': reverse('account')}, {'name': 'Messages', 'url': reverse('messages')}], 'mesgs': mesgs}\nreturn TemplateResponse(... | <|body_start_0|>
u_id = request.user.id
mesgs = Message.objects.filter(Q(recipient=u_id) | Q(sender=u_id)).exclude(~Q(parent_msg=None)).order_by('-sent_at')
context_data = {'breadcrumbs': [{'name': 'Merchant', 'url': reverse('account')}, {'name': 'Messages', 'url': reverse('messages')}], 'mesgs'... | Views messages for a sender | MessagesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessagesView:
"""Views messages for a sender"""
def get(self, request):
"""Read thread topics"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Dispatch message to start a new conversation"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_015030 | 5,346 | permissive | [
{
"docstring": "Read thread topics",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Dispatch message to start a new conversation",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006361 | Implement the Python class `MessagesView` described below.
Class description:
Views messages for a sender
Method signatures and docstrings:
- def get(self, request): Read thread topics
- def post(self, request, *args, **kwargs): Dispatch message to start a new conversation | Implement the Python class `MessagesView` described below.
Class description:
Views messages for a sender
Method signatures and docstrings:
- def get(self, request): Read thread topics
- def post(self, request, *args, **kwargs): Dispatch message to start a new conversation
<|skeleton|>
class MessagesView:
"""Vie... | 3704cbe6e69ba3e4c53401d3bbc339208e9ebccd | <|skeleton|>
class MessagesView:
"""Views messages for a sender"""
def get(self, request):
"""Read thread topics"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Dispatch message to start a new conversation"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MessagesView:
"""Views messages for a sender"""
def get(self, request):
"""Read thread topics"""
u_id = request.user.id
mesgs = Message.objects.filter(Q(recipient=u_id) | Q(sender=u_id)).exclude(~Q(parent_msg=None)).order_by('-sent_at')
context_data = {'breadcrumbs': [{'na... | the_stack_v2_python_sparse | troupon/conversations/views.py | morristech/troupon | train | 0 |
a2d6aa03aa41ae5fa842219ae37a6dabdfddf0c9 | [
"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. | UserFavServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserFavServicer:
"""Missing associated documentation comment in .proto file."""
def GetFavList(self, request, context):
"""过滤收藏信息"""
<|body_0|>
def AddUserFav(self, request, context):
"""添加留言"""
<|body_1|>
def DeleteUserFav(self, request, context):
... | stack_v2_sparse_classes_36k_train_015031 | 6,939 | no_license | [
{
"docstring": "过滤收藏信息",
"name": "GetFavList",
"signature": "def GetFavList(self, request, context)"
},
{
"docstring": "添加留言",
"name": "AddUserFav",
"signature": "def AddUserFav(self, request, context)"
},
{
"docstring": "删除留言",
"name": "DeleteUserFav",
"signature": "def ... | 4 | stack_v2_sparse_classes_30k_train_010476 | Implement the Python class `UserFavServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetFavList(self, request, context): 过滤收藏信息
- def AddUserFav(self, request, context): 添加留言
- def DeleteUserFav(self, request, context): 删除留言
... | Implement the Python class `UserFavServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetFavList(self, request, context): 过滤收藏信息
- def AddUserFav(self, request, context): 添加留言
- def DeleteUserFav(self, request, context): 删除留言
... | e01c8fc9d9e734578733816669c122dede02489e | <|skeleton|>
class UserFavServicer:
"""Missing associated documentation comment in .proto file."""
def GetFavList(self, request, context):
"""过滤收藏信息"""
<|body_0|>
def AddUserFav(self, request, context):
"""添加留言"""
<|body_1|>
def DeleteUserFav(self, request, context):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserFavServicer:
"""Missing associated documentation comment in .proto file."""
def GetFavList(self, request, context):
"""过滤收藏信息"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not impleme... | the_stack_v2_python_sparse | other/mxshop_srvs/userop_srv/proto/userfav_pb2_grpc.py | xqmmy/go-fresh | train | 1 |
f2ac5bc411ed1f7f5acfcf12def6c75a00d9e246 | [
"self.year = year\nself.dupersids = dupersids\nself.OP_LOOKUPS = {2018: {'model': OutpatientVisits18, 'fields': {'DUPERSID', 'EVNTIDX', 'OPDATEYR', 'OPDATEMM', 'SEEDOC_M18'}, 'see_doc': 'SEEDOC_M18'}, 2017: {'model': OutpatientVisits17, 'fields': {'DUPERSID', 'EVNTIDX', 'OPDATEYR', 'OPDATEMM', 'SEEDOC'}, 'see_doc':... | <|body_start_0|>
self.year = year
self.dupersids = dupersids
self.OP_LOOKUPS = {2018: {'model': OutpatientVisits18, 'fields': {'DUPERSID', 'EVNTIDX', 'OPDATEYR', 'OPDATEMM', 'SEEDOC_M18'}, 'see_doc': 'SEEDOC_M18'}, 2017: {'model': OutpatientVisits17, 'fields': {'DUPERSID', 'EVNTIDX', 'OPDATEYR',... | Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types. | OutpatientVisitsEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutpatientVisitsEncoder:
"""Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types."""
def __init__(self, year, dupersids=None):
"""Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fet... | stack_v2_sparse_classes_36k_train_015032 | 5,038 | permissive | [
{
"docstring": "Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fetch data for",
"name": "__init__",
"signature": "def __init__(self, year, dupersids=None)"
},
{
"docstring": "Groups events by respondents. Classifies events th... | 2 | stack_v2_sparse_classes_30k_train_008471 | Implement the Python class `OutpatientVisitsEncoder` described below.
Class description:
Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types.
Method signatures and docstrings:
- def __init__(self, year, dupersids=None): Required_Inputs: year: Year to fetch data for Optional Inputs: d... | Implement the Python class `OutpatientVisitsEncoder` described below.
Class description:
Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types.
Method signatures and docstrings:
- def __init__(self, year, dupersids=None): Required_Inputs: year: Year to fetch data for Optional Inputs: d... | cd98ff6b484799fc0f2f447b3945621bd013bee6 | <|skeleton|>
class OutpatientVisitsEncoder:
"""Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types."""
def __init__(self, year, dupersids=None):
"""Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OutpatientVisitsEncoder:
"""Queries the OutpatientVisits Tables. Encodes fields from strings to usable data types."""
def __init__(self, year, dupersids=None):
"""Required_Inputs: year: Year to fetch data for Optional Inputs: dupersids: list of respondent dupersids to exclusively fetch data for""... | the_stack_v2_python_sparse | meps_db/processors/encoders/outpatient_visits_encoder.py | explore-meps/meps_dev | train | 0 |
f64bcd3dbd53b90534bb61bf076b87d7a2ff7e93 | [
"def deco(fn):\n \"\"\"Decorate the function.\"\"\"\n if isinstance(prim, str):\n self[prim] = fn\n elif issubclass(prim, Primitive):\n self[id(prim)] = fn\n return fn\nreturn deco",
"fn = default\nif isinstance(prim_obj, str) and prim_obj in self:\n fn = self[prim_obj]\nelif isinstan... | <|body_start_0|>
def deco(fn):
"""Decorate the function."""
if isinstance(prim, str):
self[prim] = fn
elif issubclass(prim, Primitive):
self[id(prim)] = fn
return fn
return deco
<|end_body_0|>
<|body_start_1|>
fn = ... | Registry class for registry functions for grad and vm_impl on Primitive. | Registry | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-f... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Registry:
"""Registry class for registry functions for grad and vm_impl on Primitive."""
def register(self, prim):
"""register the function."""
<|body_0|>
def get(self, prim_obj, default):
"""Get the value by primitive."""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_015033 | 2,358 | permissive | [
{
"docstring": "register the function.",
"name": "register",
"signature": "def register(self, prim)"
},
{
"docstring": "Get the value by primitive.",
"name": "get",
"signature": "def get(self, prim_obj, default)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013056 | Implement the Python class `Registry` described below.
Class description:
Registry class for registry functions for grad and vm_impl on Primitive.
Method signatures and docstrings:
- def register(self, prim): register the function.
- def get(self, prim_obj, default): Get the value by primitive. | Implement the Python class `Registry` described below.
Class description:
Registry class for registry functions for grad and vm_impl on Primitive.
Method signatures and docstrings:
- def register(self, prim): register the function.
- def get(self, prim_obj, default): Get the value by primitive.
<|skeleton|>
class Re... | 54acb15d435533c815ee1bd9f6dc0b56b4d4cf83 | <|skeleton|>
class Registry:
"""Registry class for registry functions for grad and vm_impl on Primitive."""
def register(self, prim):
"""register the function."""
<|body_0|>
def get(self, prim_obj, default):
"""Get the value by primitive."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Registry:
"""Registry class for registry functions for grad and vm_impl on Primitive."""
def register(self, prim):
"""register the function."""
def deco(fn):
"""Decorate the function."""
if isinstance(prim, str):
self[prim] = fn
elif iss... | the_stack_v2_python_sparse | mindspore/python/mindspore/ops/_register_for_op.py | mindspore-ai/mindspore | train | 4,178 |
b118f558b174ec499dc5d820ac8aaffe6520cc55 | [
"self.exploration_vs_exploitation = exploration_vs_exploitation\nself.decomposition_funcs = decomposition_funcs\nself.preprocessors = preprocessors\nself.nbits = nbits\nself.seed = seed\nself.estimators = [MLPRegressor(hidden_layer_sizes=hidden_layer_sizes, alpha=alpha) for _ in range(n_estimators)]",
"coefs = [e... | <|body_start_0|>
self.exploration_vs_exploitation = exploration_vs_exploitation
self.decomposition_funcs = decomposition_funcs
self.preprocessors = preprocessors
self.nbits = nbits
self.seed = seed
self.estimators = [MLPRegressor(hidden_layer_sizes=hidden_layer_sizes, alp... | GraphNeuralNetworkScoreEstimator. | GraphNeuralNetworkScoreEstimator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_015034 | 21,013 | permissive | [
{
"docstring": "init.",
"name": "__init__",
"signature": "def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1)"
},
{
"docstring": "predict_gradient.",
"name": "predict_g... | 2 | stack_v2_sparse_classes_30k_train_008739 | Implement the Python class `GraphNeuralNetworkScoreEstimator` described below.
Class description:
GraphNeuralNetworkScoreEstimator.
Method signatures and docstrings:
- def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessor... | Implement the Python class `GraphNeuralNetworkScoreEstimator` described below.
Class description:
GraphNeuralNetworkScoreEstimator.
Method signatures and docstrings:
- def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessor... | d89e88183cce1ff24dca9333c09fa11597a45c7a | <|skeleton|>
class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphNeuralNetworkScoreEstimator:
"""GraphNeuralNetworkScoreEstimator."""
def __init__(self, hidden_layer_sizes=[100, 50], alpha=0.0001, n_estimators=100, exploration_vs_exploitation=0, decomposition_funcs=None, preprocessors=None, nbits=14, seed=1):
"""init."""
self.exploration_vs_exploi... | the_stack_v2_python_sparse | ego/optimization/score_estimator.py | smautner/EGO | train | 0 |
f58b426f9c59e447a40adec0f60bb25b7d9ceb7a | [
"length = len(msg)\ndata_len = struct.pack('i', length)\nself.request.send(data_len)\nif type(msg) is str:\n self.request.send(msg.encode('utf-8'))\nelse:\n self.request.send(msg)",
"res_dsize = self.request.recv(4)\nres_dsize = struct.unpack('i', res_dsize)[0]\nrev_dsize = 0\nres_data = b''\nwhile rev_dsiz... | <|body_start_0|>
length = len(msg)
data_len = struct.pack('i', length)
self.request.send(data_len)
if type(msg) is str:
self.request.send(msg.encode('utf-8'))
else:
self.request.send(msg)
<|end_body_0|>
<|body_start_1|>
res_dsize = self.request.re... | MySS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
<|body_0|>
def my_recv(self, buffer):
"""收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容"""
<|body_1|>
def auth_user(self, buffer):
"""认证登录socket_server的用... | stack_v2_sparse_classes_36k_train_015035 | 4,308 | no_license | [
{
"docstring": "通过该对象建立的TCP连接发送数据的函数 :param msg: :return:",
"name": "my_send",
"signature": "def my_send(self, msg)"
},
{
"docstring": "收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容",
"name": "my_recv",
"signature": "def my_recv(self, buffer)"
},
{
"docstring": "认... | 6 | stack_v2_sparse_classes_30k_train_004115 | Implement the Python class `MySS` described below.
Class description:
Implement the MySS class.
Method signatures and docstrings:
- def my_send(self, msg): 通过该对象建立的TCP连接发送数据的函数 :param msg: :return:
- def my_recv(self, buffer): 收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容
- def auth_user(self, buffer)... | Implement the Python class `MySS` described below.
Class description:
Implement the MySS class.
Method signatures and docstrings:
- def my_send(self, msg): 通过该对象建立的TCP连接发送数据的函数 :param msg: :return:
- def my_recv(self, buffer): 收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容
- def auth_user(self, buffer)... | 8e4dfaaeae782a37f6baca4c024b1c2a1dc83cba | <|skeleton|>
class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
<|body_0|>
def my_recv(self, buffer):
"""收取通过TCP连接发送过来的数据,不会黏包 :param buffer: :return: 从客户端接收到的比特格式的内容"""
<|body_1|>
def auth_user(self, buffer):
"""认证登录socket_server的用... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MySS:
def my_send(self, msg):
"""通过该对象建立的TCP连接发送数据的函数 :param msg: :return:"""
length = len(msg)
data_len = struct.pack('i', length)
self.request.send(data_len)
if type(msg) is str:
self.request.send(msg.encode('utf-8'))
else:
self.request... | the_stack_v2_python_sparse | socket_test/socketserver_test/new_socketserver_v2.py | PeterZhangxing/codewars | train | 0 | |
fbbab8098e59f8c03536b89b41017fd4539f2dd5 | [
"with plt.style.context(self._config['STYLE_SHEET']):\n title = f'Confusion Matrix - {self._model_name}'\n y_pred = self._model.predict(self._test_x)\n return plot_confusion_matrix(self._test_y, y_pred, normalized, title, **kwargs)",
"if not hasattr(self._model, 'predict_proba'):\n raise VizError(\"Mo... | <|body_start_0|>
with plt.style.context(self._config['STYLE_SHEET']):
title = f'Confusion Matrix - {self._model_name}'
y_pred = self._model.predict(self._test_x)
return plot_confusion_matrix(self._test_y, y_pred, normalized, title, **kwargs)
<|end_body_0|>
<|body_start_1|>
... | Visualization class for Classification models | ClassificationVisualize | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassificationVisualize:
"""Visualization class for Classification models"""
def confusion_matrix(self, normalized=True, **kwargs):
"""Visualize a confusion matrix for a classification model :param normalized: Whether or not to normalize annotated class counts :return: matplotlib.Axe... | stack_v2_sparse_classes_36k_train_015036 | 10,271 | permissive | [
{
"docstring": "Visualize a confusion matrix for a classification model :param normalized: Whether or not to normalize annotated class counts :return: matplotlib.Axes",
"name": "confusion_matrix",
"signature": "def confusion_matrix(self, normalized=True, **kwargs)"
},
{
"docstring": "Visualize a... | 3 | stack_v2_sparse_classes_30k_train_017356 | Implement the Python class `ClassificationVisualize` described below.
Class description:
Visualization class for Classification models
Method signatures and docstrings:
- def confusion_matrix(self, normalized=True, **kwargs): Visualize a confusion matrix for a classification model :param normalized: Whether or not to... | Implement the Python class `ClassificationVisualize` described below.
Class description:
Visualization class for Classification models
Method signatures and docstrings:
- def confusion_matrix(self, normalized=True, **kwargs): Visualize a confusion matrix for a classification model :param normalized: Whether or not to... | c0f651bc63f2b49198e15814b891c9306b9f743b | <|skeleton|>
class ClassificationVisualize:
"""Visualization class for Classification models"""
def confusion_matrix(self, normalized=True, **kwargs):
"""Visualize a confusion matrix for a classification model :param normalized: Whether or not to normalize annotated class counts :return: matplotlib.Axe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassificationVisualize:
"""Visualization class for Classification models"""
def confusion_matrix(self, normalized=True, **kwargs):
"""Visualize a confusion matrix for a classification model :param normalized: Whether or not to normalize annotated class counts :return: matplotlib.Axes"""
... | the_stack_v2_python_sparse | src/ml_utils/visualizations/visualizations.py | clausvestergaard/ml_utils | train | 0 |
9f1f227e9b2eea62631303fe0e98a5cef80344fb | [
"self.URL = locDict['URL']\nself.LocationName = locDict['Location']\nself.Keys = [locDict['Key']]\nself.locDict = locDict\nreturn",
"case = Status.POSSIBLE\nr = requests.get(self.URL)\ntry:\n if self.locDict['available']:\n case = Status.YES\n else:\n case = Status.NO\nexcept KeyError:\n lo... | <|body_start_0|>
self.URL = locDict['URL']
self.LocationName = locDict['Location']
self.Keys = [locDict['Key']]
self.locDict = locDict
return
<|end_body_0|>
<|body_start_1|>
case = Status.POSSIBLE
r = requests.get(self.URL)
try:
if self.locDic... | class for a scraper that reports status for a single Pharmaca location | Pharmaca | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pharmaca:
"""class for a scraper that reports status for a single Pharmaca location"""
def __init__(self, locDict):
"""initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute... | stack_v2_sparse_classes_36k_train_015037 | 1,417 | permissive | [
{
"docstring": "initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute of the PharmacaWrapper class",
"name": "__init__",
"signature": "def __init__(self, locDict)"
},
{
"docstring": "l... | 2 | stack_v2_sparse_classes_30k_train_008247 | Implement the Python class `Pharmaca` described below.
Class description:
class for a scraper that reports status for a single Pharmaca location
Method signatures and docstrings:
- def __init__(self, locDict): initialization method. Takes a locDict dictionary with information about a single location. The keys of the ... | Implement the Python class `Pharmaca` described below.
Class description:
class for a scraper that reports status for a single Pharmaca location
Method signatures and docstrings:
- def __init__(self, locDict): initialization method. Takes a locDict dictionary with information about a single location. The keys of the ... | 28248155c136f9b267f0ada7749d30848de0981f | <|skeleton|>
class Pharmaca:
"""class for a scraper that reports status for a single Pharmaca location"""
def __init__(self, locDict):
"""initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Pharmaca:
"""class for a scraper that reports status for a single Pharmaca location"""
def __init__(self, locDict):
"""initialization method. Takes a locDict dictionary with information about a single location. The keys of the location dictionary MUST match the self.columns attribute of the Pharm... | the_stack_v2_python_sparse | python/Pharmaca.py | CovidWA/scrapers-oss | train | 0 |
d475827d8d8f8f7bb532b4e222713b2ba86ecc1f | [
"if n == 1:\n return True\nwhile n:\n n /= 2.0\n print(n)\n if n == 1:\n return True\n elif n < 1:\n break\nreturn False",
"if n != 0 and n & n - 1 == 0:\n return True\nelse:\n return False"
] | <|body_start_0|>
if n == 1:
return True
while n:
n /= 2.0
print(n)
if n == 1:
return True
elif n < 1:
break
return False
<|end_body_0|>
<|body_start_1|>
if n != 0 and n & n - 1 == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPowerOfTwo(self, n):
""":type n: int :rtype: bool"""
<|body_0|>
def isPowerOfTwo1(self, n):
""":type n: int :rtype: bool 位运算 特点是有且仅有一个位为1的二进制"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 1:
return True
... | stack_v2_sparse_classes_36k_train_015038 | 776 | no_license | [
{
"docstring": ":type n: int :rtype: bool",
"name": "isPowerOfTwo",
"signature": "def isPowerOfTwo(self, n)"
},
{
"docstring": ":type n: int :rtype: bool 位运算 特点是有且仅有一个位为1的二进制",
"name": "isPowerOfTwo1",
"signature": "def isPowerOfTwo1(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPowerOfTwo(self, n): :type n: int :rtype: bool
- def isPowerOfTwo1(self, n): :type n: int :rtype: bool 位运算 特点是有且仅有一个位为1的二进制 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPowerOfTwo(self, n): :type n: int :rtype: bool
- def isPowerOfTwo1(self, n): :type n: int :rtype: bool 位运算 特点是有且仅有一个位为1的二进制
<|skeleton|>
class Solution:
def isPowerOf... | 069bb0b751ef7f469036b9897436eb5d138ffa24 | <|skeleton|>
class Solution:
def isPowerOfTwo(self, n):
""":type n: int :rtype: bool"""
<|body_0|>
def isPowerOfTwo1(self, n):
""":type n: int :rtype: bool 位运算 特点是有且仅有一个位为1的二进制"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPowerOfTwo(self, n):
""":type n: int :rtype: bool"""
if n == 1:
return True
while n:
n /= 2.0
print(n)
if n == 1:
return True
elif n < 1:
break
return False
def isPo... | the_stack_v2_python_sparse | 算法/位运算/2的幂.py | RichieSong/algorithm | train | 0 | |
ccd2cce751ca970c128c9e6d92fb52047dfb350e | [
"count = defaultdict(int)\nstart = 0\nres = 0\nfor end, c in enumerate(s):\n count[c] += 1\n while count[c] > 1:\n count[s[start]] -= 1\n start += 1\n res = max(res, end - start + 1)\nreturn res",
"seen = []\nres = 0\nfor c in s:\n while c in seen:\n seen.pop(0)\n seen.append(c... | <|body_start_0|>
count = defaultdict(int)
start = 0
res = 0
for end, c in enumerate(s):
count[c] += 1
while count[c] > 1:
count[s[start]] -= 1
start += 1
res = max(res, end - start + 1)
return res
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
count = defaultdict(int)
start = 0... | stack_v2_sparse_classes_36k_train_015039 | 778 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring2",
"signature": "def lengthOfLongestSubstring2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014921 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | a32a1add8720de35e0ddc0c51efe781fb04c9d4a | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
count = defaultdict(int)
start = 0
res = 0
for end, c in enumerate(s):
count[c] += 1
while count[c] > 1:
count[s[start]] -= 1
start +=... | the_stack_v2_python_sparse | 双指针/leetcode_3_Longest_Substring_Without_Repeating_Characters.py | cleverer123/Algorithm | train | 0 | |
0dede8582813858998aafa1921f7aa86ed0d54e4 | [
"expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ=='\nresult = user.encodePassword('MoinMoin', salt='12345')\nassert result == expected\nresult = user.encodePassword(u'MoinMoin', salt='12345')\nassert result == expected",
"result = user.encodePassword(u'סיסמה סודית בהחלט', salt='12345')\nexpected = '{SSHA}Yiw... | <|body_start_0|>
expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ=='
result = user.encodePassword('MoinMoin', salt='12345')
assert result == expected
result = user.encodePassword(u'MoinMoin', salt='12345')
assert result == expected
<|end_body_0|>
<|body_start_1|>
res... | user: encode passwords tests | TestEncodePassword | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEncodePassword:
"""user: encode passwords tests"""
def testAscii(self):
"""user: encode ascii password"""
<|body_0|>
def testUnicode(self):
"""user: encode unicode password"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
expected = '{SSHA}xk... | stack_v2_sparse_classes_36k_train_015040 | 11,347 | no_license | [
{
"docstring": "user: encode ascii password",
"name": "testAscii",
"signature": "def testAscii(self)"
},
{
"docstring": "user: encode unicode password",
"name": "testUnicode",
"signature": "def testUnicode(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006103 | Implement the Python class `TestEncodePassword` described below.
Class description:
user: encode passwords tests
Method signatures and docstrings:
- def testAscii(self): user: encode ascii password
- def testUnicode(self): user: encode unicode password | Implement the Python class `TestEncodePassword` described below.
Class description:
user: encode passwords tests
Method signatures and docstrings:
- def testAscii(self): user: encode ascii password
- def testUnicode(self): user: encode unicode password
<|skeleton|>
class TestEncodePassword:
"""user: encode passw... | d6e801402c4538bdfb34a97cf07153101167c1ec | <|skeleton|>
class TestEncodePassword:
"""user: encode passwords tests"""
def testAscii(self):
"""user: encode ascii password"""
<|body_0|>
def testUnicode(self):
"""user: encode unicode password"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestEncodePassword:
"""user: encode passwords tests"""
def testAscii(self):
"""user: encode ascii password"""
expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ=='
result = user.encodePassword('MoinMoin', salt='12345')
assert result == expected
result = user.enco... | the_stack_v2_python_sparse | MoinMoin/_tests/test_user.py | happytk/jardin | train | 0 |
c42145706873c6a924e3ab932bfa5561ad9c93c1 | [
"pickleFileStr = self.fbBasename() + '.pick'\nfileExists = os.path.isfile(pickleFileStr)\nif fileExists:\n mTime = os.path.getmtime(self.fileStr)\n tTime = os.path.getmtime(pickleFileStr)\n fSize = os.path.getsize(pickleFileStr)\n if tTime < mTime or fSize < 100:\n print('~updating {:s}'.format(o... | <|body_start_0|>
pickleFileStr = self.fbBasename() + '.pick'
fileExists = os.path.isfile(pickleFileStr)
if fileExists:
mTime = os.path.getmtime(self.fileStr)
tTime = os.path.getmtime(pickleFileStr)
fSize = os.path.getsize(pickleFileStr)
if tTime < ... | FileFASTA | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileFASTA:
def getFastaDict(self):
"""return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based"""
<|body_0|>
def __createPickleFile(self, pickleFileStr):
"""create the fasta dictionary and save it to a pickle file return fasta... | stack_v2_sparse_classes_36k_train_015041 | 22,678 | no_license | [
{
"docstring": "return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based",
"name": "getFastaDict",
"signature": "def getFastaDict(self)"
},
{
"docstring": "create the fasta dictionary and save it to a pickle file return fastaDict",
"name": "__createPi... | 3 | null | Implement the Python class `FileFASTA` described below.
Class description:
Implement the FileFASTA class.
Method signatures and docstrings:
- def getFastaDict(self): return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based
- def __createPickleFile(self, pickleFileStr): create ... | Implement the Python class `FileFASTA` described below.
Class description:
Implement the FileFASTA class.
Method signatures and docstrings:
- def getFastaDict(self): return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based
- def __createPickleFile(self, pickleFileStr): create ... | 189bf355f0f878c5603b09a06b3b50b61a11ad93 | <|skeleton|>
class FileFASTA:
def getFastaDict(self):
"""return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based"""
<|body_0|>
def __createPickleFile(self, pickleFileStr):
"""create the fasta dictionary and save it to a pickle file return fasta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileFASTA:
def getFastaDict(self):
"""return dictionary where key is chromosome, value is array array has FASTA sequence and is 1-based"""
pickleFileStr = self.fbBasename() + '.pick'
fileExists = os.path.isfile(pickleFileStr)
if fileExists:
mTime = os.path.getmtime(... | the_stack_v2_python_sparse | python_util/bioFiles.py | bhofmei/analysis-scripts | train | 2 | |
199ffaef94cf149852ceb2b44a90f6e30b430290 | [
"area = 0\nself.areas = [0]\nself.rects = [[]]\nfor x1, y1, x2, y2 in rects:\n xx, yy = (x2 - x1 + 1, y2 - y1 + 1)\n area += xx * yy\n self.areas.append(area)\n self.rects.append((xx, x1, y1))",
"target = random.randrange(self.areas[-1])\ni = bisect.bisect_right(self.areas, target)\ny, x = divmod(targ... | <|body_start_0|>
area = 0
self.areas = [0]
self.rects = [[]]
for x1, y1, x2, y2 in rects:
xx, yy = (x2 - x1 + 1, y2 - y1 + 1)
area += xx * yy
self.areas.append(area)
self.rects.append((xx, x1, y1))
<|end_body_0|>
<|body_start_1|>
t... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
area = 0
self.areas = [0]
self.rects = [[]]
for x1, y1, x... | stack_v2_sparse_classes_36k_train_015042 | 1,567 | no_license | [
{
"docstring": ":type rects: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, rects)"
},
{
"docstring": ":rtype: List[int]",
"name": "pick",
"signature": "def pick(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int]
<|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: ... | 36d7f9e967a62db77622e0888f61999d7f37579a | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
area = 0
self.areas = [0]
self.rects = [[]]
for x1, y1, x2, y2 in rects:
xx, yy = (x2 - x1 + 1, y2 - y1 + 1)
area += xx * yy
self.areas.append(area)
s... | the_stack_v2_python_sparse | P0497.py | westgate458/LeetCode | train | 0 | |
43f87fd7151725d032194be10f7a5313f44ff2de | [
"self.airgap_config = airgap_config\nself.cluster_id = cluster_id\nself.cluster_incarnation_id = cluster_incarnation_id\nself.current_operation = current_operation\nself.message = message\nself.name = name\nself.node_statuses = node_statuses\nself.removal_state = removal_state\nself.services_synced = services_synce... | <|body_start_0|>
self.airgap_config = airgap_config
self.cluster_id = cluster_id
self.cluster_incarnation_id = cluster_incarnation_id
self.current_operation = current_operation
self.message = message
self.name = name
self.node_statuses = node_statuses
self... | Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarnation ID of the Cluster. current_op... | ClusterStatusResult | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifie... | stack_v2_sparse_classes_36k_train_015043 | 10,055 | permissive | [
{
"docstring": "Constructor for the ClusterStatusResult class",
"name": "__init__",
"signature": "def __init__(self, airgap_config=None, cluster_id=None, cluster_incarnation_id=None, current_operation=None, message=None, name=None, node_statuses=None, removal_state=None, services_synced=None, software_v... | 2 | stack_v2_sparse_classes_30k_train_011618 | Implement the Python class `ClusterStatusResult` described below.
Class description:
Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. clus... | Implement the Python class `ClusterStatusResult` described below.
Class description:
Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. clus... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClusterStatusResult:
"""Implementation of the 'ClusterStatusResult' model. Specifies the result of getting the status of a Cluster. Attributes: airgap_config (AirgapConfig): Specifies Airgap config cluster_id (long|int): Specifies the ID of the Cluster. cluster_incarnation_id (long|int): Specifies the incarna... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cluster_status_result.py | cohesity/management-sdk-python | train | 24 |
b7e1020f922462a96c74de2426d8ae7d8a566592 | [
"res = []\n\ndef dfs_preorder(node):\n if not node:\n return\n res.append(str(node.val))\n dfs_preorder(node.left)\n dfs_preorder(node.right)\ndfs_preorder(root)\nreturn '' if not res else '|'.join(res)",
"def dfs_restore(lis):\n father = TreeNode(lis[0])\n length = len(lis)\n if lengt... | <|body_start_0|>
res = []
def dfs_preorder(node):
if not node:
return
res.append(str(node.val))
dfs_preorder(node.left)
dfs_preorder(node.right)
dfs_preorder(root)
return '' if not res else '|'.join(res)
<|end_body_0|>
<|b... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = []
... | stack_v2_sparse_classes_36k_train_015044 | 3,029 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_021002 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | ee59b82125f100970c842d5e1245287c484d6649 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
res = []
def dfs_preorder(node):
if not node:
return
res.append(str(node.val))
dfs_preorder(node.left)
dfs_preorder(node.right)
... | the_stack_v2_python_sparse | _CodeTopics/LeetCode/401-600/000449/WA--000449.py3 | BIAOXYZ/variousCodes | train | 0 | |
cb368d801f1cc91c9ca65f339cca370141865b41 | [
"self.path = path\nself.fileName = path + filename\nif not os.path.exists(self.path):\n os.makedirs(self.path)\nself.logger = logging.getLogger('PLANHEAT')\nself.logger.setLevel('DEBUG')\nself.filehandler = logging.FileHandler(self.fileName)\nself.filehandler.setLevel(logging_level)\nstreamformatter = logging.Fo... | <|body_start_0|>
self.path = path
self.fileName = path + filename
if not os.path.exists(self.path):
os.makedirs(self.path)
self.logger = logging.getLogger('PLANHEAT')
self.logger.setLevel('DEBUG')
self.filehandler = logging.FileHandler(self.fileName)
s... | Python Logger API Control level, formatting and output handlers for logger | Logger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Logger:
"""Python Logger API Control level, formatting and output handlers for logger"""
def __init__(self, path, filename, logging_level):
"""logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level"""
<|bod... | stack_v2_sparse_classes_36k_train_015045 | 3,218 | permissive | [
{
"docstring": "logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level",
"name": "__init__",
"signature": "def __init__(self, path, filename, logging_level)"
},
{
"docstring": "Write Message in Log file :param level str: level... | 2 | stack_v2_sparse_classes_30k_train_019123 | Implement the Python class `Logger` described below.
Class description:
Python Logger API Control level, formatting and output handlers for logger
Method signatures and docstrings:
- def __init__(self, path, filename, logging_level): logger Constructor :param path str:path of log file :param fileName str: name of log... | Implement the Python class `Logger` described below.
Class description:
Python Logger API Control level, formatting and output handlers for logger
Method signatures and docstrings:
- def __init__(self, path, filename, logging_level): logger Constructor :param path str:path of log file :param fileName str: name of log... | 9764fcb86d3898b232c4cc333dab75ebe41cd421 | <|skeleton|>
class Logger:
"""Python Logger API Control level, formatting and output handlers for logger"""
def __init__(self, path, filename, logging_level):
"""logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Logger:
"""Python Logger API Control level, formatting and output handlers for logger"""
def __init__(self, path, filename, logging_level):
"""logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level"""
self.path = path
... | the_stack_v2_python_sparse | PlanheatMappingModule/PlanHeatDMM/manageLog/logger.py | Planheat/Planheat-Tool | train | 2 |
5f4085548a05c1e8ce8d03b35f7a3874baacd730 | [
"for vertex in g:\n vertex.setDistance(1000000)\ng.getVertex(start_vertex_key).setDistance(0)\npriority_queue = PriorityQueue([vertex for vertex in g])\nwhile not priority_queue.isEmpty():\n current_vertex = g.getVertex(priority_queue.delMin())\n for next_vertex in current_vertex.getConnections():\n ... | <|body_start_0|>
for vertex in g:
vertex.setDistance(1000000)
g.getVertex(start_vertex_key).setDistance(0)
priority_queue = PriorityQueue([vertex for vertex in g])
while not priority_queue.isEmpty():
current_vertex = g.getVertex(priority_queue.delMin())
... | Dijkstra | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dijkstra:
def dijkstra(self, g, start_vertex_key):
"""Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:"""
<|body_0|>
def searchMinPath(self, g, start_vertex_key, finish_vertex_key):
"""根据起始节点建立Dijkstra图 根据结束节点寻找最短路径 :param g: :param start_vertex_ke... | stack_v2_sparse_classes_36k_train_015046 | 4,831 | no_license | [
{
"docstring": "Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:",
"name": "dijkstra",
"signature": "def dijkstra(self, g, start_vertex_key)"
},
{
"docstring": "根据起始节点建立Dijkstra图 根据结束节点寻找最短路径 :param g: :param start_vertex_key: :param finish_vertex_key: :return:",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_001295 | Implement the Python class `Dijkstra` described below.
Class description:
Implement the Dijkstra class.
Method signatures and docstrings:
- def dijkstra(self, g, start_vertex_key): Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:
- def searchMinPath(self, g, start_vertex_key, finish_vertex_key): 根据... | Implement the Python class `Dijkstra` described below.
Class description:
Implement the Dijkstra class.
Method signatures and docstrings:
- def dijkstra(self, g, start_vertex_key): Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:
- def searchMinPath(self, g, start_vertex_key, finish_vertex_key): 根据... | 97cc61fefe0bedf5161687aab92fb09b0df990e2 | <|skeleton|>
class Dijkstra:
def dijkstra(self, g, start_vertex_key):
"""Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:"""
<|body_0|>
def searchMinPath(self, g, start_vertex_key, finish_vertex_key):
"""根据起始节点建立Dijkstra图 根据结束节点寻找最短路径 :param g: :param start_vertex_ke... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dijkstra:
def dijkstra(self, g, start_vertex_key):
"""Dijkstra算法 :param g: 图 :param start_vertex_key: 起始顶点vertex :return:"""
for vertex in g:
vertex.setDistance(1000000)
g.getVertex(start_vertex_key).setDistance(0)
priority_queue = PriorityQueue([vertex for vertex i... | the_stack_v2_python_sparse | code/graph/dijkstra.py | JiaXingBinggan/For_work | train | 0 | |
dfcd81ec8dda4023777cde8dbde40fcfa32e0b03 | [
"reader_keys = ['parameters', 'parameter_file', 'scale_factors', 'scale_factor_file', 'header_size', 'nhalos_per_tree', 'read_header_func', 'item_dtype']\nreader_kwargs = dict()\nfor k in reader_keys:\n if k in kwargs:\n reader_kwargs[k] = kwargs.pop(k)\nself._lht0 = LHaloTreeReader(args[0], **reader_kwar... | <|body_start_0|>
reader_keys = ['parameters', 'parameter_file', 'scale_factors', 'scale_factor_file', 'header_size', 'nhalos_per_tree', 'read_header_func', 'item_dtype']
reader_kwargs = dict()
for k in reader_keys:
if k in kwargs:
reader_kwargs[k] = kwargs.pop(k)
... | Arbors for LHaloTree data. | LHaloTreeArbor | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LHaloTreeArbor:
"""Arbors for LHaloTree data."""
def __init__(self, *args, **kwargs):
"""Added reader class to allow fast access of header info."""
<|body_0|>
def _parse_parameter_file(self):
"""Parse the file header, get things like: - cosmological parameters - ... | stack_v2_sparse_classes_36k_train_015047 | 8,055 | permissive | [
{
"docstring": "Added reader class to allow fast access of header info.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Parse the file header, get things like: - cosmological parameters - box size - list of fields",
"name": "_parse_parameter_file",... | 4 | null | Implement the Python class `LHaloTreeArbor` described below.
Class description:
Arbors for LHaloTree data.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Added reader class to allow fast access of header info.
- def _parse_parameter_file(self): Parse the file header, get things like: - cosmo... | Implement the Python class `LHaloTreeArbor` described below.
Class description:
Arbors for LHaloTree data.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Added reader class to allow fast access of header info.
- def _parse_parameter_file(self): Parse the file header, get things like: - cosmo... | 57d379f85048372d75fb197166289efd67a2e829 | <|skeleton|>
class LHaloTreeArbor:
"""Arbors for LHaloTree data."""
def __init__(self, *args, **kwargs):
"""Added reader class to allow fast access of header info."""
<|body_0|>
def _parse_parameter_file(self):
"""Parse the file header, get things like: - cosmological parameters - ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LHaloTreeArbor:
"""Arbors for LHaloTree data."""
def __init__(self, *args, **kwargs):
"""Added reader class to allow fast access of header info."""
reader_keys = ['parameters', 'parameter_file', 'scale_factors', 'scale_factor_file', 'header_size', 'nhalos_per_tree', 'read_header_func', 'i... | the_stack_v2_python_sparse | ytree/frontends/lhalotree/arbor.py | ytree-project/ytree | train | 6 |
d85f9b39577affb5fb8da830b64b93c0ac7ff352 | [
"min_fst = float('inf')\nfor snd in range(1, len(nums) - 1):\n min_fst = min(min_fst, nums[snd - 1])\n for trd in range(snd + 1, len(nums)):\n if nums[snd] > nums[trd] and nums[trd] > min_fst:\n return True\nreturn False",
"stack = []\nele = -float('inf')\nfor i in range(len(nums) - 1, -1,... | <|body_start_0|>
min_fst = float('inf')
for snd in range(1, len(nums) - 1):
min_fst = min(min_fst, nums[snd - 1])
for trd in range(snd + 1, len(nums)):
if nums[snd] > nums[trd] and nums[trd] > min_fst:
return True
return False
<|end_bod... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""Better Brute Force: Time: O(n^2), Space: O(1)"""
<|body_0|>
def find_132_pattern(self, nums):
"""Stack: Time: O(n), Space: O(n) Idea: Use a stack to keep track of the 3 elements."""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_015048 | 1,074 | no_license | [
{
"docstring": "Better Brute Force: Time: O(n^2), Space: O(1)",
"name": "find132pattern",
"signature": "def find132pattern(self, nums: List[int]) -> bool"
},
{
"docstring": "Stack: Time: O(n), Space: O(n) Idea: Use a stack to keep track of the 3 elements.",
"name": "find_132_pattern",
"s... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern(self, nums: List[int]) -> bool: Better Brute Force: Time: O(n^2), Space: O(1)
- def find_132_pattern(self, nums): Stack: Time: O(n), Space: O(n) Idea: Use a st... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern(self, nums: List[int]) -> bool: Better Brute Force: Time: O(n^2), Space: O(1)
- def find_132_pattern(self, nums): Stack: Time: O(n), Space: O(n) Idea: Use a st... | 33252434f8d90b46fd2de07e257842331dcd81a8 | <|skeleton|>
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""Better Brute Force: Time: O(n^2), Space: O(1)"""
<|body_0|>
def find_132_pattern(self, nums):
"""Stack: Time: O(n), Space: O(n) Idea: Use a stack to keep track of the 3 elements."""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""Better Brute Force: Time: O(n^2), Space: O(1)"""
min_fst = float('inf')
for snd in range(1, len(nums) - 1):
min_fst = min(min_fst, nums[snd - 1])
for trd in range(snd + 1, len(nums)):
... | the_stack_v2_python_sparse | main/leetcode/456.py | dawnonme/Eureka | train | 0 | |
b59e32475a14f6a878cfcb31c009317cc2e83eae | [
"if len(chars) == 0:\n return 0\nans = [chars[0]]\nrepeat = 1\ni = 1\nwhile i < len(chars):\n if chars[i] == chars[i - 1]:\n repeat += 1\n chars.pop(i)\n else:\n if repeat > 1:\n self.insert_nums(i, chars, repeat)\n i += 1\n repeat = 1\n i += 1\nif r... | <|body_start_0|>
if len(chars) == 0:
return 0
ans = [chars[0]]
repeat = 1
i = 1
while i < len(chars):
if chars[i] == chars[i - 1]:
repeat += 1
chars.pop(i)
else:
if repeat > 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def compress(self, chars: List[str]) -> int:
"""NOTE: the problems requies to modify chars in-place"""
<|body_0|>
def insert_nums(self, i, chars, num):
"""e.g. 130 -> "130" -> ["1", "3", "0"]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_015049 | 1,002 | no_license | [
{
"docstring": "NOTE: the problems requies to modify chars in-place",
"name": "compress",
"signature": "def compress(self, chars: List[str]) -> int"
},
{
"docstring": "e.g. 130 -> \"130\" -> [\"1\", \"3\", \"0\"]",
"name": "insert_nums",
"signature": "def insert_nums(self, i, chars, num)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compress(self, chars: List[str]) -> int: NOTE: the problems requies to modify chars in-place
- def insert_nums(self, i, chars, num): e.g. 130 -> "130" -> ["1", "3", "0"] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def compress(self, chars: List[str]) -> int: NOTE: the problems requies to modify chars in-place
- def insert_nums(self, i, chars, num): e.g. 130 -> "130" -> ["1", "3", "0"]
<|s... | 54d777e11b91c5debe49c1aef723234c66a5d2cc | <|skeleton|>
class Solution:
def compress(self, chars: List[str]) -> int:
"""NOTE: the problems requies to modify chars in-place"""
<|body_0|>
def insert_nums(self, i, chars, num):
"""e.g. 130 -> "130" -> ["1", "3", "0"]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def compress(self, chars: List[str]) -> int:
"""NOTE: the problems requies to modify chars in-place"""
if len(chars) == 0:
return 0
ans = [chars[0]]
repeat = 1
i = 1
while i < len(chars):
if chars[i] == chars[i - 1]:
... | the_stack_v2_python_sparse | leetcode_solution/string/#443.String_Compression.py | HsiangHung/Code-Challenges | train | 0 | |
baca99befe12fb624df638be67c6e502f4ee2cbe | [
"c = Client()\nc.login(username='admin', password='admin1')\nresp = c.post('/clientes/crearCliente/', {'nombre': 'testCliente', 'ruc': 123, 'numeroTelefono': 123456, 'representante': 1})\nself.assertTrue(resp.status_code, 200)\nprint('\\n Se crea correctamente el cliente')",
"resp = self.client.get('/clientes/')\... | <|body_start_0|>
c = Client()
c.login(username='admin', password='admin1')
resp = c.post('/clientes/crearCliente/', {'nombre': 'testCliente', 'ruc': 123, 'numeroTelefono': 123456, 'representante': 1})
self.assertTrue(resp.status_code, 200)
print('\n Se crea correctamente el clien... | SGPTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SGPTestCase:
def test_crear_cliente(self):
"""Test para la creacion de un cliente @author: Mauricio Allegretti"""
<|body_0|>
def test_inicio(self):
"""Test para ver si puede entrar a la pagina de inicio"""
<|body_1|>
def test_listar_cliente(self):
... | stack_v2_sparse_classes_36k_train_015050 | 4,644 | no_license | [
{
"docstring": "Test para la creacion de un cliente @author: Mauricio Allegretti",
"name": "test_crear_cliente",
"signature": "def test_crear_cliente(self)"
},
{
"docstring": "Test para ver si puede entrar a la pagina de inicio",
"name": "test_inicio",
"signature": "def test_inicio(self)... | 5 | stack_v2_sparse_classes_30k_train_001103 | Implement the Python class `SGPTestCase` described below.
Class description:
Implement the SGPTestCase class.
Method signatures and docstrings:
- def test_crear_cliente(self): Test para la creacion de un cliente @author: Mauricio Allegretti
- def test_inicio(self): Test para ver si puede entrar a la pagina de inicio
... | Implement the Python class `SGPTestCase` described below.
Class description:
Implement the SGPTestCase class.
Method signatures and docstrings:
- def test_crear_cliente(self): Test para la creacion de un cliente @author: Mauricio Allegretti
- def test_inicio(self): Test para ver si puede entrar a la pagina de inicio
... | d3e26916bbad89e67086d5973bbed6bc0d584182 | <|skeleton|>
class SGPTestCase:
def test_crear_cliente(self):
"""Test para la creacion de un cliente @author: Mauricio Allegretti"""
<|body_0|>
def test_inicio(self):
"""Test para ver si puede entrar a la pagina de inicio"""
<|body_1|>
def test_listar_cliente(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SGPTestCase:
def test_crear_cliente(self):
"""Test para la creacion de un cliente @author: Mauricio Allegretti"""
c = Client()
c.login(username='admin', password='admin1')
resp = c.post('/clientes/crearCliente/', {'nombre': 'testCliente', 'ruc': 123, 'numeroTelefono': 123456, '... | the_stack_v2_python_sparse | SGP/cliente/tests.py | gfvazquez/IS2 | train | 0 | |
bb0b624d45c5420a3f3c2df5737b76e47d58a7a4 | [
"l_bytes = b'\\x00'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 0)",
"l_bytes = b'\\x00\\x00\\x00\\x00'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 0)",
"l_bytes = b'\\x00\\x00\\x01'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 1)",
"l_bytes = b'\\x00... | <|body_start_0|>
l_bytes = b'\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
<|end_body_0|>
<|body_start_1|>
l_bytes = b'\x00\x00\x00\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
<|end_body_1|>
<|body_start_2|>
l_b... | Test fetching big endian byte strings | D2_BigEnd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_one3(self):
"""Convert a dateti... | stack_v2_sparse_classes_36k_train_015051 | 6,756 | permissive | [
{
"docstring": "Convert a datetime to Minutes",
"name": "test_01_zero1",
"signature": "def test_01_zero1(self)"
},
{
"docstring": "Convert a datetime to Minutes",
"name": "test_02_zero4",
"signature": "def test_02_zero4(self)"
},
{
"docstring": "Convert a datetime to Minutes",
... | 5 | stack_v2_sparse_classes_30k_train_016660 | Implement the Python class `D2_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero1(self): Convert a datetime to Minutes
- def test_02_zero4(self): Convert a datetime to Minutes
- def test_03_one3(self): Convert a datetime to Minutes
-... | Implement the Python class `D2_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero1(self): Convert a datetime to Minutes
- def test_02_zero4(self): Convert a datetime to Minutes
- def test_03_one3(self): Convert a datetime to Minutes
-... | a100fc67761a22ae47ed6f21f3c9464e2de5d54f | <|skeleton|>
class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_one3(self):
"""Convert a dateti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
l_bytes = b'\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
... | the_stack_v2_python_sparse | Project/src/Modules/Core/Utilities/_test/test_convert.py | DBrianKimmel/PyHouse | train | 3 |
21ecc5119db1855689f6c4580a78adf4ddd825e7 | [
"self.player = player\nself.item = item\nself.quant = 1\nself.max_quant = player.bag[item.type][item]\nself.is_dead = False\nself.how_many_dialogue = Dialogue('30', self.player, self.player, show_curs=False, replace=[item.name.upper()])\nself.text_maker = TextMaker(join('fonts', 'party_txt_font.png'))\nself.menu_fr... | <|body_start_0|>
self.player = player
self.item = item
self.quant = 1
self.max_quant = player.bag[item.type][item]
self.is_dead = False
self.how_many_dialogue = Dialogue('30', self.player, self.player, show_curs=False, replace=[item.name.upper()])
self.text_maker ... | SellHowMany | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SellHowMany:
def __init__(self, player, item):
"""Creates an event which determines how many of an item that the user wants to sell."""
<|body_0|>
def update(self, ticks):
"""Updates the sell event if it exists. Otherwise update the quantity cursor."""
<|body... | stack_v2_sparse_classes_36k_train_015052 | 36,471 | no_license | [
{
"docstring": "Creates an event which determines how many of an item that the user wants to sell.",
"name": "__init__",
"signature": "def __init__(self, player, item)"
},
{
"docstring": "Updates the sell event if it exists. Otherwise update the quantity cursor.",
"name": "update",
"sign... | 5 | stack_v2_sparse_classes_30k_train_005177 | Implement the Python class `SellHowMany` described below.
Class description:
Implement the SellHowMany class.
Method signatures and docstrings:
- def __init__(self, player, item): Creates an event which determines how many of an item that the user wants to sell.
- def update(self, ticks): Updates the sell event if it... | Implement the Python class `SellHowMany` described below.
Class description:
Implement the SellHowMany class.
Method signatures and docstrings:
- def __init__(self, player, item): Creates an event which determines how many of an item that the user wants to sell.
- def update(self, ticks): Updates the sell event if it... | 6718fdb6555d87f0b7b331c10d64a604431f8e81 | <|skeleton|>
class SellHowMany:
def __init__(self, player, item):
"""Creates an event which determines how many of an item that the user wants to sell."""
<|body_0|>
def update(self, ticks):
"""Updates the sell event if it exists. Otherwise update the quantity cursor."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SellHowMany:
def __init__(self, player, item):
"""Creates an event which determines how many of an item that the user wants to sell."""
self.player = player
self.item = item
self.quant = 1
self.max_quant = player.bag[item.type][item]
self.is_dead = False
... | the_stack_v2_python_sparse | pokered/modules/events/poke_mart_event.py | surranc20/pokered | train | 44 | |
a5b6d6e3deeb7fbdb7824467544d34fcee5502fb | [
"amount_secured = '100'\ninterest_paid_indicator = 'No'\nFinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '')\ncalls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is required', inline_message=\"If you don't know ... | <|body_start_0|>
amount_secured = '100'
interest_paid_indicator = 'No'
FinancialChargeDetailsValidator.validate(amount_secured, interest_paid_indicator, '')
calls = [call(amount_secured, 'amount-secured', 'Amount originally secured', mock_error_builder(), summary_message='Amount is requi... | TestFinancialChargeDetailsValidator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFinancialChargeDetailsValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
<|body_0|>
def test_max_params_passed(self, mock_field_validator... | stack_v2_sparse_classes_36k_train_015053 | 6,886 | permissive | [
{
"docstring": "should pass the given parameter to the fieldset validator and call the expected validations",
"name": "test_min_params_passed",
"signature": "def test_min_params_passed(self, mock_field_validator, mock_error_builder)"
},
{
"docstring": "should pass the given parameter to the fiel... | 6 | stack_v2_sparse_classes_30k_train_021620 | Implement the Python class `TestFinancialChargeDetailsValidator` described below.
Class description:
Implement the TestFinancialChargeDetailsValidator class.
Method signatures and docstrings:
- def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ... | Implement the Python class `TestFinancialChargeDetailsValidator` described below.
Class description:
Implement the TestFinancialChargeDetailsValidator class.
Method signatures and docstrings:
- def test_min_params_passed(self, mock_field_validator, mock_error_builder): should pass the given parameter to the fieldset ... | d92446a9972ebbcd9a43a7a7444a528aa2f30bf7 | <|skeleton|>
class TestFinancialChargeDetailsValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
<|body_0|>
def test_max_params_passed(self, mock_field_validator... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestFinancialChargeDetailsValidator:
def test_min_params_passed(self, mock_field_validator, mock_error_builder):
"""should pass the given parameter to the fieldset validator and call the expected validations"""
amount_secured = '100'
interest_paid_indicator = 'No'
FinancialChar... | the_stack_v2_python_sparse | unit_tests/Add_land_charge/validation/test_financial_charge_details_validator.py | uk-gov-mirror/LandRegistry.maintain-frontend | train | 0 | |
42cdfe5552163e98743968e0ec3e5231d0981b44 | [
"self.agent_num = agent_num\nself.PID_acc = PIDController(1.0, 0, 0)\nself.PID_steer = PIDController(2.0, 0, 0)\nself.not_initiliazed = True",
"if self.not_initiliazed:\n geoplanner = GeometricPlanner(state, inter_point_d=40.0, planning_time=0.1)\n geoplanner.plan_for_agents(state, type_of_agent='controlled... | <|body_start_0|>
self.agent_num = agent_num
self.PID_acc = PIDController(1.0, 0, 0)
self.PID_steer = PIDController(2.0, 0, 0)
self.not_initiliazed = True
<|end_body_0|>
<|body_start_1|>
if self.not_initiliazed:
geoplanner = GeometricPlanner(state, inter_point_d=40.0,... | Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynamic_objects | SteeringSupervisor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SteeringSupervisor:
"""Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynamic_objects"""
def __init__(self, ag... | stack_v2_sparse_classes_36k_train_015054 | 2,025 | permissive | [
{
"docstring": "Initializes the SteeringSupervisor Class Parameters ---------- agent_num: int The number which specifies the agent in the dictionary state.dynamic_objects['controlled_cars']",
"name": "__init__",
"signature": "def __init__(self, agent_num=0)"
},
{
"docstring": "Returns action bas... | 2 | stack_v2_sparse_classes_30k_train_016938 | Implement the Python class `SteeringSupervisor` described below.
Class description:
Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynami... | Implement the Python class `SteeringSupervisor` described below.
Class description:
Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynami... | c4d420e2bad173e5ddd0f93e98449c786d90f2db | <|skeleton|>
class SteeringSupervisor:
"""Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynamic_objects"""
def __init__(self, ag... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SteeringSupervisor:
"""Superivsor agent which implements the planning stack to obtain steering level supervision of which the car should follow. Attributes ---------- agent_num : int Index of this agent in the world. Used to access its object in state.dynamic_objects"""
def __init__(self, agent_num=0):
... | the_stack_v2_python_sparse | gym_urbandriving/agents/supervisor/steering_supervisor.py | mikolajblaz/Urban_Driving_Simulator | train | 0 |
2d9a5c3abedaa7198d3a77028afff933471f9fe9 | [
"for item in kdddx:\n if l0(item):\n return item",
"count = 0\nfor item in kdddx:\n if l3(item):\n count += 1\nreturn count",
"for i in kdddx1:\n if l(i):\n yield i",
"mins = l1(kdddx2[0])\nfor c in range(1, len(kdddx2)):\n if l1(kdddx2[c]) < mins:\n mins = l1(kdddx2[c]... | <|body_start_0|>
for item in kdddx:
if l0(item):
return item
<|end_body_0|>
<|body_start_1|>
count = 0
for item in kdddx:
if l3(item):
count += 1
return count
<|end_body_1|>
<|body_start_2|>
for i in kdddx1:
if... | Iterablehelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Iterablehelper:
def find_singel01(kdddx, l0):
""":param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值"""
<|body_0|>
def find_count(kdddx, l3):
""":param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量"""
<|body_1|>
def find_all(kdddx1, l):
""":par... | stack_v2_sparse_classes_36k_train_015055 | 1,646 | permissive | [
{
"docstring": ":param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值",
"name": "find_singel01",
"signature": "def find_singel01(kdddx, l0)"
},
{
"docstring": ":param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量",
"name": "find_count",
"signature": "def find_count(kdddx, l3)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_020226 | Implement the Python class `Iterablehelper` described below.
Class description:
Implement the Iterablehelper class.
Method signatures and docstrings:
- def find_singel01(kdddx, l0): :param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值
- def find_count(kdddx, l3): :param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量
... | Implement the Python class `Iterablehelper` described below.
Class description:
Implement the Iterablehelper class.
Method signatures and docstrings:
- def find_singel01(kdddx, l0): :param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值
- def find_count(kdddx, l3): :param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量
... | d8ba30ea4bc2b662a2d6a87d247f813e5680d63e | <|skeleton|>
class Iterablehelper:
def find_singel01(kdddx, l0):
""":param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值"""
<|body_0|>
def find_count(kdddx, l3):
""":param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量"""
<|body_1|>
def find_all(kdddx1, l):
""":par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Iterablehelper:
def find_singel01(kdddx, l0):
""":param kdddx: 输入可迭代对象 :param l0: 目标函数 :return: 返回单一值"""
for item in kdddx:
if l0(item):
return item
def find_count(kdddx, l3):
""":param kdddx: 输入可迭代对象 :param l3: 目标函数 :return: 返回目标数量"""
count = 0... | the_stack_v2_python_sparse | 1-mouth01/gongju/gongjuren.py | gary-gggggg/gary | train | 4 | |
c838b97f2badd0127072e0460292c3f4a1c35d59 | [
"learning_rate = 0.001\nresolution = (128, 128)\nbatch_size = 2\nnum_slots = 3\nnum_iterations = 2\noptimizer = tf.keras.optimizers.Adam(learning_rate, epsilon=1e-08)\nmodel = model_utils.build_model(resolution, batch_size, num_slots, num_iterations, model_type='object_discovery')\ninput_shape = (batch_size, resolu... | <|body_start_0|>
learning_rate = 0.001
resolution = (128, 128)
batch_size = 2
num_slots = 3
num_iterations = 2
optimizer = tf.keras.optimizers.Adam(learning_rate, epsilon=1e-08)
model = model_utils.build_model(resolution, batch_size, num_slots, num_iterations, mod... | Test model construction and training. | ModelTests | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelTests:
"""Test model construction and training."""
def test_object_discovery_model(self):
"""Test object discovery model."""
<|body_0|>
def test_set_prediction_model(self):
"""Test set prediction model."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_015056 | 2,850 | permissive | [
{
"docstring": "Test object discovery model.",
"name": "test_object_discovery_model",
"signature": "def test_object_discovery_model(self)"
},
{
"docstring": "Test set prediction model.",
"name": "test_set_prediction_model",
"signature": "def test_set_prediction_model(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005089 | Implement the Python class `ModelTests` described below.
Class description:
Test model construction and training.
Method signatures and docstrings:
- def test_object_discovery_model(self): Test object discovery model.
- def test_set_prediction_model(self): Test set prediction model. | Implement the Python class `ModelTests` described below.
Class description:
Test model construction and training.
Method signatures and docstrings:
- def test_object_discovery_model(self): Test object discovery model.
- def test_set_prediction_model(self): Test set prediction model.
<|skeleton|>
class ModelTests:
... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class ModelTests:
"""Test model construction and training."""
def test_object_discovery_model(self):
"""Test object discovery model."""
<|body_0|>
def test_set_prediction_model(self):
"""Test set prediction model."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelTests:
"""Test model construction and training."""
def test_object_discovery_model(self):
"""Test object discovery model."""
learning_rate = 0.001
resolution = (128, 128)
batch_size = 2
num_slots = 3
num_iterations = 2
optimizer = tf.keras.opti... | the_stack_v2_python_sparse | slot_attention/unit_tests/test_lib.py | Jimmy-INL/google-research | train | 1 |
0dbbe969f713b6bf8b232c185c954d938047bf2c | [
"time.sleep(0.5)\nres = requests.post(url=self.url, headers=self.headers, json=self.data)\nself.assertEqual(res.status_code, 200)\nself.assertEqual(res.json().get('name')[:8], 'API_Test')",
"headers = self.headers.copy()\nheaders['authorization'] = 'abcdefg'\nres = requests.post(url=self.url, headers=headers, jso... | <|body_start_0|>
time.sleep(0.5)
res = requests.post(url=self.url, headers=self.headers, json=self.data)
self.assertEqual(res.status_code, 200)
self.assertEqual(res.json().get('name')[:8], 'API_Test')
<|end_body_0|>
<|body_start_1|>
headers = self.headers.copy()
headers[... | 保存作品 | Save_file | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Save_file:
"""保存作品"""
def test_15_save01(self):
"""登录态正常--正常保存操作"""
<|body_0|>
def test_16_save02(self):
"""登录态失效--进行保存操作"""
<|body_1|>
def test_17_save03(self):
"""登录态正常--作品名称长度为0,进行保存操作"""
<|body_2|>
def test_18_save04(self):
... | stack_v2_sparse_classes_36k_train_015057 | 4,910 | no_license | [
{
"docstring": "登录态正常--正常保存操作",
"name": "test_15_save01",
"signature": "def test_15_save01(self)"
},
{
"docstring": "登录态失效--进行保存操作",
"name": "test_16_save02",
"signature": "def test_16_save02(self)"
},
{
"docstring": "登录态正常--作品名称长度为0,进行保存操作",
"name": "test_17_save03",
"si... | 6 | stack_v2_sparse_classes_30k_val_001156 | Implement the Python class `Save_file` described below.
Class description:
保存作品
Method signatures and docstrings:
- def test_15_save01(self): 登录态正常--正常保存操作
- def test_16_save02(self): 登录态失效--进行保存操作
- def test_17_save03(self): 登录态正常--作品名称长度为0,进行保存操作
- def test_18_save04(self): 登录态正常--作品长度超过限制进行保存操作
- def test_19_save0... | Implement the Python class `Save_file` described below.
Class description:
保存作品
Method signatures and docstrings:
- def test_15_save01(self): 登录态正常--正常保存操作
- def test_16_save02(self): 登录态失效--进行保存操作
- def test_17_save03(self): 登录态正常--作品名称长度为0,进行保存操作
- def test_18_save04(self): 登录态正常--作品长度超过限制进行保存操作
- def test_19_save0... | e75039fcd2361977a2a5dc7ea95b7fb2fbc96bb0 | <|skeleton|>
class Save_file:
"""保存作品"""
def test_15_save01(self):
"""登录态正常--正常保存操作"""
<|body_0|>
def test_16_save02(self):
"""登录态失效--进行保存操作"""
<|body_1|>
def test_17_save03(self):
"""登录态正常--作品名称长度为0,进行保存操作"""
<|body_2|>
def test_18_save04(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Save_file:
"""保存作品"""
def test_15_save01(self):
"""登录态正常--正常保存操作"""
time.sleep(0.5)
res = requests.post(url=self.url, headers=self.headers, json=self.data)
self.assertEqual(res.status_code, 200)
self.assertEqual(res.json().get('name')[:8], 'API_Test')
def test... | the_stack_v2_python_sparse | API_study/Wood/F_Save_file.py | JmeterChen/api_wood | train | 1 |
6c1e26425d4865392e5b3caf9c5f52d0dd67d276 | [
"self.name = name\nself.legal_entity_id = legal_entity_id\nself.original_hire_date = original_hire_date\nself.latest_hire_date = latest_hire_date\nself.employment_end_date = employment_end_date\nself.address = address\nself.employment_status_code = employment_status_code\nself.employment_status_name = employment_st... | <|body_start_0|>
self.name = name
self.legal_entity_id = legal_entity_id
self.original_hire_date = original_hire_date
self.latest_hire_date = latest_hire_date
self.employment_end_date = employment_end_date
self.address = address
self.employment_status_code = emplo... | Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identification number (EIN) original_hire_date (long|int): The original hired date of an employee ... | PayrollEmployerRecord | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PayrollEmployerRecord:
"""Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identification number (EIN) original_hire_date (l... | stack_v2_sparse_classes_36k_train_015058 | 5,502 | permissive | [
{
"docstring": "Constructor for the PayrollEmployerRecord class",
"name": "__init__",
"signature": "def __init__(self, name=None, legal_entity_id=None, original_hire_date=None, latest_hire_date=None, employment_end_date=None, address=None, employment_status_code=None, employment_status_name=None, work_l... | 2 | null | Implement the Python class `PayrollEmployerRecord` described below.
Class description:
Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identifica... | Implement the Python class `PayrollEmployerRecord` described below.
Class description:
Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identifica... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class PayrollEmployerRecord:
"""Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identification number (EIN) original_hire_date (l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PayrollEmployerRecord:
"""Implementation of the 'Payroll Employer Record' model. TODO: type model description here. Attributes: name (string): Name of the employer as stated by the employer in the payroll system. legal_entity_id (string): Employer identification number (EIN) original_hire_date (long|int): The... | the_stack_v2_python_sparse | finicityapi/models/payroll_employer_record.py | monarchmoney/finicity-python | train | 0 |
26df45b81150901138efa1be5520e595c816a1e9 | [
"log.info('Initialising user ' + username)\nself.__username = username\nself.__passwd_change_token = ''\nself.__request_header = {'content-type': 'application/json'}",
"log.info('Creating new user with username : ' + self.__username)\npath = 'user'\nsignup_info = {'user_name': self.__username, 'password': passwor... | <|body_start_0|>
log.info('Initialising user ' + username)
self.__username = username
self.__passwd_change_token = ''
self.__request_header = {'content-type': 'application/json'}
<|end_body_0|>
<|body_start_1|>
log.info('Creating new user with username : ' + self.__username)
... | User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str | User | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
"""User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str"""
def __init__(self, username):
"""Instantiate user with username."""
<|body_0|>
def signup_request(self, passwor... | stack_v2_sparse_classes_36k_train_015059 | 8,311 | permissive | [
{
"docstring": "Instantiate user with username.",
"name": "__init__",
"signature": "def __init__(self, username)"
},
{
"docstring": "Sign up request of new User for ESP Rainmaker. :param password: Password to set for new user :type password: str :raises NetworkError: If there is a network connec... | 5 | stack_v2_sparse_classes_30k_train_011369 | Implement the Python class `User` described below.
Class description:
User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str
Method signatures and docstrings:
- def __init__(self, username): Instantiate user with username.
- ... | Implement the Python class `User` described below.
Class description:
User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str
Method signatures and docstrings:
- def __init__(self, username): Instantiate user with username.
- ... | 6a8c62d8a5d3b45acc4620bc47f475a1ec0d0493 | <|skeleton|>
class User:
"""User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str"""
def __init__(self, username):
"""Instantiate user with username."""
<|body_0|>
def signup_request(self, passwor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class User:
"""User class used to instantiate instances of user to perform various user signup/login operations. :param username: Name of User :type username: str"""
def __init__(self, username):
"""Instantiate user with username."""
log.info('Initialising user ' + username)
self.__user... | the_stack_v2_python_sparse | cli/rmaker_lib/user.py | ashmagin/esp-rainmaker | train | 0 |
3f590307c4e50d1541efba93db3325a8e347bd33 | [
"keypair_name = 'instancekey_{0}'.format(randint(100, 1000))\nself.instance_keypair = self.os_conn.create_key(key_name=keypair_name)\nlogger.info('New keypair \"{0}\" was created'.format(keypair_name))\nzone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nhosts = zone.hosts.keys()[:2]\nlogger.info('Ad... | <|body_start_0|>
keypair_name = 'instancekey_{0}'.format(randint(100, 1000))
self.instance_keypair = self.os_conn.create_key(key_name=keypair_name)
logger.info('New keypair "{0}" was created'.format(keypair_name))
zone = self.os_conn.nova.availability_zones.find(zoneName='nova')
... | Check restarts of openvswitch-agents. | TestOVSRestartTwoSeparateVms | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOVSRestartTwoSeparateVms:
"""Check restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_net_05 SubNetw: test_net_05__subnet, 192.168.5.0/24 Route... | stack_v2_sparse_classes_36k_train_015060 | 41,546 | no_license | [
{
"docstring": "Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_net_05 SubNetw: test_net_05__subnet, 192.168.5.0/24 Router: test_router_05 3. Create CONFIG 2: Network: test_net_06 SubNetw: test_net_06__subnet, 192.168.6.0/24 Router: test_ro... | 2 | stack_v2_sparse_classes_30k_train_007837 | Implement the Python class `TestOVSRestartTwoSeparateVms` described below.
Class description:
Check restarts of openvswitch-agents.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_... | Implement the Python class `TestOVSRestartTwoSeparateVms` described below.
Class description:
Check restarts of openvswitch-agents.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_... | 8aced2855b78b5f123195d188c80e27b43888a2e | <|skeleton|>
class TestOVSRestartTwoSeparateVms:
"""Check restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_net_05 SubNetw: test_net_05__subnet, 192.168.5.0/24 Route... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestOVSRestartTwoSeparateVms:
"""Check restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group if needed 2. Create CONFIG 1: Network: test_net_05 SubNetw: test_net_05__subnet, 192.168.5.0/24 Router: test_route... | the_stack_v2_python_sparse | mos_tests/neutron/python_tests/test_ovs_restart.py | Mirantis/mos-integration-tests | train | 16 |
56445945f919ee175790c234783392aec87525df | [
"self.k = k\nself.heap = nums\nheapq.heapify(self.heap)\nwhile len(self.heap) > k:\n heapq.heappop(self.heap)",
"if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelif val > self.heap[0]:\n heapq.heapreplace(self.heap, val)\nreturn self.heap[0]"
] | <|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
<|end_body_0|>
<|body_start_1|>
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
elif val > self.heap[0]:
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(... | stack_v2_sparse_classes_36k_train_015061 | 1,213 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | null | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 1461b10b8910fa90a311939c6df9082a8526f9b1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
def add(self, val):
""":type val: int :rtype: int"""
... | the_stack_v2_python_sparse | Easy/703_kthLargestElementInAStream.py | Yucheng7713/CodingPracticeByYuch | train | 0 | |
20b3963246425314a7020f59b2ed56355cf4d4f0 | [
"self.arm = arm\nself.joint_state_lock = Lock()\nself.traj_client = actionlib.SimpleActionClient(self.arm[0] + '_arm_controller/joint_trajectory_action', JointTrajectoryAction)\nif not self.traj_client.wait_for_server(rospy.Duration(5)):\n rospy.loginfo('[IKGoalSender] Timed Out waiting for ' + 'JointTrajectoryA... | <|body_start_0|>
self.arm = arm
self.joint_state_lock = Lock()
self.traj_client = actionlib.SimpleActionClient(self.arm[0] + '_arm_controller/joint_trajectory_action', JointTrajectoryAction)
if not self.traj_client.wait_for_server(rospy.Duration(5)):
rospy.loginfo('[IKGoalSen... | A class for performing IK with the PR2 | IKGoalSender | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IKGoalSender:
"""A class for performing IK with the PR2"""
def __init__(self, arm):
"""Initialize IK Services, arm trajectory client, state, and feedback"""
<|body_0|>
def joint_state_cb(self, js_msg):
"""Update joint positions and velocities"""
<|body_1|... | stack_v2_sparse_classes_36k_train_015062 | 4,805 | no_license | [
{
"docstring": "Initialize IK Services, arm trajectory client, state, and feedback",
"name": "__init__",
"signature": "def __init__(self, arm)"
},
{
"docstring": "Update joint positions and velocities",
"name": "joint_state_cb",
"signature": "def joint_state_cb(self, js_msg)"
},
{
... | 4 | null | Implement the Python class `IKGoalSender` described below.
Class description:
A class for performing IK with the PR2
Method signatures and docstrings:
- def __init__(self, arm): Initialize IK Services, arm trajectory client, state, and feedback
- def joint_state_cb(self, js_msg): Update joint positions and velocities... | Implement the Python class `IKGoalSender` described below.
Class description:
A class for performing IK with the PR2
Method signatures and docstrings:
- def __init__(self, arm): Initialize IK Services, arm trajectory client, state, and feedback
- def joint_state_cb(self, js_msg): Update joint positions and velocities... | 86ae2c6e4e55acd424abb7fbb5bd63d9c29340ee | <|skeleton|>
class IKGoalSender:
"""A class for performing IK with the PR2"""
def __init__(self, arm):
"""Initialize IK Services, arm trajectory client, state, and feedback"""
<|body_0|>
def joint_state_cb(self, js_msg):
"""Update joint positions and velocities"""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IKGoalSender:
"""A class for performing IK with the PR2"""
def __init__(self, arm):
"""Initialize IK Services, arm trajectory client, state, and feedback"""
self.arm = arm
self.joint_state_lock = Lock()
self.traj_client = actionlib.SimpleActionClient(self.arm[0] + '_arm_co... | the_stack_v2_python_sparse | assistive_teleop/src/assistive_teleop/ik_move.py | and/hrl-assistive | train | 0 |
0bee20f6a9cb77c17928914fc2b4abf7e8b01067 | [
"form = context['form']\nticket = generate_ticket(request, form, score, suspicious)\nif ticket:\n response = requests.post(settings.ZENDESK_REQUEST_URL, json=ticket)\n if response.status_code == 201:\n context['form_success'] = True\n else:\n form.add_error(None, _('Sorry, something went wron... | <|body_start_0|>
form = context['form']
ticket = generate_ticket(request, form, score, suspicious)
if ticket:
response = requests.post(settings.ZENDESK_REQUEST_URL, json=ticket)
if response.status_code == 201:
context['form_success'] = True
els... | Abstract mixin class to provide contact form functionality to page classes. | ContactFormMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContactFormMixin:
"""Abstract mixin class to provide contact form functionality to page classes."""
def post_submission(self, request, context, score=None, suspicious=False):
"""Try generating a ticket and posting a request to Zendesk, update and return the context object."""
... | stack_v2_sparse_classes_36k_train_015063 | 3,198 | permissive | [
{
"docstring": "Try generating a ticket and posting a request to Zendesk, update and return the context object.",
"name": "post_submission",
"signature": "def post_submission(self, request, context, score=None, suspicious=False)"
},
{
"docstring": "Overwrite context to intercept POST requests to... | 2 | stack_v2_sparse_classes_30k_val_000257 | Implement the Python class `ContactFormMixin` described below.
Class description:
Abstract mixin class to provide contact form functionality to page classes.
Method signatures and docstrings:
- def post_submission(self, request, context, score=None, suspicious=False): Try generating a ticket and posting a request to ... | Implement the Python class `ContactFormMixin` described below.
Class description:
Abstract mixin class to provide contact form functionality to page classes.
Method signatures and docstrings:
- def post_submission(self, request, context, score=None, suspicious=False): Try generating a ticket and posting a request to ... | 4cf7be72b6b3d0c46dcadcc9d9904b471215ea81 | <|skeleton|>
class ContactFormMixin:
"""Abstract mixin class to provide contact form functionality to page classes."""
def post_submission(self, request, context, score=None, suspicious=False):
"""Try generating a ticket and posting a request to Zendesk, update and return the context object."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContactFormMixin:
"""Abstract mixin class to provide contact form functionality to page classes."""
def post_submission(self, request, context, score=None, suspicious=False):
"""Try generating a ticket and posting a request to Zendesk, update and return the context object."""
form = conte... | the_stack_v2_python_sparse | guidance_and_support/mixins.py | IATI/IATI-Standard-Website | train | 4 |
dfafe1811e4e32eb633e9632afb0744456af769e | [
"self._publishers = {}\nself._parameters = self._setup_ros_parameters()\nself._publishers['info'] = rospy.Publisher('info', rocon_std_msgs.MasterInfo, latch=True, queue_size=1)\nmaster_info = rocon_std_msgs.MasterInfo()\nmaster_info.name = self._parameters['name']\nmaster_info.description = self._parameters['descri... | <|body_start_0|>
self._publishers = {}
self._parameters = self._setup_ros_parameters()
self._publishers['info'] = rospy.Publisher('info', rocon_std_msgs.MasterInfo, latch=True, queue_size=1)
master_info = rocon_std_msgs.MasterInfo()
master_info.name = self._parameters['name']
... | This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directly publishing the icon rather than having clients go do the lookup themselves. | RoconMaster | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoconMaster:
"""This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directly publishing the icon rather than havin... | stack_v2_sparse_classes_36k_train_015064 | 3,575 | no_license | [
{
"docstring": "Retrieves ``name``, ``description`` and ``icon`` parameters from the parameter server and publishes them on a latched ``info`` topic. The icon parameter must be a ros resource name (pkg/filename).",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Paramete... | 2 | stack_v2_sparse_classes_30k_train_013077 | Implement the Python class `RoconMaster` described below.
Class description:
This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directl... | Implement the Python class `RoconMaster` described below.
Class description:
This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directl... | dfc8bb2026c06d0f97696a726a6773ff8b99496e | <|skeleton|>
class RoconMaster:
"""This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directly publishing the icon rather than havin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoconMaster:
"""This class accepts a few parameters describing the ros master and then publishes the ros master info on a latched publisher. Publishing is necessary because an icon can only be represented by it's location as a parameter. It is easier directly publishing the icon rather than having clients go ... | the_stack_v2_python_sparse | src/rocon_tools/rocon_master_info/src/rocon_master_info/master.py | uml-robotics/catkin_tester | train | 0 |
c4d2e0a6cd1426b361a60fdf8349b1d31d8d015d | [
"if id:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects",
"if list_dictionaries is None or len(list_dictionaries) == 0:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)",
"if list_objs is None:\n new_list = []\nelse:\n new_list = list((item.to_diction... | <|body_start_0|>
if id:
self.id = id
else:
Base.__nb_objects += 1
self.id = Base.__nb_objects
<|end_body_0|>
<|body_start_1|>
if list_dictionaries is None or len(list_dictionaries) == 0:
return '[]'
else:
return json.dumps(list... | classf or all objects | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""classf or all objects"""
def __init__(self, id=None):
"""instantiate base"""
<|body_0|>
def to_json_string(list_dictionaries):
"""takes a dict and puts into a json string"""
<|body_1|>
def save_to_file(cls, list_objs):
"""writes the ... | stack_v2_sparse_classes_36k_train_015065 | 2,052 | no_license | [
{
"docstring": "instantiate base",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "takes a dict and puts into a json string",
"name": "to_json_string",
"signature": "def to_json_string(list_dictionaries)"
},
{
"docstring": "writes the JSON string... | 6 | stack_v2_sparse_classes_30k_train_012485 | Implement the Python class `Base` described below.
Class description:
classf or all objects
Method signatures and docstrings:
- def __init__(self, id=None): instantiate base
- def to_json_string(list_dictionaries): takes a dict and puts into a json string
- def save_to_file(cls, list_objs): writes the JSON string rep... | Implement the Python class `Base` described below.
Class description:
classf or all objects
Method signatures and docstrings:
- def __init__(self, id=None): instantiate base
- def to_json_string(list_dictionaries): takes a dict and puts into a json string
- def save_to_file(cls, list_objs): writes the JSON string rep... | f691935bb84b042a33408c2b35ab65d2d59991ca | <|skeleton|>
class Base:
"""classf or all objects"""
def __init__(self, id=None):
"""instantiate base"""
<|body_0|>
def to_json_string(list_dictionaries):
"""takes a dict and puts into a json string"""
<|body_1|>
def save_to_file(cls, list_objs):
"""writes the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base:
"""classf or all objects"""
def __init__(self, id=None):
"""instantiate base"""
if id:
self.id = id
else:
Base.__nb_objects += 1
self.id = Base.__nb_objects
def to_json_string(list_dictionaries):
"""takes a dict and puts into ... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | KevinClauson/holbertonschool-higher_level_programming | train | 0 |
74800a23e309d026ab8c9580654961e558b15ac6 | [
"self._vt = VTLookupV3()\nself._current_data: pd.DataFrame = pd.DataFrame()\nself.data_sel = widgets.Select(description='Attribute', layout=widgets.Layout(height='400px'))\nself.data_view = widgets.Textarea(description='Value', layout=widgets.Layout(height='400px', width='60%'))\nself.data_sel.observe(self._display... | <|body_start_0|>
self._vt = VTLookupV3()
self._current_data: pd.DataFrame = pd.DataFrame()
self.data_sel = widgets.Select(description='Attribute', layout=widgets.Layout(height='400px'))
self.data_view = widgets.Textarea(description='Value', layout=widgets.Layout(height='400px', width='60... | VirusTotal object attributes browser. | VTObjectBrowser | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"EPL-1.0",
"GPL-1.0-or-later",
"LGPL-2.1-only",
"MPL-2.0",
"Python-2.0",
"PSF-2.0",
"LicenseRef-scancode-python-cwi",
"GPL-2.0-or-later",
"LGPL-2.1-or-later... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VTObjectBrowser:
"""VirusTotal object attributes browser."""
def __init__(self, file_id: Optional[str]=None):
"""Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be retrieved and displayed, by default None"""
<|body_... | stack_v2_sparse_classes_36k_train_015066 | 4,503 | permissive | [
{
"docstring": "Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be retrieved and displayed, by default None",
"name": "__init__",
"signature": "def __init__(self, file_id: Optional[str]=None)"
},
{
"docstring": "Display selected attrib... | 3 | stack_v2_sparse_classes_30k_train_020395 | Implement the Python class `VTObjectBrowser` described below.
Class description:
VirusTotal object attributes browser.
Method signatures and docstrings:
- def __init__(self, file_id: Optional[str]=None): Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be re... | Implement the Python class `VTObjectBrowser` described below.
Class description:
VirusTotal object attributes browser.
Method signatures and docstrings:
- def __init__(self, file_id: Optional[str]=None): Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be re... | 55c6c1aebb8505a220046705b7c74194f83d62f3 | <|skeleton|>
class VTObjectBrowser:
"""VirusTotal object attributes browser."""
def __init__(self, file_id: Optional[str]=None):
"""Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be retrieved and displayed, by default None"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VTObjectBrowser:
"""VirusTotal object attributes browser."""
def __init__(self, file_id: Optional[str]=None):
"""Initialize the VT Browser. Parameters ---------- file_id : Optional[str], optional File ID (Hash) of file to be retrieved and displayed, by default None"""
self._vt = VTLookupV... | the_stack_v2_python_sparse | msticpy/vis/vtobject_browser.py | rhaug77/msticpy | train | 0 |
34443723d6fcf2aed884d9aa89f7d0734540bf52 | [
"super(TornadoAsyncHTTPClientEvent, self).__init__(start_time)\nself.event_id = 'tornado-client-{}'.format(str(uuid4()))\nrequest = args[0]\nheaders = dict(request.headers)\nif headers:\n epsagon_trace_id = headers.get(EPSAGON_HEADER_TITLE)\n if epsagon_trace_id:\n self.resource['metadata']['http_trace... | <|body_start_0|>
super(TornadoAsyncHTTPClientEvent, self).__init__(start_time)
self.event_id = 'tornado-client-{}'.format(str(uuid4()))
request = args[0]
headers = dict(request.headers)
if headers:
epsagon_trace_id = headers.get(EPSAGON_HEADER_TITLE)
if ep... | Represents base request event. | TornadoAsyncHTTPClientEvent | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TornadoAsyncHTTPClientEvent:
"""Represents base request event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kw... | stack_v2_sparse_classes_36k_train_015067 | 4,790 | permissive | [
{
"docstring": "Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param start_time: Start timestamp (epoch) :param response: response data :param exception: Exception (if happened)",
"name": "__init__",
"signature": "de... | 2 | null | Implement the Python class `TornadoAsyncHTTPClientEvent` described below.
Class description:
Represents base request event.
Method signatures and docstrings:
- def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's ins... | Implement the Python class `TornadoAsyncHTTPClientEvent` described below.
Class description:
Represents base request event.
Method signatures and docstrings:
- def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception): Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's ins... | 91e28fe43bc4f42152fb156145088cb8c9f69b85 | <|skeleton|>
class TornadoAsyncHTTPClientEvent:
"""Represents base request event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TornadoAsyncHTTPClientEvent:
"""Represents base request event."""
def __init__(self, wrapped, instance, args, kwargs, start_time, response, exception):
"""Initialize. :param wrapped: wrapt's wrapped :param instance: wrapt's instance :param args: wrapt's args :param kwargs: wrapt's kwargs :param s... | the_stack_v2_python_sparse | epsagon/events/tornado_client.py | epsagon/epsagon-python | train | 57 |
ef4443389b0ca479f2db1d12f9db33545e9b5abf | [
"self.name = name\nself.sound = sound\nself.num_legs = num_legs",
"if self.sound is None and sound is None:\n raise NotImplementedError('Silent Animals are not supported!')\nout_sound = self.sound if sound is None else sound\nprint(self.says_str.format(name=self.name, sound=out_sound))"
] | <|body_start_0|>
self.name = name
self.sound = sound
self.num_legs = num_legs
<|end_body_0|>
<|body_start_1|>
if self.sound is None and sound is None:
raise NotImplementedError('Silent Animals are not supported!')
out_sound = self.sound if sound is None else sound
... | A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the animal has (default 4) Methods ------- says(sound=None) Prints the animals... | Animal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Animal:
"""A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the animal has (default 4) Methods ------- s... | stack_v2_sparse_classes_36k_train_015068 | 7,007 | no_license | [
{
"docstring": "Parameters ---------- name : str The name of the animal sound : str The sound the animal makes num_legs : int, optional The number of legs the animal (default is 4)",
"name": "__init__",
"signature": "def __init__(self, name, sound, num_legs)"
},
{
"docstring": "Prints what the a... | 2 | stack_v2_sparse_classes_30k_train_002492 | Implement the Python class `Animal` described below.
Class description:
A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the a... | Implement the Python class `Animal` described below.
Class description:
A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the a... | df4d9b85eeff4e14c91533135a347b59d52812c7 | <|skeleton|>
class Animal:
"""A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the animal has (default 4) Methods ------- s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Animal:
"""A class used to represent an Animal ... Attributes ---------- says_str : str a formatted string to print out what the animal says name : str the name of the animal sound : str the sound that the animal makes num_legs : int the number of legs the animal has (default 4) Methods ------- says(sound=Non... | the_stack_v2_python_sparse | useful_stuff/documenting_code_explanation.py | Ze1598/Python_stuff | train | 0 |
5a9f8dd7fbfc5d15af38965d539cddb9db9eec21 | [
"name = input('请输入增加的课程名称:')\nif name in Data.courses_dict:\n print('课程已存在,请使用其他课程名称')\n return self.add_course()\nteacher = input('请输入授课老师:')\nlimit = input('请输入人数:')\ntimes = input('请输入课程时长:')\nscore = input('请输入分数:')\ndes = input('请输入课程描述:')\ncourse = Course(name, teacher, limit, times, score, des)\ncourse... | <|body_start_0|>
name = input('请输入增加的课程名称:')
if name in Data.courses_dict:
print('课程已存在,请使用其他课程名称')
return self.add_course()
teacher = input('请输入授课老师:')
limit = input('请输入人数:')
times = input('请输入课程时长:')
score = input('请输入分数:')
des = input('... | 管理员类 | Admin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Admin:
"""管理员类"""
def add_course(self):
"""添加课程"""
<|body_0|>
def check_course(self):
"""查看课程"""
<|body_1|>
def update_course(self):
"""修改课程"""
<|body_2|>
def delete_course(self):
"""删除课程"""
<|body_3|>
<|end_skel... | stack_v2_sparse_classes_36k_train_015069 | 4,039 | no_license | [
{
"docstring": "添加课程",
"name": "add_course",
"signature": "def add_course(self)"
},
{
"docstring": "查看课程",
"name": "check_course",
"signature": "def check_course(self)"
},
{
"docstring": "修改课程",
"name": "update_course",
"signature": "def update_course(self)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_002865 | Implement the Python class `Admin` described below.
Class description:
管理员类
Method signatures and docstrings:
- def add_course(self): 添加课程
- def check_course(self): 查看课程
- def update_course(self): 修改课程
- def delete_course(self): 删除课程 | Implement the Python class `Admin` described below.
Class description:
管理员类
Method signatures and docstrings:
- def add_course(self): 添加课程
- def check_course(self): 查看课程
- def update_course(self): 修改课程
- def delete_course(self): 删除课程
<|skeleton|>
class Admin:
"""管理员类"""
def add_course(self):
"""添加课程... | e11f5fcb10f37a0f0663e4c746ca862b076f9aee | <|skeleton|>
class Admin:
"""管理员类"""
def add_course(self):
"""添加课程"""
<|body_0|>
def check_course(self):
"""查看课程"""
<|body_1|>
def update_course(self):
"""修改课程"""
<|body_2|>
def delete_course(self):
"""删除课程"""
<|body_3|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Admin:
"""管理员类"""
def add_course(self):
"""添加课程"""
name = input('请输入增加的课程名称:')
if name in Data.courses_dict:
print('课程已存在,请使用其他课程名称')
return self.add_course()
teacher = input('请输入授课老师:')
limit = input('请输入人数:')
times = input('请输入课程时长... | the_stack_v2_python_sparse | dmeo/day12/code/demo_01homework.py | liujiang9/python0421 | train | 1 |
452da76459d7248cf7c7dc5bf6fe5ad014532ac3 | [
"self._validate_location(response)\nfor item in response.css('.space'):\n item_text = ' '.join(item.css('.list *::text').extract()).strip()\n meeting = Meeting(title=self._parse_title(item_text), description='', classification=BOARD, start=self._parse_start(item_text), end=None, all_day=False, time_notes='See... | <|body_start_0|>
self._validate_location(response)
for item in response.css('.space'):
item_text = ' '.join(item.css('.list *::text').extract()).strip()
meeting = Meeting(title=self._parse_title(item_text), description='', classification=BOARD, start=self._parse_start(item_text),... | IlGamingBoardSpider | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IlGamingBoardSpider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_title(self, text):
"""Parse or generate meeting title."""
... | stack_v2_sparse_classes_36k_train_015070 | 2,961 | permissive | [
{
"docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "Parse or generate meeting title.",
"name": "_parse_title",
"signa... | 5 | null | Implement the Python class `IlGamingBoardSpider` described below.
Class description:
Implement the IlGamingBoardSpider class.
Method signatures and docstrings:
- def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.
-... | Implement the Python class `IlGamingBoardSpider` described below.
Class description:
Implement the IlGamingBoardSpider class.
Method signatures and docstrings:
- def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.
-... | 611fce6a2705446e25a2fc33e32090a571eb35d1 | <|skeleton|>
class IlGamingBoardSpider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
<|body_0|>
def _parse_title(self, text):
"""Parse or generate meeting title."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IlGamingBoardSpider:
def parse(self, response):
"""`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs."""
self._validate_location(response)
for item in response.css('.space'):
item_text = ' '.join(i... | the_stack_v2_python_sparse | city_scrapers/spiders/il_gaming_board.py | City-Bureau/city-scrapers | train | 308 | |
af09134318406b0d3f1a854c5f1e5c7a9bc237c2 | [
"self.subjname = subjname\nself.content = content\nself.category = category",
"for locid in locids:\n findings = locid.find_usage(content=self.content, category=self.category)\n if findings is not None:\n line_nr, indents = findings\n yield (locid, line_nr, indents)"
] | <|body_start_0|>
self.subjname = subjname
self.content = content
self.category = category
<|end_body_0|>
<|body_start_1|>
for locid in locids:
findings = locid.find_usage(content=self.content, category=self.category)
if findings is not None:
line_... | SubjectFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubjectFile:
def __init__(self, subjname: str, content: str, category: str):
"""Subject file utility class."""
<|body_0|>
def search_locids(self, locids: t.Sequence['LocId']) -> t.Generator[tuple['LocId', int, int], None, None]:
"""Search the file content for the pre... | stack_v2_sparse_classes_36k_train_015071 | 20,765 | no_license | [
{
"docstring": "Subject file utility class.",
"name": "__init__",
"signature": "def __init__(self, subjname: str, content: str, category: str)"
},
{
"docstring": "Search the file content for the presence of localisation identifiers. :param locids: localisation identifiers",
"name": "search_l... | 2 | stack_v2_sparse_classes_30k_train_020396 | Implement the Python class `SubjectFile` described below.
Class description:
Implement the SubjectFile class.
Method signatures and docstrings:
- def __init__(self, subjname: str, content: str, category: str): Subject file utility class.
- def search_locids(self, locids: t.Sequence['LocId']) -> t.Generator[tuple['Loc... | Implement the Python class `SubjectFile` described below.
Class description:
Implement the SubjectFile class.
Method signatures and docstrings:
- def __init__(self, subjname: str, content: str, category: str): Subject file utility class.
- def search_locids(self, locids: t.Sequence['LocId']) -> t.Generator[tuple['Loc... | 959a2696644b80a3077e83f1014e1149b2323549 | <|skeleton|>
class SubjectFile:
def __init__(self, subjname: str, content: str, category: str):
"""Subject file utility class."""
<|body_0|>
def search_locids(self, locids: t.Sequence['LocId']) -> t.Generator[tuple['LocId', int, int], None, None]:
"""Search the file content for the pre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubjectFile:
def __init__(self, subjname: str, content: str, category: str):
"""Subject file utility class."""
self.subjname = subjname
self.content = content
self.category = category
def search_locids(self, locids: t.Sequence['LocId']) -> t.Generator[tuple['LocId', int, i... | the_stack_v2_python_sparse | scripts/localisation/localisation_search.py | Scurek/Third-Odyssey-Back-to-the-Motherland | train | 13 | |
6389ea10e2bf5d4b044f894f26d814564e1b8666 | [
"import collections\n\ndef find(x):\n if x != parents[x]:\n parents[x] = find(parents[x])\n return parents[x]\n\ndef union(x, y):\n parents[find(x)] = find(y)\nn = len(graph)\nparents = range(n)\nfor i in range(n):\n for j in range(i + 1, n):\n if graph[i][j] == 1:\n union(i, j)... | <|body_start_0|>
import collections
def find(x):
if x != parents[x]:
parents[x] = find(parents[x])
return parents[x]
def union(x, y):
parents[find(x)] = find(y)
n = len(graph)
parents = range(n)
for i in range(n):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minMalwareSpread(self, graph, initial):
""":type graph: List[List[int]] :type initial: List[int] :rtype: int"""
<|body_0|>
def rewrite(self, graph, initial):
""":type graph: List[List[int]] :type initial: List[int] :rtype: int"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_015072 | 4,589 | no_license | [
{
"docstring": ":type graph: List[List[int]] :type initial: List[int] :rtype: int",
"name": "minMalwareSpread",
"signature": "def minMalwareSpread(self, graph, initial)"
},
{
"docstring": ":type graph: List[List[int]] :type initial: List[int] :rtype: int",
"name": "rewrite",
"signature":... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minMalwareSpread(self, graph, initial): :type graph: List[List[int]] :type initial: List[int] :rtype: int
- def rewrite(self, graph, initial): :type graph: List[List[int]] :t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minMalwareSpread(self, graph, initial): :type graph: List[List[int]] :type initial: List[int] :rtype: int
- def rewrite(self, graph, initial): :type graph: List[List[int]] :t... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def minMalwareSpread(self, graph, initial):
""":type graph: List[List[int]] :type initial: List[int] :rtype: int"""
<|body_0|>
def rewrite(self, graph, initial):
""":type graph: List[List[int]] :type initial: List[int] :rtype: int"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minMalwareSpread(self, graph, initial):
""":type graph: List[List[int]] :type initial: List[int] :rtype: int"""
import collections
def find(x):
if x != parents[x]:
parents[x] = find(parents[x])
return parents[x]
def union(... | the_stack_v2_python_sparse | co_amazon/924_Minimize_Malware_Spread.py | vsdrun/lc_public | train | 6 | |
5b0500661a868e1922a93a3abd6f634c0d08e8ec | [
"self.name = name\nself.num = num\nself.school = school\nself.course = course\nself.classes = classes",
"ret = MyPickle.load(file)\nfor i in ret.values():\n if self.name == i.name:\n Public.print('%s已经存在!' % self.name, 'error')\n return 0\nself.num = len(ret) + 1\nself.school = school_obj\nret[se... | <|body_start_0|>
self.name = name
self.num = num
self.school = school
self.course = course
self.classes = classes
<|end_body_0|>
<|body_start_1|>
ret = MyPickle.load(file)
for i in ret.values():
if self.name == i.name:
Public.print('%s... | User | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
def __init__(self, name, num=0, school='', course={}, classes={}):
""":param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param classes: 老师、学生可以有多个班级{}"""
<|body_0|>
def create(self, school_obj, file, types):
... | stack_v2_sparse_classes_36k_train_015073 | 3,775 | no_license | [
{
"docstring": ":param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param classes: 老师、学生可以有多个班级{}",
"name": "__init__",
"signature": "def __init__(self, name, num=0, school='', course={}, classes={})"
},
{
"docstring": "创建老师 :param school_o... | 2 | stack_v2_sparse_classes_30k_train_002625 | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def __init__(self, name, num=0, school='', course={}, classes={}): :param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param class... | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def __init__(self, name, num=0, school='', course={}, classes={}): :param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param class... | d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7 | <|skeleton|>
class User:
def __init__(self, name, num=0, school='', course={}, classes={}):
""":param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param classes: 老师、学生可以有多个班级{}"""
<|body_0|>
def create(self, school_obj, file, types):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class User:
def __init__(self, name, num=0, school='', course={}, classes={}):
""":param name: 老师、学生名称 :param num: 老师、学生ID :param school: 所属学校 一个老师、学生只能属于一所学校 :param course: 老师、学生可以有多个课程{} :param classes: 老师、学生可以有多个班级{}"""
self.name = name
self.num = num
self.school = school
... | the_stack_v2_python_sparse | Homework/day07/core/school.py | 214031230/Python21 | train | 0 | |
c90fcecec2eff172d8b01235dddd8db5105b0e5b | [
"type_detector_list = ['военный', 'медицинский', 'транспортный']\nif object_type not in type_detector_list:\n raise ValueError('Мне передали некорректный тип вертолета, что дальше?')\nsuper().__init__(name, price, object_type, flight_altitude, producing_country, owner_country)\nself.people_count = people_count\n... | <|body_start_0|>
type_detector_list = ['военный', 'медицинский', 'транспортный']
if object_type not in type_detector_list:
raise ValueError('Мне передали некорректный тип вертолета, что дальше?')
super().__init__(name, price, object_type, flight_altitude, producing_country, owner_cou... | Дочерний класс вертолет | HelicopterClass | [
"WTFPL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна... | stack_v2_sparse_classes_36k_train_015074 | 11,707 | permissive | [
{
"docstring": "Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна владелец Различные поля с Aicraft: Количество членов экипажа, грузоподъемность, место расположение объекта",
"name": "__init__",
"signature": "def __init__(self, name, price, object_type, flig... | 2 | null | Implement the Python class `HelicopterClass` described below.
Class description:
Дочерний класс вертолет
Method signatures and docstrings:
- def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location): Общие поля с Aircraft: Название, цена,... | Implement the Python class `HelicopterClass` described below.
Class description:
Дочерний класс вертолет
Method signatures and docstrings:
- def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location): Общие поля с Aircraft: Название, цена,... | 9575c43fa01c261ea1ed573df9b5686b5a6f4211 | <|skeleton|>
class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна владелец Раз... | the_stack_v2_python_sparse | Course_I/Алгоритмы Python/Part2/семинары/control1/airclass_module.py | GeorgiyDemo/FA | train | 46 |
e96945fababa77d483574550ab01855da9d66d98 | [
"permission = AdministerOrganizationPermission(orgname)\nif permission.can():\n organization = model.organization.get_organization(orgname)\n return get_card(organization)\nraise Unauthorized()",
"permission = AdministerOrganizationPermission(orgname)\nif permission.can():\n organization = model.organiza... | <|body_start_0|>
permission = AdministerOrganizationPermission(orgname)
if permission.can():
organization = model.organization.get_organization(orgname)
return get_card(organization)
raise Unauthorized()
<|end_body_0|>
<|body_start_1|>
permission = AdministerOrga... | Resource for managing an organization's credit card. | OrganizationCard | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationCard:
"""Resource for managing an organization's credit card."""
def get(self, orgname):
"""Get the organization's credit card."""
<|body_0|>
def post(self, orgname):
"""Update the orgnaization's credit card."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_015075 | 33,890 | permissive | [
{
"docstring": "Get the organization's credit card.",
"name": "get",
"signature": "def get(self, orgname)"
},
{
"docstring": "Update the orgnaization's credit card.",
"name": "post",
"signature": "def post(self, orgname)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011063 | Implement the Python class `OrganizationCard` described below.
Class description:
Resource for managing an organization's credit card.
Method signatures and docstrings:
- def get(self, orgname): Get the organization's credit card.
- def post(self, orgname): Update the orgnaization's credit card. | Implement the Python class `OrganizationCard` described below.
Class description:
Resource for managing an organization's credit card.
Method signatures and docstrings:
- def get(self, orgname): Get the organization's credit card.
- def post(self, orgname): Update the orgnaization's credit card.
<|skeleton|>
class O... | e400a0c22c5f89dd35d571654b13d262b1f6e3b3 | <|skeleton|>
class OrganizationCard:
"""Resource for managing an organization's credit card."""
def get(self, orgname):
"""Get the organization's credit card."""
<|body_0|>
def post(self, orgname):
"""Update the orgnaization's credit card."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrganizationCard:
"""Resource for managing an organization's credit card."""
def get(self, orgname):
"""Get the organization's credit card."""
permission = AdministerOrganizationPermission(orgname)
if permission.can():
organization = model.organization.get_organization... | the_stack_v2_python_sparse | endpoints/api/billing.py | quay/quay | train | 2,363 |
09b5a79be981a73cf92324b0d3e21ccbac9cc569 | [
"r = super(RevisionReadonlyForm, self).__init__(*a, **kw)\nif self.instance:\n self.initial['delta_repr'] = mark_safe(self.instance.display_diff())\nreturn r",
"if self.cleaned_data['reapply']:\n info = getattr(self.instance, 'revision_info', {})\n self.instance.reapply(editor_ip=info.get('editor_ip'), e... | <|body_start_0|>
r = super(RevisionReadonlyForm, self).__init__(*a, **kw)
if self.instance:
self.initial['delta_repr'] = mark_safe(self.instance.display_diff())
return r
<|end_body_0|>
<|body_start_1|>
if self.cleaned_data['reapply']:
info = getattr(self.instance... | RevisionReadonlyForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RevisionReadonlyForm:
def __init__(self, *a, **kw):
"""Instance constructor"""
<|body_0|>
def save(self, *a, **kw):
"""Don't saves, only reapply if need."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = super(RevisionReadonlyForm, self).__init__(... | stack_v2_sparse_classes_36k_train_015076 | 1,579 | permissive | [
{
"docstring": "Instance constructor",
"name": "__init__",
"signature": "def __init__(self, *a, **kw)"
},
{
"docstring": "Don't saves, only reapply if need.",
"name": "save",
"signature": "def save(self, *a, **kw)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019052 | Implement the Python class `RevisionReadonlyForm` described below.
Class description:
Implement the RevisionReadonlyForm class.
Method signatures and docstrings:
- def __init__(self, *a, **kw): Instance constructor
- def save(self, *a, **kw): Don't saves, only reapply if need. | Implement the Python class `RevisionReadonlyForm` described below.
Class description:
Implement the RevisionReadonlyForm class.
Method signatures and docstrings:
- def __init__(self, *a, **kw): Instance constructor
- def save(self, *a, **kw): Don't saves, only reapply if need.
<|skeleton|>
class RevisionReadonlyForm... | 0575c332803bf697c222c8c30375428175525d4f | <|skeleton|>
class RevisionReadonlyForm:
def __init__(self, *a, **kw):
"""Instance constructor"""
<|body_0|>
def save(self, *a, **kw):
"""Don't saves, only reapply if need."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RevisionReadonlyForm:
def __init__(self, *a, **kw):
"""Instance constructor"""
r = super(RevisionReadonlyForm, self).__init__(*a, **kw)
if self.instance:
self.initial['delta_repr'] = mark_safe(self.instance.display_diff())
return r
def save(self, *a, **kw):
... | the_stack_v2_python_sparse | versioning/forms.py | tpllaha/connect.academy | train | 1 | |
3889d381dcaa8cf4d70f8a6d0a47f7bf1a3f2a8c | [
"assert statistics_list\nassert all((issubclass(s.__class__, Statistics) for s in statistics_list))\nself._statistics_list = statistics_list",
"try:\n stats = next((s for s in self._statistics_list if s.key == stats_key))\nexcept StopIteration:\n raise Exception(f'Could not find statistics: {stats_key}')\n\... | <|body_start_0|>
assert statistics_list
assert all((issubclass(s.__class__, Statistics) for s in statistics_list))
self._statistics_list = statistics_list
<|end_body_0|>
<|body_start_1|>
try:
stats = next((s for s in self._statistics_list if s.key == stats_key))
exce... | This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value | StatisticsCollection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatisticsCollection:
"""This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value"""
def __init__(self, statistics_list: list):
... | stack_v2_sparse_classes_36k_train_015077 | 8,062 | permissive | [
{
"docstring": "@param statistics_list: (`list` of `Statistics`) The list of statistics object of the collection.",
"name": "__init__",
"signature": "def __init__(self, statistics_list: list)"
},
{
"docstring": "Fetch the statistics by key and create a wrapper the call the statistic",
"name"... | 2 | stack_v2_sparse_classes_30k_train_000150 | Implement the Python class `StatisticsCollection` described below.
Class description:
This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value
Method signatures a... | Implement the Python class `StatisticsCollection` described below.
Class description:
This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value
Method signatures a... | 4cf6cf1fe975a9002299f0460873c0f21bc8d414 | <|skeleton|>
class StatisticsCollection:
"""This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value"""
def __init__(self, statistics_list: list):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatisticsCollection:
"""This class provide a wrapper for a collection of statistics objects. It used to provide an easy access to the statistics inside the tasks by only getattr, as following: self.<statistics_key>.<statistic> --> value"""
def __init__(self, statistics_list: list):
"""@param sta... | the_stack_v2_python_sparse | nudgebot/statistics/base.py | RedHatQE/Nudgebot | train | 2 |
44cd910dda05b0f07c9339f3a0fc6d95e9977bb3 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.Resolution = Resolution\nself.Ellipticity = Ellipticity\nself.Polarizations = Polarizations\nself.North = North\nself.Extensions = Extensions\nsuper(ExploitationFeaturesPro... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.Resolution = Resolution
self.Ellipticity = Ellipticity
self.Polarizations = Polarizations
self.North... | Metadata regarding the product. | ExploitationFeaturesProductType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExploitationFeaturesProductType:
"""Metadata regarding the product."""
def __init__(self, Resolution=None, Ellipticity=None, Polarizations=None, North=None, Extensions=None, **kwargs):
"""Parameters ---------- Resolution : RowColDoubleType|numpy.ndarray|list|tuple Ellipticity : float... | stack_v2_sparse_classes_36k_train_015078 | 34,922 | permissive | [
{
"docstring": "Parameters ---------- Resolution : RowColDoubleType|numpy.ndarray|list|tuple Ellipticity : float Polarizations : List[ProcTxRcvPolarizationType] North : None|float Extensions : None|ParametersCollection|dict kwargs",
"name": "__init__",
"signature": "def __init__(self, Resolution=None, E... | 2 | null | Implement the Python class `ExploitationFeaturesProductType` described below.
Class description:
Metadata regarding the product.
Method signatures and docstrings:
- def __init__(self, Resolution=None, Ellipticity=None, Polarizations=None, North=None, Extensions=None, **kwargs): Parameters ---------- Resolution : RowC... | Implement the Python class `ExploitationFeaturesProductType` described below.
Class description:
Metadata regarding the product.
Method signatures and docstrings:
- def __init__(self, Resolution=None, Ellipticity=None, Polarizations=None, North=None, Extensions=None, **kwargs): Parameters ---------- Resolution : RowC... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class ExploitationFeaturesProductType:
"""Metadata regarding the product."""
def __init__(self, Resolution=None, Ellipticity=None, Polarizations=None, North=None, Extensions=None, **kwargs):
"""Parameters ---------- Resolution : RowColDoubleType|numpy.ndarray|list|tuple Ellipticity : float... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExploitationFeaturesProductType:
"""Metadata regarding the product."""
def __init__(self, Resolution=None, Ellipticity=None, Polarizations=None, North=None, Extensions=None, **kwargs):
"""Parameters ---------- Resolution : RowColDoubleType|numpy.ndarray|list|tuple Ellipticity : float Polarization... | the_stack_v2_python_sparse | sarpy/io/product/sidd2_elements/ExploitationFeatures.py | ngageoint/sarpy | train | 192 |
9f354582135a4e010d142b8474e9b52653289f09 | [
"serializer = UserCreateSerializer(data=request.data)\nif not serializer.is_valid():\n return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)\ntry:\n new_user = serializer.save()\nexcept:\n return Response(data={'error': sys.exc_info()[0]}, status=status.HTTP_400_BAD_REQUEST)\nserializ... | <|body_start_0|>
serializer = UserCreateSerializer(data=request.data)
if not serializer.is_valid():
return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)
try:
new_user = serializer.save()
except:
return Response(data={'error': sys... | View for creating/editing users | UserCreateUpdateView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserCreateUpdateView:
"""View for creating/editing users"""
def post(self, request):
"""POST method for creating new user"""
<|body_0|>
def patch(self, request, pk):
"""PATCH method for editing user's name and password"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_015079 | 3,171 | no_license | [
{
"docstring": "POST method for creating new user",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "PATCH method for editing user's name and password",
"name": "patch",
"signature": "def patch(self, request, pk)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001186 | Implement the Python class `UserCreateUpdateView` described below.
Class description:
View for creating/editing users
Method signatures and docstrings:
- def post(self, request): POST method for creating new user
- def patch(self, request, pk): PATCH method for editing user's name and password | Implement the Python class `UserCreateUpdateView` described below.
Class description:
View for creating/editing users
Method signatures and docstrings:
- def post(self, request): POST method for creating new user
- def patch(self, request, pk): PATCH method for editing user's name and password
<|skeleton|>
class Use... | 611efe683d545bef191a0376c770eeb4fc0698fb | <|skeleton|>
class UserCreateUpdateView:
"""View for creating/editing users"""
def post(self, request):
"""POST method for creating new user"""
<|body_0|>
def patch(self, request, pk):
"""PATCH method for editing user's name and password"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserCreateUpdateView:
"""View for creating/editing users"""
def post(self, request):
"""POST method for creating new user"""
serializer = UserCreateSerializer(data=request.data)
if not serializer.is_valid():
return Response(data=serializer.errors, status=status.HTTP_40... | the_stack_v2_python_sparse | web/src/project/users/views.py | anurmanov/money_transfer_system | train | 0 |
b266ae20180232ee336f9ffbed5f114a3fa8802c | [
"resource_creator_action_config = self.svc.get(system_id)\nif resource_creator_action_config is None:\n raise error_codes.VALIDATE_ERROR.format('system[{}] do not register resource_creator_actions config'.format(system_id))\nrac_beans = self._tiled_resource_creator_action(resource_creator_action_config.config)\n... | <|body_start_0|>
resource_creator_action_config = self.svc.get(system_id)
if resource_creator_action_config is None:
raise error_codes.VALIDATE_ERROR.format('system[{}] do not register resource_creator_actions config'.format(system_id))
rac_beans = self._tiled_resource_creator_action... | ResourceCreatorActionBiz | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceCreatorActionBiz:
def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]:
"""查询某个资源类型当其实例被创建时,创建者需要的操作权限"""
<|body_0|>
def _tiled_resource_creator_action(self, rca_config: List[ResourceCreatorActionConfigItem]) -> List[ResourceCreatorActionBean]... | stack_v2_sparse_classes_36k_train_015080 | 3,181 | permissive | [
{
"docstring": "查询某个资源类型当其实例被创建时,创建者需要的操作权限",
"name": "list_action_id",
"signature": "def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]"
},
{
"docstring": "将新建关联配置按照资源类型平铺",
"name": "_tiled_resource_creator_action",
"signature": "def _tiled_resource_creator_act... | 2 | stack_v2_sparse_classes_30k_train_020049 | Implement the Python class `ResourceCreatorActionBiz` described below.
Class description:
Implement the ResourceCreatorActionBiz class.
Method signatures and docstrings:
- def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]: 查询某个资源类型当其实例被创建时,创建者需要的操作权限
- def _tiled_resource_creator_action(sel... | Implement the Python class `ResourceCreatorActionBiz` described below.
Class description:
Implement the ResourceCreatorActionBiz class.
Method signatures and docstrings:
- def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]: 查询某个资源类型当其实例被创建时,创建者需要的操作权限
- def _tiled_resource_creator_action(sel... | 33c8f4ffe8697081abcfc5771b98a88c0578059f | <|skeleton|>
class ResourceCreatorActionBiz:
def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]:
"""查询某个资源类型当其实例被创建时,创建者需要的操作权限"""
<|body_0|>
def _tiled_resource_creator_action(self, rca_config: List[ResourceCreatorActionConfigItem]) -> List[ResourceCreatorActionBean]... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourceCreatorActionBiz:
def list_action_id(self, system_id: str, resource_type_id: str) -> List[str]:
"""查询某个资源类型当其实例被创建时,创建者需要的操作权限"""
resource_creator_action_config = self.svc.get(system_id)
if resource_creator_action_config is None:
raise error_codes.VALIDATE_ERROR.for... | the_stack_v2_python_sparse | saas/backend/biz/resource_creator_action.py | robert871126/bk-iam-saas | train | 0 | |
2ac952ac12cdaefd7ce1c5123d3de49c3ba5d61f | [
"m, n = (len(grid), len(grid[0]))\n\ndef dfs(i: int, j: int):\n \"\"\" 深度优先搜索一个岛屿中的所有陆地,计算其面积 \"\"\"\n if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):\n nonlocal area\n area += 1\n grid[i][j] = 2\n dfs(i - 1, j)\n dfs(i + 1, j)\n dfs(i, j - 1)\n dfs(i, j + ... | <|body_start_0|>
m, n = (len(grid), len(grid[0]))
def dfs(i: int, j: int):
""" 深度优先搜索一个岛屿中的所有陆地,计算其面积 """
if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):
nonlocal area
area += 1
grid[i][j] = 2
dfs(i - 1, j)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m, n = (len(grid), len(grid[0]))
def ... | stack_v2_sparse_classes_36k_train_015081 | 2,707 | no_license | [
{
"docstring": "DFS",
"name": "maxAreaOfIsland",
"signature": "def maxAreaOfIsland(self, grid: List[List[int]]) -> int"
},
{
"docstring": "BFS",
"name": "maxAreaOfIslandBFS",
"signature": "def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_009965 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS
- def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int: BFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS
- def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int: BFS
<|skeleton|>
class Solution:
def maxAreaOfIsl... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
m, n = (len(grid), len(grid[0]))
def dfs(i: int, j: int):
""" 深度优先搜索一个岛屿中的所有陆地,计算其面积 """
if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):
nonlocal area
... | the_stack_v2_python_sparse | 695.岛屿的最大面积/solution.py | QtTao/daily_leetcode | train | 0 | |
42bdc6d18d3394296c471f8f39f4cd62f052516a | [
"super(TransformerFFN, self).__init__()\nself._dropout_rate = dropout_rate\nself._dense1 = nn.Linear(input_size, filter_size, bias=True)\nself._dense2 = nn.Linear(filter_size, output_size, bias=True)\nself._activation_fn = get_activation(activation)",
"output = self._activation_fn(self._dense1(inputs))\noutput = ... | <|body_start_0|>
super(TransformerFFN, self).__init__()
self._dropout_rate = dropout_rate
self._dense1 = nn.Linear(input_size, filter_size, bias=True)
self._dense2 = nn.Linear(filter_size, output_size, bias=True)
self._activation_fn = get_activation(activation)
<|end_body_0|>
<|... | Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762 | TransformerFFN | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerFFN:
"""Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762"""
def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'):
"""Initializes Transformer FFN. Args: input_size: The dimension of the input tensor... | stack_v2_sparse_classes_36k_train_015082 | 15,012 | permissive | [
{
"docstring": "Initializes Transformer FFN. Args: input_size: The dimension of the input tensor. filter_size: The hidden size of the relu layer. output_size: The output size. dropout_rate: The dropout rate. activation: The activation of internal layer.",
"name": "__init__",
"signature": "def __init__(s... | 2 | null | Implement the Python class `TransformerFFN` described below.
Class description:
Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762
Method signatures and docstrings:
- def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): Initializes Transformer... | Implement the Python class `TransformerFFN` described below.
Class description:
Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762
Method signatures and docstrings:
- def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): Initializes Transformer... | 06613a99305f02312a0e64ee3c3c50e7b00dcf0e | <|skeleton|>
class TransformerFFN:
"""Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762"""
def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'):
"""Initializes Transformer FFN. Args: input_size: The dimension of the input tensor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerFFN:
"""Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762"""
def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'):
"""Initializes Transformer FFN. Args: input_size: The dimension of the input tensor. filter_size... | the_stack_v2_python_sparse | neurst/neurst_pt/layers/common_layers.py | ohlionel/Prune-Tune | train | 12 |
353b484551e296fa283ed9c1efc206146e6dbb1f | [
"self.nrturns = 512\nself.turn_by_turn = True\nself.x_min = -0.012\nself.x_max = 0.0\nself.y_min = 0.0\nself.y_max = 0.004\nself.x_nrpts = 70\nself.y_nrpts = 30\nself.de_offset = 0.0\nself.xl_off = 1e-05\nself.yl_off = 1e-05\nself.intnux = 49.0\nself.intnuy = 14.0",
"strng = ''\nstrng += 'nrturns : {:d}\\n'.... | <|body_start_0|>
self.nrturns = 512
self.turn_by_turn = True
self.x_min = -0.012
self.x_max = 0.0
self.y_min = 0.0
self.y_max = 0.004
self.x_nrpts = 70
self.y_nrpts = 30
self.de_offset = 0.0
self.xl_off = 1e-05
self.yl_off = 1e-05
... | . | DynapXYParams | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynapXYParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __str__(self):
"""."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.nrturns = 512
self.turn_by_turn = True
self.x_min = -0.012
self.x_max = 0.0
... | stack_v2_sparse_classes_36k_train_015083 | 11,214 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ".",
"name": "__str__",
"signature": "def __str__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000597 | Implement the Python class `DynapXYParams` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self): .
- def __str__(self): . | Implement the Python class `DynapXYParams` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self): .
- def __str__(self): .
<|skeleton|>
class DynapXYParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __str__(self):
"""."""
<... | 39644161d98964a3a3d80d63269201f0a1712e82 | <|skeleton|>
class DynapXYParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __str__(self):
"""."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DynapXYParams:
"""."""
def __init__(self):
"""."""
self.nrturns = 512
self.turn_by_turn = True
self.x_min = -0.012
self.x_max = 0.0
self.y_min = 0.0
self.y_max = 0.004
self.x_nrpts = 70
self.y_nrpts = 30
self.de_offset = 0.0
... | the_stack_v2_python_sparse | apsuite/dynap/dynap_xy.py | lnls-fac/apsuite | train | 1 |
dc747c3ea0d7e878c729caab43931b04eb24fe66 | [
"coins = models.Historical.objects.all()\nfor coin in coins:\n if coin.name in self.historical_data:\n self.historical_data[coin.name].append([str(coin.name), coin.datetime.strftime('%s'), float(coin.historical_price), float(coin.circulating_supply), float(coin.market_cap), float(coin.volume)])\n else:... | <|body_start_0|>
coins = models.Historical.objects.all()
for coin in coins:
if coin.name in self.historical_data:
self.historical_data[coin.name].append([str(coin.name), coin.datetime.strftime('%s'), float(coin.historical_price), float(coin.circulating_supply), float(coin.mar... | ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager | MLFetcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MLFetcher:
"""ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager"""
def collect_data(self):
"""Capture all coin historical data that is in the database and store in a local data structure"""
<|body_0|>
def run(self... | stack_v2_sparse_classes_36k_train_015084 | 1,533 | permissive | [
{
"docstring": "Capture all coin historical data that is in the database and store in a local data structure",
"name": "collect_data",
"signature": "def collect_data(self)"
},
{
"docstring": "Pass the stored data to the manager to run the machine learning",
"name": "run",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_010364 | Implement the Python class `MLFetcher` described below.
Class description:
ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager
Method signatures and docstrings:
- def collect_data(self): Capture all coin historical data that is in the database and store in a loc... | Implement the Python class `MLFetcher` described below.
Class description:
ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager
Method signatures and docstrings:
- def collect_data(self): Capture all coin historical data that is in the database and store in a loc... | 59e6c5380950a92fcce841642d1cdc31f85618ed | <|skeleton|>
class MLFetcher:
"""ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager"""
def collect_data(self):
"""Capture all coin historical data that is in the database and store in a local data structure"""
<|body_0|>
def run(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MLFetcher:
"""ML Fetcher fetches historical data and stores into a python data structure and then triggers the ML Manager"""
def collect_data(self):
"""Capture all coin historical data that is in the database and store in a local data structure"""
coins = models.Historical.objects.all()
... | the_stack_v2_python_sparse | prophet/mlFetcher.py | andywu9/Prophet | train | 0 |
3042779c650874fdf9440bc58b0a7f97d7c2a63c | [
"cmd = self.command.split()[0]\nproc = subprocess.Popen('%s --help' % cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)\nreturn 'pdftoppm' in str(proc.communicate())",
"if outfile is None:\n outfile = self.tmpFile.with_suffix('.pdf')\noptions = ''\nif self._configOptio... | <|body_start_0|>
cmd = self.command.split()[0]
proc = subprocess.Popen('%s --help' % cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
return 'pdftoppm' in str(proc.communicate())
<|end_body_0|>
<|body_start_1|>
if outfile is None:
o... | Imager that uses libpoppler's pdftoppm to convert pdf to png | pdftoppm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pdftoppm:
"""Imager that uses libpoppler's pdftoppm to convert pdf to png"""
def verify(self):
"""pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this method. Note that this method will also work if pdftoppm... | stack_v2_sparse_classes_36k_train_015085 | 1,859 | permissive | [
{
"docstring": "pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this method. Note that this method will also work if pdftoppm writes its help message to standard output.",
"name": "verify",
"signature": "def verify(self)"
},
... | 2 | null | Implement the Python class `pdftoppm` described below.
Class description:
Imager that uses libpoppler's pdftoppm to convert pdf to png
Method signatures and docstrings:
- def verify(self): pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this... | Implement the Python class `pdftoppm` described below.
Class description:
Imager that uses libpoppler's pdftoppm to convert pdf to png
Method signatures and docstrings:
- def verify(self): pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this... | a882a62b81e6ae7b8c9454ae2b222ef5c2c14bb1 | <|skeleton|>
class pdftoppm:
"""Imager that uses libpoppler's pdftoppm to convert pdf to png"""
def verify(self):
"""pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this method. Note that this method will also work if pdftoppm... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pdftoppm:
"""Imager that uses libpoppler's pdftoppm to convert pdf to png"""
def verify(self):
"""pdftoppm writes its help message to standard error, and not standard output as plasTeX expects, and we thus have to override this method. Note that this method will also work if pdftoppm writes its h... | the_stack_v2_python_sparse | plasTeX/Imagers/pdftoppm.py | plastex/plastex | train | 129 |
ce50d897cbd481842a16f3d8abbc716754d4c5f3 | [
"self.__client = Client(verify_ssl_cert=False)\nself.bearer_token = token\nOSM_COMPONENTS = os.environ.get('OSM_COMPONENTS')\nif OSM_COMPONENTS is None:\n print('NO OSM_COMPONENTS in ENV')\nelse:\n self.OSM_COMPONENTS = json.loads(OSM_COMPONENTS)",
"endpoint = '{}/osm/nslcm/v1/ns_instances'.format(self.OSM_... | <|body_start_0|>
self.__client = Client(verify_ssl_cert=False)
self.bearer_token = token
OSM_COMPONENTS = os.environ.get('OSM_COMPONENTS')
if OSM_COMPONENTS is None:
print('NO OSM_COMPONENTS in ENV')
else:
self.OSM_COMPONENTS = json.loads(OSM_COMPONENTS)
<... | NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token | Ns | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ns:
"""NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token"""
def __init__(self, token):
"""NS LCM Class Constructor."""
<|body_0|>
def get_list(self):
"""Fetch a list of all NS Instances Returns: o... | stack_v2_sparse_classes_36k_train_015086 | 4,218 | permissive | [
{
"docstring": "NS LCM Class Constructor.",
"name": "__init__",
"signature": "def __init__(self, token)"
},
{
"docstring": "Fetch a list of all NS Instances Returns: object: A list of NSs as a requests object Examples: >>> from nbiapi.identity import bearer_token >>> from nbiapi.ns import Ns >>>... | 4 | null | Implement the Python class `Ns` described below.
Class description:
NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token
Method signatures and docstrings:
- def __init__(self, token): NS LCM Class Constructor.
- def get_list(self): Fetch a list of all NS... | Implement the Python class `Ns` described below.
Class description:
NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token
Method signatures and docstrings:
- def __init__(self, token): NS LCM Class Constructor.
- def get_list(self): Fetch a list of all NS... | a48a15d0190f20913cf313ca28e3daabb3753285 | <|skeleton|>
class Ns:
"""NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token"""
def __init__(self, token):
"""NS LCM Class Constructor."""
<|body_0|>
def get_list(self):
"""Fetch a list of all NS Instances Returns: o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ns:
"""NS Class. Attributes: bearer_token (str): The OSM Authorization Token Args: token (str): The OSM Authorization Token"""
def __init__(self, token):
"""NS LCM Class Constructor."""
self.__client = Client(verify_ssl_cert=False)
self.bearer_token = token
OSM_COMPONENTS ... | the_stack_v2_python_sparse | vnv_manager/app/api/management/commands/osm/nbiapi/ns.py | sonata-nfv/son-monitor | train | 5 |
3d2e01c99ec4c3a8cd5f88d4ced9016fa5dd17d9 | [
"entro = 0\nfor x_value in set(x):\n p = np.sum(x == x_value) / len(x)\n if p != 0:\n logp = np.log2(p)\n entro -= p * logp\nreturn entro",
"condition_entro = 0\nfor x_value in set(x):\n sub_y = y[x == x_value]\n temp_entro = self.get_entro(sub_y)\n condition_entro += float(sub_y.shap... | <|body_start_0|>
entro = 0
for x_value in set(x):
p = np.sum(x == x_value) / len(x)
if p != 0:
logp = np.log2(p)
entro -= p * logp
return entro
<|end_body_0|>
<|body_start_1|>
condition_entro = 0
for x_value in set(x):
... | Calc information_gain & information_gain_rto | GetInformGain | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetInformGain:
"""Calc information_gain & information_gain_rto"""
def get_entro(self, x):
"""Cala entropy :param x: np.array :return: entropy"""
<|body_0|>
def get_condition_entro(self, x, y):
"""Calc condition entropy H(y|x) :param x: np.array :param y: np.array... | stack_v2_sparse_classes_36k_train_015087 | 32,015 | no_license | [
{
"docstring": "Cala entropy :param x: np.array :return: entropy",
"name": "get_entro",
"signature": "def get_entro(self, x)"
},
{
"docstring": "Calc condition entropy H(y|x) :param x: np.array :param y: np.array :return: condition entropy",
"name": "get_condition_entro",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_000887 | Implement the Python class `GetInformGain` described below.
Class description:
Calc information_gain & information_gain_rto
Method signatures and docstrings:
- def get_entro(self, x): Cala entropy :param x: np.array :return: entropy
- def get_condition_entro(self, x, y): Calc condition entropy H(y|x) :param x: np.arr... | Implement the Python class `GetInformGain` described below.
Class description:
Calc information_gain & information_gain_rto
Method signatures and docstrings:
- def get_entro(self, x): Cala entropy :param x: np.array :return: entropy
- def get_condition_entro(self, x, y): Calc condition entropy H(y|x) :param x: np.arr... | 2b6812fcd8a7414e606cc3f5964b171503683144 | <|skeleton|>
class GetInformGain:
"""Calc information_gain & information_gain_rto"""
def get_entro(self, x):
"""Cala entropy :param x: np.array :return: entropy"""
<|body_0|>
def get_condition_entro(self, x, y):
"""Calc condition entropy H(y|x) :param x: np.array :param y: np.array... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetInformGain:
"""Calc information_gain & information_gain_rto"""
def get_entro(self, x):
"""Cala entropy :param x: np.array :return: entropy"""
entro = 0
for x_value in set(x):
p = np.sum(x == x_value) / len(x)
if p != 0:
logp = np.log2(p)
... | the_stack_v2_python_sparse | model_tools/model_tools/gentools/advtools.py | yanghaitian1/risk_control | train | 3 |
2a7245d149fb14ce8edfada6c91adba5f9e27c0a | [
"QGroupBox.__init__(self, parent)\nself.u = gui_option.unit\nself.setTitle(self.tr('Output'))\nself.setMinimumSize(QSize(200, 0))\nself.setObjectName('g_output')\nself.layout = QVBoxLayout(self)\nself.layout.setObjectName('layout')\nself.out_Smag = QLabel(self)\nself.out_Smag.setObjectName('out_Smag')\nself.layout.... | <|body_start_0|>
QGroupBox.__init__(self, parent)
self.u = gui_option.unit
self.setTitle(self.tr('Output'))
self.setMinimumSize(QSize(200, 0))
self.setObjectName('g_output')
self.layout = QVBoxLayout(self)
self.layout.setObjectName('layout')
self.out_Smag ... | Setup of QGroupBox for output for Magnet | WMagnetOut | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WMagnetOut:
"""Setup of QGroupBox for output for Magnet"""
def __init__(self, parent=None):
"""Initialize the widget"""
<|body_0|>
def comp_output(self):
"""Update the Output text with the computed values Parameters ---------- self : WMagnetOut A WMagnetOut objec... | stack_v2_sparse_classes_36k_train_015088 | 2,936 | permissive | [
{
"docstring": "Initialize the widget",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Update the Output text with the computed values Parameters ---------- self : WMagnetOut A WMagnetOut object",
"name": "comp_output",
"signature": "def comp_output... | 2 | null | Implement the Python class `WMagnetOut` described below.
Class description:
Setup of QGroupBox for output for Magnet
Method signatures and docstrings:
- def __init__(self, parent=None): Initialize the widget
- def comp_output(self): Update the Output text with the computed values Parameters ---------- self : WMagnetO... | Implement the Python class `WMagnetOut` described below.
Class description:
Setup of QGroupBox for output for Magnet
Method signatures and docstrings:
- def __init__(self, parent=None): Initialize the widget
- def comp_output(self): Update the Output text with the computed values Parameters ---------- self : WMagnetO... | 29e6b4358420754993af1a43048aa12d1538774e | <|skeleton|>
class WMagnetOut:
"""Setup of QGroupBox for output for Magnet"""
def __init__(self, parent=None):
"""Initialize the widget"""
<|body_0|>
def comp_output(self):
"""Update the Output text with the computed values Parameters ---------- self : WMagnetOut A WMagnetOut objec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WMagnetOut:
"""Setup of QGroupBox for output for Magnet"""
def __init__(self, parent=None):
"""Initialize the widget"""
QGroupBox.__init__(self, parent)
self.u = gui_option.unit
self.setTitle(self.tr('Output'))
self.setMinimumSize(QSize(200, 0))
self.setObj... | the_stack_v2_python_sparse | pyleecan/GUI/Dialog/DMachineSetup/SMagnet/WMagnetOut/WMagnetOut.py | BonneelP/pyleecan | train | 2 |
0989d3c5161c4e8f5a2ba914314692415b71a340 | [
"for n in nodes:\n dict.__setitem__(self, n.i, n)\nfor e in edges:\n self[e.n1].connect(self[e.n2])\n self[e.n2].connect(self[e.n1])",
"r = dict()\nr[-1] = 0\nr[0] = 0\nfor k in self:\n if r.get(self[k].s) == None:\n r[self[k].s] = 1.0 / float(len(self))\n else:\n r[self[k].s] = r[sel... | <|body_start_0|>
for n in nodes:
dict.__setitem__(self, n.i, n)
for e in edges:
self[e.n1].connect(self[e.n2])
self[e.n2].connect(self[e.n1])
<|end_body_0|>
<|body_start_1|>
r = dict()
r[-1] = 0
r[0] = 0
for k in self:
if r... | A graph object | Graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
"""A graph object"""
def __init__(self, nodes=[], edges=[]):
"""Constructor nodes: a list of Node objects edges: a list of Edge objects"""
<|body_0|>
def ratio(self):
"""Pseudo-property: get the ratio of each player's occupied nodes"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_015089 | 24,726 | no_license | [
{
"docstring": "Constructor nodes: a list of Node objects edges: a list of Edge objects",
"name": "__init__",
"signature": "def __init__(self, nodes=[], edges=[])"
},
{
"docstring": "Pseudo-property: get the ratio of each player's occupied nodes",
"name": "ratio",
"signature": "def ratio... | 5 | stack_v2_sparse_classes_30k_train_011478 | Implement the Python class `Graph` described below.
Class description:
A graph object
Method signatures and docstrings:
- def __init__(self, nodes=[], edges=[]): Constructor nodes: a list of Node objects edges: a list of Edge objects
- def ratio(self): Pseudo-property: get the ratio of each player's occupied nodes
- ... | Implement the Python class `Graph` described below.
Class description:
A graph object
Method signatures and docstrings:
- def __init__(self, nodes=[], edges=[]): Constructor nodes: a list of Node objects edges: a list of Edge objects
- def ratio(self): Pseudo-property: get the ratio of each player's occupied nodes
- ... | 34d1387524d969e36fe13689edfcb43891c262e0 | <|skeleton|>
class Graph:
"""A graph object"""
def __init__(self, nodes=[], edges=[]):
"""Constructor nodes: a list of Node objects edges: a list of Edge objects"""
<|body_0|>
def ratio(self):
"""Pseudo-property: get the ratio of each player's occupied nodes"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
"""A graph object"""
def __init__(self, nodes=[], edges=[]):
"""Constructor nodes: a list of Node objects edges: a list of Edge objects"""
for n in nodes:
dict.__setitem__(self, n.i, n)
for e in edges:
self[e.n1].connect(self[e.n2])
self[... | the_stack_v2_python_sparse | NoUpload/shaqal/Nanomunchers/nano.py | designreuse/HeuristicProblemSolving | train | 0 |
e8dd285ddcfe4bab3a15b54425c9626ef917bf90 | [
"self.head = head\ntemp = head\ni = 0\nwhile temp is not None:\n i += 1\n temp = temp.next\nself.len = i",
"steps = random.randint(0, self.len - 1)\ntemp = self.head\nfor i in range(steps):\n temp = temp.next\nreturn temp.val"
] | <|body_start_0|>
self.head = head
temp = head
i = 0
while temp is not None:
i += 1
temp = temp.next
self.len = i
<|end_body_0|>
<|body_start_1|>
steps = random.randint(0, self.len - 1)
temp = self.head
for i in range(steps):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
<|body_0|>
def getRandom(self) -> int:
"""Returns a random node's value."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_015090 | 1,344 | no_license | [
{
"docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.",
"name": "__init__",
"signature": "def __init__(self, head: ListNode)"
},
{
"docstring": "Returns a random node's value.",
"name": "getRandom",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_005513 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.
- def getRandom(self) -... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head: ListNode): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node.
- def getRandom(self) -... | fb5a930b5ad27e7ed405e5787346327d9b3bf957 | <|skeleton|>
class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
<|body_0|>
def getRandom(self) -> int:
"""Returns a random node's value."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, head: ListNode):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node."""
self.head = head
temp = head
i = 0
while temp is not None:
i += 1
temp = te... | the_stack_v2_python_sparse | Jiuzhang_practice/Linkedlist_random_node.py | armstrong019/coding_n_project | train | 0 | |
4c2c3bba0d627f07726be1c89a8169f24637d040 | [
"self.rule_name = rule_name\nself.rule_index = rule_index\nself.rule = rule",
"violating_apis = _RULE_MODE_METHODS[self.rule['mode']](rule_apis=self.rule['services'], enabled_apis=enabled_apis)\nif violating_apis:\n yield self.RuleViolation(resource_name=project.display_name, resource_type=project.type, resour... | <|body_start_0|>
self.rule_name = rule_name
self.rule_index = rule_index
self.rule = rule
<|end_body_0|>
<|body_start_1|>
violating_apis = _RULE_MODE_METHODS[self.rule['mode']](rule_apis=self.rule['services'], enabled_apis=enabled_apis)
if violating_apis:
yield self.... | Rule properties from the rule definition file. Also finds violations. | Rule | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule:
"""Rule properties from the rule definition file. Also finds violations."""
def __init__(self, rule_name, rule_index, rule):
"""Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of the rule from the rule definitions. rule (dict): The rule d... | stack_v2_sparse_classes_36k_train_015091 | 14,006 | permissive | [
{
"docstring": "Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of the rule from the rule definitions. rule (dict): The rule definition from the file.",
"name": "__init__",
"signature": "def __init__(self, rule_name, rule_index, rule)"
},
{
"docstring": "F... | 2 | stack_v2_sparse_classes_30k_train_020445 | Implement the Python class `Rule` described below.
Class description:
Rule properties from the rule definition file. Also finds violations.
Method signatures and docstrings:
- def __init__(self, rule_name, rule_index, rule): Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of th... | Implement the Python class `Rule` described below.
Class description:
Rule properties from the rule definition file. Also finds violations.
Method signatures and docstrings:
- def __init__(self, rule_name, rule_index, rule): Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of th... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class Rule:
"""Rule properties from the rule definition file. Also finds violations."""
def __init__(self, rule_name, rule_index, rule):
"""Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of the rule from the rule definitions. rule (dict): The rule d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rule:
"""Rule properties from the rule definition file. Also finds violations."""
def __init__(self, rule_name, rule_index, rule):
"""Initialize. Args: rule_name (str): Name of the loaded rule. rule_index (int): The index of the rule from the rule definitions. rule (dict): The rule definition fro... | the_stack_v2_python_sparse | google/cloud/forseti/scanner/audit/enabled_apis_rules_engine.py | kevensen/forseti-security | train | 1 |
c74217be9f7714ab14d92844a4b4d4cedc75bfe4 | [
"y_pred = y_pred.T\ny_true_ = np.zeros(y_pred.shape)\nfor i, y in enumerate(y_true.flatten()):\n y_true_[i, y] = 1\nC = -np.sum(y_true_ * np.log(y_pred))\nif penalty > 0:\n for w in W:\n C += 0.5 * penalty * np.sum(w ** 2)\nreturn C",
"a = np.exp(x - np.max(x))\nsm = a / np.sum(a, axis=0, keepdims=Tr... | <|body_start_0|>
y_pred = y_pred.T
y_true_ = np.zeros(y_pred.shape)
for i, y in enumerate(y_true.flatten()):
y_true_[i, y] = 1
C = -np.sum(y_true_ * np.log(y_pred))
if penalty > 0:
for w in W:
C += 0.5 * penalty * np.sum(w ** 2)
ret... | Class containing the cost and output activation function for classification. | C_classification | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class C_classification:
"""Class containing the cost and output activation function for classification."""
def C(y_true, y_pred, penalty=0, W=0):
"""Cost function for classification (cross entropy + penalty). Arguments: y_true (array): observed response y_pred (array): predicted response p... | stack_v2_sparse_classes_36k_train_015092 | 12,501 | no_license | [
{
"docstring": "Cost function for classification (cross entropy + penalty). Arguments: y_true (array): observed response y_pred (array): predicted response penalty (float, optional): penalty parameter, defaults to 0 W (float, optional): weight, defaults to 0",
"name": "C",
"signature": "def C(y_true, y_... | 2 | stack_v2_sparse_classes_30k_train_012622 | Implement the Python class `C_classification` described below.
Class description:
Class containing the cost and output activation function for classification.
Method signatures and docstrings:
- def C(y_true, y_pred, penalty=0, W=0): Cost function for classification (cross entropy + penalty). Arguments: y_true (array... | Implement the Python class `C_classification` described below.
Class description:
Class containing the cost and output activation function for classification.
Method signatures and docstrings:
- def C(y_true, y_pred, penalty=0, W=0): Cost function for classification (cross entropy + penalty). Arguments: y_true (array... | 5bbd2dc3fa274f6e48b2d4ef387b3939483cafe8 | <|skeleton|>
class C_classification:
"""Class containing the cost and output activation function for classification."""
def C(y_true, y_pred, penalty=0, W=0):
"""Cost function for classification (cross entropy + penalty). Arguments: y_true (array): observed response y_pred (array): predicted response p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class C_classification:
"""Class containing the cost and output activation function for classification."""
def C(y_true, y_pred, penalty=0, W=0):
"""Cost function for classification (cross entropy + penalty). Arguments: y_true (array): observed response y_pred (array): predicted response penalty (float... | the_stack_v2_python_sparse | Project2/neural_network.py | fridalarsen/FYS-STK4155 | train | 0 |
a3ff5f63af5b65b2553c6c5cc3fb5fab8b8780c4 | [
"cnt = 0\nret = 0\nfor c, u in sorted(boxTypes, key=lambda x: x[1], reverse=True):\n n = min(truckSize - cnt, c)\n cnt += n\n ret += n * u\n if cnt >= truckSize:\n break\nreturn ret",
"ret = 0\nfor box_cnt, unit_cnt in sorted(boxTypes, key=lambda x: x[1], reverse=True):\n if truckSize == 0:\... | <|body_start_0|>
cnt = 0
ret = 0
for c, u in sorted(boxTypes, key=lambda x: x[1], reverse=True):
n = min(truckSize - cnt, c)
cnt += n
ret += n * u
if cnt >= truckSize:
break
return ret
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
"""06/25/2021 20:52"""
<|body_0|>
def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
"""07/21/2022 21:50"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_015093 | 2,512 | no_license | [
{
"docstring": "06/25/2021 20:52",
"name": "maximumUnits",
"signature": "def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int"
},
{
"docstring": "07/21/2022 21:50",
"name": "maximumUnits",
"signature": "def maximumUnits(self, boxTypes: List[List[int]], truckSize: int)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: 06/25/2021 20:52
- def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: 07/21/2022 ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: 06/25/2021 20:52
- def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: 07/21/2022 ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
"""06/25/2021 20:52"""
<|body_0|>
def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
"""07/21/2022 21:50"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int:
"""06/25/2021 20:52"""
cnt = 0
ret = 0
for c, u in sorted(boxTypes, key=lambda x: x[1], reverse=True):
n = min(truckSize - cnt, c)
cnt += n
ret += n * u
... | the_stack_v2_python_sparse | leetcode/solved/1829_Maximum_Units_on_a_Truck/solution.py | sungminoh/algorithms | train | 0 | |
09884443f2dfd8b0cd53d0d719f9ec426a3059f0 | [
"nums = [float('-inf')] + nums + [float('-inf')]\nfor i in range(1, len(nums)):\n if nums[i + 1] < nums[i] > nums[i - 1]:\n return int(i - 1)",
"if len(nums) == 1:\n return 0\nif len(nums) == 2:\n return int(nums[0] < nums[1])\nmid = int(len(nums) / 2)\nif nums[mid - 1] > nums[mid]:\n return se... | <|body_start_0|>
nums = [float('-inf')] + nums + [float('-inf')]
for i in range(1, len(nums)):
if nums[i + 1] < nums[i] > nums[i - 1]:
return int(i - 1)
<|end_body_0|>
<|body_start_1|>
if len(nums) == 1:
return 0
if len(nums) == 2:
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findPeakElement(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findPeakElement2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums = [float('-inf')] + nums + [flo... | stack_v2_sparse_classes_36k_train_015094 | 1,299 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findPeakElement",
"signature": "def findPeakElement(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findPeakElement2",
"signature": "def findPeakElement2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPeakElement(self, nums): :type nums: List[int] :rtype: int
- def findPeakElement2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPeakElement(self, nums): :type nums: List[int] :rtype: int
- def findPeakElement2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def fi... | 391328c7c601b5c77ff250ad173600d4d1dd7f57 | <|skeleton|>
class Solution:
def findPeakElement(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findPeakElement2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findPeakElement(self, nums):
""":type nums: List[int] :rtype: int"""
nums = [float('-inf')] + nums + [float('-inf')]
for i in range(1, len(nums)):
if nums[i + 1] < nums[i] > nums[i - 1]:
return int(i - 1)
def findPeakElement2(self, nums):
... | the_stack_v2_python_sparse | leetcode/algo/162. Find Peak Element.py | wduncan21/Challenges | train | 0 | |
9a795248d53faa9dfa3cadeffcddcf87812d0878 | [
"while True:\n account = input(INPUT_ACCOUNT)\n if account == 'q':\n exit()\n else:\n student_file = os.path.join(STUDENTS_DIR, account)\n teacher_file = os.path.join(TEACHERS_DIR, account)\n admin_file = os.path.join(PROJECT_DIR, 'db', account)\n result = list(map(os.pat... | <|body_start_0|>
while True:
account = input(INPUT_ACCOUNT)
if account == 'q':
exit()
else:
student_file = os.path.join(STUDENTS_DIR, account)
teacher_file = os.path.join(TEACHERS_DIR, account)
admin_file = os.pa... | User | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
def login():
"""静态方法,登录 :return:"""
<|body_0|>
def register_user():
"""新用户注册 :param account: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
while True:
account = input(INPUT_ACCOUNT)
if account == 'q':
... | stack_v2_sparse_classes_36k_train_015095 | 23,394 | no_license | [
{
"docstring": "静态方法,登录 :return:",
"name": "login",
"signature": "def login()"
},
{
"docstring": "新用户注册 :param account: :return:",
"name": "register_user",
"signature": "def register_user()"
}
] | 2 | stack_v2_sparse_classes_30k_train_020922 | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def login(): 静态方法,登录 :return:
- def register_user(): 新用户注册 :param account: :return: | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def login(): 静态方法,登录 :return:
- def register_user(): 新用户注册 :param account: :return:
<|skeleton|>
class User:
def login():
"""静态方法,登录 :return:"""
<|body_0|>
def... | de3ef5ddde474acfb1b570da64fc74807e614632 | <|skeleton|>
class User:
def login():
"""静态方法,登录 :return:"""
<|body_0|>
def register_user():
"""新用户注册 :param account: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class User:
def login():
"""静态方法,登录 :return:"""
while True:
account = input(INPUT_ACCOUNT)
if account == 'q':
exit()
else:
student_file = os.path.join(STUDENTS_DIR, account)
teacher_file = os.path.join(TEACHERS_DIR, ... | the_stack_v2_python_sparse | day6/SelectCourse/src/user.py | huamingao/homework | train | 0 | |
b8d1b9ca018303e0fc315148dfdde02761825036 | [
"try:\n self._force_joinall_to_use_set(node)\nexcept InferenceError:\n pass",
"for inferred_func in node.func.infer():\n if is_joinall(inferred_func):\n is_every_value_a_set = all((inferred_first_arg.pytype() == 'builtins.set' for inferred_first_arg in node.args[0].infer()))\n if not is_eve... | <|body_start_0|>
try:
self._force_joinall_to_use_set(node)
except InferenceError:
pass
<|end_body_0|>
<|body_start_1|>
for inferred_func in node.func.infer():
if is_joinall(inferred_func):
is_every_value_a_set = all((inferred_first_arg.pytype(... | GeventWaitall | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeventWaitall:
def visit_call(self, node):
"""Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`."""
<|body_0|>
def _force_joinall_to_use_set(self, node):
"""This detect usages of the form: >>> from gevent impo... | stack_v2_sparse_classes_36k_train_015096 | 1,816 | permissive | [
{
"docstring": "Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`.",
"name": "visit_call",
"signature": "def visit_call(self, node)"
},
{
"docstring": "This detect usages of the form: >>> from gevent import joinall >>> joinall(...) or: >>... | 2 | null | Implement the Python class `GeventWaitall` described below.
Class description:
Implement the GeventWaitall class.
Method signatures and docstrings:
- def visit_call(self, node): Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`.
- def _force_joinall_to_use_set... | Implement the Python class `GeventWaitall` described below.
Class description:
Implement the GeventWaitall class.
Method signatures and docstrings:
- def visit_call(self, node): Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`.
- def _force_joinall_to_use_set... | 1ee26cd3e4294cb122efb705160e03ba3e74ab9f | <|skeleton|>
class GeventWaitall:
def visit_call(self, node):
"""Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`."""
<|body_0|>
def _force_joinall_to_use_set(self, node):
"""This detect usages of the form: >>> from gevent impo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeventWaitall:
def visit_call(self, node):
"""Called on expressions of the form `expr()`, where `expr` is a simple name e.g. `f()` or a path e.g. `v.f()`."""
try:
self._force_joinall_to_use_set(node)
except InferenceError:
pass
def _force_joinall_to_use_set... | the_stack_v2_python_sparse | tools/pylint/gevent_checker.py | LefterisJP/raiden | train | 0 | |
a9b624297274773b195611f20c5a4270800a9512 | [
"super(PBAHpo, self).__init__(search_space, **kwargs)\nself.transformers = search_space.transformers\nself.operation_names = []\nfor operation, w_o in self.transformers.items():\n if w_o:\n self.operation_names.append(operation)\nnum_operation = len(self.operation_names)\nself.hpo = PBA(self.config.policy... | <|body_start_0|>
super(PBAHpo, self).__init__(search_space, **kwargs)
self.transformers = search_space.transformers
self.operation_names = []
for operation, w_o in self.transformers.items():
if w_o:
self.operation_names.append(operation)
num_operation ... | An Hpo of PBA, inherit from HpoGenerator. | PBAHpo | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PBAHpo:
"""An Hpo of PBA, inherit from HpoGenerator."""
def __init__(self, search_space=None, **kwargs):
"""Init PBAHpo."""
<|body_0|>
def search(self):
"""Search an id and hps from hpo."""
<|body_1|>
def update(self, record):
"""Update curre... | stack_v2_sparse_classes_36k_train_015097 | 3,217 | permissive | [
{
"docstring": "Init PBAHpo.",
"name": "__init__",
"signature": "def __init__(self, search_space=None, **kwargs)"
},
{
"docstring": "Search an id and hps from hpo.",
"name": "search",
"signature": "def search(self)"
},
{
"docstring": "Update current performance into hpo score boa... | 3 | stack_v2_sparse_classes_30k_train_012833 | Implement the Python class `PBAHpo` described below.
Class description:
An Hpo of PBA, inherit from HpoGenerator.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init PBAHpo.
- def search(self): Search an id and hps from hpo.
- def update(self, record): Update current performance ... | Implement the Python class `PBAHpo` described below.
Class description:
An Hpo of PBA, inherit from HpoGenerator.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init PBAHpo.
- def search(self): Search an id and hps from hpo.
- def update(self, record): Update current performance ... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class PBAHpo:
"""An Hpo of PBA, inherit from HpoGenerator."""
def __init__(self, search_space=None, **kwargs):
"""Init PBAHpo."""
<|body_0|>
def search(self):
"""Search an id and hps from hpo."""
<|body_1|>
def update(self, record):
"""Update curre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PBAHpo:
"""An Hpo of PBA, inherit from HpoGenerator."""
def __init__(self, search_space=None, **kwargs):
"""Init PBAHpo."""
super(PBAHpo, self).__init__(search_space, **kwargs)
self.transformers = search_space.transformers
self.operation_names = []
for operation, w... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/algorithms/data_augmentation/pba_hpo.py | Huawei-Ascend/modelzoo | train | 1 |
540e8605ca870c8402c691e83d3ad49ac24c314d | [
"self.row = 0\nself.col = maze[0].index('|')\nself.letters = []\nself.direction = 'down'\nself.maze = maze",
"if self.direction == 'down':\n self.row += 1\nelif self.direction == 'up':\n self.row -= 1\nelif self.direction == 'right':\n self.col += 1\nelif self.direction == 'left':\n self.col -= 1",
... | <|body_start_0|>
self.row = 0
self.col = maze[0].index('|')
self.letters = []
self.direction = 'down'
self.maze = maze
<|end_body_0|>
<|body_start_1|>
if self.direction == 'down':
self.row += 1
elif self.direction == 'up':
self.row -= 1
... | Navigate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Navigate:
def __init__(self, maze):
"""navigate the maze"""
<|body_0|>
def one_step(self):
"""move in self.direction"""
<|body_1|>
def search(self):
"""search around for next direction"""
<|body_2|>
def move(self):
"""move on... | stack_v2_sparse_classes_36k_train_015098 | 1,851 | no_license | [
{
"docstring": "navigate the maze",
"name": "__init__",
"signature": "def __init__(self, maze)"
},
{
"docstring": "move in self.direction",
"name": "one_step",
"signature": "def one_step(self)"
},
{
"docstring": "search around for next direction",
"name": "search",
"signa... | 5 | null | Implement the Python class `Navigate` described below.
Class description:
Implement the Navigate class.
Method signatures and docstrings:
- def __init__(self, maze): navigate the maze
- def one_step(self): move in self.direction
- def search(self): search around for next direction
- def move(self): move one step
- de... | Implement the Python class `Navigate` described below.
Class description:
Implement the Navigate class.
Method signatures and docstrings:
- def __init__(self, maze): navigate the maze
- def one_step(self): move in self.direction
- def search(self): search around for next direction
- def move(self): move one step
- de... | b1688431de1c5ab60659bc632c1a7131c3c7aad5 | <|skeleton|>
class Navigate:
def __init__(self, maze):
"""navigate the maze"""
<|body_0|>
def one_step(self):
"""move in self.direction"""
<|body_1|>
def search(self):
"""search around for next direction"""
<|body_2|>
def move(self):
"""move on... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Navigate:
def __init__(self, maze):
"""navigate the maze"""
self.row = 0
self.col = maze[0].index('|')
self.letters = []
self.direction = 'down'
self.maze = maze
def one_step(self):
"""move in self.direction"""
if self.direction == 'down':
... | the_stack_v2_python_sparse | 2017/19_02.py | yknot/adventOfCode | train | 0 | |
4c1e20b625d26759913e57219bb155cf05545309 | [
"can_activate, username = self._can_activate(data=data)\nif not can_activate or username is None:\n return\nh_result: Dict = {'steam_id_64_hex': None, 'steam_id_3': None, 'steam_id': None, 'profile_state': None, 'profile_creation_data': None}\nif data['steam'][username]['steam_id'] is not None:\n logger.info(... | <|body_start_0|>
can_activate, username = self._can_activate(data=data)
if not can_activate or username is None:
return
h_result: Dict = {'steam_id_64_hex': None, 'steam_id_3': None, 'steam_id': None, 'profile_state': None, 'profile_creation_data': None}
if data['steam'][user... | Steam Id Finder Data Digger. | SteamIdFinderDataDigger | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SteamIdFinderDataDigger:
"""Steam Id Finder Data Digger."""
def run(self, config: ConfigParser, args: Dict, data: Dict) -> None:
"""Execute Module."""
<|body_0|>
def __get_steam_id_data(self, steam_id: str, config: ConfigParser) -> Dict:
"""Get the Steam Finder D... | stack_v2_sparse_classes_36k_train_015099 | 8,031 | permissive | [
{
"docstring": "Execute Module.",
"name": "run",
"signature": "def run(self, config: ConfigParser, args: Dict, data: Dict) -> None"
},
{
"docstring": "Get the Steam Finder Data.",
"name": "__get_steam_id_data",
"signature": "def __get_steam_id_data(self, steam_id: str, config: ConfigPars... | 3 | stack_v2_sparse_classes_30k_train_016852 | Implement the Python class `SteamIdFinderDataDigger` described below.
Class description:
Steam Id Finder Data Digger.
Method signatures and docstrings:
- def run(self, config: ConfigParser, args: Dict, data: Dict) -> None: Execute Module.
- def __get_steam_id_data(self, steam_id: str, config: ConfigParser) -> Dict: G... | Implement the Python class `SteamIdFinderDataDigger` described below.
Class description:
Steam Id Finder Data Digger.
Method signatures and docstrings:
- def run(self, config: ConfigParser, args: Dict, data: Dict) -> None: Execute Module.
- def __get_steam_id_data(self, steam_id: str, config: ConfigParser) -> Dict: G... | 058714c1870bde0d794452b32ad0e62d544bdd90 | <|skeleton|>
class SteamIdFinderDataDigger:
"""Steam Id Finder Data Digger."""
def run(self, config: ConfigParser, args: Dict, data: Dict) -> None:
"""Execute Module."""
<|body_0|>
def __get_steam_id_data(self, steam_id: str, config: ConfigParser) -> Dict:
"""Get the Steam Finder D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SteamIdFinderDataDigger:
"""Steam Id Finder Data Digger."""
def run(self, config: ConfigParser, args: Dict, data: Dict) -> None:
"""Execute Module."""
can_activate, username = self._can_activate(data=data)
if not can_activate or username is None:
return
h_resul... | the_stack_v2_python_sparse | OSIx/modules/steam_username_data_digger.py | guibacellar/OSIx | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.