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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a4cb066a6f50340b2d4a171e26743012817b3a1a | [
"wx.Frame(parent, title=title, size=(400, 250))\nself.mainframe = parent\nwx.Frame.__init__(self, parent, title=title, size=(400, 250))\nself.panel = wx.Panel(self, pos=(0, 0), size=(400, 250))\nself.panel.SetBackgroundColour('#FFFFFF')\nbookName_tip = wx.StaticText(self.panel, label='书名:', pos=(5, 8), size=(35, 25... | <|body_start_0|>
wx.Frame(parent, title=title, size=(400, 250))
self.mainframe = parent
wx.Frame.__init__(self, parent, title=title, size=(400, 250))
self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250))
self.panel.SetBackgroundColour('#FFFFFF')
bookName_tip = wx.Stati... | UpdateFrame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateFrame:
def __init__(self, parent, title, select_id):
"""初始化更新图书信息界面总布局"""
<|body_0|>
def showAllText(self):
"""显示概述本原始信息"""
<|body_1|>
def saveUpdate(self, evt):
"""保存修改后的值"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
w... | stack_v2_sparse_classes_36k_train_012600 | 13,549 | no_license | [
{
"docstring": "初始化更新图书信息界面总布局",
"name": "__init__",
"signature": "def __init__(self, parent, title, select_id)"
},
{
"docstring": "显示概述本原始信息",
"name": "showAllText",
"signature": "def showAllText(self)"
},
{
"docstring": "保存修改后的值",
"name": "saveUpdate",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_016163 | Implement the Python class `UpdateFrame` described below.
Class description:
Implement the UpdateFrame class.
Method signatures and docstrings:
- def __init__(self, parent, title, select_id): 初始化更新图书信息界面总布局
- def showAllText(self): 显示概述本原始信息
- def saveUpdate(self, evt): 保存修改后的值 | Implement the Python class `UpdateFrame` described below.
Class description:
Implement the UpdateFrame class.
Method signatures and docstrings:
- def __init__(self, parent, title, select_id): 初始化更新图书信息界面总布局
- def showAllText(self): 显示概述本原始信息
- def saveUpdate(self, evt): 保存修改后的值
<|skeleton|>
class UpdateFrame:
d... | e19c56fb353e9bc961a568da41dedba6ae6aa05f | <|skeleton|>
class UpdateFrame:
def __init__(self, parent, title, select_id):
"""初始化更新图书信息界面总布局"""
<|body_0|>
def showAllText(self):
"""显示概述本原始信息"""
<|body_1|>
def saveUpdate(self, evt):
"""保存修改后的值"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateFrame:
def __init__(self, parent, title, select_id):
"""初始化更新图书信息界面总布局"""
wx.Frame(parent, title=title, size=(400, 250))
self.mainframe = parent
wx.Frame.__init__(self, parent, title=title, size=(400, 250))
self.panel = wx.Panel(self, pos=(0, 0), size=(400, 250))
... | the_stack_v2_python_sparse | SXB/venv/Tkinter-master/t3.py | sh2268411762/Python_Three | train | 1 | |
43c07d4ad034e1c6e0887434a0ab6ad4fe89b9f2 | [
"course_runs = get_course_runs_for_course(entitlement.course_uuid)\nfor run in course_runs:\n if course_run_id == run.get('key', ''):\n return True\nreturn False",
"try:\n unexpired_paid_modes = [mode.slug for mode in CourseMode.paid_modes_for_course(course_run_key)]\n can_upgrade = unexpired_paid... | <|body_start_0|>
course_runs = get_course_runs_for_course(entitlement.course_uuid)
for run in course_runs:
if course_run_id == run.get('key', ''):
return True
return False
<|end_body_0|>
<|body_start_1|>
try:
unexpired_paid_modes = [mode.slug for ... | Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment | EntitlementEnrollmentViewSet | [
"MIT",
"AGPL-3.0-only",
"AGPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntitlementEnrollmentViewSet:
"""Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment"""
def _verify_course_run_for_entitlement(self, entitlement, course_run_id):
"""Verifies that a Course run i... | stack_v2_sparse_classes_36k_train_012601 | 22,628 | permissive | [
{
"docstring": "Verifies that a Course run is a child of the Course assigned to the entitlement.",
"name": "_verify_course_run_for_entitlement",
"signature": "def _verify_course_run_for_entitlement(self, entitlement, course_run_id)"
},
{
"docstring": "Internal method to handle the details of enr... | 4 | null | Implement the Python class `EntitlementEnrollmentViewSet` described below.
Class description:
Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment
Method signatures and docstrings:
- def _verify_course_run_for_entitlement(self, ... | Implement the Python class `EntitlementEnrollmentViewSet` described below.
Class description:
Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment
Method signatures and docstrings:
- def _verify_course_run_for_entitlement(self, ... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class EntitlementEnrollmentViewSet:
"""Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment"""
def _verify_course_run_for_entitlement(self, entitlement, course_run_id):
"""Verifies that a Course run i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntitlementEnrollmentViewSet:
"""Endpoint in the Entitlement API to handle the Enrollment of a User's Entitlement. This API will handle - Enroll - Unenroll - Switch Enrollment"""
def _verify_course_run_for_entitlement(self, entitlement, course_run_id):
"""Verifies that a Course run is a child of ... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/entitlements/rest_api/v1/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
0ea6ca49ff0589f14e14960dbf9e58d3e4f3dc14 | [
"log.debug('AquadoppDwVelocityDataParticle: raw data =%r', self.raw_data)\nmatch = VELOCITY_DATA_REGEX.match(self.raw_data)\nif not match:\n raise SampleException('AquadoppDwVelocityDataParticle: No regex match of parsed sample data: [%s]' % self.raw_data)\nresult = self._build_particle(match)\nlog.debug('Aquado... | <|body_start_0|>
log.debug('AquadoppDwVelocityDataParticle: raw data =%r', self.raw_data)
match = VELOCITY_DATA_REGEX.match(self.raw_data)
if not match:
raise SampleException('AquadoppDwVelocityDataParticle: No regex match of parsed sample data: [%s]' % self.raw_data)
result ... | Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor. | AquadoppDwVelocityDataParticle | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AquadoppDwVelocityDataParticle:
"""Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor."""
def _build_parsed_values(self):
"""Take the velocity data sample and parse it into values with appropriate tags. @throws SampleException If there is a pr... | stack_v2_sparse_classes_36k_train_012602 | 47,350 | permissive | [
{
"docstring": "Take the velocity data sample and parse it into values with appropriate tags. @throws SampleException If there is a problem with sample creation",
"name": "_build_parsed_values",
"signature": "def _build_parsed_values(self)"
},
{
"docstring": "Build a particle. Used for parsing V... | 2 | stack_v2_sparse_classes_30k_train_006782 | Implement the Python class `AquadoppDwVelocityDataParticle` described below.
Class description:
Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor.
Method signatures and docstrings:
- def _build_parsed_values(self): Take the velocity data sample and parse it into values with a... | Implement the Python class `AquadoppDwVelocityDataParticle` described below.
Class description:
Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor.
Method signatures and docstrings:
- def _build_parsed_values(self): Take the velocity data sample and parse it into values with a... | a1f2fa611b773cb2ae309fce7b9df2dec6d739d6 | <|skeleton|>
class AquadoppDwVelocityDataParticle:
"""Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor."""
def _build_parsed_values(self):
"""Take the velocity data sample and parse it into values with appropriate tags. @throws SampleException If there is a pr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AquadoppDwVelocityDataParticle:
"""Routine for parsing velocity data into a data particle structure for the Aquadopp DW sensor."""
def _build_parsed_values(self):
"""Take the velocity data sample and parse it into values with appropriate tags. @throws SampleException If there is a problem with sa... | the_stack_v2_python_sparse | mi/instrument/nortek/aquadopp/ooicore/driver.py | AYCS/marine-integrations | train | 0 |
ab8c179844c1f3c2d89b46561354756b57897fa0 | [
"self.f = f\nself.gp = GP(X_init, Y_init, l, sigma_f)\nself.X_s = np.linspace(start=bounds[0], stop=bounds[1], num=ac_samples)[:, np.newaxis]\nself.xsi = xsi\nself.minimize = minimize",
"mu, sigma = self.gp.predict(self.X_s)\nif self.minimize is True:\n mu_sample_opt = np.min(self.gp.Y)\nelse:\n mu_sample_o... | <|body_start_0|>
self.f = f
self.gp = GP(X_init, Y_init, l, sigma_f)
self.X_s = np.linspace(start=bounds[0], stop=bounds[1], num=ac_samples)[:, np.newaxis]
self.xsi = xsi
self.minimize = minimize
<|end_body_0|>
<|body_start_1|>
mu, sigma = self.gp.predict(self.X_s)
... | The Bayesian Optimization class | BayesianOptimization | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BayesianOptimization:
"""The Bayesian Optimization class"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""init of Bayesian Optimization"""
<|body_0|>
def acquisition(self):
"""Acquires X_next, and Expectati... | stack_v2_sparse_classes_36k_train_012603 | 1,177 | no_license | [
{
"docstring": "init of Bayesian Optimization",
"name": "__init__",
"signature": "def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True)"
},
{
"docstring": "Acquires X_next, and Expectation improvement",
"name": "acquisition",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_013361 | Implement the Python class `BayesianOptimization` described below.
Class description:
The Bayesian Optimization class
Method signatures and docstrings:
- def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): init of Bayesian Optimization
- def acquisition(self): Acquires ... | Implement the Python class `BayesianOptimization` described below.
Class description:
The Bayesian Optimization class
Method signatures and docstrings:
- def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True): init of Bayesian Optimization
- def acquisition(self): Acquires ... | 4200798bdbbe828db94e5585b62a595e3a96c3e6 | <|skeleton|>
class BayesianOptimization:
"""The Bayesian Optimization class"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""init of Bayesian Optimization"""
<|body_0|>
def acquisition(self):
"""Acquires X_next, and Expectati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BayesianOptimization:
"""The Bayesian Optimization class"""
def __init__(self, f, X_init, Y_init, bounds, ac_samples, l=1, sigma_f=1, xsi=0.01, minimize=True):
"""init of Bayesian Optimization"""
self.f = f
self.gp = GP(X_init, Y_init, l, sigma_f)
self.X_s = np.linspace(st... | the_stack_v2_python_sparse | unsupervised_learning/0x03-hyperparameter_tuning/4-bayes_opt.py | JohnCook17/holbertonschool-machine_learning | train | 3 |
2328ea021016837fb5391277e2d0e8bc9a646ad8 | [
"import heapq\ndummy = ListNode(0)\np = dummy\nhead = []\nfor i in range(len(lists)):\n if lists[i]:\n heapq.heappush(head, (lists[i].val, i))\n lists[i] = lists[i].next\nwhile head:\n val, idx = heapq.heappop(head)\n p.next = ListNode(val)\n p = p.next\n if lists[idx]:\n heapq.h... | <|body_start_0|>
import heapq
dummy = ListNode(0)
p = dummy
head = []
for i in range(len(lists)):
if lists[i]:
heapq.heappush(head, (lists[i].val, i))
lists[i] = lists[i].next
while head:
val, idx = heapq.heappop(hea... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""官网解法,使用基于堆的优先级队列 :param lists: :return:"""
<|body_0|>
def showNode(self, node: ListNode) -> list:
"""show all value of ListNode :param node: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_012604 | 3,032 | no_license | [
{
"docstring": "官网解法,使用基于堆的优先级队列 :param lists: :return:",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists: [ListNode]) -> ListNode"
},
{
"docstring": "show all value of ListNode :param node: :return:",
"name": "showNode",
"signature": "def showNode(self, node: ListNode) ... | 2 | stack_v2_sparse_classes_30k_train_016407 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists: [ListNode]) -> ListNode: 官网解法,使用基于堆的优先级队列 :param lists: :return:
- def showNode(self, node: ListNode) -> list: show all value of ListNode :param node... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists: [ListNode]) -> ListNode: 官网解法,使用基于堆的优先级队列 :param lists: :return:
- def showNode(self, node: ListNode) -> list: show all value of ListNode :param node... | fa45cd44c3d4e7b0205833efcdc708d1638cbbe4 | <|skeleton|>
class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""官网解法,使用基于堆的优先级队列 :param lists: :return:"""
<|body_0|>
def showNode(self, node: ListNode) -> list:
"""show all value of ListNode :param node: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""官网解法,使用基于堆的优先级队列 :param lists: :return:"""
import heapq
dummy = ListNode(0)
p = dummy
head = []
for i in range(len(lists)):
if lists[i]:
heapq.heappush(head, (lists[i]... | the_stack_v2_python_sparse | Python/t23.py | g-lyc/LeetCode | train | 15 | |
18721a09cc7ae642a7a07738a0419493be69c38e | [
"self.name = name\nself.grid = grid\nself.reward = reward\nself.num_actions = 4\nself.discount = discount\nfile_name = 'world_{}_run.pickle'.format(name)\nwith open(file_name, 'rb') as run_file:\n self.run = pickle.load(run_file)\nstart = np.where(self.grid == 'S')\nself.start_state = (start[0][0], start[1][0])\... | <|body_start_0|>
self.name = name
self.grid = grid
self.reward = reward
self.num_actions = 4
self.discount = discount
file_name = 'world_{}_run.pickle'.format(name)
with open(file_name, 'rb') as run_file:
self.run = pickle.load(run_file)
start ... | World | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class World:
def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float):
"""Create the World object"""
<|body_0|>
def make_move_det(self, dir_intended: int, n_sa) -> State:
"""Given the current state (self.curr_state) and the intended direction (dir_in... | stack_v2_sparse_classes_36k_train_012605 | 6,713 | no_license | [
{
"docstring": "Create the World object",
"name": "__init__",
"signature": "def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float)"
},
{
"docstring": "Given the current state (self.curr_state) and the intended direction (dir_intended), make a move (using the pre-determin... | 2 | stack_v2_sparse_classes_30k_train_014097 | Implement the Python class `World` described below.
Class description:
Implement the World class.
Method signatures and docstrings:
- def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float): Create the World object
- def make_move_det(self, dir_intended: int, n_sa) -> State: Given the current ... | Implement the Python class `World` described below.
Class description:
Implement the World class.
Method signatures and docstrings:
- def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float): Create the World object
- def make_move_det(self, dir_intended: int, n_sa) -> State: Given the current ... | 34160e2ba607826f7696055d190f6a7905530582 | <|skeleton|>
class World:
def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float):
"""Create the World object"""
<|body_0|>
def make_move_det(self, dir_intended: int, n_sa) -> State:
"""Given the current state (self.curr_state) and the intended direction (dir_in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class World:
def __init__(self, name: str, grid: np.ndarray, reward: float, discount: float):
"""Create the World object"""
self.name = name
self.grid = grid
self.reward = reward
self.num_actions = 4
self.discount = discount
file_name = 'world_{}_run.pickle'.f... | the_stack_v2_python_sparse | Asg4/code_posted/rl_provided.py | StellarrZ/cs686-repo | train | 0 | |
34e8e7061503d3b1d681bc0905aa6cbc876464a7 | [
"self.line_items = []\nself.bills = {}\nself.projects = {}\nself.products = {}\nself.requested_partitions = set()",
"self.line_items = []\nself.projects = {}\nself.products = {}\nself.bills = {}"
] | <|body_start_0|>
self.line_items = []
self.bills = {}
self.projects = {}
self.products = {}
self.requested_partitions = set()
<|end_body_0|>
<|body_start_1|>
self.line_items = []
self.projects = {}
self.products = {}
self.bills = {}
<|end_body_1|>... | Kept in memory object of report items. | ProcessedGCPReport | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessedGCPReport:
"""Kept in memory object of report items."""
def __init__(self):
"""Initialize new cost entry containers."""
<|body_0|>
def remove_processed_rows(self):
"""Clear a batch of rows after they've been saved."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_012606 | 15,731 | permissive | [
{
"docstring": "Initialize new cost entry containers.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Clear a batch of rows after they've been saved.",
"name": "remove_processed_rows",
"signature": "def remove_processed_rows(self)"
}
] | 2 | null | Implement the Python class `ProcessedGCPReport` described below.
Class description:
Kept in memory object of report items.
Method signatures and docstrings:
- def __init__(self): Initialize new cost entry containers.
- def remove_processed_rows(self): Clear a batch of rows after they've been saved. | Implement the Python class `ProcessedGCPReport` described below.
Class description:
Kept in memory object of report items.
Method signatures and docstrings:
- def __init__(self): Initialize new cost entry containers.
- def remove_processed_rows(self): Clear a batch of rows after they've been saved.
<|skeleton|>
clas... | 2979f03fbdd1c20c3abc365a963a1282b426f321 | <|skeleton|>
class ProcessedGCPReport:
"""Kept in memory object of report items."""
def __init__(self):
"""Initialize new cost entry containers."""
<|body_0|>
def remove_processed_rows(self):
"""Clear a batch of rows after they've been saved."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcessedGCPReport:
"""Kept in memory object of report items."""
def __init__(self):
"""Initialize new cost entry containers."""
self.line_items = []
self.bills = {}
self.projects = {}
self.products = {}
self.requested_partitions = set()
def remove_pro... | the_stack_v2_python_sparse | koku/masu/processor/gcp/gcp_report_processor.py | luisfdez/koku | train | 0 |
533090537ef05fc6faa3738b6a8c8bfa6c2ca461 | [
"buf = self.value[:]\nwhile True:\n if len(buf) <= 8:\n break\n next_entry_offset, flags, ea_name_length, ea_value_length = struct.unpack('<LBBH', buf[:8])\n if 9 + ea_name_length + ea_value_length > len(buf) or next_entry_offset > len(buf):\n break\n name = buf[8:8 + ea_name_length + 1]\n... | <|body_start_0|>
buf = self.value[:]
while True:
if len(buf) <= 8:
break
next_entry_offset, flags, ea_name_length, ea_value_length = struct.unpack('<LBBH', buf[:8])
if 9 + ea_name_length + ea_value_length > len(buf) or next_entry_offset > len(buf):
... | $EA. | EA | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EA:
"""$EA."""
def data_parsed(self):
"""Attempt to parse the extended attribute and yield (name, flags, value) tuples."""
<|body_0|>
def print_information(self):
"""Print all information in a human-readable form."""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_012607 | 36,119 | permissive | [
{
"docstring": "Attempt to parse the extended attribute and yield (name, flags, value) tuples.",
"name": "data_parsed",
"signature": "def data_parsed(self)"
},
{
"docstring": "Print all information in a human-readable form.",
"name": "print_information",
"signature": "def print_informati... | 2 | stack_v2_sparse_classes_30k_train_020969 | Implement the Python class `EA` described below.
Class description:
$EA.
Method signatures and docstrings:
- def data_parsed(self): Attempt to parse the extended attribute and yield (name, flags, value) tuples.
- def print_information(self): Print all information in a human-readable form. | Implement the Python class `EA` described below.
Class description:
$EA.
Method signatures and docstrings:
- def data_parsed(self): Attempt to parse the extended attribute and yield (name, flags, value) tuples.
- def print_information(self): Print all information in a human-readable form.
<|skeleton|>
class EA:
... | f9299b8ad0cb2a6bbbd5e65f01d2ba06406c70ac | <|skeleton|>
class EA:
"""$EA."""
def data_parsed(self):
"""Attempt to parse the extended attribute and yield (name, flags, value) tuples."""
<|body_0|>
def print_information(self):
"""Print all information in a human-readable form."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EA:
"""$EA."""
def data_parsed(self):
"""Attempt to parse the extended attribute and yield (name, flags, value) tuples."""
buf = self.value[:]
while True:
if len(buf) <= 8:
break
next_entry_offset, flags, ea_name_length, ea_value_length = st... | the_stack_v2_python_sparse | modules/NTFS/dfir_ntfs/Attributes.py | dfrc-korea/carpe | train | 75 |
66a652ff07569da696c0478841487379c5943f8c | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nnew_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob), 'conv2': ConvBlock2X_to_X(chans + 32, chans, drop_prob)})\nself.dow... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
new_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob), 'conv... | PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. | UnetModelAssistEverywhere | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnetModelAssistEverywhere:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, ... | stack_v2_sparse_classes_36k_train_012608 | 15,577 | no_license | [
{
"docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ... | 2 | stack_v2_sparse_classes_30k_train_015953 | Implement the Python class `UnetModelAssistEverywhere` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computi... | Implement the Python class `UnetModelAssistEverywhere` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computi... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class UnetModelAssistEverywhere:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnetModelAssistEverywhere:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241... | the_stack_v2_python_sparse | lemawarersn_unet_conv_redundancy_removed/unetmodels.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
4d0b5892854eab2e51a6bad35a5f2cb2a2c884ee | [
"event_key = headers.get('X-GitHub-Event')\nif event_key not in GitHubEventTypes.values():\n raise UnrecognizableEventType('Unrecognizable event type', detail='Unrecognizable event type ({})'.format(event_key))\nif event_key == GitHubEventTypes.PING:\n return cls._translate_ping()\nelif event_key == GitHubEve... | <|body_start_0|>
event_key = headers.get('X-GitHub-Event')
if event_key not in GitHubEventTypes.values():
raise UnrecognizableEventType('Unrecognizable event type', detail='Unrecognizable event type ({})'.format(event_key))
if event_key == GitHubEventTypes.PING:
return cl... | GitHub event translator. | GitHubEventTranslator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GitHubEventTranslator:
"""GitHub event translator."""
def translate(cls, payload, headers=None):
"""Translate event. :param payload: :param headers: :return:"""
<|body_0|>
def _translate_ping(cls):
"""Translate ping event. :return:"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_012609 | 7,656 | permissive | [
{
"docstring": "Translate event. :param payload: :param headers: :return:",
"name": "translate",
"signature": "def translate(cls, payload, headers=None)"
},
{
"docstring": "Translate ping event. :return:",
"name": "_translate_ping",
"signature": "def _translate_ping(cls)"
},
{
"d... | 6 | null | Implement the Python class `GitHubEventTranslator` described below.
Class description:
GitHub event translator.
Method signatures and docstrings:
- def translate(cls, payload, headers=None): Translate event. :param payload: :param headers: :return:
- def _translate_ping(cls): Translate ping event. :return:
- def _tra... | Implement the Python class `GitHubEventTranslator` described below.
Class description:
GitHub event translator.
Method signatures and docstrings:
- def translate(cls, payload, headers=None): Translate event. :param payload: :param headers: :return:
- def _translate_ping(cls): Translate ping event. :return:
- def _tra... | 8601d652476cd30457961aaf9feac143fd437606 | <|skeleton|>
class GitHubEventTranslator:
"""GitHub event translator."""
def translate(cls, payload, headers=None):
"""Translate event. :param payload: :param headers: :return:"""
<|body_0|>
def _translate_ping(cls):
"""Translate ping event. :return:"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GitHubEventTranslator:
"""GitHub event translator."""
def translate(cls, payload, headers=None):
"""Translate event. :param payload: :param headers: :return:"""
event_key = headers.get('X-GitHub-Event')
if event_key not in GitHubEventTypes.values():
raise Unrecognizabl... | the_stack_v2_python_sparse | devops/src/ax/devops/gateway/event_translators/github.py | durgeshsanagaram/argo | train | 1 |
1d2d71749b95fd8f3564daa857aeb6f78c7d0512 | [
"if VirtApiFactory._virt is None:\n VirtApiFactory._virt = VirtApiFactory._implement(virt_sw, virt_connection)\nreturn VirtApiFactory._virt",
"if virt_sw == 'vmware':\n return VirtVmware(virt_connection)\nelse:\n raise VirtException(ErrorMessages.CONFIGURATION_ERROR)"
] | <|body_start_0|>
if VirtApiFactory._virt is None:
VirtApiFactory._virt = VirtApiFactory._implement(virt_sw, virt_connection)
return VirtApiFactory._virt
<|end_body_0|>
<|body_start_1|>
if virt_sw == 'vmware':
return VirtVmware(virt_connection)
else:
r... | Class to get any implement | VirtApiFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VirtApiFactory:
"""Class to get any implement"""
def get_connection(virt_sw: str, virt_connection: str) -> VirtApi:
"""Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:"""
<|body_0|>
def _implement(virt_sw: str, vir... | stack_v2_sparse_classes_36k_train_012610 | 1,124 | no_license | [
{
"docstring": "Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:",
"name": "get_connection",
"signature": "def get_connection(virt_sw: str, virt_connection: str) -> VirtApi"
},
{
"docstring": "Set implementation :param virt_sw: name of imp... | 2 | stack_v2_sparse_classes_30k_train_016967 | Implement the Python class `VirtApiFactory` described below.
Class description:
Class to get any implement
Method signatures and docstrings:
- def get_connection(virt_sw: str, virt_connection: str) -> VirtApi: Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:
- ... | Implement the Python class `VirtApiFactory` described below.
Class description:
Class to get any implement
Method signatures and docstrings:
- def get_connection(virt_sw: str, virt_connection: str) -> VirtApi: Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:
- ... | d838937cf92262176faec6a6a833a602dbcd868e | <|skeleton|>
class VirtApiFactory:
"""Class to get any implement"""
def get_connection(virt_sw: str, virt_connection: str) -> VirtApi:
"""Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:"""
<|body_0|>
def _implement(virt_sw: str, vir... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VirtApiFactory:
"""Class to get any implement"""
def get_connection(virt_sw: str, virt_connection: str) -> VirtApi:
"""Get virtualization implementation :param virt_sw: name of implementation software :param virt_connection:"""
if VirtApiFactory._virt is None:
VirtApiFactory._... | the_stack_v2_python_sparse | common/infra_modules/virt_module/impl/virt_api_factory.py | jsmoyam/zserver | train | 0 |
3e5f1255c2276781a1a4f553bef9fa53919a388e | [
"self.model = model\nself.parameters = parameters\nself.data = data\nself.initial_conditions = initial_conditions\nself.fit_method = fit_method\nself.error = error\nself.fit_period = fit_period\nself.result = None\nself.fitted_parameters = None",
"x = odeint(self.model.calibrate, initial_conditions, time_range, a... | <|body_start_0|>
self.model = model
self.parameters = parameters
self.data = data
self.initial_conditions = initial_conditions
self.fit_method = fit_method
self.error = error
self.fit_period = fit_period
self.result = None
self.fitted_parameters = ... | Class to perform solutions and parameter-fitting of epidemic models | EpidemicModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EpidemicModel:
"""Class to perform solutions and parameter-fitting of epidemic models"""
def __init__(self, model: Type[CompartmentalModel], parameters: tuple=None, data: np.array=None, initial_conditions: list=None, fit_method: str='leastsq', error: callable=None, fit_period: float=None):
... | stack_v2_sparse_classes_36k_train_012611 | 29,649 | permissive | [
{
"docstring": "A class to standardize fitting and solving epidemiological models. :param model: the model to use, currently a class in the form of SIR, SEIR above :param parameters: tuple, parameters to use for the model, defaults to the output of [model].get_parameters :param data: np.array, data that can be ... | 4 | null | Implement the Python class `EpidemicModel` described below.
Class description:
Class to perform solutions and parameter-fitting of epidemic models
Method signatures and docstrings:
- def __init__(self, model: Type[CompartmentalModel], parameters: tuple=None, data: np.array=None, initial_conditions: list=None, fit_met... | Implement the Python class `EpidemicModel` described below.
Class description:
Class to perform solutions and parameter-fitting of epidemic models
Method signatures and docstrings:
- def __init__(self, model: Type[CompartmentalModel], parameters: tuple=None, data: np.array=None, initial_conditions: list=None, fit_met... | 4cf8ec75c4d85b16ec08371c46cc1a9ede9d72a2 | <|skeleton|>
class EpidemicModel:
"""Class to perform solutions and parameter-fitting of epidemic models"""
def __init__(self, model: Type[CompartmentalModel], parameters: tuple=None, data: np.array=None, initial_conditions: list=None, fit_method: str='leastsq', error: callable=None, fit_period: float=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EpidemicModel:
"""Class to perform solutions and parameter-fitting of epidemic models"""
def __init__(self, model: Type[CompartmentalModel], parameters: tuple=None, data: np.array=None, initial_conditions: list=None, fit_method: str='leastsq', error: callable=None, fit_period: float=None):
"""A c... | the_stack_v2_python_sparse | gs_quant/models/epidemiology.py | goldmansachs/gs-quant | train | 2,088 |
5387360372fa674be695cc9aa2ef1c0cb4c8a047 | [
"self.assertTrue(geneutil.longestRun('AAAAA', 'A') == 5)\nself.assertTrue(geneutil.longestRun('AAATAA', 'A', 1) == 6)\nself.assertTrue(geneutil.longestRun('AAATTAA', 'A', 1) == 3)\nself.assertTrue(geneutil.longestRun('AAATTAA', 'A', 2) == 7)\nself.assertTrue(geneutil.longestRun('TAAATAA', 'A', 1) == 6)\nself.assert... | <|body_start_0|>
self.assertTrue(geneutil.longestRun('AAAAA', 'A') == 5)
self.assertTrue(geneutil.longestRun('AAATAA', 'A', 1) == 6)
self.assertTrue(geneutil.longestRun('AAATTAA', 'A', 1) == 3)
self.assertTrue(geneutil.longestRun('AAATTAA', 'A', 2) == 7)
self.assertTrue(geneutil.... | test001 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test001:
def test_longest_run(self):
"""Longest run testcases"""
<|body_0|>
def test_longest_run_mult(self):
"""Longest run testcases with more than one target"""
<|body_1|>
def test_max_sliding_count(self):
"""Max Sliding Count testcases"""
... | stack_v2_sparse_classes_36k_train_012612 | 2,692 | no_license | [
{
"docstring": "Longest run testcases",
"name": "test_longest_run",
"signature": "def test_longest_run(self)"
},
{
"docstring": "Longest run testcases with more than one target",
"name": "test_longest_run_mult",
"signature": "def test_longest_run_mult(self)"
},
{
"docstring": "Ma... | 3 | stack_v2_sparse_classes_30k_train_008593 | Implement the Python class `test001` described below.
Class description:
Implement the test001 class.
Method signatures and docstrings:
- def test_longest_run(self): Longest run testcases
- def test_longest_run_mult(self): Longest run testcases with more than one target
- def test_max_sliding_count(self): Max Sliding... | Implement the Python class `test001` described below.
Class description:
Implement the test001 class.
Method signatures and docstrings:
- def test_longest_run(self): Longest run testcases
- def test_longest_run_mult(self): Longest run testcases with more than one target
- def test_max_sliding_count(self): Max Sliding... | d7ddd2b585a841c6d986974a24a53e4d1abe71ba | <|skeleton|>
class test001:
def test_longest_run(self):
"""Longest run testcases"""
<|body_0|>
def test_longest_run_mult(self):
"""Longest run testcases with more than one target"""
<|body_1|>
def test_max_sliding_count(self):
"""Max Sliding Count testcases"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test001:
def test_longest_run(self):
"""Longest run testcases"""
self.assertTrue(geneutil.longestRun('AAAAA', 'A') == 5)
self.assertTrue(geneutil.longestRun('AAATAA', 'A', 1) == 6)
self.assertTrue(geneutil.longestRun('AAATTAA', 'A', 1) == 3)
self.assertTrue(geneutil.lon... | the_stack_v2_python_sparse | src/geneutil_test.py | dad/base | train | 0 | |
d03a7efefd8a3dd762323504effe16184674ba54 | [
"self.year = YEAR(year).year_value\nself.data = data\nself.attribute = attribute\nself.grouping_feature = grouping_feature",
"HistPlot = self.data.hist(column=self.attribute, by=self.grouping_feature, figsize=(10, 15))\nplt.suptitle('Distribution of Incomes by {0} in {1}'.format(self.grouping_feature, self.year),... | <|body_start_0|>
self.year = YEAR(year).year_value
self.data = data
self.attribute = attribute
self.grouping_feature = grouping_feature
<|end_body_0|>
<|body_start_1|>
HistPlot = self.data.hist(column=self.attribute, by=self.grouping_feature, figsize=(10, 15))
plt.suptit... | Graph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def __init__(self, attribute, grouping_feature, year, data):
"""This class defines the variables and tools used to build a histogram or boxplot. @param "attribute": Feature whose distribution we'll be visualizing. (e.g. "Income") @param "grouping_feature": categorical feature used... | stack_v2_sparse_classes_36k_train_012613 | 4,548 | no_license | [
{
"docstring": "This class defines the variables and tools used to build a histogram or boxplot. @param \"attribute\": Feature whose distribution we'll be visualizing. (e.g. \"Income\") @param \"grouping_feature\": categorical feature used to place countries into \"bins\". (e.g. \"Region\") @param \"year\": if ... | 3 | stack_v2_sparse_classes_30k_train_004751 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, attribute, grouping_feature, year, data): This class defines the variables and tools used to build a histogram or boxplot. @param "attribute": Feature whose distribu... | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, attribute, grouping_feature, year, data): This class defines the variables and tools used to build a histogram or boxplot. @param "attribute": Feature whose distribu... | f5bb1e51de4f84ab3dd62d3073aee4f56534afa1 | <|skeleton|>
class Graph:
def __init__(self, attribute, grouping_feature, year, data):
"""This class defines the variables and tools used to build a histogram or boxplot. @param "attribute": Feature whose distribution we'll be visualizing. (e.g. "Income") @param "grouping_feature": categorical feature used... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
def __init__(self, attribute, grouping_feature, year, data):
"""This class defines the variables and tools used to build a histogram or boxplot. @param "attribute": Feature whose distribution we'll be visualizing. (e.g. "Income") @param "grouping_feature": categorical feature used to place coun... | the_stack_v2_python_sparse | ba1303/functions_and_classes.py | ds-ga-1007/assignment9 | train | 2 | |
e15d11980028d64bf3e9eee0f8f1f77d197ae249 | [
"ObjectManager.__init__(self)\nself.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time'})\nself.setters.update({'date_completed': 'set_time', 'date_started': 'set_time'})\nself.my_django_model = facade.models.AssignmentAttempt\nself.subclass_manager_map = {'exam... | <|body_start_0|>
ObjectManager.__init__(self)
self.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time'})
self.setters.update({'date_completed': 'set_time', 'date_started': 'set_time'})
self.my_django_model = facade.models.AssignmentAt... | Manage AssignmentAttempts in the Power Reg system | AssignmentAttemptManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssignmentAttemptManager:
"""Manage AssignmentAttempts in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def _create(self, auth_token, assignment):
"""create the appropriate subtype of AssignmentAttempt :param assignment: instance of an ... | stack_v2_sparse_classes_36k_train_012614 | 1,793 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "create the appropriate subtype of AssignmentAttempt :param assignment: instance of an assignment :type assignment: facade.models.Assignment :return: whatever the sub-class's manager returns",
... | 2 | null | Implement the Python class `AssignmentAttemptManager` described below.
Class description:
Manage AssignmentAttempts in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def _create(self, auth_token, assignment): create the appropriate subtype of AssignmentAttempt :param assign... | Implement the Python class `AssignmentAttemptManager` described below.
Class description:
Manage AssignmentAttempts in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def _create(self, auth_token, assignment): create the appropriate subtype of AssignmentAttempt :param assign... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class AssignmentAttemptManager:
"""Manage AssignmentAttempts in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def _create(self, auth_token, assignment):
"""create the appropriate subtype of AssignmentAttempt :param assignment: instance of an ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AssignmentAttemptManager:
"""Manage AssignmentAttempts in the Power Reg system"""
def __init__(self):
"""constructor"""
ObjectManager.__init__(self)
self.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time'})
self.setter... | the_stack_v2_python_sparse | pr_services/credential_system/assignment_attempt_manager.py | ninemoreminutes/openassign-server | train | 0 |
840546d62b0cbc8021436094f16664c2267817a2 | [
"if include:\n return {c.name: getattr(self, c.name) for c in self.__table__.columns if c.name in include}\nelse:\n return {c.name: getattr(self, c.name) for c in self.__table__.columns if c.name not in excluded}",
"for key, value in search_dict:\n if not isinstance(key, (wtforms.Field, str)) and (not is... | <|body_start_0|>
if include:
return {c.name: getattr(self, c.name) for c in self.__table__.columns if c.name in include}
else:
return {c.name: getattr(self, c.name) for c in self.__table__.columns if c.name not in excluded}
<|end_body_0|>
<|body_start_1|>
for key, value ... | Base model class that includes CRUD convenience methods. | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""Base model class that includes CRUD convenience methods."""
def to_dict(self, excluded=(), include=()):
"""将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典"""
<|body_0|>
def form_filter(cls, search_dict):
"""多个条件查询 :par... | stack_v2_sparse_classes_36k_train_012615 | 3,070 | no_license | [
{
"docstring": "将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典",
"name": "to_dict",
"signature": "def to_dict(self, excluded=(), include=())"
},
{
"docstring": "多个条件查询 :param search_dict: :return:",
"name": "form_filter",
"signature": "def form_filter(... | 2 | null | Implement the Python class `Model` described below.
Class description:
Base model class that includes CRUD convenience methods.
Method signatures and docstrings:
- def to_dict(self, excluded=(), include=()): 将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典
- def form_filter(cls, sear... | Implement the Python class `Model` described below.
Class description:
Base model class that includes CRUD convenience methods.
Method signatures and docstrings:
- def to_dict(self, excluded=(), include=()): 将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典
- def form_filter(cls, sear... | 471c4af95d3a7222d6933afc571a8e52e8fe4aee | <|skeleton|>
class Model:
"""Base model class that includes CRUD convenience methods."""
def to_dict(self, excluded=(), include=()):
"""将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典"""
<|body_0|>
def form_filter(cls, search_dict):
"""多个条件查询 :par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model:
"""Base model class that includes CRUD convenience methods."""
def to_dict(self, excluded=(), include=()):
"""将一条数据库记录转换为字典 :param model: 数据库记录 :param attrs_excluded: 需要过滤的字段 :return: 返回转换后的字典"""
if include:
return {c.name: getattr(self, c.name) for c in self.__table__.... | the_stack_v2_python_sparse | python/uline/uline/uline/model/uline/base.py | apollowesley/Demo | train | 0 |
a34d1ca3a8b4ec696bdadbb45bc93c83c2bd6a7d | [
"self.loc = loc\nself.scale = scale\nself.NG = NormalDist()\nsuper().__init__(ContinuousSpace(-np.inf, np.inf))",
"y1 = self.NG.sample(num_samples)\ny2 = self.NG.sample(num_samples)\nreturn self.scale * (y1 / y2) + self.loc",
"loc = self.loc\nscale = self.scale\nv = m.pi * self.scale * (1 + np.square((x - loc) ... | <|body_start_0|>
self.loc = loc
self.scale = scale
self.NG = NormalDist()
super().__init__(ContinuousSpace(-np.inf, np.inf))
<|end_body_0|>
<|body_start_1|>
y1 = self.NG.sample(num_samples)
y2 = self.NG.sample(num_samples)
return self.scale * (y1 / y2) + self.loc... | Simple cauchy distribution. | CauchyDist | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
<|body_0|>
def sample(self, num_samples=1):
"""Generat... | stack_v2_sparse_classes_36k_train_012616 | 1,451 | permissive | [
{
"docstring": "Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution",
"name": "__init__",
"signature": "def __init__(self, loc=1, scale=1)"
},
{
"docstring": "Generate random numbers from Cauchy(mean,scale) by using ratio of no... | 3 | stack_v2_sparse_classes_30k_train_001283 | Implement the Python class `CauchyDist` described below.
Class description:
Simple cauchy distribution.
Method signatures and docstrings:
- def __init__(self, loc=1, scale=1): Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution
- def sample(self, nu... | Implement the Python class `CauchyDist` described below.
Class description:
Simple cauchy distribution.
Method signatures and docstrings:
- def __init__(self, loc=1, scale=1): Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution
- def sample(self, nu... | 4c854e90bfd4acaa511c1786c96f0610d7aea037 | <|skeleton|>
class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
<|body_0|>
def sample(self, num_samples=1):
"""Generat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CauchyDist:
"""Simple cauchy distribution."""
def __init__(self, loc=1, scale=1):
"""Creates Cauchy(loc, scale) distribution. :param loc Location of the distribution. :param scale Scale of the distribution"""
self.loc = loc
self.scale = scale
self.NG = NormalDist()
... | the_stack_v2_python_sparse | src/continuous/cauchy.py | kosmitive/univariate-distributions | train | 0 |
4eca387528e53aa20835173db4bbc588aa27c96d | [
"super().__init__()\nself.smooth = smooth\nself.criterion = nn.KLDivLoss(size_average=False)\nself.confidence = 1 - smooth\nself.size = size\nself.paddingidx = paddingidx",
"N = x.size(0)\ntrue_dist = x.data.clone()\ntrue_dist.fill_(self.smooth / (self.size - 2))\ntrue_dist.scatter_(1, y.unsqueeze(1), self.confid... | <|body_start_0|>
super().__init__()
self.smooth = smooth
self.criterion = nn.KLDivLoss(size_average=False)
self.confidence = 1 - smooth
self.size = size
self.paddingidx = paddingidx
<|end_body_0|>
<|body_start_1|>
N = x.size(0)
true_dist = x.data.clone()
... | LabelSmoothingLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabelSmoothingLoss:
def __init__(self, size, paddingidx, smooth=0):
"""size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label"""
<|body_0|>
def forward(self, x, y, normalizer):
"""x:(N,size): y:(N,):sparse ... | stack_v2_sparse_classes_36k_train_012617 | 11,927 | no_license | [
{
"docstring": "size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label",
"name": "__init__",
"signature": "def __init__(self, size, paddingidx, smooth=0)"
},
{
"docstring": "x:(N,size): y:(N,):sparse encoding this network first create ... | 2 | stack_v2_sparse_classes_30k_train_003846 | Implement the Python class `LabelSmoothingLoss` described below.
Class description:
Implement the LabelSmoothingLoss class.
Method signatures and docstrings:
- def __init__(self, size, paddingidx, smooth=0): size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the ... | Implement the Python class `LabelSmoothingLoss` described below.
Class description:
Implement the LabelSmoothingLoss class.
Method signatures and docstrings:
- def __init__(self, size, paddingidx, smooth=0): size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the ... | 24e60f24b6e442db22507adddd6bf3e2c343c013 | <|skeleton|>
class LabelSmoothingLoss:
def __init__(self, size, paddingidx, smooth=0):
"""size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label"""
<|body_0|>
def forward(self, x, y, normalizer):
"""x:(N,size): y:(N,):sparse ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabelSmoothingLoss:
def __init__(self, size, paddingidx, smooth=0):
"""size:vocab size paddingidx:if target ==paddingidx,the loss for that target is 0 smooth:how much to smooth the label"""
super().__init__()
self.smooth = smooth
self.criterion = nn.KLDivLoss(size_average=False... | the_stack_v2_python_sparse | daily/8/pytorch_tutoral/nmt/model.py | mckjzhangxk/deepAI | train | 1 | |
eec746f1bf7a9e5576bfe0edd5e9b04f8d44be19 | [
"Frame.__init__(self, parent)\nself.pack()\nEd.make_widgets(self)\nEd.new_problem(self)",
"self.exp = Entry(self)\nself.exp.grid(row=0, column=0)\nself.res = Entry(self)\nself.res.grid(row=0, column=1)\nButton(self, text='Enter', command=self.evaluate).grid(row=0, column=3)",
"temp1 = randrange(1, 10)\ntemp2 = ... | <|body_start_0|>
Frame.__init__(self, parent)
self.pack()
Ed.make_widgets(self)
Ed.new_problem(self)
<|end_body_0|>
<|body_start_1|>
self.exp = Entry(self)
self.exp.grid(row=0, column=0)
self.res = Entry(self)
self.res.grid(row=0, column=1)
Button... | Simple arithmetic education app | Ed | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ed:
"""Simple arithmetic education app"""
def __init__(self, parent=None):
"""constructor"""
<|body_0|>
def make_widgets(self):
"""defines Ed widgets"""
<|body_1|>
def new_problem(self):
"""creates new arithmetic problem"""
<|body_2|>... | stack_v2_sparse_classes_36k_train_012618 | 4,468 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "defines Ed widgets",
"name": "make_widgets",
"signature": "def make_widgets(self)"
},
{
"docstring": "creates new arithmetic problem",
"name": "new_problem",
... | 4 | stack_v2_sparse_classes_30k_train_004910 | Implement the Python class `Ed` described below.
Class description:
Simple arithmetic education app
Method signatures and docstrings:
- def __init__(self, parent=None): constructor
- def make_widgets(self): defines Ed widgets
- def new_problem(self): creates new arithmetic problem
- def evaluate(self): handles button... | Implement the Python class `Ed` described below.
Class description:
Simple arithmetic education app
Method signatures and docstrings:
- def __init__(self, parent=None): constructor
- def make_widgets(self): defines Ed widgets
- def new_problem(self): creates new arithmetic problem
- def evaluate(self): handles button... | 9524f9df064bf9b1e2d6bdac55e850e1ae2549d9 | <|skeleton|>
class Ed:
"""Simple arithmetic education app"""
def __init__(self, parent=None):
"""constructor"""
<|body_0|>
def make_widgets(self):
"""defines Ed widgets"""
<|body_1|>
def new_problem(self):
"""creates new arithmetic problem"""
<|body_2|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ed:
"""Simple arithmetic education app"""
def __init__(self, parent=None):
"""constructor"""
Frame.__init__(self, parent)
self.pack()
Ed.make_widgets(self)
Ed.new_problem(self)
def make_widgets(self):
"""defines Ed widgets"""
self.exp = Entry(s... | the_stack_v2_python_sparse | csc242hw5.py | brandonPauly/pythonToys | train | 0 |
163373fe25c3323235d1139532c49f5c9aa32ddf | [
"self.root = root\nself.tlh = tlh\nself.top_level = Tkinter.Toplevel(self.root)\nself.top_level.transient(self.root)\nself.top_level.grab_set()\nself.top_level.bind('<Return>', self._cancel)\nself.top_level.bind('<Escape>', self._cancel)\nself.top_level.title('Error!')\nif message:\n Tkinter.Label(self.top_level... | <|body_start_0|>
self.root = root
self.tlh = tlh
self.top_level = Tkinter.Toplevel(self.root)
self.top_level.transient(self.root)
self.top_level.grab_set()
self.top_level.bind('<Return>', self._cancel)
self.top_level.bind('<Escape>', self._cancel)
self.top... | show_error_and_exit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class show_error_and_exit:
def __init__(self, root=None, tlh=None, message=None):
"""Display an error message in a widget with an "Exit" button until the button is clicked."""
<|body_0|>
def _cancel(self, event=None):
"""The button has been clicked. Restore the TCL_LIBRARY... | stack_v2_sparse_classes_36k_train_012619 | 13,571 | no_license | [
{
"docstring": "Display an error message in a widget with an \"Exit\" button until the button is clicked.",
"name": "__init__",
"signature": "def __init__(self, root=None, tlh=None, message=None)"
},
{
"docstring": "The button has been clicked. Restore the TCL_LIBRARY environment variable to its... | 2 | stack_v2_sparse_classes_30k_train_006988 | Implement the Python class `show_error_and_exit` described below.
Class description:
Implement the show_error_and_exit class.
Method signatures and docstrings:
- def __init__(self, root=None, tlh=None, message=None): Display an error message in a widget with an "Exit" button until the button is clicked.
- def _cancel... | Implement the Python class `show_error_and_exit` described below.
Class description:
Implement the show_error_and_exit class.
Method signatures and docstrings:
- def __init__(self, root=None, tlh=None, message=None): Display an error message in a widget with an "Exit" button until the button is clicked.
- def _cancel... | bff2d8c9e5e1ead4018f63098c1adea0e0c28184 | <|skeleton|>
class show_error_and_exit:
def __init__(self, root=None, tlh=None, message=None):
"""Display an error message in a widget with an "Exit" button until the button is clicked."""
<|body_0|>
def _cancel(self, event=None):
"""The button has been clicked. Restore the TCL_LIBRARY... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class show_error_and_exit:
def __init__(self, root=None, tlh=None, message=None):
"""Display an error message in a widget with an "Exit" button until the button is clicked."""
self.root = root
self.tlh = tlh
self.top_level = Tkinter.Toplevel(self.root)
self.top_level.transien... | the_stack_v2_python_sparse | adk/tools/packages/menus/pydbgCoredump.py | litterstar7/Qualcomm_BT_Audio | train | 4 | |
8020e48bd85371c334c9f7fd1d44b1b12562e01d | [
"from collections import OrderedDict\nself.capacity = capacity\nself.cache = OrderedDict()",
"if key not in self.cache:\n return -1\nv = self.cache.pop(key)\nself.cache[key] = v\nreturn v",
"if key in self.cache:\n self.cache.pop(key)\nself.cache[key] = value\nwhile len(self.cache) > self.capacity:\n s... | <|body_start_0|>
from collections import OrderedDict
self.capacity = capacity
self.cache = OrderedDict()
<|end_body_0|>
<|body_start_1|>
if key not in self.cache:
return -1
v = self.cache.pop(key)
self.cache[key] = v
return v
<|end_body_1|>
<|body_st... | LRUCache2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache2:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_... | stack_v2_sparse_classes_36k_train_012620 | 3,024 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_017654 | Implement the Python class `LRUCache2` described below.
Class description:
Implement the LRUCache2 class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache2` described below.
Class description:
Implement the LRUCache2 class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|... | 080d3815c3bf568f6dd0a62c8221b4a7a84c2f86 | <|skeleton|>
class LRUCache2:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache2:
def __init__(self, capacity):
""":type capacity: int"""
from collections import OrderedDict
self.capacity = capacity
self.cache = OrderedDict()
def get(self, key):
""":type key: int :rtype: int"""
if key not in self.cache:
return -1
... | the_stack_v2_python_sparse | 146. LRU Cache.py | EastonLee/leetcode_python_solutions | train | 1 | |
205748b941dfe8bdaa322345a11ceb5aa0b242b0 | [
"super().__init__(parent=parent)\nself.setLabel('left', 'I1 (arb.)')\nself.setLabel('bottom', 'I0 (micro J)')\nself.setTitle(f'MCP{idx + 1} correlation')\nself._idx = idx\nself._plot = self.plotScatter(brush=FColor.mkBrush(_DIGITIZER_CHANNEL_COLORS[idx], alpha=150))",
"data = self._data\ni1 = data['i1'][self._idx... | <|body_start_0|>
super().__init__(parent=parent)
self.setLabel('left', 'I1 (arb.)')
self.setLabel('bottom', 'I0 (micro J)')
self.setTitle(f'MCP{idx + 1} correlation')
self._idx = idx
self._plot = self.plotScatter(brush=FColor.mkBrush(_DIGITIZER_CHANNEL_COLORS[idx], alpha=... | XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel. | XasTimCorrelationPlot | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XasTimCorrelationPlot:
"""XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel."""
def __init__(self, idx, *, parent=None):
"""Initialization. :param int idx: channel index."""
<|body_0|>
def refresh(self):
"""Override."""
... | stack_v2_sparse_classes_36k_train_012621 | 13,999 | permissive | [
{
"docstring": "Initialization. :param int idx: channel index.",
"name": "__init__",
"signature": "def __init__(self, idx, *, parent=None)"
},
{
"docstring": "Override.",
"name": "refresh",
"signature": "def refresh(self)"
}
] | 2 | null | Implement the Python class `XasTimCorrelationPlot` described below.
Class description:
XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel.
Method signatures and docstrings:
- def __init__(self, idx, *, parent=None): Initialization. :param int idx: channel index.
- def refresh(self... | Implement the Python class `XasTimCorrelationPlot` described below.
Class description:
XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel.
Method signatures and docstrings:
- def __init__(self, idx, *, parent=None): Initialization. :param int idx: channel index.
- def refresh(self... | a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0 | <|skeleton|>
class XasTimCorrelationPlot:
"""XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel."""
def __init__(self, idx, *, parent=None):
"""Initialization. :param int idx: channel index."""
<|body_0|>
def refresh(self):
"""Override."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XasTimCorrelationPlot:
"""XasTimCorrelationPlot class. Visualize correlation between I0 and I1 for single channel."""
def __init__(self, idx, *, parent=None):
"""Initialization. :param int idx: channel index."""
super().__init__(parent=parent)
self.setLabel('left', 'I1 (arb.)')
... | the_stack_v2_python_sparse | extra_foam/special_suite/xas_tim_w.py | European-XFEL/EXtra-foam | train | 8 |
8249436483100e1df4338b4b208adef1917fe299 | [
"Thread.__init__(self)\nself.name = 'Binary Codec Add Data Thread'\nself.internal_condition = Condition()\nself.alive = True\nself.temp_data = bytes()",
"self.alive = False\nwith self.internal_condition:\n self.internal_condition.notify()\nif self.is_alive():\n self.join()",
"with global_condition:\n s... | <|body_start_0|>
Thread.__init__(self)
self.name = 'Binary Codec Add Data Thread'
self.internal_condition = Condition()
self.alive = True
self.temp_data = bytes()
<|end_body_0|>
<|body_start_1|>
self.alive = False
with self.internal_condition:
self.in... | Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition". | AddDataThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddDataThread:
"""Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition"."""
def __init__(self):
"""Initialize the thread."""
<|body_0|>
def shutdown(self):
"""Shutdown the object. Stop the thread. :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_012622 | 16,372 | no_license | [
{
"docstring": "Initialize the thread.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Shutdown the object. Stop the thread. :return:",
"name": "shutdown",
"signature": "def shutdown(self)"
},
{
"docstring": "Add data to the buffer. Then wakeup the inte... | 4 | null | Implement the Python class `AddDataThread` described below.
Class description:
Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition".
Method signatures and docstrings:
- def __init__(self): Initialize the thread.
- def shutdown(self): Shutdown the object. Stop the thread. :return:
-... | Implement the Python class `AddDataThread` described below.
Class description:
Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition".
Method signatures and docstrings:
- def __init__(self): Initialize the thread.
- def shutdown(self): Shutdown the object. Stop the thread. :return:
-... | 384edef9c14ae5296d7e123eec473b29905a8a58 | <|skeleton|>
class AddDataThread:
"""Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition"."""
def __init__(self):
"""Initialize the thread."""
<|body_0|>
def shutdown(self):
"""Shutdown the object. Stop the thread. :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddDataThread:
"""Receive all incoming data. Buffer the data and wakeup ProcessDataThread with "condition"."""
def __init__(self):
"""Initialize the thread."""
Thread.__init__(self)
self.name = 'Binary Codec Add Data Thread'
self.internal_condition = Condition()
se... | the_stack_v2_python_sparse | Codecs/BinaryCodec.py | ricorx7/rti_python-1 | train | 0 |
8fa3a6eb8cf8725b6be447d74ad2f1d6c6b77081 | [
"super().__init__(name, plug, model, unique_id)\nif self._model == MODEL_POWER_STRIP_V2:\n self._device_features = FEATURE_FLAGS_POWER_STRIP_V2\nelse:\n self._device_features = FEATURE_FLAGS_POWER_STRIP_V1\nself._state_attrs[ATTR_LOAD_POWER] = None\nif self._device_features & FEATURE_SET_POWER_MODE == 1:\n ... | <|body_start_0|>
super().__init__(name, plug, model, unique_id)
if self._model == MODEL_POWER_STRIP_V2:
self._device_features = FEATURE_FLAGS_POWER_STRIP_V2
else:
self._device_features = FEATURE_FLAGS_POWER_STRIP_V1
self._state_attrs[ATTR_LOAD_POWER] = None
... | Representation of a Xiaomi Power Strip. | XiaomiPowerStripSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XiaomiPowerStripSwitch:
"""Representation of a Xiaomi Power Strip."""
def __init__(self, name, plug, model, unique_id):
"""Initialize the plug switch."""
<|body_0|>
async def async_update(self) -> None:
"""Fetch state from the device."""
<|body_1|>
a... | stack_v2_sparse_classes_36k_train_012623 | 36,734 | permissive | [
{
"docstring": "Initialize the plug switch.",
"name": "__init__",
"signature": "def __init__(self, name, plug, model, unique_id)"
},
{
"docstring": "Fetch state from the device.",
"name": "async_update",
"signature": "async def async_update(self) -> None"
},
{
"docstring": "Set t... | 3 | null | Implement the Python class `XiaomiPowerStripSwitch` described below.
Class description:
Representation of a Xiaomi Power Strip.
Method signatures and docstrings:
- def __init__(self, name, plug, model, unique_id): Initialize the plug switch.
- async def async_update(self) -> None: Fetch state from the device.
- async... | Implement the Python class `XiaomiPowerStripSwitch` described below.
Class description:
Representation of a Xiaomi Power Strip.
Method signatures and docstrings:
- def __init__(self, name, plug, model, unique_id): Initialize the plug switch.
- async def async_update(self) -> None: Fetch state from the device.
- async... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class XiaomiPowerStripSwitch:
"""Representation of a Xiaomi Power Strip."""
def __init__(self, name, plug, model, unique_id):
"""Initialize the plug switch."""
<|body_0|>
async def async_update(self) -> None:
"""Fetch state from the device."""
<|body_1|>
a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XiaomiPowerStripSwitch:
"""Representation of a Xiaomi Power Strip."""
def __init__(self, name, plug, model, unique_id):
"""Initialize the plug switch."""
super().__init__(name, plug, model, unique_id)
if self._model == MODEL_POWER_STRIP_V2:
self._device_features = FEAT... | the_stack_v2_python_sparse | homeassistant/components/xiaomi_miio/switch.py | home-assistant/core | train | 35,501 |
d5b188cf33941b0f248c596f975c6cc85397fcd9 | [
"self.nums = {}\nfor i, v in enumerate(nums):\n self.nums[i] = v",
"sum = 0\nfor x in range(i, j + 1):\n sum += self.nums[x]\nreturn sum"
] | <|body_start_0|>
self.nums = {}
for i, v in enumerate(nums):
self.nums[i] = v
<|end_body_0|>
<|body_start_1|>
sum = 0
for x in range(i, j + 1):
sum += self.nums[x]
return sum
<|end_body_1|>
| NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
"""sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_012624 | 1,287 | no_license | [
{
"docstring": "initialize your data structure here. :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, ... | 2 | stack_v2_sparse_classes_30k_train_002639 | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ... | 6de551327f96ec4d4b63d0045281b65bbb4f5d0f | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
"""sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
self.nums = {}
for i, v in enumerate(nums):
self.nums[i] = v
def sumRange(self, i, j):
"""sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtyp... | the_stack_v2_python_sparse | sumRange.py | JingweiTu/leetcode | train | 0 | |
50b31da39114c5e2c1f3dd2111b7ffd849f8769b | [
"extra = self.extra_parameters.copy()\nextra['parent_node_id'] = node['id']\nextra['catalog_id'] = catalog_id\nexpand_model = CatalogStructureModel(self.catalog_name, extra)\nnode['expand_url'] = request.link(expand_model)\nselection_id = node.get('selection_id')\nif selection_id:\n extra['selection_id'] = selec... | <|body_start_0|>
extra = self.extra_parameters.copy()
extra['parent_node_id'] = node['id']
extra['catalog_id'] = catalog_id
expand_model = CatalogStructureModel(self.catalog_name, extra)
node['expand_url'] = request.link(expand_model)
selection_id = node.get('selection_id... | Specialization to retrieve values for structure catalogs | CatalogStructureModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CatalogStructureModel:
"""Specialization to retrieve values for structure catalogs"""
def _adjust_node(self, node, catalog_id, request):
"""Prepares the node for REST. Remove the fields we do not need and add further fields if necessary."""
<|body_0|>
def get_nodes(self,... | stack_v2_sparse_classes_36k_train_012625 | 20,917 | no_license | [
{
"docstring": "Prepares the node for REST. Remove the fields we do not need and add further fields if necessary.",
"name": "_adjust_node",
"signature": "def _adjust_node(self, node, catalog_id, request)"
},
{
"docstring": "Returns a list of dictionaries where every dictionary represents a node.... | 2 | null | Implement the Python class `CatalogStructureModel` described below.
Class description:
Specialization to retrieve values for structure catalogs
Method signatures and docstrings:
- def _adjust_node(self, node, catalog_id, request): Prepares the node for REST. Remove the fields we do not need and add further fields if ... | Implement the Python class `CatalogStructureModel` described below.
Class description:
Specialization to retrieve values for structure catalogs
Method signatures and docstrings:
- def _adjust_node(self, node, catalog_id, request): Prepares the node for REST. Remove the fields we do not need and add further fields if ... | 6bc932c67bc8d93b873838ae6d9fb8d33c72234d | <|skeleton|>
class CatalogStructureModel:
"""Specialization to retrieve values for structure catalogs"""
def _adjust_node(self, node, catalog_id, request):
"""Prepares the node for REST. Remove the fields we do not need and add further fields if necessary."""
<|body_0|>
def get_nodes(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CatalogStructureModel:
"""Specialization to retrieve values for structure catalogs"""
def _adjust_node(self, node, catalog_id, request):
"""Prepares the node for REST. Remove the fields we do not need and add further fields if necessary."""
extra = self.extra_parameters.copy()
ext... | the_stack_v2_python_sparse | site-packages/cs.web-15.3.0.6-py2.7.egg/cs/web/components/ui_support/catalogs.py | prachipainuly-rbei/devops-poc | train | 0 |
f4d8b32220926433d2d1a23a2e1371ff284c648b | [
"super(PatchEmbedding, self).__init__()\nself.out_channels: int = out_channels\nself.linear_embedding: nn.Module = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(patch_size, patch_size), stride=(patch_size, patch_size))\nself.normalization: nn.Module = nn.LayerNorm(normalized_shape=out_c... | <|body_start_0|>
super(PatchEmbedding, self).__init__()
self.out_channels: int = out_channels
self.linear_embedding: nn.Module = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=(patch_size, patch_size), stride=(patch_size, patch_size))
self.normalization: nn.Mod... | Module embeds a given image into patch embeddings. | PatchEmbedding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output chann... | stack_v2_sparse_classes_36k_train_012626 | 41,159 | no_license | [
{
"docstring": "Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output channels :param patch_size: (int) Patch size to be utilized :param image_size: (int) Image size to be used",
"name": "__init__",
"signature": "def __init__(self, in_channels:... | 2 | stack_v2_sparse_classes_30k_train_002646 | Implement the Python class `PatchEmbedding` described below.
Class description:
Module embeds a given image into patch embeddings.
Method signatures and docstrings:
- def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None: Constructor method :param in_channels: (int) Number of input c... | Implement the Python class `PatchEmbedding` described below.
Class description:
Module embeds a given image into patch embeddings.
Method signatures and docstrings:
- def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None: Constructor method :param in_channels: (int) Number of input c... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output chann... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PatchEmbedding:
"""Module embeds a given image into patch embeddings."""
def __init__(self, in_channels: int=3, out_channels: int=96, patch_size: int=4) -> None:
"""Constructor method :param in_channels: (int) Number of input channels :param out_channels: (int) Number of output channels :param pa... | the_stack_v2_python_sparse | generated/test_ChristophReich1996_Swin_Transformer_V2.py | jansel/pytorch-jit-paritybench | train | 35 |
620d38984194a84d9ac2cd73c7d2f32c46085dfb | [
"\"\"\"在__init__中定义的属性,称为静态属性\"\"\"\nself.screen_width = 1000\nself.screen_height = 600\nself.bg_color = (230, 230, 230)\nself.ship_limit = 2\nself.bullet_width = 300\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_max_num = 3\nself.alien_drop_speed = 30\nself.speed_scale = 1.1\nself.score_s... | <|body_start_0|>
"""在__init__中定义的属性,称为静态属性"""
self.screen_width = 1000
self.screen_height = 600
self.bg_color = (230, 230, 230)
self.ship_limit = 2
self.bullet_width = 300
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullet_max_num... | 保存游戏中的所有设置 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化 随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_012627 | 1,265 | no_license | [
{
"docstring": "初始化游戏设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化 随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度",
"name": "increase_speed",
"signature"... | 3 | null | Implement the Python class `Settings` described below.
Class description:
保存游戏中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_settings(self): 初始化 随游戏进行而变化的设置
- def increase_speed(self): 提高速度 | Implement the Python class `Settings` described below.
Class description:
保存游戏中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_settings(self): 初始化 随游戏进行而变化的设置
- def increase_speed(self): 提高速度
<|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
... | 497c933217019046aca0d4258b174a13965348a7 | <|skeleton|>
class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化 随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Settings:
"""保存游戏中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
"""在__init__中定义的属性,称为静态属性"""
self.screen_width = 1000
self.screen_height = 600
self.bg_color = (230, 230, 230)
self.ship_limit = 2
self.bullet_width = 300
self.bullet_height = 15
... | the_stack_v2_python_sparse | python编程从入门到实践/alien_invasion/settings.py | tp-yan/PythonScript | train | 0 |
00fdaa3f56965b058fcda4b23405645b7f476dd3 | [
"length = len(nums)\nprefix, suffix = ([0] * length, [0] * length)\nfor i in range(1, length):\n for j in range(i):\n if nums[j] < nums[i]:\n prefix[i] = max(prefix[i], prefix[j] + 1)\nfor i in range(length - 2, -1, -1):\n for j in range(length - 1, i, -1):\n if nums[j] < nums[i]:\n ... | <|body_start_0|>
length = len(nums)
prefix, suffix = ([0] * length, [0] * length)
for i in range(1, length):
for j in range(i):
if nums[j] < nums[i]:
prefix[i] = max(prefix[i], prefix[j] + 1)
for i in range(length - 2, -1, -1):
... | Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array."""
def minimumMountainRemovals_(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def minimumMountainRemovals(self, nums):
""":type nums: L... | stack_v2_sparse_classes_36k_train_012628 | 1,525 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "minimumMountainRemovals_",
"signature": "def minimumMountainRemovals_(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "minimumMountainRemovals",
"signature": "def minimumMountainRemovals(self, nums)"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array.
Method signatures and docstrings:
- def minimumMountainRemovals_(self, nums): :type nums: List[int] :rtype: int
- def minimumMountainRemovals(self,... | Implement the Python class `Solution` described below.
Class description:
Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array.
Method signatures and docstrings:
- def minimumMountainRemovals_(self, nums): :type nums: List[int] :rtype: int
- def minimumMountainRemovals(self,... | 238995bd23c8a6c40c6035890e94baa2473d4bbc | <|skeleton|>
class Solution:
"""Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array."""
def minimumMountainRemovals_(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def minimumMountainRemovals(self, nums):
""":type nums: L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Find LIS(longest increasing sequence) from start and end. Then check the largest mountain array."""
def minimumMountainRemovals_(self, nums):
""":type nums: List[int] :rtype: int"""
length = len(nums)
prefix, suffix = ([0] * length, [0] * length)
for i in rang... | the_stack_v2_python_sparse | problems/N1671_Minimum_Number_Of_Removals_To_Make_Mountain_Array.py | wan-catherine/Leetcode | train | 5 |
9afbd0641f4ccc1281068af080bf89c89b7b8d75 | [
"WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, CommonLocators.LEVEL_1_MyWifi)))\nassert self.driver.find_element_by_xpath(CommonLocators.LEVEL_1_MyWifi).text == 'My WiFi', CommonLocators.LEVEL_1_MyWifi\nassert self.driver.find_element_by_xpath(RouterManagementLocators.Mesh_Topology)... | <|body_start_0|>
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, CommonLocators.LEVEL_1_MyWifi)))
assert self.driver.find_element_by_xpath(CommonLocators.LEVEL_1_MyWifi).text == 'My WiFi', CommonLocators.LEVEL_1_MyWifi
assert self.driver.find_element_by_xpath(Route... | Language | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Language:
def test_A_set_English(self):
"""语言-成功切换为英文"""
<|body_0|>
def test_B_set_Chinese(self):
"""语言-成功切换为为中文"""
<|body_1|>
def test_C_set_Deutsch(self):
"""语言-成功切换为德文"""
<|body_2|>
def test_D_set_Dutch(self):
"""语言-成功切换为荷... | stack_v2_sparse_classes_36k_train_012629 | 4,481 | no_license | [
{
"docstring": "语言-成功切换为英文",
"name": "test_A_set_English",
"signature": "def test_A_set_English(self)"
},
{
"docstring": "语言-成功切换为为中文",
"name": "test_B_set_Chinese",
"signature": "def test_B_set_Chinese(self)"
},
{
"docstring": "语言-成功切换为德文",
"name": "test_C_set_Deutsch",
... | 4 | stack_v2_sparse_classes_30k_train_006029 | Implement the Python class `Language` described below.
Class description:
Implement the Language class.
Method signatures and docstrings:
- def test_A_set_English(self): 语言-成功切换为英文
- def test_B_set_Chinese(self): 语言-成功切换为为中文
- def test_C_set_Deutsch(self): 语言-成功切换为德文
- def test_D_set_Dutch(self): 语言-成功切换为荷兰语 | Implement the Python class `Language` described below.
Class description:
Implement the Language class.
Method signatures and docstrings:
- def test_A_set_English(self): 语言-成功切换为英文
- def test_B_set_Chinese(self): 语言-成功切换为为中文
- def test_C_set_Deutsch(self): 语言-成功切换为德文
- def test_D_set_Dutch(self): 语言-成功切换为荷兰语
<|skele... | 794cae756d4316c2ad75399e57b24bbce5776210 | <|skeleton|>
class Language:
def test_A_set_English(self):
"""语言-成功切换为英文"""
<|body_0|>
def test_B_set_Chinese(self):
"""语言-成功切换为为中文"""
<|body_1|>
def test_C_set_Deutsch(self):
"""语言-成功切换为德文"""
<|body_2|>
def test_D_set_Dutch(self):
"""语言-成功切换为荷... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Language:
def test_A_set_English(self):
"""语言-成功切换为英文"""
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, CommonLocators.LEVEL_1_MyWifi)))
assert self.driver.find_element_by_xpath(CommonLocators.LEVEL_1_MyWifi).text == 'My WiFi', CommonLocators.LEVEL_1_MyW... | the_stack_v2_python_sparse | rweb/test_language.py | jungaohzz/Practice_1 | train | 0 | |
89d41eadf011da32289d8e71e4f771e6950d6787 | [
"self.convertUnits = convert\nself.eventsDir = os.path.join(processedDataDir, 'events/Neuropix-PXI-100.0/TTL_1/')\nself.infoDir = os.path.join(processedDataDir, 'info')\nchannelsFile = 'channels.npy'\nchannelStatesFile = 'channel_states.npy'\nfullWordsFile = 'full_words.npy'\ntimestampsFile = 'timestamps.npy'\nself... | <|body_start_0|>
self.convertUnits = convert
self.eventsDir = os.path.join(processedDataDir, 'events/Neuropix-PXI-100.0/TTL_1/')
self.infoDir = os.path.join(processedDataDir, 'info')
channelsFile = 'channels.npy'
channelStatesFile = 'channel_states.npy'
fullWordsFile = 'f... | Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort. | Events | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Events:
"""Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort."""
def __init__(self, processedDataDir, convert=True):
""... | stack_v2_sparse_classes_36k_train_012630 | 17,989 | no_license | [
{
"docstring": "Args: processedDataDir (str): path to root of neuropixels raw data for a given session. convert(bool): if True, convert timestamps to seconds.",
"name": "__init__",
"signature": "def __init__(self, processedDataDir, convert=True)"
},
{
"docstring": "Get the onset times for specif... | 2 | null | Implement the Python class `Events` described below.
Class description:
Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort.
Method signatures and docstrin... | Implement the Python class `Events` described below.
Class description:
Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort.
Method signatures and docstrin... | 0a4a0d2700427acf00de0b9ed66f0b64c02fdc43 | <|skeleton|>
class Events:
"""Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort."""
def __init__(self, processedDataDir, convert=True):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Events:
"""Class for loading TTL events. Note that timestamps for events are stored relative to the start of acquisition (play button), not recording. This class can make the right conversion to match spike data from kilosort."""
def __init__(self, processedDataDir, convert=True):
"""Args: proces... | the_stack_v2_python_sparse | jaratoolbox/loadneuropix.py | sjara/jaratoolbox | train | 3 |
8e2d37d3848a28427cf801da86557efa125ccf88 | [
"try:\n natController = NatController()\n json_data = json.loads(request.data.decode())\n natController.add_floating_ip(json_data)\n return Response(status=202)\nexcept Exception as err:\n logging.debug(err)\n return Response(status=500)",
"try:\n natController = NatController()\n if id is... | <|body_start_0|>
try:
natController = NatController()
json_data = json.loads(request.data.decode())
natController.add_floating_ip(json_data)
return Response(status=202)
except Exception as err:
logging.debug(err)
return Response(sta... | Nat_FloatingIP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Nat_FloatingIP:
def post(self):
"""Add a Floating IP"""
<|body_0|>
def get(self, id=None):
"""Get a Floating IP"""
<|body_1|>
def put(self, id):
"""Update a Floating IP"""
<|body_2|>
def delete(self, id):
"""Remove a Floating... | stack_v2_sparse_classes_36k_train_012631 | 6,500 | no_license | [
{
"docstring": "Add a Floating IP",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Get a Floating IP",
"name": "get",
"signature": "def get(self, id=None)"
},
{
"docstring": "Update a Floating IP",
"name": "put",
"signature": "def put(self, id)"
},
{... | 4 | stack_v2_sparse_classes_30k_train_000130 | Implement the Python class `Nat_FloatingIP` described below.
Class description:
Implement the Nat_FloatingIP class.
Method signatures and docstrings:
- def post(self): Add a Floating IP
- def get(self, id=None): Get a Floating IP
- def put(self, id): Update a Floating IP
- def delete(self, id): Remove a Floating IP | Implement the Python class `Nat_FloatingIP` described below.
Class description:
Implement the Nat_FloatingIP class.
Method signatures and docstrings:
- def post(self): Add a Floating IP
- def get(self, id=None): Get a Floating IP
- def put(self, id): Update a Floating IP
- def delete(self, id): Remove a Floating IP
... | b543ca1f90e1463a08e15ab45c7248e1db238327 | <|skeleton|>
class Nat_FloatingIP:
def post(self):
"""Add a Floating IP"""
<|body_0|>
def get(self, id=None):
"""Get a Floating IP"""
<|body_1|>
def put(self, id):
"""Update a Floating IP"""
<|body_2|>
def delete(self, id):
"""Remove a Floating... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Nat_FloatingIP:
def post(self):
"""Add a Floating IP"""
try:
natController = NatController()
json_data = json.loads(request.data.decode())
natController.add_floating_ip(json_data)
return Response(status=202)
except Exception as err:
... | the_stack_v2_python_sparse | configuration-agent/nat/rest_api/resources/floating_ip.py | piscoroma/Configurable-VNF | train | 0 | |
3a267466c38741b0fb948488479f434f9cbdb947 | [
"super().__init__()\nself.fm = FMLayer(dropout_p)\nself.use_bias = use_bias\nif use_bias:\n self.bias = nn.Parameter(torch.zeros((1, 1), names=('B', 'O')))\n nn.init.uniform_(self.bias.data)",
"feat_inputs.names = ('B', 'N', 'E')\nfm_first = feat_inputs.sum(dim='N').rename(E='O')\nfm_second = self.fm(emb_in... | <|body_start_0|>
super().__init__()
self.fm = FMLayer(dropout_p)
self.use_bias = use_bias
if use_bias:
self.bias = nn.Parameter(torch.zeros((1, 1), names=('B', 'O')))
nn.init.uniform_(self.bias.data)
<|end_body_0|>
<|body_start_1|>
feat_inputs.names = ('B... | Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Reference: #. `Steffen Rendle, 2010. Factorization Machine <h... | FactorizationMachineModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Referenc... | stack_v2_sparse_classes_36k_train_012632 | 2,532 | permissive | [
{
"docstring": "Initialize FactorizationMachineModel Args: use_bias (bool, optional): whether the bias constant is added to the input. Defaults to True dropout_p (float, optional): probability of Dropout in FM. Defaults to None",
"name": "__init__",
"signature": "def __init__(self, use_bias: bool=True, ... | 2 | stack_v2_sparse_classes_30k_train_018575 | Implement the Python class `FactorizationMachineModel` described below.
Class description:
Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{... | Implement the Python class `FactorizationMachineModel` described below.
Class description:
Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{... | 751a43b9cd35e951d81c0d9cf46507b1777bb7ff | <|skeleton|>
class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Referenc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Reference: #. `Steffe... | the_stack_v2_python_sparse | torecsys/models/ctr/factorization_machine.py | p768lwy3/torecsys | train | 98 |
44ca53d6280718d50d5b49a3c1a6f28f7f28fc63 | [
"super().__init__()\nself.mask_l2_weight = mask_l2_weight\nself.channel_weight = channel_weight\nself.spatial_weight = spatial_weight\nself.nonloacl_weight = nonloacl_weight\nself.loss_weight = loss_weight",
"losses = 0.0\ns_spatial_mask, s_channel_mask, s_channel_pool_adapt, s_spatial_pool_adapt, s_relation_adap... | <|body_start_0|>
super().__init__()
self.mask_l2_weight = mask_l2_weight
self.channel_weight = channel_weight
self.spatial_weight = spatial_weight
self.nonloacl_weight = nonloacl_weight
self.loss_weight = loss_weight
<|end_body_0|>
<|body_start_1|>
losses = 0.0
... | Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the default value in source code. channe... | FBKDLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FBKDLoss:
"""Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the ... | stack_v2_sparse_classes_36k_train_012633 | 4,435 | permissive | [
{
"docstring": "Inits FBKDLoss.",
"name": "__init__",
"signature": "def __init__(self, mask_l2_weight: float=7e-05, channel_weight: float=0.004, spatial_weight: float=0.004, nonloacl_weight: float=7e-05, loss_weight: float=1.0) -> None"
},
{
"docstring": "Forward function of FBKDLoss, including ... | 2 | stack_v2_sparse_classes_30k_test_000354 | Implement the Python class `FBKDLoss` described below.
Class description:
Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l... | Implement the Python class `FBKDLoss` described below.
Class description:
Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l... | 9d643e88946fc4a24f2d4d073c08b05ea693f4c5 | <|skeleton|>
class FBKDLoss:
"""Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FBKDLoss:
"""Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the default value... | the_stack_v2_python_sparse | cv/distiller/CWD/pytorch/mmrazor/mmrazor/models/losses/fbkd_loss.py | Deep-Spark/DeepSparkHub | train | 7 |
95f8d5cdb04db131eec782075bf3a3abf601f4e7 | [
"self.beta1 = beta1\nself.beta2 = beta2\nself.eps = eps\nmomentums = dict()\nvelocitys = dict()\nfor k, v in model.params.items():\n momentums[k] = np.zeros_like(v)\n velocitys[k] = np.zeros_like(v)\nself.momentums = momentums\nself.velocitys = velocitys\nself.t = 0",
"beta1 = self.beta1\nbeta2 = self.beta2... | <|body_start_0|>
self.beta1 = beta1
self.beta2 = beta2
self.eps = eps
momentums = dict()
velocitys = dict()
for k, v in model.params.items():
momentums[k] = np.zeros_like(v)
velocitys[k] = np.zeros_like(v)
self.momentums = momentums
... | AdamOptim | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdamOptim:
def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08):
"""Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be differen... | stack_v2_sparse_classes_36k_train_012634 | 9,004 | no_license | [
{
"docstring": "Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be different",
"name": "__init__",
"signature": "def __init__(self, model, beta1=0.9, b... | 2 | stack_v2_sparse_classes_30k_train_009724 | Implement the Python class `AdamOptim` described below.
Class description:
Implement the AdamOptim class.
Method signatures and docstrings:
- def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (floa... | Implement the Python class `AdamOptim` described below.
Class description:
Implement the AdamOptim class.
Method signatures and docstrings:
- def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (floa... | a401d09c28432109e9ced10e5011bff97dda05b9 | <|skeleton|>
class AdamOptim:
def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08):
"""Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be differen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdamOptim:
def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08):
"""Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be different"""
s... | the_stack_v2_python_sparse | assignment2/E4040.2017.Assign2.xw2501/E4040.2017.Assign2.xw2501/ecbm4040/optimizers.py | xw2501/Deep_Learning_study | train | 7 | |
3592a21a27eb2d56b9842deac95f857f9d18f577 | [
"self.args = args\nself.tcex = tcex\nself.log = tcex.log",
"resource.args = self.args\nresource.log = self.log\nresource.tcex = self.tcex"
] | <|body_start_0|>
self.args = args
self.tcex = tcex
self.log = tcex.log
<|end_body_0|>
<|body_start_1|>
resource.args = self.args
resource.log = self.log
resource.tcex = self.tcex
<|end_body_1|>
| TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class. | TcExMiddleware | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TcExMiddleware:
"""TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class."""
def __init__(self, args: object, tcex: TcEx):
"""Initialize class properties. Args: args: The argparser arg namespace. tcex: An instance of tcex"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_012635 | 2,205 | permissive | [
{
"docstring": "Initialize class properties. Args: args: The argparser arg namespace. tcex: An instance of tcex",
"name": "__init__",
"signature": "def __init__(self, args: object, tcex: TcEx)"
},
{
"docstring": "Process resource method.",
"name": "process_resource",
"signature": "def pr... | 2 | stack_v2_sparse_classes_30k_train_014034 | Implement the Python class `TcExMiddleware` described below.
Class description:
TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class.
Method signatures and docstrings:
- def __init__(self, args: object, tcex: TcEx): Initialize class properties. Args: args: The argparser arg names... | Implement the Python class `TcExMiddleware` described below.
Class description:
TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class.
Method signatures and docstrings:
- def __init__(self, args: object, tcex: TcEx): Initialize class properties. Args: args: The argparser arg names... | 7cf04fec048fadc71ff851970045b8a587269ccf | <|skeleton|>
class TcExMiddleware:
"""TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class."""
def __init__(self, args: object, tcex: TcEx):
"""Initialize class properties. Args: args: The argparser arg namespace. tcex: An instance of tcex"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TcExMiddleware:
"""TcEx middleware module. Adds access to self.args, self.tcex and self.log in resource Class."""
def __init__(self, args: object, tcex: TcEx):
"""Initialize class properties. Args: args: The argparser arg namespace. tcex: An instance of tcex"""
self.args = args
se... | the_stack_v2_python_sparse | app_init/service_api/app.py | TpyoKnig/tcex | train | 0 |
e5c3032de9833c0924000c84f018ef32ba7a01d3 | [
"text = '\\n Have you ever noticed, in television and movies, that phone numbers and credit cards\\n are obviously fake numbers like 555-123-4567 or 4012 8888 8888 1881? It is because a number\\n that appears to be real, such as 3782-8224631-0005, triggers the attention of privacy and \\n ... | <|body_start_0|>
text = '\n Have you ever noticed, in television and movies, that phone numbers and credit cards\n are obviously fake numbers like 555-123-4567 or 4012 8888 8888 1881? It is because a number\n that appears to be real, such as 3782-8224631-0005, triggers the attention of priv... | TestCCNSafety | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCCNSafety:
def test_ccn_masking_embedded(self):
"""Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in them. Test that numbers that do not pass all the test are unchanged."""
<|body_0|>
def test... | stack_v2_sparse_classes_36k_train_012636 | 3,554 | no_license | [
{
"docstring": "Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in them. Test that numbers that do not pass all the test are unchanged.",
"name": "test_ccn_masking_embedded",
"signature": "def test_ccn_masking_embedded(self)"
... | 6 | stack_v2_sparse_classes_30k_train_014947 | Implement the Python class `TestCCNSafety` described below.
Class description:
Implement the TestCCNSafety class.
Method signatures and docstrings:
- def test_ccn_masking_embedded(self): Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in th... | Implement the Python class `TestCCNSafety` described below.
Class description:
Implement the TestCCNSafety class.
Method signatures and docstrings:
- def test_ccn_masking_embedded(self): Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in th... | f51c1d2d9557c95e869cbce5bff7158f5aa90192 | <|skeleton|>
class TestCCNSafety:
def test_ccn_masking_embedded(self):
"""Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in them. Test that numbers that do not pass all the test are unchanged."""
<|body_0|>
def test... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCCNSafety:
def test_ccn_masking_embedded(self):
"""Tests masking of true test credit numbers embedded in text, specifically Visa and American Express, with dashes and or spaces in them. Test that numbers that do not pass all the test are unchanged."""
text = '\n Have you ever notice... | the_stack_v2_python_sparse | Python 03: The Python Environment/Lesson 05: More On Regular Expressions/test_ccn_safety.py | MTset/Python-Programming-Coursework | train | 0 | |
79c3d93e6f2429690e8ac22c61589cb2f73cca17 | [
"self.registrert_dato_field = APIHelper.RFC3339DateTime(registrert_dato_field) if registrert_dato_field else None\nself.beta_gruppe_kode_field = beta_gruppe_kode_field\nself.beta_gruppe_tekst_field = beta_gruppe_tekst_field\nself.beta_type_field = beta_type_field\nself.beta_tekst_field = beta_tekst_field\nself.beta... | <|body_start_0|>
self.registrert_dato_field = APIHelper.RFC3339DateTime(registrert_dato_field) if registrert_dato_field else None
self.beta_gruppe_kode_field = beta_gruppe_kode_field
self.beta_gruppe_tekst_field = beta_gruppe_tekst_field
self.beta_type_field = beta_type_field
sel... | Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (string): TODO: type description here. beta_type_field (string): TODO: type desc... | BetaDetaljer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BetaDetaljer:
"""Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (string): TODO: type description here. b... | stack_v2_sparse_classes_36k_train_012637 | 5,833 | permissive | [
{
"docstring": "Constructor for the BetaDetaljer class",
"name": "__init__",
"signature": "def __init__(self, registrert_dato_field=None, beta_gruppe_kode_field=None, beta_gruppe_tekst_field=None, beta_type_field=None, beta_tekst_field=None, beta_belop_field=None, kilde_kode_field=None, kilde_tekst_fiel... | 2 | null | Implement the Python class `BetaDetaljer` described below.
Class description:
Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (... | Implement the Python class `BetaDetaljer` described below.
Class description:
Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class BetaDetaljer:
"""Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (string): TODO: type description here. b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BetaDetaljer:
"""Implementation of the 'BetaDetaljer' model. TODO: type model description here. Attributes: registrert_dato_field (datetime): TODO: type description here. beta_gruppe_kode_field (string): TODO: type description here. beta_gruppe_tekst_field (string): TODO: type description here. beta_type_fiel... | the_stack_v2_python_sparse | idfy_rest_client/models/beta_detaljer.py | dealflowteam/Idfy | train | 0 |
e7e153df9033d8a4eb3ac2ebec93ba112312dea3 | [
"self.node_1 = BinaryTree(1)\nself.node_2 = BinaryTree(2)\nself.node_3 = BinaryTree(3)\nself.node_4 = BinaryTree(4)\nself.node_5 = BinaryTree(5)\nself.node_6 = BinaryTree(6)\nself.node_7 = BinaryTree(7)\nself.node_1.left = self.node_2\nself.node_1.right = self.node_3\nself.node_2.left = self.node_4\nself.node_2.rig... | <|body_start_0|>
self.node_1 = BinaryTree(1)
self.node_2 = BinaryTree(2)
self.node_3 = BinaryTree(3)
self.node_4 = BinaryTree(4)
self.node_5 = BinaryTree(5)
self.node_6 = BinaryTree(6)
self.node_7 = BinaryTree(7)
self.node_1.left = self.node_2
self... | Class with unittests for MaxPathSumInBinaryTree.py | test_MaxPathSumInBinaryTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_MaxPathSumInBinaryTree:
"""Class with unittests for MaxPathSumInBinaryTree.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_012638 | 1,324 | no_license | [
{
"docstring": "Sets up input.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Checks if method works properly.",
"name": "test_user_input",
"signature": "def test_user_input(self)"
}
] | 2 | null | Implement the Python class `test_MaxPathSumInBinaryTree` described below.
Class description:
Class with unittests for MaxPathSumInBinaryTree.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly. | Implement the Python class `test_MaxPathSumInBinaryTree` described below.
Class description:
Class with unittests for MaxPathSumInBinaryTree.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly.
<|skeleton|>
class test_MaxPathSumInBinaryT... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_MaxPathSumInBinaryTree:
"""Class with unittests for MaxPathSumInBinaryTree.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test_MaxPathSumInBinaryTree:
"""Class with unittests for MaxPathSumInBinaryTree.py"""
def setUp(self):
"""Sets up input."""
self.node_1 = BinaryTree(1)
self.node_2 = BinaryTree(2)
self.node_3 = BinaryTree(3)
self.node_4 = BinaryTree(4)
self.node_5 = BinaryT... | the_stack_v2_python_sparse | AlgoExpert_algorithms/Hard/MaxPathSumInBinaryTree/test_MaxPathSumInBinaryTree.py | JakubKazimierski/PythonPortfolio | train | 9 |
7a21f8c4078a95825f26b57f50138744ae448ee9 | [
"super().__init__(sys_argv)\nlog.debug('Supplying Thread information from init of QApplication')\nself.setAttribute(Qt.AA_EnableHighDpiScaling)\nself.setStyle('Fusion')\nself.mainWindow = MainWindow()\nself.mainWindow.setWindowTitle('jet-tracker')\nself.mainWindow.show()",
"if issubclass(exc_type, KeyboardInterru... | <|body_start_0|>
super().__init__(sys_argv)
log.debug('Supplying Thread information from init of QApplication')
self.setAttribute(Qt.AA_EnableHighDpiScaling)
self.setStyle('Fusion')
self.mainWindow = MainWindow()
self.mainWindow.setWindowTitle('jet-tracker')
self.... | App | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class App:
def __init__(self, sys_argv):
"""Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application."""
<|body_0|>
def handle_exception(exc_type, exc_value, exc_traceback):
"""Static method for handling uncaught ... | stack_v2_sparse_classes_36k_train_012639 | 2,711 | permissive | [
{
"docstring": "Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application.",
"name": "__init__",
"signature": "def __init__(self, sys_argv)"
},
{
"docstring": "Static method for handling uncaught exceptions. Parameters: exc_type(type): T... | 2 | stack_v2_sparse_classes_30k_train_005260 | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self, sys_argv): Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application.
- def handle_exception(exc_type, exc_val... | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self, sys_argv): Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application.
- def handle_exception(exc_type, exc_val... | 55a62be17cec19c3e3dc92d3805e72b191b7c112 | <|skeleton|>
class App:
def __init__(self, sys_argv):
"""Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application."""
<|body_0|>
def handle_exception(exc_type, exc_value, exc_traceback):
"""Static method for handling uncaught ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class App:
def __init__(self, sys_argv):
"""Constructor method for the App class. Parameters: sys_argv(list): Command - line arguments passed to the application."""
super().__init__(sys_argv)
log.debug('Supplying Thread information from init of QApplication')
self.setAttribute(Qt.AA_... | the_stack_v2_python_sparse | jet_tracking/main.py | pcdshub/jet_tracking | train | 3 | |
31198dddcf37a5e74c2bb72d72354b75f9dfc8e1 | [
"history_file = os.path.join(self.base_path, 'places.sqlite')\nwith io.open(history_file, mode='rb') as history_filedesc:\n history = firefox3_history.Firefox3History()\n entries = [x for x in history.Parse(history_filedesc)]\nself.assertLen(entries, 1)\ntry:\n dt1 = datetime.datetime(1970, 1, 1)\n dt1 ... | <|body_start_0|>
history_file = os.path.join(self.base_path, 'places.sqlite')
with io.open(history_file, mode='rb') as history_filedesc:
history = firefox3_history.Firefox3History()
entries = [x for x in history.Parse(history_filedesc)]
self.assertLen(entries, 1)
... | Test parsing of Firefox 3 history files. | Firefox3HistoryTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Firefox3HistoryTest:
"""Test parsing of Firefox 3 history files."""
def testBasicParsing(self):
"""Test we can parse a standard file."""
<|body_0|>
def testNewHistoryFile(self):
"""Tests reading of history files written by recent versions of Firefox."""
<... | stack_v2_sparse_classes_36k_train_012640 | 2,258 | permissive | [
{
"docstring": "Test we can parse a standard file.",
"name": "testBasicParsing",
"signature": "def testBasicParsing(self)"
},
{
"docstring": "Tests reading of history files written by recent versions of Firefox.",
"name": "testNewHistoryFile",
"signature": "def testNewHistoryFile(self)"
... | 2 | stack_v2_sparse_classes_30k_train_019939 | Implement the Python class `Firefox3HistoryTest` described below.
Class description:
Test parsing of Firefox 3 history files.
Method signatures and docstrings:
- def testBasicParsing(self): Test we can parse a standard file.
- def testNewHistoryFile(self): Tests reading of history files written by recent versions of ... | Implement the Python class `Firefox3HistoryTest` described below.
Class description:
Test parsing of Firefox 3 history files.
Method signatures and docstrings:
- def testBasicParsing(self): Test we can parse a standard file.
- def testNewHistoryFile(self): Tests reading of history files written by recent versions of ... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class Firefox3HistoryTest:
"""Test parsing of Firefox 3 history files."""
def testBasicParsing(self):
"""Test we can parse a standard file."""
<|body_0|>
def testNewHistoryFile(self):
"""Tests reading of history files written by recent versions of Firefox."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Firefox3HistoryTest:
"""Test parsing of Firefox 3 history files."""
def testBasicParsing(self):
"""Test we can parse a standard file."""
history_file = os.path.join(self.base_path, 'places.sqlite')
with io.open(history_file, mode='rb') as history_filedesc:
history = fi... | the_stack_v2_python_sparse | grr/core/grr_response_core/lib/parsers/firefox3_history_test.py | google/grr | train | 4,683 |
d7a48299debfed85d2acbb5960a27728862e8269 | [
"self.reliability_probabilities = np.array([0.0, 0.4, 0.8])\nself.observation_frequencies = np.array([0.2, 0.6, 1.0])\nself.plugin = Plugin()",
"expected = np.array([0.4, 0.6, 0.8])\nforecast_threshold = np.array([0.2, 0.4, 0.6])\nresult = self.plugin._interpolate(forecast_threshold, self.reliability_probabilitie... | <|body_start_0|>
self.reliability_probabilities = np.array([0.0, 0.4, 0.8])
self.observation_frequencies = np.array([0.2, 0.6, 1.0])
self.plugin = Plugin()
<|end_body_0|>
<|body_start_1|>
expected = np.array([0.4, 0.6, 0.8])
forecast_threshold = np.array([0.2, 0.4, 0.6])
... | Test the _interpolate method. | Test__interpolate | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__interpolate:
"""Test the _interpolate method."""
def setUp(self):
"""Set up data for testing the interpolate method."""
<|body_0|>
def test_unmasked_data(self):
"""Test unmasked data is interpolated and returned as expected."""
<|body_1|>
def t... | stack_v2_sparse_classes_36k_train_012641 | 24,150 | permissive | [
{
"docstring": "Set up data for testing the interpolate method.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test unmasked data is interpolated and returned as expected.",
"name": "test_unmasked_data",
"signature": "def test_unmasked_data(self)"
},
{
"docs... | 5 | null | Implement the Python class `Test__interpolate` described below.
Class description:
Test the _interpolate method.
Method signatures and docstrings:
- def setUp(self): Set up data for testing the interpolate method.
- def test_unmasked_data(self): Test unmasked data is interpolated and returned as expected.
- def test_... | Implement the Python class `Test__interpolate` described below.
Class description:
Test the _interpolate method.
Method signatures and docstrings:
- def setUp(self): Set up data for testing the interpolate method.
- def test_unmasked_data(self): Test unmasked data is interpolated and returned as expected.
- def test_... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test__interpolate:
"""Test the _interpolate method."""
def setUp(self):
"""Set up data for testing the interpolate method."""
<|body_0|>
def test_unmasked_data(self):
"""Test unmasked data is interpolated and returned as expected."""
<|body_1|>
def t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test__interpolate:
"""Test the _interpolate method."""
def setUp(self):
"""Set up data for testing the interpolate method."""
self.reliability_probabilities = np.array([0.0, 0.4, 0.8])
self.observation_frequencies = np.array([0.2, 0.6, 1.0])
self.plugin = Plugin()
def... | the_stack_v2_python_sparse | improver_tests/calibration/reliability_calibration/test_ApplyReliabilityCalibration.py | metoppv/improver | train | 101 |
4304c33b5feefd51c3e986003be3c0b792bb9542 | [
"loop = asyncio.get_running_loop()\nnats = FakeNatsHandler('cubesat_1', '4222', loop=loop, user='a', password='b')\nawait nats.connect()\nshared_storage = {'log_path': './'}\nawait logging_service.create_log_file(nats, shared_storage, None)\nfile_made = False\nfor i in os.listdir():\n if f'log-{datetime.utcnow()... | <|body_start_0|>
loop = asyncio.get_running_loop()
nats = FakeNatsHandler('cubesat_1', '4222', loop=loop, user='a', password='b')
await nats.connect()
shared_storage = {'log_path': './'}
await logging_service.create_log_file(nats, shared_storage, None)
file_made = False
... | Test | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
async def test_create_log_file(self):
"""Testing the creation of the log files"""
<|body_0|>
async def test_print_log(self):
"""Testing printing the log info"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
loop = asyncio.get_running_loop()
... | stack_v2_sparse_classes_36k_train_012642 | 2,565 | permissive | [
{
"docstring": "Testing the creation of the log files",
"name": "test_create_log_file",
"signature": "async def test_create_log_file(self)"
},
{
"docstring": "Testing printing the log info",
"name": "test_print_log",
"signature": "async def test_print_log(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011402 | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- async def test_create_log_file(self): Testing the creation of the log files
- async def test_print_log(self): Testing printing the log info | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- async def test_create_log_file(self): Testing the creation of the log files
- async def test_print_log(self): Testing printing the log info
<|skeleton|>
class Test:
async def test_... | e64372cc4cf71d9db7fe2395ba60d93722fccff6 | <|skeleton|>
class Test:
async def test_create_log_file(self):
"""Testing the creation of the log files"""
<|body_0|>
async def test_print_log(self):
"""Testing printing the log info"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test:
async def test_create_log_file(self):
"""Testing the creation of the log files"""
loop = asyncio.get_running_loop()
nats = FakeNatsHandler('cubesat_1', '4222', loop=loop, user='a', password='b')
await nats.connect()
shared_storage = {'log_path': './'}
awai... | the_stack_v2_python_sparse | simulation/logging/test_logging_service.py | sallyom/spacetech-kubesat | train | 0 | |
c523a7ccd3372b36c130bddd593dc31782023784 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CrossTenantAccessPolicyTarget()",
"from .cross_tenant_access_policy_target_type import CrossTenantAccessPolicyTargetType\nfrom .cross_tenant_access_policy_target_type import CrossTenantAccessPolicyTargetType\nfields: Dict[str, Callable... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return CrossTenantAccessPolicyTarget()
<|end_body_0|>
<|body_start_1|>
from .cross_tenant_access_policy_target_type import CrossTenantAccessPolicyTargetType
from .cross_tenant_access_policy_tar... | CrossTenantAccessPolicyTarget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossTenantAccessPolicyTarget:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicyTarget:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val... | stack_v2_sparse_classes_36k_train_012643 | 3,323 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: CrossTenantAccessPolicyTarget",
"name": "create_from_discriminator_value",
"signature": "def create_from_dis... | 3 | null | Implement the Python class `CrossTenantAccessPolicyTarget` described below.
Class description:
Implement the CrossTenantAccessPolicyTarget class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicyTarget: Creates a new instance of th... | Implement the Python class `CrossTenantAccessPolicyTarget` described below.
Class description:
Implement the CrossTenantAccessPolicyTarget class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicyTarget: Creates a new instance of th... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class CrossTenantAccessPolicyTarget:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicyTarget:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CrossTenantAccessPolicyTarget:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CrossTenantAccessPolicyTarget:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ... | the_stack_v2_python_sparse | msgraph/generated/models/cross_tenant_access_policy_target.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
3c0c88dcecaaef0791230f216f06b9a984ba389b | [
"PlottingComponent.__init__(self, config)\nDecompositionComponent.__init__(self)\nself.frame = None\nself.bulge = None\nself.disk = None\nself.model = None",
"self.setup()\nself.load_images()\nself.plot()",
"log.info('Loading the IRAC 3.6 micron image ...')\npath = fs.join(self.truncation_path, 'IRAC I1.fits')\... | <|body_start_0|>
PlottingComponent.__init__(self, config)
DecompositionComponent.__init__(self)
self.frame = None
self.bulge = None
self.disk = None
self.model = None
<|end_body_0|>
<|body_start_1|>
self.setup()
self.load_images()
self.plot()
<|en... | This class... | DecompositionPlotter | [
"MIT",
"GPL-1.0-or-later",
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-philippe-de-muyter"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DecompositionPlotter:
"""This class..."""
def __init__(self, config=None):
"""The constructor ... :param config: :return:"""
<|body_0|>
def run(self, features=None):
"""This function ... :return:"""
<|body_1|>
def load_images(self):
"""This f... | stack_v2_sparse_classes_36k_train_012644 | 4,395 | permissive | [
{
"docstring": "The constructor ... :param config: :return:",
"name": "__init__",
"signature": "def __init__(self, config=None)"
},
{
"docstring": "This function ... :return:",
"name": "run",
"signature": "def run(self, features=None)"
},
{
"docstring": "This function ... :return... | 4 | stack_v2_sparse_classes_30k_train_002250 | Implement the Python class `DecompositionPlotter` described below.
Class description:
This class...
Method signatures and docstrings:
- def __init__(self, config=None): The constructor ... :param config: :return:
- def run(self, features=None): This function ... :return:
- def load_images(self): This function ... :re... | Implement the Python class `DecompositionPlotter` described below.
Class description:
This class...
Method signatures and docstrings:
- def __init__(self, config=None): The constructor ... :param config: :return:
- def run(self, features=None): This function ... :return:
- def load_images(self): This function ... :re... | 62b2339beb2eb956565e1605d44d92f934361ad7 | <|skeleton|>
class DecompositionPlotter:
"""This class..."""
def __init__(self, config=None):
"""The constructor ... :param config: :return:"""
<|body_0|>
def run(self, features=None):
"""This function ... :return:"""
<|body_1|>
def load_images(self):
"""This f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DecompositionPlotter:
"""This class..."""
def __init__(self, config=None):
"""The constructor ... :param config: :return:"""
PlottingComponent.__init__(self, config)
DecompositionComponent.__init__(self)
self.frame = None
self.bulge = None
self.disk = None
... | the_stack_v2_python_sparse | CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/plotting/decomposition.py | Stargrazer82301/CAAPR | train | 8 |
6d83e3273401ebbafb25ea5d9be6f4f43936e9f6 | [
"super(BaselineDNN, self).__init__()\n...\n...\n...\n...\n...",
"embeddings = ...\nrepresentations = ...\nrepresentations = ...\nlogits = ...\nreturn logits"
] | <|body_start_0|>
super(BaselineDNN, self).__init__()
...
...
...
...
...
<|end_body_0|>
<|body_start_1|>
embeddings = ...
representations = ...
representations = ...
logits = ...
return logits
<|end_body_1|>
| 1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth) | BaselineDNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaselineDNN:
"""1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)"""... | stack_v2_sparse_classes_36k_train_012645 | 1,913 | permissive | [
{
"docstring": "Args: output_size(int): the number of classes embeddings(bool): the 2D matrix with the pretrained embeddings trainable_emb(bool): train (finetune) or freeze the weights the embedding layer",
"name": "__init__",
"signature": "def __init__(self, output_size, embeddings, trainable_emb=False... | 2 | stack_v2_sparse_classes_30k_train_005867 | Implement the Python class `BaselineDNN` described below.
Class description:
1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the represent... | Implement the Python class `BaselineDNN` described below.
Class description:
1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the represent... | 37b06ac0bff1e380335912d9b442f884aeb3476d | <|skeleton|>
class BaselineDNN:
"""1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaselineDNN:
"""1. We embed the words in the input texts using an embedding layer 2. We compute the min, mean, max of the word embeddings in each sample and use it as the feature representation of the sequence. 4. We project with a linear layer the representation to the number of classes.ngth)"""
def __i... | the_stack_v2_python_sparse | lab3/models.py | DidoStoikou/slp-labs | train | 0 |
6d1166eb71c49e2afa4e4cb9d2374abc2276cc61 | [
"super().fit(dataset)\ndataset = dataset.to_numpy()\ndata = dataset.data\nself.meds = np.nanmedian(data, axis=0)\nself.meds[np.isnan(self.meds)] = 0\nreturn self",
"super().transform(dataset)\ndataset = dataset.to_numpy()\ndata = dataset.data\ndata = np.where(np.isnan(data), self.meds, data)\noutput = dataset.emp... | <|body_start_0|>
super().fit(dataset)
dataset = dataset.to_numpy()
data = dataset.data
self.meds = np.nanmedian(data, axis=0)
self.meds[np.isnan(self.meds)] = 0
return self
<|end_body_0|>
<|body_start_1|>
super().transform(dataset)
dataset = dataset.to_nu... | Fillna with median. | FillnaMedian | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FillnaMedian:
"""Fillna with median."""
def fit(self, dataset: NumpyTransformable):
"""Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self."""
<|body_0|>
def transform(self, dataset: NumpyTransformable) -> NumpyDataset:
... | stack_v2_sparse_classes_36k_train_012646 | 9,262 | permissive | [
{
"docstring": "Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.",
"name": "fit",
"signature": "def fit(self, dataset: NumpyTransformable)"
},
{
"docstring": "Transform - fillna with medians. Args: dataset: Pandas or Numpy dataset of categorical fe... | 2 | null | Implement the Python class `FillnaMedian` described below.
Class description:
Fillna with median.
Method signatures and docstrings:
- def fit(self, dataset: NumpyTransformable): Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.
- def transform(self, dataset: NumpyTransfo... | Implement the Python class `FillnaMedian` described below.
Class description:
Fillna with median.
Method signatures and docstrings:
- def fit(self, dataset: NumpyTransformable): Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.
- def transform(self, dataset: NumpyTransfo... | a4c3bfb4f1239d05c5d5d36a386c507c6f561324 | <|skeleton|>
class FillnaMedian:
"""Fillna with median."""
def fit(self, dataset: NumpyTransformable):
"""Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self."""
<|body_0|>
def transform(self, dataset: NumpyTransformable) -> NumpyDataset:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FillnaMedian:
"""Fillna with median."""
def fit(self, dataset: NumpyTransformable):
"""Estimate medians. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self."""
super().fit(dataset)
dataset = dataset.to_numpy()
data = dataset.data
self.med... | the_stack_v2_python_sparse | lightautoml/transformers/numeric.py | sberbank-ai-lab/LightAutoML | train | 851 |
ec8a5e56a5def9f5b20c51aff5d62d7a8b53f5ec | [
"self.f = 1.0\nself.hue = [0.0, 61.74061433447099]\nself.sat = [73.38129496402877, 255.0]\nself.val = [215.55755395683454 * self.f, 255.0 * self.f]\nself.starthsv = (self.hue[0], self.sat[0], self.val[0])\nself.endhsv = (self.hue[1], self.sat[1], self.val[1])",
"imagebw = cv2.cvtColor(source0, cv2.COLOR_BGR2GRAY)... | <|body_start_0|>
self.f = 1.0
self.hue = [0.0, 61.74061433447099]
self.sat = [73.38129496402877, 255.0]
self.val = [215.55755395683454 * self.f, 255.0 * self.f]
self.starthsv = (self.hue[0], self.sat[0], self.val[0])
self.endhsv = (self.hue[1], self.sat[1], self.val[1])
<... | An OpenCV pipeline generated by GRIP. | FindBalls | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindBalls:
"""An OpenCV pipeline generated by GRIP."""
def __init__(self):
"""initializes all values to presets or None if need to be set"""
<|body_0|>
def process(self, source0):
"""Runs the pipeline and sets all outputs to new values."""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_012647 | 2,044 | permissive | [
{
"docstring": "initializes all values to presets or None if need to be set",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Runs the pipeline and sets all outputs to new values.",
"name": "process",
"signature": "def process(self, source0)"
}
] | 2 | null | Implement the Python class `FindBalls` described below.
Class description:
An OpenCV pipeline generated by GRIP.
Method signatures and docstrings:
- def __init__(self): initializes all values to presets or None if need to be set
- def process(self, source0): Runs the pipeline and sets all outputs to new values. | Implement the Python class `FindBalls` described below.
Class description:
An OpenCV pipeline generated by GRIP.
Method signatures and docstrings:
- def __init__(self): initializes all values to presets or None if need to be set
- def process(self, source0): Runs the pipeline and sets all outputs to new values.
<|sk... | 3f12431173b0ac280e0c39839dce3de401d16e99 | <|skeleton|>
class FindBalls:
"""An OpenCV pipeline generated by GRIP."""
def __init__(self):
"""initializes all values to presets or None if need to be set"""
<|body_0|>
def process(self, source0):
"""Runs the pipeline and sets all outputs to new values."""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FindBalls:
"""An OpenCV pipeline generated by GRIP."""
def __init__(self):
"""initializes all values to presets or None if need to be set"""
self.f = 1.0
self.hue = [0.0, 61.74061433447099]
self.sat = [73.38129496402877, 255.0]
self.val = [215.55755395683454 * self... | the_stack_v2_python_sparse | 2018 Pipeline/findballs.py | uutzinger/BucketVision | train | 1 |
078ec46bfe3bea2e1b94adc344679e120ef203a3 | [
"super().__init__(**kwargs)\ntry:\n rive_files = kwargs['rive_files']\nexcept KeyError:\n raise KeyError('rive_files is a required argument')\nself.interpreter = rivescript.RiveScript(utf8=True)\nrive_files.extend(['./rive/array.rive', './rive/person.rive'])\nfor f in rive_files:\n self.interpreter.load_fi... | <|body_start_0|>
super().__init__(**kwargs)
try:
rive_files = kwargs['rive_files']
except KeyError:
raise KeyError('rive_files is a required argument')
self.interpreter = rivescript.RiveScript(utf8=True)
rive_files.extend(['./rive/array.rive', './rive/pers... | This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory | RiveScriptAdapter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RiveScriptAdapter:
"""This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory"""
def __init__(self, **kwargs):
"""take one kwarg : rive_files, a list, the paths to the .rive files"""
<|body_0|>
def get(self, statement):
"... | stack_v2_sparse_classes_36k_train_012648 | 3,143 | no_license | [
{
"docstring": "take one kwarg : rive_files, a list, the paths to the .rive files",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "take a statment and ask a reply to the interpreter",
"name": "get",
"signature": "def get(self, statement)"
},
{
... | 4 | stack_v2_sparse_classes_30k_val_000283 | Implement the Python class `RiveScriptAdapter` described below.
Class description:
This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory
Method signatures and docstrings:
- def __init__(self, **kwargs): take one kwarg : rive_files, a list, the paths to the .rive files
- def... | Implement the Python class `RiveScriptAdapter` described below.
Class description:
This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory
Method signatures and docstrings:
- def __init__(self, **kwargs): take one kwarg : rive_files, a list, the paths to the .rive files
- def... | cfc0970e01cbe4e4a362182613fea1e2a5f881da | <|skeleton|>
class RiveScriptAdapter:
"""This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory"""
def __init__(self, **kwargs):
"""take one kwarg : rive_files, a list, the paths to the .rive files"""
<|body_0|>
def get(self, statement):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RiveScriptAdapter:
"""This logic adapter is an interface to RiveScript The .rive files should be in the /rive directory"""
def __init__(self, **kwargs):
"""take one kwarg : rive_files, a list, the paths to the .rive files"""
super().__init__(**kwargs)
try:
rive_files =... | the_stack_v2_python_sparse | brain/logic/rivescript_adapter.py | LeonLenclos/alan | train | 10 |
1f03d6728476aacc8fa99bba5f9ad3f684df35a8 | [
"activation_max, index_max = torch.max(input, -1, keepdim=True)\ninput_scale = input * scale\noutput_max_scale = torch.where(input == activation_max, input, input_scale)\nmask = (input == activation_max).type(torch.float)\nctx.save_for_backward(input, mask)\nreturn output_max_scale",
"input, mask = ctx.saved_tens... | <|body_start_0|>
activation_max, index_max = torch.max(input, -1, keepdim=True)
input_scale = input * scale
output_max_scale = torch.where(input == activation_max, input, input_scale)
mask = (input == activation_max).type(torch.float)
ctx.save_for_backward(input, mask)
re... | We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors. | WTA_scale | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WTA_scale:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, scale=0.0001):
"""In the forward pass we receive a Tensor containing the input... | stack_v2_sparse_classes_36k_train_012649 | 18,453 | permissive | [
{
"docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. You can cache arbitrary Tensors for use in the backward pass using the save_for_backward method.",
"name": "forward",
"signature": "def forward(ctx, input, scale=0.0001)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_001800 | Implement the Python class `WTA_scale` described below.
Class description:
We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.
Method signatures and docstrings:
- def forward(ctx, input, scale=0.0001): In ... | Implement the Python class `WTA_scale` described below.
Class description:
We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.
Method signatures and docstrings:
- def forward(ctx, input, scale=0.0001): In ... | de0c1bbd3389e0ae4631997513d7ddca32ce4432 | <|skeleton|>
class WTA_scale:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, scale=0.0001):
"""In the forward pass we receive a Tensor containing the input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WTA_scale:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, scale=0.0001):
"""In the forward pass we receive a Tensor containing the input and return a... | the_stack_v2_python_sparse | models/networks/correspondence.py | microsoft/CoCosNet | train | 391 |
938a5fa2b23ec9e8254790053ca89d49dfa8455a | [
"self.t_max = 5.0\nself.plate_hot = platewall.PlateWall()\nself.t_step = 0.001\nsuper(Transient_HX, self).__init__()",
"self.init_arrays()\nself.solve_hx()\nself.init_trans_zeros()\nself.init_trans_values()\nfor t in range(1, int(self.t_max / self.t_step)):\n for i in range(self.nodes):\n self.solve_nod... | <|body_start_0|>
self.t_max = 5.0
self.plate_hot = platewall.PlateWall()
self.t_step = 0.001
super(Transient_HX, self).__init__()
<|end_body_0|>
<|body_start_1|>
self.init_arrays()
self.solve_hx()
self.init_trans_zeros()
self.init_trans_values()
f... | Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions. | Transient_HX | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transient_HX:
"""Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions."""
def __init__(self):
"""initializes variables."""
<|body_0|>
def solve_hx_transient(self):
"""This doc string explains what this... | stack_v2_sparse_classes_36k_train_012650 | 7,024 | no_license | [
{
"docstring": "initializes variables.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This doc string explains what this method should do. The method should specify an inlet boundary condition after having initially run the steady state solution. With the inlet bounda... | 4 | stack_v2_sparse_classes_30k_train_017805 | Implement the Python class `Transient_HX` described below.
Class description:
Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions.
Method signatures and docstrings:
- def __init__(self): initializes variables.
- def solve_hx_transient(self): This doc stri... | Implement the Python class `Transient_HX` described below.
Class description:
Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions.
Method signatures and docstrings:
- def __init__(self): initializes variables.
- def solve_hx_transient(self): This doc stri... | d619b66b1f16557e06c94eee1c16d4ee2a9e896a | <|skeleton|>
class Transient_HX:
"""Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions."""
def __init__(self):
"""initializes variables."""
<|body_0|>
def solve_hx_transient(self):
"""This doc string explains what this... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transient_HX:
"""Special class for modeling waste heat recovery heat exchanger with transient inlet temperature and flow conditions."""
def __init__(self):
"""initializes variables."""
self.t_max = 5.0
self.plate_hot = platewall.PlateWall()
self.t_step = 0.001
supe... | the_stack_v2_python_sparse | Modules/transient.py | hfateh/TE_Model-1 | train | 0 |
aff8e4a8bc7571ae75464bb5a38286570ff77ea2 | [
"super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)",
"enc_output = self.encoder(inputs, training, encoder_mask)\ndec_output = self... | <|body_start_0|>
super().__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)
self.linear = tf.keras.layers.Dense(target_vocab)
<|end_body_0|>
<|body_start_1|>
... | class Transform | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense lay... | stack_v2_sparse_classes_36k_train_012651 | 1,535 | no_license | [
{
"docstring": "Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense layer with target_vocab units",
"name": "__init__",
"signature": "def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_tar... | 2 | stack_v2_sparse_classes_30k_train_007231 | Implement the Python class `Transformer` described below.
Class description:
class Transform
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Sets the following public instance attributes: * encoder - the encoder layer *... | Implement the Python class `Transformer` described below.
Class description:
class Transform
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Sets the following public instance attributes: * encoder - the encoder layer *... | 9ff78818c132d1233c11b8fc8fd469878b23b14e | <|skeleton|>
class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense lay... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense layer with targe... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/11-transformer.py | Nzparra/holbertonschool-machine_learning | train | 0 |
639d98c50fc0e8d04942131b2ee65f6aea482e91 | [
"if self.dbconn.version < 90000:\n self.query = QUERY_PRE90\nfor trig in self.fetch():\n for timing in ['BEFORE', 'AFTER', 'INSTEAD OF']:\n timspc = timing + ' '\n if timspc in trig.definition:\n trig.timing = timing.lower()\n evtstart = trig.definition.index(timspc) + len(... | <|body_start_0|>
if self.dbconn.version < 90000:
self.query = QUERY_PRE90
for trig in self.fetch():
for timing in ['BEFORE', 'AFTER', 'INSTEAD OF']:
timspc = timing + ' '
if timspc in trig.definition:
trig.timing = timing.lower(... | The collection of triggers in a database | TriggerDict | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerDict:
"""The collection of triggers in a database"""
def _from_catalog(self):
"""Initialize the dictionary of triggers by querying the catalogs"""
<|body_0|>
def from_map(self, table, intriggers):
"""Initalize the dictionary of triggers by converting the i... | stack_v2_sparse_classes_36k_train_012652 | 7,510 | permissive | [
{
"docstring": "Initialize the dictionary of triggers by querying the catalogs",
"name": "_from_catalog",
"signature": "def _from_catalog(self)"
},
{
"docstring": "Initalize the dictionary of triggers by converting the input map :param table: table owning the triggers :param intriggers: YAML map... | 3 | stack_v2_sparse_classes_30k_train_019857 | Implement the Python class `TriggerDict` described below.
Class description:
The collection of triggers in a database
Method signatures and docstrings:
- def _from_catalog(self): Initialize the dictionary of triggers by querying the catalogs
- def from_map(self, table, intriggers): Initalize the dictionary of trigger... | Implement the Python class `TriggerDict` described below.
Class description:
The collection of triggers in a database
Method signatures and docstrings:
- def _from_catalog(self): Initialize the dictionary of triggers by querying the catalogs
- def from_map(self, table, intriggers): Initalize the dictionary of trigger... | 0133f3bc522890e0564d27de6791824acb4d2773 | <|skeleton|>
class TriggerDict:
"""The collection of triggers in a database"""
def _from_catalog(self):
"""Initialize the dictionary of triggers by querying the catalogs"""
<|body_0|>
def from_map(self, table, intriggers):
"""Initalize the dictionary of triggers by converting the i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TriggerDict:
"""The collection of triggers in a database"""
def _from_catalog(self):
"""Initialize the dictionary of triggers by querying the catalogs"""
if self.dbconn.version < 90000:
self.query = QUERY_PRE90
for trig in self.fetch():
for timing in ['BEFO... | the_stack_v2_python_sparse | pyrseas/dbobject/trigger.py | vayerx/Pyrseas | train | 1 |
8a23cb5ee2291deccd858c30b0e0bbb33661a375 | [
"starting_record_count = Biology.objects.count()\nnew_taxon = Taxon.objects.get(name__exact='Primates')\nid_qualifier = IdentificationQualifier.objects.get(name__exact='None')\nnew_occurrence = Biology(barcode=1111, item_type='Faunal', basis_of_record='HumanObservation', collecting_method='Surface Standard', field_... | <|body_start_0|>
starting_record_count = Biology.objects.count()
new_taxon = Taxon.objects.get(name__exact='Primates')
id_qualifier = IdentificationQualifier.objects.get(name__exact='None')
new_occurrence = Biology(barcode=1111, item_type='Faunal', basis_of_record='HumanObservation', col... | Test mlp Biology instance creation and methods | BiologyMethodsTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiologyMethodsTests:
"""Test mlp Biology instance creation and methods"""
def test_mlp_biology_save_simple(self):
"""Test Biology instance save method with the simplest possible attributes."""
<|body_0|>
def test_biology_create_observation(self):
"""Test Biology ... | stack_v2_sparse_classes_36k_train_012653 | 22,739 | permissive | [
{
"docstring": "Test Biology instance save method with the simplest possible attributes.",
"name": "test_mlp_biology_save_simple",
"signature": "def test_mlp_biology_save_simple(self)"
},
{
"docstring": "Test Biology instance creation for observations",
"name": "test_biology_create_observati... | 3 | null | Implement the Python class `BiologyMethodsTests` described below.
Class description:
Test mlp Biology instance creation and methods
Method signatures and docstrings:
- def test_mlp_biology_save_simple(self): Test Biology instance save method with the simplest possible attributes.
- def test_biology_create_observation... | Implement the Python class `BiologyMethodsTests` described below.
Class description:
Test mlp Biology instance creation and methods
Method signatures and docstrings:
- def test_mlp_biology_save_simple(self): Test Biology instance save method with the simplest possible attributes.
- def test_biology_create_observation... | 808022a11e6b70020b0b6f448567b96d21341974 | <|skeleton|>
class BiologyMethodsTests:
"""Test mlp Biology instance creation and methods"""
def test_mlp_biology_save_simple(self):
"""Test Biology instance save method with the simplest possible attributes."""
<|body_0|>
def test_biology_create_observation(self):
"""Test Biology ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiologyMethodsTests:
"""Test mlp Biology instance creation and methods"""
def test_mlp_biology_save_simple(self):
"""Test Biology instance save method with the simplest possible attributes."""
starting_record_count = Biology.objects.count()
new_taxon = Taxon.objects.get(name__exac... | the_stack_v2_python_sparse | mlp/tests.py | paleocore/paleocore110 | train | 0 |
48cd774e133b620203e7c99677bdeb5ceac7cddf | [
"from nestedworld_api.db import MonsterAttack as DbMonsterAttack\nmonster = DbMonsterAttack.query.filter(DbMonsterAttack.monster_id == monster_id, DbMonsterAttack.id == attack_id).first()\nreturn monster",
"from nestedworld_api.db import db\nfrom nestedworld_api.db import MonsterAttack as DbMonsterAttack\nDbMonst... | <|body_start_0|>
from nestedworld_api.db import MonsterAttack as DbMonsterAttack
monster = DbMonsterAttack.query.filter(DbMonsterAttack.monster_id == monster_id, DbMonsterAttack.id == attack_id).first()
return monster
<|end_body_0|>
<|body_start_1|>
from nestedworld_api.db import db
... | MonsterAttack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonsterAttack:
def get(self, monster_id, attack_id):
"""Retrieve a specific monster of the user This request is used by a user for retrieve his own monster."""
<|body_0|>
def delete(self, monster_id, attack_id):
"""Delete an attack to a monster This request is used f... | stack_v2_sparse_classes_36k_train_012654 | 3,837 | no_license | [
{
"docstring": "Retrieve a specific monster of the user This request is used by a user for retrieve his own monster.",
"name": "get",
"signature": "def get(self, monster_id, attack_id)"
},
{
"docstring": "Delete an attack to a monster This request is used for delete an existing link between an a... | 2 | stack_v2_sparse_classes_30k_train_015263 | Implement the Python class `MonsterAttack` described below.
Class description:
Implement the MonsterAttack class.
Method signatures and docstrings:
- def get(self, monster_id, attack_id): Retrieve a specific monster of the user This request is used by a user for retrieve his own monster.
- def delete(self, monster_id... | Implement the Python class `MonsterAttack` described below.
Class description:
Implement the MonsterAttack class.
Method signatures and docstrings:
- def get(self, monster_id, attack_id): Retrieve a specific monster of the user This request is used by a user for retrieve his own monster.
- def delete(self, monster_id... | af2262742b04c823d2cf6e0fa40fa0fc6456671e | <|skeleton|>
class MonsterAttack:
def get(self, monster_id, attack_id):
"""Retrieve a specific monster of the user This request is used by a user for retrieve his own monster."""
<|body_0|>
def delete(self, monster_id, attack_id):
"""Delete an attack to a monster This request is used f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MonsterAttack:
def get(self, monster_id, attack_id):
"""Retrieve a specific monster of the user This request is used by a user for retrieve his own monster."""
from nestedworld_api.db import MonsterAttack as DbMonsterAttack
monster = DbMonsterAttack.query.filter(DbMonsterAttack.monster... | the_stack_v2_python_sparse | nestedworld_api/views/api/v1/monster/attacks.py | NestedWorld/NestedWorld-Server-API | train | 1 | |
bc2b24aa571bbf6a305547043475cb13c8b8c072 | [
"if not isinstance(s, str):\n return False\nelif s.isupper():\n return False\nelif len(s) != 24:\n return False\nelif all((c in '0123456789abcdef' for c in s)):\n return True\nelse:\n return False",
"if cls.is_valid(s):\n return datetime.fromtimestamp(int(s[:8], base=16))\nelse:\n return Fals... | <|body_start_0|>
if not isinstance(s, str):
return False
elif s.isupper():
return False
elif len(s) != 24:
return False
elif all((c in '0123456789abcdef' for c in s)):
return True
else:
return False
<|end_body_0|>
<|bod... | Mongo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mongo:
def is_valid(cls, s):
"""returns True if s is a valid MongoID; otherwise False"""
<|body_0|>
def get_timestamp(cls, s):
"""if s is a MongoID, returns a datetime object for the timestamp; otherwise False"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_012655 | 3,244 | no_license | [
{
"docstring": "returns True if s is a valid MongoID; otherwise False",
"name": "is_valid",
"signature": "def is_valid(cls, s)"
},
{
"docstring": "if s is a MongoID, returns a datetime object for the timestamp; otherwise False",
"name": "get_timestamp",
"signature": "def get_timestamp(cl... | 2 | stack_v2_sparse_classes_30k_train_012676 | Implement the Python class `Mongo` described below.
Class description:
Implement the Mongo class.
Method signatures and docstrings:
- def is_valid(cls, s): returns True if s is a valid MongoID; otherwise False
- def get_timestamp(cls, s): if s is a MongoID, returns a datetime object for the timestamp; otherwise False | Implement the Python class `Mongo` described below.
Class description:
Implement the Mongo class.
Method signatures and docstrings:
- def is_valid(cls, s): returns True if s is a valid MongoID; otherwise False
- def get_timestamp(cls, s): if s is a MongoID, returns a datetime object for the timestamp; otherwise False... | f72906de23b1dfd367a39ff5c6675803ea6cf91c | <|skeleton|>
class Mongo:
def is_valid(cls, s):
"""returns True if s is a valid MongoID; otherwise False"""
<|body_0|>
def get_timestamp(cls, s):
"""if s is a MongoID, returns a datetime object for the timestamp; otherwise False"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mongo:
def is_valid(cls, s):
"""returns True if s is a valid MongoID; otherwise False"""
if not isinstance(s, str):
return False
elif s.isupper():
return False
elif len(s) != 24:
return False
elif all((c in '0123456789abcdef' for c in... | the_stack_v2_python_sparse | mongo_object_id.py | shinux/codewars-Python-accepted | train | 2 | |
bbd0698a5d0d470066b2a3f67b6652dfef4366a6 | [
"self.true_labels = true_labels\nself.num_instances, self.num_labels = true_labels.shape\nself.remove_invalid = remove_invalid\nself.valid_idx = None\nif self.remove_invalid:\n samples = np.sum(self.true_labels, axis=1)\n self.valid_idx = np.arange(self.num_instances).reshape(-1, 1)[samples > 0]\n self.tru... | <|body_start_0|>
self.true_labels = true_labels
self.num_instances, self.num_labels = true_labels.shape
self.remove_invalid = remove_invalid
self.valid_idx = None
if self.remove_invalid:
samples = np.sum(self.true_labels, axis=1)
self.valid_idx = np.arange... | Metrics | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Metrics:
def __init__(self, true_labels, inv_psp=None, remove_invalid=False):
"""Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix or np.ndarray ground truth in sparse or dense format shape: (num_instances, num_labels) inv_psp:... | stack_v2_sparse_classes_36k_train_012656 | 15,487 | permissive | [
{
"docstring": "Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix or np.ndarray ground truth in sparse or dense format shape: (num_instances, num_labels) inv_psp: np.ndarray or None; default=None propensity scores for each label will compute propensit... | 2 | stack_v2_sparse_classes_30k_train_009257 | Implement the Python class `Metrics` described below.
Class description:
Implement the Metrics class.
Method signatures and docstrings:
- def __init__(self, true_labels, inv_psp=None, remove_invalid=False): Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix ... | Implement the Python class `Metrics` described below.
Class description:
Implement the Metrics class.
Method signatures and docstrings:
- def __init__(self, true_labels, inv_psp=None, remove_invalid=False): Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix ... | 6e23615742f0bb263313f2899f46bb027ea68007 | <|skeleton|>
class Metrics:
def __init__(self, true_labels, inv_psp=None, remove_invalid=False):
"""Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix or np.ndarray ground truth in sparse or dense format shape: (num_instances, num_labels) inv_psp:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Metrics:
def __init__(self, true_labels, inv_psp=None, remove_invalid=False):
"""Class to compute vanilla and propensity scored precision and ndcg Arguments: --------- true_labels: csr_matrix or np.ndarray ground truth in sparse or dense format shape: (num_instances, num_labels) inv_psp: np.ndarray or... | the_stack_v2_python_sparse | xclib/evaluation/xc_metrics.py | ryaninhust/pyxclib | train | 0 | |
3b31f1100a9974cb0ab35c0ff5497bd83a151224 | [
"self.channelName = ''\nself.connection = None\nself.type = UNKNOWN\nif specName is not None and specVersion is not None:\n self.connectToSpec(specName, specVersion, timeout)\nelse:\n self.specName = None\n self.specVersion = None",
"self.specName = specName\nself.specVersion = specVersion\nself.connecti... | <|body_start_0|>
self.channelName = ''
self.connection = None
self.type = UNKNOWN
if specName is not None and specVersion is not None:
self.connectToSpec(specName, specVersion, timeout)
else:
self.specName = None
self.specVersion = None
<|end_b... | SpecCounter class | SpecCounter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecCounter:
"""SpecCounter class"""
def __init__(self, specName=None, specVersion=None, timeout=None):
"""Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port' string representing a Spec server to connect to (default... | stack_v2_sparse_classes_36k_train_012657 | 2,948 | permissive | [
{
"docstring": "Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port' string representing a Spec server to connect to (defaults to None) timeout -- optional timeout for connection (defaults to None)",
"name": "__init__",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_017502 | Implement the Python class `SpecCounter` described below.
Class description:
SpecCounter class
Method signatures and docstrings:
- def __init__(self, specName=None, specVersion=None, timeout=None): Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port'... | Implement the Python class `SpecCounter` described below.
Class description:
SpecCounter class
Method signatures and docstrings:
- def __init__(self, specName=None, specVersion=None, timeout=None): Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port'... | 3152bd19d14eca07c946ff9e6d0ee28d87c4d046 | <|skeleton|>
class SpecCounter:
"""SpecCounter class"""
def __init__(self, specName=None, specVersion=None, timeout=None):
"""Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port' string representing a Spec server to connect to (default... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecCounter:
"""SpecCounter class"""
def __init__(self, specName=None, specVersion=None, timeout=None):
"""Constructor Keyword arguments: specName -- the name of the counter in Spec (defaults to None) specVersion -- 'host:port' string representing a Spec server to connect to (defaults to None) ti... | the_stack_v2_python_sparse | python/client/SpecCounter.py | drs378/pyspec | train | 0 |
d326d6867ce91b7680780fc0feb60033941a9259 | [
"if nums:\n m = len(nums) // 2\n r = TreeNode(nums[m])\n r.left, r.right = map(self.sortedArrayToBST, [nums[:m], nums[m + 1:]])\n return r",
"def construct(start, end):\n middle = start + end >> 1\n p = TreeNode(nums[middle])\n if middle > start:\n p.left = construct(start, middle - 1)... | <|body_start_0|>
if nums:
m = len(nums) // 2
r = TreeNode(nums[m])
r.left, r.right = map(self.sortedArrayToBST, [nums[:m], nums[m + 1:]])
return r
<|end_body_0|>
<|body_start_1|>
def construct(start, end):
middle = start + end >> 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortedArrayToBST(self, nums: List[int]) -> TreeNode:
"""根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度平衡) :param nums: :return:"""
<|body_0|>
def sortedArrayToBST1(self, nums: List[int])... | stack_v2_sparse_classes_36k_train_012658 | 5,938 | no_license | [
{
"docstring": "根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度平衡) :param nums: :return:",
"name": "sortedArrayToBST",
"signature": "def sortedArrayToBST(self, nums: List[int]) -> TreeNode"
},
{
"docstring": "将有序数组转换成二叉搜索树... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortedArrayToBST(self, nums: List[int]) -> TreeNode: 根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortedArrayToBST(self, nums: List[int]) -> TreeNode: 根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def sortedArrayToBST(self, nums: List[int]) -> TreeNode:
"""根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度平衡) :param nums: :return:"""
<|body_0|>
def sortedArrayToBST1(self, nums: List[int])... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortedArrayToBST(self, nums: List[int]) -> TreeNode:
"""根据此题,一个可行的递归条件可以得出: 1,每次返回的根节点处于数组中间,以其左右半数组分别递归构造左右子树 2,那么就意味着左子树小于根,右子树大于根, 且所有节点左右子树节点相差不超过1, (由于递归的构造树的方式相同,所有节点都满足高度平衡) :param nums: :return:"""
if nums:
m = len(nums) // 2
r = TreeNode(nums[m])
... | the_stack_v2_python_sparse | LeetCode_practice/BinaryTree/0108_ConvertSortedArrayToBinarySearchTree.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
7bb74f71098bbe6f48e155ff0179b1dae388d3db | [
"search = Lexicon.search()\nquery, pagination_info = paginate_query(request, search)\nresponse = query.execute()\nschema = LexiconSchema()\nresults = [schema.dump(lexicon) for lexicon in response]\nreturn {'pagination': pagination_info, 'data': results}",
"if not request.is_json:\n abort(400)\njson_data = requ... | <|body_start_0|>
search = Lexicon.search()
query, pagination_info = paginate_query(request, search)
response = query.execute()
schema = LexiconSchema()
results = [schema.dump(lexicon) for lexicon in response]
return {'pagination': pagination_info, 'data': results}
<|end_b... | Methods for performing some operations on lists of Lexicon members. | LexiconListAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LexiconListAPI:
"""Methods for performing some operations on lists of Lexicon members."""
def get(self):
"""HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Parameter for the page to fetch. Default - 0. :param results: URL... | stack_v2_sparse_classes_36k_train_012659 | 3,045 | no_license | [
{
"docstring": "HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Parameter for the page to fetch. Default - 0. :param results: URL Parameter for the number of results to return per page. Default - 20. :return:",
"name": "get",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_019508 | Implement the Python class `LexiconListAPI` described below.
Class description:
Methods for performing some operations on lists of Lexicon members.
Method signatures and docstrings:
- def get(self): HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Paramete... | Implement the Python class `LexiconListAPI` described below.
Class description:
Methods for performing some operations on lists of Lexicon members.
Method signatures and docstrings:
- def get(self): HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Paramete... | 54481dfd88637572b92b8e17ba6ef6458fade9a4 | <|skeleton|>
class LexiconListAPI:
"""Methods for performing some operations on lists of Lexicon members."""
def get(self):
"""HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Parameter for the page to fetch. Default - 0. :param results: URL... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LexiconListAPI:
"""Methods for performing some operations on lists of Lexicon members."""
def get(self):
"""HTTP Get for the lexicon list resource. Returns a list of lexicon members from elasticsearch. :param page: URL Parameter for the page to fetch. Default - 0. :param results: URL Parameter fo... | the_stack_v2_python_sparse | web/bfex/blueprints/lexicon_api.py | MandyMeindersma/BFEX | train | 0 |
812da1f1a0ef90835445f1ea89070f239586dcd5 | [
"super(BottleneckBlock, self).__init__(trainable=trainable)\nself._finetune_bn = finetune_bn\nif use_projection:\n filters_out = 4 * filters\n self._local_layers['projection'] = dict()\n self._local_layers['projection']['conv2d'] = Conv2dFixedPadding(filters=filters_out, kernel_size=1, strides=strides, dat... | <|body_start_0|>
super(BottleneckBlock, self).__init__(trainable=trainable)
self._finetune_bn = finetune_bn
if use_projection:
filters_out = 4 * filters
self._local_layers['projection'] = dict()
self._local_layers['projection']['conv2d'] = Conv2dFixedPadding(f... | BottleneckBlock | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BottleneckBlock:
def __init__(self, filters, trainable, finetune_bn, strides, use_projection=False, data_format='channels_last'):
"""Bottleneck block variant for residual networks with BN after convolutions. Args: filters: `int` number of filters for the first two convolutions. Note that... | stack_v2_sparse_classes_36k_train_012660 | 21,671 | permissive | [
{
"docstring": "Bottleneck block variant for residual networks with BN after convolutions. Args: filters: `int` number of filters for the first two convolutions. Note that the third and final convolution will use 4 times as many filters. finetune_bn: `bool` for whether the model is in training. strides: `int` b... | 2 | null | Implement the Python class `BottleneckBlock` described below.
Class description:
Implement the BottleneckBlock class.
Method signatures and docstrings:
- def __init__(self, filters, trainable, finetune_bn, strides, use_projection=False, data_format='channels_last'): Bottleneck block variant for residual networks with... | Implement the Python class `BottleneckBlock` described below.
Class description:
Implement the BottleneckBlock class.
Method signatures and docstrings:
- def __init__(self, filters, trainable, finetune_bn, strides, use_projection=False, data_format='channels_last'): Bottleneck block variant for residual networks with... | 3ca77c4a5fb62c60372e8a2839b1fccc3c4e4212 | <|skeleton|>
class BottleneckBlock:
def __init__(self, filters, trainable, finetune_bn, strides, use_projection=False, data_format='channels_last'):
"""Bottleneck block variant for residual networks with BN after convolutions. Args: filters: `int` number of filters for the first two convolutions. Note that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BottleneckBlock:
def __init__(self, filters, trainable, finetune_bn, strides, use_projection=False, data_format='channels_last'):
"""Bottleneck block variant for residual networks with BN after convolutions. Args: filters: `int` number of filters for the first two convolutions. Note that the third and... | the_stack_v2_python_sparse | TensorFlow/computer_vision/maskrcnn/mask_rcnn/models/resnet.py | HabanaAI/Model-References | train | 108 | |
eec620b9546a502640e1e848f634d7b050620b69 | [
"DIS_threshold = DIS_threshold if DIS_threshold is not None and 0.0 < DIS_threshold < 1.0 else 0.5\nACC_threshold = ACC_threshold if ACC_threshold is not None and 0.0 < ACC_threshold < 1.0 else 0.2\npredictions = {}\nfor prot in paths:\n for predictor in paths[prot]:\n if predictor.lower() == 'raptorx':\n... | <|body_start_0|>
DIS_threshold = DIS_threshold if DIS_threshold is not None and 0.0 < DIS_threshold < 1.0 else 0.5
ACC_threshold = ACC_threshold if ACC_threshold is not None and 0.0 < ACC_threshold < 1.0 else 0.2
predictions = {}
for prot in paths:
for predictor in paths[prot... | Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class definition of All predictors. ACC_threshold: probability threshold for Scratch1D (onl... | Structural_pred | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Structural_pred:
"""Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class definition of All predictors. ACC_threshol... | stack_v2_sparse_classes_36k_train_012661 | 6,247 | no_license | [
{
"docstring": "Parses all the prediction output files. Parameters ---------- paths : dict Dictionary with raw prediction data. DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class definition of All predictors. ACC_threshold: probability threshold for Scratch1D (o... | 2 | stack_v2_sparse_classes_30k_test_000754 | Implement the Python class `Structural_pred` described below.
Class description:
Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class def... | Implement the Python class `Structural_pred` described below.
Class description:
Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class def... | 06db4e0833cffb1b4d8490aebef00718cd3f7c2b | <|skeleton|>
class Structural_pred:
"""Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class definition of All predictors. ACC_threshol... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Structural_pred:
"""Class that organises Structural Predictions output. Inherits MOdule_pred base class Attributes ---------- Additional from base class: DIS_threshold : float with values between 0. and 1. (default=0.50) Threshold used for disorder class definition of All predictors. ACC_threshold: probabilit... | the_stack_v2_python_sparse | species_proteins/structural/Structural_pred.py | frankji/CrossSpeciesWorkflow | train | 0 |
dc31babbf9be1b75cc8b3de77a77242c0080223d | [
"self.keys = keys or []\nself.obj = copy.copy(obj)\nself.hook = can(hook)\nfor key in keys:\n setattr(self.obj, key, can(getattr(obj, key)))\nself.buffers = []",
"if g is None:\n g = {}\nobj = self.obj\nfor key in self.keys:\n setattr(obj, key, uncan(getattr(obj, key), g))\nif self.hook:\n self.hook =... | <|body_start_0|>
self.keys = keys or []
self.obj = copy.copy(obj)
self.hook = can(hook)
for key in keys:
setattr(self.obj, key, can(getattr(obj, key)))
self.buffers = []
<|end_body_0|>
<|body_start_1|>
if g is None:
g = {}
obj = self.obj
... | A canned object. | CannedObject | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CannedObject:
"""A canned object."""
def __init__(self, obj, keys=None, hook=None):
"""can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional)... | stack_v2_sparse_classes_36k_train_012662 | 13,378 | permissive | [
{
"docstring": "can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional) An optional extra callable, which can do additional processing of the uncanned object. Notes -----... | 2 | null | Implement the Python class `CannedObject` described below.
Class description:
A canned object.
Method signatures and docstrings:
- def __init__(self, obj, keys=None, hook=None): can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will b... | Implement the Python class `CannedObject` described below.
Class description:
A canned object.
Method signatures and docstrings:
- def __init__(self, obj, keys=None, hook=None): can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will b... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class CannedObject:
"""A canned object."""
def __init__(self, obj, keys=None, hook=None):
"""can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CannedObject:
"""A canned object."""
def __init__(self, obj, keys=None, hook=None):
"""can an object for safe pickling Parameters ---------- obj The object to be canned keys : list (optional) list of attribute names that will be explicitly canned / uncanned hook : callable (optional) An optional ... | the_stack_v2_python_sparse | contrib/python/ipykernel/py3/ipykernel/pickleutil.py | catboost/catboost | train | 8,012 |
57efe61e025fff8b6a5e5d4cba5b634ad9c5dc1b | [
"reg_type = self.request.POST['registration_type']\nuser = self.request.user\nif reg_type == 'registration':\n message = self.register_user(user)\nelif reg_type == 'deregistration':\n message = self.deregister_user(user)\nelse:\n message = 'Her skjedde det noe galt.'\nself.messages.info(message)\nreturn Ht... | <|body_start_0|>
reg_type = self.request.POST['registration_type']
user = self.request.user
if reg_type == 'registration':
message = self.register_user(user)
elif reg_type == 'deregistration':
message = self.deregister_user(user)
else:
message ... | View for at en bruker skal kunne melde seg av og på. | RegisterUserView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
<|body_0|>
def register_user(self, user):
"""Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment ... | stack_v2_sparse_classes_36k_train_012663 | 24,750 | permissive | [
{
"docstring": "Handle http post request",
"name": "post",
"signature": "def post(self, *args, **kwargs)"
},
{
"docstring": "Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment for brukeren.",
"name": "register_user",
"signature": "def register_user(self, user)"
... | 3 | stack_v2_sparse_classes_30k_train_018175 | Implement the Python class `RegisterUserView` described below.
Class description:
View for at en bruker skal kunne melde seg av og på.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Handle http post request
- def register_user(self, user): Prøver å melde en bruker på arrangementet. Returnerer en... | Implement the Python class `RegisterUserView` described below.
Class description:
View for at en bruker skal kunne melde seg av og på.
Method signatures and docstrings:
- def post(self, *args, **kwargs): Handle http post request
- def register_user(self, user): Prøver å melde en bruker på arrangementet. Returnerer en... | 5661cbea1011f8851a244ae3d72351fce647123f | <|skeleton|>
class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
<|body_0|>
def register_user(self, user):
"""Prøver å melde en bruker på arrangementet. Returnerer en melding som er ment ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegisterUserView:
"""View for at en bruker skal kunne melde seg av og på."""
def post(self, *args, **kwargs):
"""Handle http post request"""
reg_type = self.request.POST['registration_type']
user = self.request.user
if reg_type == 'registration':
message = self... | the_stack_v2_python_sparse | nablapps/events/views.py | Nabla-NTNU/nablaweb | train | 21 |
f2226f0bea76cf8bde0550a9749e8e1b27991c42 | [
"super(WCEPCalculator, self).__init__(name=name)\nself.num_wceps = num_wceps\nself.warper = bk.CepstralWarper()\nself.channel = channel\nself.window = None\nself.channel_sel = LambdaNode.LambdaNode(lambda x, sel_channel=self.channel: x[:, [sel_channel]], name=name + '.ChannelSel')\nself.audio_fb = FrameBuffer.Frame... | <|body_start_0|>
super(WCEPCalculator, self).__init__(name=name)
self.num_wceps = num_wceps
self.warper = bk.CepstralWarper()
self.channel = channel
self.window = None
self.channel_sel = LambdaNode.LambdaNode(lambda x, sel_channel=self.channel: x[:, [sel_channel]], name=n... | Takes a continuous stream of data as input and outputs a spectrogram. | WCEPCalculator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WCEPCalculator:
"""Takes a continuous stream of data as input and outputs a spectrogram."""
def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator'):
"""Initializes all the nodes used to run-on calculate WCEP featu... | stack_v2_sparse_classes_36k_train_012664 | 2,676 | no_license | [
{
"docstring": "Initializes all the nodes used to run-on calculate WCEP features.",
"name": "__init__",
"signature": "def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator')"
},
{
"docstring": "Returns warped MFCCs.",
"na... | 2 | stack_v2_sparse_classes_30k_train_019050 | Implement the Python class `WCEPCalculator` described below.
Class description:
Takes a continuous stream of data as input and outputs a spectrogram.
Method signatures and docstrings:
- def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator'): Init... | Implement the Python class `WCEPCalculator` described below.
Class description:
Takes a continuous stream of data as input and outputs a spectrogram.
Method signatures and docstrings:
- def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator'): Init... | 8766168c07f1fe8ab9743034a7512bc1861388a7 | <|skeleton|>
class WCEPCalculator:
"""Takes a continuous stream of data as input and outputs a spectrogram."""
def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator'):
"""Initializes all the nodes used to run-on calculate WCEP featu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WCEPCalculator:
"""Takes a continuous stream of data as input and outputs a spectrogram."""
def __init__(self, frame_len_ms, frame_shift_ms, sample_rate, num_wceps=25, channel=0, warm_start=True, name='WCEPCalculator'):
"""Initializes all the nodes used to run-on calculate WCEP features."""
... | the_stack_v2_python_sparse | Nodes/WCEPCalculator.py | cognitive-systems-lab/EMG-GUI | train | 0 |
26d805477d1c8229b046b338a5abe559c1691599 | [
"d = DefaultDict(0)\nd['a'] = 1\nd[2] = 'b'\nself.assertEqual(d['a'], 1)\nself.assertEqual(d[2], 'b')\nself.assertFalse('c' in d)\nself.assertTrue('a' in d)\nd2 = {'a': 1, 2: 'b'}\nself.assertEqual(d, d2)\nd3 = {'a': 3, 2: 'b'}\nself.assertNotEqual(d, d3)\nd4 = {'a': 1, 2: 'b', 'c': 5}\nself.assertNotEqual(d, d4)\n... | <|body_start_0|>
d = DefaultDict(0)
d['a'] = 1
d[2] = 'b'
self.assertEqual(d['a'], 1)
self.assertEqual(d[2], 'b')
self.assertFalse('c' in d)
self.assertTrue('a' in d)
d2 = {'a': 1, 2: 'b'}
self.assertEqual(d, d2)
d3 = {'a': 3, 2: 'b'}
... | DefaultDictTest | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultDictTest:
def test_dict(self):
"""Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict."""
<|body_0|>
def test_constructors(self):
"""Make sure the regular dictionary constructors still work."""
<|body_... | stack_v2_sparse_classes_36k_train_012665 | 3,585 | permissive | [
{
"docstring": "Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict.",
"name": "test_dict",
"signature": "def test_dict(self)"
},
{
"docstring": "Make sure the regular dictionary constructors still work.",
"name": "test_constructors",
"s... | 3 | stack_v2_sparse_classes_30k_train_011452 | Implement the Python class `DefaultDictTest` described below.
Class description:
Implement the DefaultDictTest class.
Method signatures and docstrings:
- def test_dict(self): Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict.
- def test_constructors(self): Make sur... | Implement the Python class `DefaultDictTest` described below.
Class description:
Implement the DefaultDictTest class.
Method signatures and docstrings:
- def test_dict(self): Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict.
- def test_constructors(self): Make sur... | 264459a8fa1480c7b65d946f88d94af1a038fbf1 | <|skeleton|>
class DefaultDictTest:
def test_dict(self):
"""Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict."""
<|body_0|>
def test_constructors(self):
"""Make sure the regular dictionary constructors still work."""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefaultDictTest:
def test_dict(self):
"""Test that it behaves like a regular dictionary if we don't try to access items that aren't in the dict."""
d = DefaultDict(0)
d['a'] = 1
d[2] = 'b'
self.assertEqual(d['a'], 1)
self.assertEqual(d[2], 'b')
self.asse... | the_stack_v2_python_sparse | hetest/python/common/default_dict_test.py | y4n9squared/HEtest | train | 7 | |
552d62249bfdc33b1da830be2c44bf1ba586a4e1 | [
"parser_context = parser_context or {}\nencoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\nparser = etree.DefusedXMLParser(encoding=encoding)\ntry:\n tree = etree.parse(stream, parser=parser, forbid_dtd=True)\nexcept (etree.ParseError, ValueError) as exc:\n raise ParseError(detail=str(exc))\... | <|body_start_0|>
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
parser = etree.DefusedXMLParser(encoding=encoding)
try:
tree = etree.parse(stream, parser=parser, forbid_dtd=True)
except (etree.ParseError, Valu... | XML company parser. | XMLCompanyParser | [
"LicenseRef-scancode-other-permissive",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
<|body_0|>
def _xml_convert(self, element):
"""convert the xml `element` into th... | stack_v2_sparse_classes_36k_train_012666 | 2,236 | permissive | [
{
"docstring": "Parses the incoming bytestream as XML and returns the resulting data.",
"name": "parse",
"signature": "def parse(self, stream, media_type=None, parser_context=None)"
},
{
"docstring": "convert the xml `element` into the corresponding python object",
"name": "_xml_convert",
... | 2 | stack_v2_sparse_classes_30k_train_015132 | Implement the Python class `XMLCompanyParser` described below.
Class description:
XML company parser.
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XML and returns the resulting data.
- def _xml_convert(self, element): convert the ... | Implement the Python class `XMLCompanyParser` described below.
Class description:
XML company parser.
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XML and returns the resulting data.
- def _xml_convert(self, element): convert the ... | 6ac816e7c2711568cd7bcb1d996ba74c09513b3f | <|skeleton|>
class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
<|body_0|>
def _xml_convert(self, element):
"""convert the xml `element` into th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XMLCompanyParser:
"""XML company parser."""
def parse(self, stream, media_type=None, parser_context=None):
"""Parses the incoming bytestream as XML and returns the resulting data."""
parser_context = parser_context or {}
encoding = parser_context.get('encoding', settings.DEFAULT_C... | the_stack_v2_python_sparse | django_kala/api/basecamp_classic/companies/parsers.py | brahimmade/kala-app | train | 0 |
114135c954007c68adab935b8bbb4839ed25f452 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | ProviderServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProviderServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Activate(self, request, context):
"""Activate provider for specified client."""
<|body_0|>
def ListActivated(self, request, context):
"""List activated providers for speci... | stack_v2_sparse_classes_36k_train_012667 | 4,877 | permissive | [
{
"docstring": "Activate provider for specified client.",
"name": "Activate",
"signature": "def Activate(self, request, context)"
},
{
"docstring": "List activated providers for specified client.",
"name": "ListActivated",
"signature": "def ListActivated(self, request, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005783 | Implement the Python class `ProviderServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def Activate(self, request, context): Activate provider for specified client.
- def ListActivated(self, request, context): List activate... | Implement the Python class `ProviderServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def Activate(self, request, context): Activate provider for specified client.
- def ListActivated(self, request, context): List activate... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class ProviderServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Activate(self, request, context):
"""Activate provider for specified client."""
<|body_0|>
def ListActivated(self, request, context):
"""List activated providers for speci... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProviderServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Activate(self, request, context):
"""Activate provider for specified client."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise ... | the_stack_v2_python_sparse | yandex/cloud/backup/v1/provider_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
d9e619d937e124b73bc3f3704d20d94d20045839 | [
"super(RNNEncoder, self).__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding)\nself.gru = tf.keras.layers.GRU(units=self.units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)",
"shape = (self.batch,... | <|body_start_0|>
super(RNNEncoder, self).__init__()
self.batch = batch
self.units = units
self.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding)
self.gru = tf.keras.layers.GRU(units=self.units, recurrent_initializer='glorot_uniform', return_sequences=Tr... | Class RNNEncoder | RNNEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNEncoder:
"""Class RNNEncoder"""
def __init__(self, vocab, embedding, units, batch):
"""Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer representing the dimensionality of the embedding vector uni... | stack_v2_sparse_classes_36k_train_012668 | 3,356 | permissive | [
{
"docstring": "Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer representing the dimensionality of the embedding vector units is an integer representing the number of hidden units in the RNN cell batch is an integer represent... | 3 | stack_v2_sparse_classes_30k_test_000364 | Implement the Python class `RNNEncoder` described below.
Class description:
Class RNNEncoder
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer re... | Implement the Python class `RNNEncoder` described below.
Class description:
Class RNNEncoder
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer re... | eaf23423ec0f412f103f5931d6610fdd67bcc5be | <|skeleton|>
class RNNEncoder:
"""Class RNNEncoder"""
def __init__(self, vocab, embedding, units, batch):
"""Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer representing the dimensionality of the embedding vector uni... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RNNEncoder:
"""Class RNNEncoder"""
def __init__(self, vocab, embedding, units, batch):
"""Constructor for Class RNNEncoder Parameters: vocab is an integer representing the size of the input vocabulary embedding is an integer representing the dimensionality of the embedding vector units is an inte... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/0-rnn_encoder.py | ledbagholberton/holbertonschool-machine_learning | train | 1 |
63cfb61ea82d11af274acd160ae070c6992fb9d6 | [
"self._deferred = deferred\nself._buff = []\nself._uid = None\nself._key = createKey()",
"if not self._uid:\n if not definition.validateSuffix(line):\n raise ValueError('Received address suffix is not valid.')\n self._uid = line\n self.transport.write('{0}{1}{1}'.format(dumpCertReq(createCertReq(s... | <|body_start_0|>
self._deferred = deferred
self._buff = []
self._uid = None
self._key = createKey()
<|end_body_0|>
<|body_start_1|>
if not self._uid:
if not definition.validateSuffix(line):
raise ValueError('Received address suffix is not valid.')
... | Protocol which is used by a client to retrieve a new UID and certificate for a machine. | _SSLClientProtocol | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SSLClientProtocol:
"""Protocol which is used by a client to retrieve a new UID and certificate for a machine."""
def __init__(self, deferred):
"""Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type ... | stack_v2_sparse_classes_36k_train_012669 | 18,143 | permissive | [
{
"docstring": "Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type deferred: Deferred",
"name": "__init__",
"signature": "def __init__(self, deferred)"
},
{
"docstring": "Callback which is called by twisted whe... | 3 | stack_v2_sparse_classes_30k_train_013147 | Implement the Python class `_SSLClientProtocol` described below.
Class description:
Protocol which is used by a client to retrieve a new UID and certificate for a machine.
Method signatures and docstrings:
- def __init__(self, deferred): Initialize SSLClientProtocol. @param deferred: Deferred which should be called w... | Implement the Python class `_SSLClientProtocol` described below.
Class description:
Protocol which is used by a client to retrieve a new UID and certificate for a machine.
Method signatures and docstrings:
- def __init__(self, deferred): Initialize SSLClientProtocol. @param deferred: Deferred which should be called w... | c277efd809fce8f0f18b009fb3b9c7f785cc3739 | <|skeleton|>
class _SSLClientProtocol:
"""Protocol which is used by a client to retrieve a new UID and certificate for a machine."""
def __init__(self, deferred):
"""Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _SSLClientProtocol:
"""Protocol which is used by a client to retrieve a new UID and certificate for a machine."""
def __init__(self, deferred):
"""Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type deferred: Def... | the_stack_v2_python_sparse | framework/core/machine.py | LCROBOT/rce | train | 0 |
cf8cccc1405982f4a284755571c910a1ebab1c89 | [
"payload = {'auto_unlink': {}}\nif not scanner_id:\n scanner_id = 1\nif self._check('software_update', software_update, bool) in [True, False]:\n payload['software_update'] = software_update\nif auto_unlink:\n payload['auto_unlink']['enabled'] = True\n payload['auto_unlink']['expiration'] = self._check(... | <|body_start_0|>
payload = {'auto_unlink': {}}
if not scanner_id:
scanner_id = 1
if self._check('software_update', software_update, bool) in [True, False]:
payload['software_update'] = software_update
if auto_unlink:
payload['auto_unlink']['enabled'] =... | This will contain all methods related to agent config | AgentConfigAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgentConfigAPI:
"""This will contain all methods related to agent config"""
def edit(self, scanner_id=1, software_update=None, auto_unlink=None):
"""Edits the agent configuration. :devportal:`agent-config: edit <agent-config-details>` Args: scanner_id (int, optional): The scanner ID.... | stack_v2_sparse_classes_36k_train_012670 | 3,278 | permissive | [
{
"docstring": "Edits the agent configuration. :devportal:`agent-config: edit <agent-config-details>` Args: scanner_id (int, optional): The scanner ID. software_update (bool, optional): If True, software updates are enabled for agents (exclusions may override this). If false, software updates for all agents are... | 2 | stack_v2_sparse_classes_30k_test_001058 | Implement the Python class `AgentConfigAPI` described below.
Class description:
This will contain all methods related to agent config
Method signatures and docstrings:
- def edit(self, scanner_id=1, software_update=None, auto_unlink=None): Edits the agent configuration. :devportal:`agent-config: edit <agent-config-de... | Implement the Python class `AgentConfigAPI` described below.
Class description:
This will contain all methods related to agent config
Method signatures and docstrings:
- def edit(self, scanner_id=1, software_update=None, auto_unlink=None): Edits the agent configuration. :devportal:`agent-config: edit <agent-config-de... | 4e31049891f55016168b14ae30d332a965523640 | <|skeleton|>
class AgentConfigAPI:
"""This will contain all methods related to agent config"""
def edit(self, scanner_id=1, software_update=None, auto_unlink=None):
"""Edits the agent configuration. :devportal:`agent-config: edit <agent-config-details>` Args: scanner_id (int, optional): The scanner ID.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AgentConfigAPI:
"""This will contain all methods related to agent config"""
def edit(self, scanner_id=1, software_update=None, auto_unlink=None):
"""Edits the agent configuration. :devportal:`agent-config: edit <agent-config-details>` Args: scanner_id (int, optional): The scanner ID. software_upd... | the_stack_v2_python_sparse | tenable/io/agent_config.py | tenable/pyTenable | train | 300 |
f9e9446e9c84b2c55788b870d721dd192ccfed28 | [
"def get_repr_columns(source_name, columns, consider_col_sel):\n\n def set_selected(c):\n if consider_col_sel:\n if c in columns:\n return 'Y'\n return 'N'\n all_fields = store_client.get_all_fields_of_source(source_name)\n colsrepr = []\n for nid, sn, fn in all_f... | <|body_start_0|>
def get_repr_columns(source_name, columns, consider_col_sel):
def set_selected(c):
if consider_col_sel:
if c in columns:
return 'Y'
return 'N'
all_fields = store_client.get_all_fields_of_source(... | ResultFormatter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResultFormatter:
def format_output_for_webclient(raw_output, consider_col_sel):
"""Format raw output into something client understands, mostly, enrich the data with schema and samples"""
<|body_0|>
def format_output_for_webclient_ss(raw_output, consider_col_sel):
"""... | stack_v2_sparse_classes_36k_train_012671 | 23,927 | permissive | [
{
"docstring": "Format raw output into something client understands, mostly, enrich the data with schema and samples",
"name": "format_output_for_webclient",
"signature": "def format_output_for_webclient(raw_output, consider_col_sel)"
},
{
"docstring": "Format raw output into something client un... | 2 | stack_v2_sparse_classes_30k_train_000541 | Implement the Python class `ResultFormatter` described below.
Class description:
Implement the ResultFormatter class.
Method signatures and docstrings:
- def format_output_for_webclient(raw_output, consider_col_sel): Format raw output into something client understands, mostly, enrich the data with schema and samples
... | Implement the Python class `ResultFormatter` described below.
Class description:
Implement the ResultFormatter class.
Method signatures and docstrings:
- def format_output_for_webclient(raw_output, consider_col_sel): Format raw output into something client understands, mostly, enrich the data with schema and samples
... | 45b29e9e04231b82cb63757fbdbe7e62de37810a | <|skeleton|>
class ResultFormatter:
def format_output_for_webclient(raw_output, consider_col_sel):
"""Format raw output into something client understands, mostly, enrich the data with schema and samples"""
<|body_0|>
def format_output_for_webclient_ss(raw_output, consider_col_sel):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResultFormatter:
def format_output_for_webclient(raw_output, consider_col_sel):
"""Format raw output into something client understands, mostly, enrich the data with schema and samples"""
def get_repr_columns(source_name, columns, consider_col_sel):
def set_selected(c):
... | the_stack_v2_python_sparse | ddapi.py | raulcf/aurum-datadiscovery | train | 1 | |
e8c5ec6b6bb9472db9e0d2be57d6d16e0478ee20 | [
"if not Fqdn(fqdn).exists():\n pub_ns.abort(400, \"can't publish non-existent fqdn\")\nif Fqdn(fqdn).owner != get_jwt_identity() and get_jwt_claims()['roles'] != 'admin':\n pub_ns.abort(401, \"you don't own this fqdn\")\nf = Fqdn(fqdn)\nif f.is_unpublish():\n f.state = 'publish'\n f.save()\nf = Fqdn(fqd... | <|body_start_0|>
if not Fqdn(fqdn).exists():
pub_ns.abort(400, "can't publish non-existent fqdn")
if Fqdn(fqdn).owner != get_jwt_identity() and get_jwt_claims()['roles'] != 'admin':
pub_ns.abort(401, "you don't own this fqdn")
f = Fqdn(fqdn)
if f.is_unpublish():
... | fqdn publish | PublishOneFqdn | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublishOneFqdn:
"""fqdn publish"""
def put(self, fqdn):
"""Publish one owned fqdn (only fqdn with state 'publish')"""
<|body_0|>
def delete(self, fqdn):
"""Unpublish one owned fqdn (state isnt modified)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_012672 | 5,403 | permissive | [
{
"docstring": "Publish one owned fqdn (only fqdn with state 'publish')",
"name": "put",
"signature": "def put(self, fqdn)"
},
{
"docstring": "Unpublish one owned fqdn (state isnt modified)",
"name": "delete",
"signature": "def delete(self, fqdn)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005416 | Implement the Python class `PublishOneFqdn` described below.
Class description:
fqdn publish
Method signatures and docstrings:
- def put(self, fqdn): Publish one owned fqdn (only fqdn with state 'publish')
- def delete(self, fqdn): Unpublish one owned fqdn (state isnt modified) | Implement the Python class `PublishOneFqdn` described below.
Class description:
fqdn publish
Method signatures and docstrings:
- def put(self, fqdn): Publish one owned fqdn (only fqdn with state 'publish')
- def delete(self, fqdn): Unpublish one owned fqdn (state isnt modified)
<|skeleton|>
class PublishOneFqdn:
... | 6a9bf3a3d73fb3faa7cf1e5cfc757cc360fbafde | <|skeleton|>
class PublishOneFqdn:
"""fqdn publish"""
def put(self, fqdn):
"""Publish one owned fqdn (only fqdn with state 'publish')"""
<|body_0|>
def delete(self, fqdn):
"""Unpublish one owned fqdn (state isnt modified)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PublishOneFqdn:
"""fqdn publish"""
def put(self, fqdn):
"""Publish one owned fqdn (only fqdn with state 'publish')"""
if not Fqdn(fqdn).exists():
pub_ns.abort(400, "can't publish non-existent fqdn")
if Fqdn(fqdn).owner != get_jwt_identity() and get_jwt_claims()['roles'... | the_stack_v2_python_sparse | haprestio/api_v1/pub.py | innofocus/haprestio | train | 0 |
e2a6b447272f15197a8dc2ac11751ffa95a91990 | [
"if not isinstance(measure, BrownianMotion):\n raise ParameterError('EuropeanCall measure must be a BrownianMotion instance')\nself.measure = measure\nself.distribution = self.measure.distribution\nself.volatility = float(volatility)\nself.start_price = float(start_price)\nself.strike_price = float(strike_price)... | <|body_start_0|>
if not isinstance(measure, BrownianMotion):
raise ParameterError('EuropeanCall measure must be a BrownianMotion instance')
self.measure = measure
self.distribution = self.measure.distribution
self.volatility = float(volatility)
self.start_price = floa... | European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12) >>> y = eo.f(x) >>> y.mean() 9.2... | EuropeanOption | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12... | stack_v2_sparse_classes_36k_train_012673 | 5,327 | permissive | [
{
"docstring": "Args: measure (TrueMeasure): A BrownianMotion TrueMeasure object volatility (float): sigma, the volatility of the asset start_price (float): S(0), the asset value at t=0 strike_price (float): strike_price, the call/put offer interest_rate (float): r, the annual interest rate call_put (str): 'cal... | 4 | null | Implement the Python class `EuropeanOption` described below.
Class description:
European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 inter... | Implement the Python class `EuropeanOption` described below.
Class description:
European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 inter... | 0ed9da2f10b9ac0004c993c01392b4c86002954c | <|skeleton|>
class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12) >>> y = eo.... | the_stack_v2_python_sparse | qmcpy/integrand/european_option.py | kachiann/QMCSoftware | train | 1 |
1fc8e5c695007c61734c84b725d8c559e698fee2 | [
"super().__init__()\nself.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)\nself.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=False)\nself.relu = nn.ReLU(inplace=True)",
"out = self.relu(x)\nout = self.conv1(out)\nout = self.relu(out)\nout = se... | <|body_start_0|>
super().__init__()
self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)
self.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=False)
self.relu = nn.ReLU(inplace=True)
<|end_body_0|>
<|body_start_1|>
... | Residual convolution module. | ResidualConvUnit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResidualConvUnit:
"""Residual convolution module."""
def __init__(self, features):
"""Init. Args: features (int): number of features"""
<|body_0|>
def forward(self, x):
"""Forward pass. Args: x (tensor): input Returns: tensor: output"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_012674 | 5,777 | permissive | [
{
"docstring": "Init. Args: features (int): number of features",
"name": "__init__",
"signature": "def __init__(self, features)"
},
{
"docstring": "Forward pass. Args: x (tensor): input Returns: tensor: output",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000553 | Implement the Python class `ResidualConvUnit` described below.
Class description:
Residual convolution module.
Method signatures and docstrings:
- def __init__(self, features): Init. Args: features (int): number of features
- def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output | Implement the Python class `ResidualConvUnit` described below.
Class description:
Residual convolution module.
Method signatures and docstrings:
- def __init__(self, features): Init. Args: features (int): number of features
- def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output
<|skele... | a00c3619bf4042e446e1919087f0b09fe9fa3a65 | <|skeleton|>
class ResidualConvUnit:
"""Residual convolution module."""
def __init__(self, features):
"""Init. Args: features (int): number of features"""
<|body_0|>
def forward(self, x):
"""Forward pass. Args: x (tensor): input Returns: tensor: output"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResidualConvUnit:
"""Residual convolution module."""
def __init__(self, features):
"""Init. Args: features (int): number of features"""
super().__init__()
self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)
self.conv2 = nn.Conv2d(featu... | the_stack_v2_python_sparse | nasws/cnn/search_space/monodepth/models/midas_net_old.py | kcyu2014/nas-landmarkreg | train | 10 |
56ec85dba51bbc53471395374ebd902f6be94db0 | [
"args = None\ntry:\n args = SystemRunList._parser.parse_args(strict=True)\nexcept exceptions.BadRequest as exc:\n return (exc.description, exc.code)\norder = args.pop('order', ())\nlimit = args.pop('limit', None)\nfor field in args:\n if field not in system_run_model.FIELDS:\n return (f'Field {field... | <|body_start_0|>
args = None
try:
args = SystemRunList._parser.parse_args(strict=True)
except exceptions.BadRequest as exc:
return (exc.description, exc.code)
order = args.pop('order', ())
limit = args.pop('limit', None)
for field in args:
... | API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun. | SystemRunList | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SystemRunList:
"""API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun."""
def get(self):
"""Retrieves a list of system runs that pass the filter defined by the key-value mappings in the request body. The filter can only contai... | stack_v2_sparse_classes_36k_train_012675 | 3,497 | permissive | [
{
"docstring": "Retrieves a list of system runs that pass the filter defined by the key-value mappings in the request body. The filter can only contain fields defined by SystemRun. This endpoint accepts two url arguments: limit and order. limit is an integer that specifies the maximum number of system runs retu... | 2 | null | Implement the Python class `SystemRunList` described below.
Class description:
API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun.
Method signatures and docstrings:
- def get(self): Retrieves a list of system runs that pass the filter defined by the key-value... | Implement the Python class `SystemRunList` described below.
Class description:
API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun.
Method signatures and docstrings:
- def get(self): Retrieves a list of system runs that pass the filter defined by the key-value... | 6b32c869f426a8a5ba1b99edd324cc0c77bbd4ad | <|skeleton|>
class SystemRunList:
"""API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun."""
def get(self):
"""Retrieves a list of system runs that pass the filter defined by the key-value mappings in the request body. The filter can only contai... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SystemRunList:
"""API for querying a list of system runs based on some criteria and for creating new system runs. See SystemRun."""
def get(self):
"""Retrieves a list of system runs that pass the filter defined by the key-value mappings in the request body. The filter can only contain fields defi... | the_stack_v2_python_sparse | import-automation/import-progress-dashboard-api/app/resource/system_run_list.py | wh1210/data | train | 1 |
68164122822f789936bb32311250da440093b437 | [
"modify = True\nif modify and kwargs is not None:\n for key, value in kwargs.items():\n log('%s == %s' % (key, value))\nif modify:\n config = kwargs['config']\n inputdict = kwargs['inputdict']\n inputkeydict = kwargs['inputkeydict']",
"modify = True\nif modify and kwargs is not None:\n for k... | <|body_start_0|>
modify = True
if modify and kwargs is not None:
for key, value in kwargs.items():
log('%s == %s' % (key, value))
if modify:
config = kwargs['config']
inputdict = kwargs['inputdict']
inputkeydict = kwargs['inputkeydi... | ServiceDataCustomization | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceDataCustomization:
def process_service_create_data(smodelctx, sdata, dev, **kwargs):
"""Custom API to modify the inputs"""
<|body_0|>
def process_service_device_bindings(smodelctx, sdata, dev, **kwargs):
"""Custom API to modify the device bindings or Call the ... | stack_v2_sparse_classes_36k_train_012676 | 18,611 | no_license | [
{
"docstring": "Custom API to modify the inputs",
"name": "process_service_create_data",
"signature": "def process_service_create_data(smodelctx, sdata, dev, **kwargs)"
},
{
"docstring": "Custom API to modify the device bindings or Call the Business Login Handlers",
"name": "process_service_... | 4 | null | Implement the Python class `ServiceDataCustomization` described below.
Class description:
Implement the ServiceDataCustomization class.
Method signatures and docstrings:
- def process_service_create_data(smodelctx, sdata, dev, **kwargs): Custom API to modify the inputs
- def process_service_device_bindings(smodelctx,... | Implement the Python class `ServiceDataCustomization` described below.
Class description:
Implement the ServiceDataCustomization class.
Method signatures and docstrings:
- def process_service_create_data(smodelctx, sdata, dev, **kwargs): Custom API to modify the inputs
- def process_service_device_bindings(smodelctx,... | 96de3a4fd4adbbc0d443620f0c53f397823a1cad | <|skeleton|>
class ServiceDataCustomization:
def process_service_create_data(smodelctx, sdata, dev, **kwargs):
"""Custom API to modify the inputs"""
<|body_0|>
def process_service_device_bindings(smodelctx, sdata, dev, **kwargs):
"""Custom API to modify the device bindings or Call the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServiceDataCustomization:
def process_service_create_data(smodelctx, sdata, dev, **kwargs):
"""Custom API to modify the inputs"""
modify = True
if modify and kwargs is not None:
for key, value in kwargs.items():
log('%s == %s' % (key, value))
if modi... | the_stack_v2_python_sparse | scripts/managed_cpe_services/customer/wanop_services/type1_site/type1_site/wanop/wanop_endpoints/wanop_endpoint/service_customization.py | lucabrasi83/anutacpedeployment | train | 0 | |
f4d4d806190de116b135dcc37de12f878bad172f | [
"self.client_id = os.getenv('SPOTIFY_CLIENT_ID')\nself.client_secret = os.getenv('SPOTIFY_CLIENT_SECRET')\nif not self.client_id:\n raise Exception('No client id set.')\nif not self.client_secret:\n raise Exception('No client secret set.')",
"payload = {'grant_type': 'client_credentials'}\nresponse = reques... | <|body_start_0|>
self.client_id = os.getenv('SPOTIFY_CLIENT_ID')
self.client_secret = os.getenv('SPOTIFY_CLIENT_SECRET')
if not self.client_id:
raise Exception('No client id set.')
if not self.client_secret:
raise Exception('No client secret set.')
<|end_body_0|>
... | Class to get authentication access token application created in user's profile | Auth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
"""Class to get authentication access token application created in user's profile"""
def __init__(self):
"""Constructor. Expects client id and secret. Throws exceptions if they are not set"""
<|body_0|>
def get_access_token(self):
"""Call the API token api ... | stack_v2_sparse_classes_36k_train_012677 | 1,088 | no_license | [
{
"docstring": "Constructor. Expects client id and secret. Throws exceptions if they are not set",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Call the API token api get access token :return:",
"name": "get_access_token",
"signature": "def get_access_token(se... | 2 | null | Implement the Python class `Auth` described below.
Class description:
Class to get authentication access token application created in user's profile
Method signatures and docstrings:
- def __init__(self): Constructor. Expects client id and secret. Throws exceptions if they are not set
- def get_access_token(self): Ca... | Implement the Python class `Auth` described below.
Class description:
Class to get authentication access token application created in user's profile
Method signatures and docstrings:
- def __init__(self): Constructor. Expects client id and secret. Throws exceptions if they are not set
- def get_access_token(self): Ca... | 02b77652d0901e6e06cb9b1e7cb3e59c675445c2 | <|skeleton|>
class Auth:
"""Class to get authentication access token application created in user's profile"""
def __init__(self):
"""Constructor. Expects client id and secret. Throws exceptions if they are not set"""
<|body_0|>
def get_access_token(self):
"""Call the API token api ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Auth:
"""Class to get authentication access token application created in user's profile"""
def __init__(self):
"""Constructor. Expects client id and secret. Throws exceptions if they are not set"""
self.client_id = os.getenv('SPOTIFY_CLIENT_ID')
self.client_secret = os.getenv('SPO... | the_stack_v2_python_sparse | 53/vipinreyo/spotify/Auth.py | pybites/challenges | train | 764 |
8ff93e0fd27b5fdddda568536bf194d3b149792a | [
"unique_chars_in_pattern = len(set(pattern))\nunique_words_in_strings = len(set(strings.split(' ')))\nunique_pairs = len(set(zip(pattern, strings.split(' '))))\nreturn unique_chars_in_pattern == unique_words_in_strings == unique_pairs",
"unique_chars_in_p = len(set(p))\nunique_chars_in_q = len(set(q))\nunique_pai... | <|body_start_0|>
unique_chars_in_pattern = len(set(pattern))
unique_words_in_strings = len(set(strings.split(' ')))
unique_pairs = len(set(zip(pattern, strings.split(' '))))
return unique_chars_in_pattern == unique_words_in_strings == unique_pairs
<|end_body_0|>
<|body_start_1|>
... | Isomorphism | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Isomorphism:
def wordPattern(self, pattern, strings):
"""Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings."""
<|body_0|>
def stringPattern(self, p, q):
"""Purpose: Return whether or not the characters in... | stack_v2_sparse_classes_36k_train_012678 | 818 | no_license | [
{
"docstring": "Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings.",
"name": "wordPattern",
"signature": "def wordPattern(self, pattern, strings)"
},
{
"docstring": "Purpose: Return whether or not the characters in p can be replaced ... | 2 | stack_v2_sparse_classes_30k_train_006318 | Implement the Python class `Isomorphism` described below.
Class description:
Implement the Isomorphism class.
Method signatures and docstrings:
- def wordPattern(self, pattern, strings): Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings.
- def stringPatte... | Implement the Python class `Isomorphism` described below.
Class description:
Implement the Isomorphism class.
Method signatures and docstrings:
- def wordPattern(self, pattern, strings): Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings.
- def stringPatte... | 95a86cbbca28d0c0f6d72d28a2f1cb5a86327934 | <|skeleton|>
class Isomorphism:
def wordPattern(self, pattern, strings):
"""Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings."""
<|body_0|>
def stringPattern(self, p, q):
"""Purpose: Return whether or not the characters in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Isomorphism:
def wordPattern(self, pattern, strings):
"""Purpose: Return whether or not there is a bijection between a letter in pattern, and a non-empty word in strings."""
unique_chars_in_pattern = len(set(pattern))
unique_words_in_strings = len(set(strings.split(' ')))
uniqu... | the_stack_v2_python_sparse | isomorphism_str.py | tashakim/puzzles_python | train | 8 | |
f9d3c7f1e9ffe1e3c38cee5eeafd17c93abe2304 | [
"self._pos_seqs = positive_seqs\nself._neg_seqs = negative_seqs\nself._schema_eval = schema_evaluator",
"seq_motif = genome.toseq()\nmotif = seq_motif.tostring()\nnum_pos = 0\nfor seq_record in self._pos_seqs:\n cur_counts = self._schema_eval.num_matches(motif, seq_record.seq.tostring())\n num_pos += cur_co... | <|body_start_0|>
self._pos_seqs = positive_seqs
self._neg_seqs = negative_seqs
self._schema_eval = schema_evaluator
<|end_body_0|>
<|body_start_1|>
seq_motif = genome.toseq()
motif = seq_motif.tostring()
num_pos = 0
for seq_record in self._pos_seqs:
c... | Calculate fitness for schemas that differentiate between sequences. | DifferentialSchemaFitness | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DifferentialSchemaFitness:
"""Calculate fitness for schemas that differentiate between sequences."""
def __init__(self, positive_seqs, negative_seqs, schema_evaluator):
"""Initialize with different sequences to evaluate Arguments: o positive_seq - A list of SeqRecord objects which ar... | stack_v2_sparse_classes_36k_train_012679 | 26,199 | permissive | [
{
"docstring": "Initialize with different sequences to evaluate Arguments: o positive_seq - A list of SeqRecord objects which are the 'positive' sequences -- the ones we want to select for. o negative_seq - A list of SeqRecord objects which are the 'negative' sequences that we want to avoid selecting. o schema_... | 2 | stack_v2_sparse_classes_30k_train_018236 | Implement the Python class `DifferentialSchemaFitness` described below.
Class description:
Calculate fitness for schemas that differentiate between sequences.
Method signatures and docstrings:
- def __init__(self, positive_seqs, negative_seqs, schema_evaluator): Initialize with different sequences to evaluate Argumen... | Implement the Python class `DifferentialSchemaFitness` described below.
Class description:
Calculate fitness for schemas that differentiate between sequences.
Method signatures and docstrings:
- def __init__(self, positive_seqs, negative_seqs, schema_evaluator): Initialize with different sequences to evaluate Argumen... | 1d9a8e84a8572809ee3260ede44290e14de3bdd1 | <|skeleton|>
class DifferentialSchemaFitness:
"""Calculate fitness for schemas that differentiate between sequences."""
def __init__(self, positive_seqs, negative_seqs, schema_evaluator):
"""Initialize with different sequences to evaluate Arguments: o positive_seq - A list of SeqRecord objects which ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DifferentialSchemaFitness:
"""Calculate fitness for schemas that differentiate between sequences."""
def __init__(self, positive_seqs, negative_seqs, schema_evaluator):
"""Initialize with different sequences to evaluate Arguments: o positive_seq - A list of SeqRecord objects which are the 'positi... | the_stack_v2_python_sparse | bin/last_wrapper/Bio/NeuralNetwork/Gene/Schema.py | LyonsLab/coge | train | 41 |
1a6750c15919f0ccb8bdc2b6a5c8fa729208f0d8 | [
"i = 0\nj = len(numbers) - 1\nwhile True:\n nsum = numbers[i] + numbers[j]\n if nsum == target:\n return [i + 1, j + 1]\n elif nsum > target:\n j -= 1\n elif nsum < target:\n i += 1",
"l = 0\nr = len(numbers) - 1\nwhile True:\n if numbers[l] + numbers[r] < target:\n l +=... | <|body_start_0|>
i = 0
j = len(numbers) - 1
while True:
nsum = numbers[i] + numbers[j]
if nsum == target:
return [i + 1, j + 1]
elif nsum > target:
j -= 1
elif nsum < target:
i += 1
<|end_body_0|>
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSumAlt(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_012680 | 904 | no_license | [
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSumAlt",
"signature": "def twoSumAlt(self, numbe... | 2 | stack_v2_sparse_classes_30k_train_013481 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSumAlt(self, numbers, target): :type numbers: List[int] :type target: int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSumAlt(self, numbers, target): :type numbers: List[int] :type target: int... | bff9cfb9bf9930399c13bbdf5fb1619bec827097 | <|skeleton|>
class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSumAlt(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
i = 0
j = len(numbers) - 1
while True:
nsum = numbers[i] + numbers[j]
if nsum == target:
return [i + 1, j + 1]
eli... | the_stack_v2_python_sparse | 167twoSumII.py | iechevarria/leetcode | train | 0 | |
74e231fd70243bb8bab2da697a42cd580fab7141 | [
"self.result = []\nself.n = n\nself.ans = []\nself.upperlime = (1 << n) - 1\nself.test(0, 0, 0)\nreturn self.result",
"if row != self.upperlime:\n pos = self.upperlime & ~(row | ld | rd)\n while pos:\n p = pos & ~pos + 1\n pos = pos - p\n self.test(row | p, (ld | p) << 1, (rd | p) >> 1)... | <|body_start_0|>
self.result = []
self.n = n
self.ans = []
self.upperlime = (1 << n) - 1
self.test(0, 0, 0)
return self.result
<|end_body_0|>
<|body_start_1|>
if row != self.upperlime:
pos = self.upperlime & ~(row | ld | rd)
while pos:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def test(self, row, ld, rd):
"""row代表每一列的禁放位 ld代表左上到右下的 斜向上对角线 禁放位 rd代表右上到左下的 斜向下对角线 禁放位"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.result = []
... | stack_v2_sparse_classes_36k_train_012681 | 1,301 | no_license | [
{
"docstring": ":type n: int :rtype: List[List[str]]",
"name": "solveNQueens",
"signature": "def solveNQueens(self, n)"
},
{
"docstring": "row代表每一列的禁放位 ld代表左上到右下的 斜向上对角线 禁放位 rd代表右上到左下的 斜向下对角线 禁放位",
"name": "test",
"signature": "def test(self, row, ld, rd)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016833 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def test(self, row, ld, rd): row代表每一列的禁放位 ld代表左上到右下的 斜向上对角线 禁放位 rd代表右上到左下的 斜向下对角线 禁放位 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def test(self, row, ld, rd): row代表每一列的禁放位 ld代表左上到右下的 斜向上对角线 禁放位 rd代表右上到左下的 斜向下对角线 禁放位
<|skeleton|>
class Soluti... | a9c982207d3fc4bcb0513f88b6b5aeaaeb09f554 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def test(self, row, ld, rd):
"""row代表每一列的禁放位 ld代表左上到右下的 斜向上对角线 禁放位 rd代表右上到左下的 斜向下对角线 禁放位"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
self.result = []
self.n = n
self.ans = []
self.upperlime = (1 << n) - 1
self.test(0, 0, 0)
return self.result
def test(self, row, ld, rd):
"""row代表每一列的禁放位 ld代表左上... | the_stack_v2_python_sparse | LeetCode51.py | hzyhzzh/LeetCode | train | 0 | |
904ef3d679591c460965ec30cfe76dcc3a7a08fa | [
"super().__init__()\nself.w1 = tf.keras.layers.Dense(units)\nself.w2 = tf.keras.layers.Dense(units)\nself.vector = tf.keras.layers.Dense(1)",
"query_with_time_axis = tf.expand_dims(query, 1)\nscore = self.vector(tf.nn.tanh(self.w1(query_with_time_axis) + self.w2(values)))\nattention_weights = tf.nn.softmax(score,... | <|body_start_0|>
super().__init__()
self.w1 = tf.keras.layers.Dense(units)
self.w2 = tf.keras.layers.Dense(units)
self.vector = tf.keras.layers.Dense(1)
<|end_body_0|>
<|body_start_1|>
query_with_time_axis = tf.expand_dims(query, 1)
score = self.vector(tf.nn.tanh(self.w1... | BahdanauAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BahdanauAttention:
def __init__(self, units):
"""attention layer from Bahdanau paper"""
<|body_0|>
def call(self, query, values):
"""get context and weights given query and values"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__()
... | stack_v2_sparse_classes_36k_train_012682 | 2,408 | permissive | [
{
"docstring": "attention layer from Bahdanau paper",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "get context and weights given query and values",
"name": "call",
"signature": "def call(self, query, values)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000379 | Implement the Python class `BahdanauAttention` described below.
Class description:
Implement the BahdanauAttention class.
Method signatures and docstrings:
- def __init__(self, units): attention layer from Bahdanau paper
- def call(self, query, values): get context and weights given query and values | Implement the Python class `BahdanauAttention` described below.
Class description:
Implement the BahdanauAttention class.
Method signatures and docstrings:
- def __init__(self, units): attention layer from Bahdanau paper
- def call(self, query, values): get context and weights given query and values
<|skeleton|>
cla... | d1d4d485d1fac8743cdbbc2996792db249dcf389 | <|skeleton|>
class BahdanauAttention:
def __init__(self, units):
"""attention layer from Bahdanau paper"""
<|body_0|>
def call(self, query, values):
"""get context and weights given query and values"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BahdanauAttention:
def __init__(self, units):
"""attention layer from Bahdanau paper"""
super().__init__()
self.w1 = tf.keras.layers.Dense(units)
self.w2 = tf.keras.layers.Dense(units)
self.vector = tf.keras.layers.Dense(1)
def call(self, query, values):
""... | the_stack_v2_python_sparse | assignment5/code/src/decoder.py | jschmidtnj/cs584 | train | 0 | |
658f7c1d386100dfbd2d106e189ff39623bca102 | [
"def update_in_place(a, b):\n a.update(b)\n return a\nreturn reduce(update_in_place, (Counter(d) for d in [d1, d2]))",
"for k in d2.keys():\n try:\n d1.pop(k)\n except KeyError:\n pass\nreturn d1"
] | <|body_start_0|>
def update_in_place(a, b):
a.update(b)
return a
return reduce(update_in_place, (Counter(d) for d in [d1, d2]))
<|end_body_0|>
<|body_start_1|>
for k in d2.keys():
try:
d1.pop(k)
except KeyError:
pas... | DictTools | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DictTools:
def combine(d1, d2):
"""values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2) >>> d Counter({'b': 2, 'c': 123, 'a': 234}) >>> :param d1: the target dict :param d2: using the ... | stack_v2_sparse_classes_36k_train_012683 | 8,381 | no_license | [
{
"docstring": "values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2) >>> d Counter({'b': 2, 'c': 123, 'a': 234}) >>> :param d1: the target dict :param d2: using the key-value pairs in d2, combine and add them... | 2 | null | Implement the Python class `DictTools` described below.
Class description:
Implement the DictTools class.
Method signatures and docstrings:
- def combine(d1, d2): values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2... | Implement the Python class `DictTools` described below.
Class description:
Implement the DictTools class.
Method signatures and docstrings:
- def combine(d1, d2): values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2... | 4796fa9d88b56f80def011e2b043ce595bfce8c4 | <|skeleton|>
class DictTools:
def combine(d1, d2):
"""values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2) >>> d Counter({'b': 2, 'c': 123, 'a': 234}) >>> :param d1: the target dict :param d2: using the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DictTools:
def combine(d1, d2):
"""values are merged and added together for matching keys. example usage: >>> d1 = {'a':234, 'b':1} >>> d2 = {'b':1, 'c':123} >>> d = DictTools.combine(d1, d2) >>> d Counter({'b': 2, 'c': 123, 'a': 234}) >>> :param d1: the target dict :param d2: using the key-value pair... | the_stack_v2_python_sparse | util/dicts.py | nakamotohideyoshi/draftboard-web | train | 0 | |
a00b1f57ea9ef0ee03c952e1e0fc3d63d715a7c2 | [
"inputSpecification = super().getInputSpecification()\ndelayClass = InputData.parameterInputFactory('delay', contentType=InputTypes.StringType, descr='Adds a delay variable that' + ' is a copy of an existing variable' + ' but offset along the pivot parameter.')\ndelayClass.addParam('original', InputTypes.StringType... | <|body_start_0|>
inputSpecification = super().getInputSpecification()
delayClass = InputData.parameterInputFactory('delay', contentType=InputTypes.StringType, descr='Adds a delay variable that' + ' is a copy of an existing variable' + ' but offset along the pivot parameter.')
delayClass.addParam... | Class to get lagged or delayed data out of a history set. | HistorySetDelay | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistorySetDelay:
"""Class to get lagged or delayed data out of a history set."""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecifi... | stack_v2_sparse_classes_36k_train_012684 | 5,276 | permissive | [
{
"docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.",
"name": "getInputSpecification",
"signatur... | 5 | null | Implement the Python class `HistorySetDelay` described below.
Class description:
Class to get lagged or delayed data out of a history set.
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for whic... | Implement the Python class `HistorySetDelay` described below.
Class description:
Class to get lagged or delayed data out of a history set.
Method signatures and docstrings:
- def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for whic... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class HistorySetDelay:
"""Class to get lagged or delayed data out of a history set."""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecifi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HistorySetDelay:
"""Class to get lagged or delayed data out of a history set."""
def getInputSpecification(cls):
"""Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, Input... | the_stack_v2_python_sparse | ravenframework/Models/PostProcessors/HistorySetDelay.py | idaholab/raven | train | 201 |
0ee0f5b294282010a67a53b83da14dc4523cee25 | [
"self.x2Num = collections.defaultdict(int)\nself.numList = collections.defaultdict(list)\nself.max = 0",
"self.x2Num[x] += 1\nkey = self.x2Num[x]\nself.numList[key].append(x)\nself.max = max(self.max, key)",
"a = self.numList[self.max].pop()\nself.x2Num[a] -= 1\nif len(self.numList[self.max]) <= 0:\n self.ma... | <|body_start_0|>
self.x2Num = collections.defaultdict(int)
self.numList = collections.defaultdict(list)
self.max = 0
<|end_body_0|>
<|body_start_1|>
self.x2Num[x] += 1
key = self.x2Num[x]
self.numList[key].append(x)
self.max = max(self.max, key)
<|end_body_1|>
<... | FreqStack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FreqStack:
def __init__(self):
"""292 ms"""
<|body_0|>
def push(self, x):
""":type x: int :rtype: void"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.x2Num = collections.defaultd... | stack_v2_sparse_classes_36k_train_012685 | 2,719 | no_license | [
{
"docstring": "292 ms",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type x: int :rtype: void",
"name": "push",
"signature": "def push(self, x)"
},
{
"docstring": ":rtype: int",
"name": "pop",
"signature": "def pop(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_018495 | Implement the Python class `FreqStack` described below.
Class description:
Implement the FreqStack class.
Method signatures and docstrings:
- def __init__(self): 292 ms
- def push(self, x): :type x: int :rtype: void
- def pop(self): :rtype: int | Implement the Python class `FreqStack` described below.
Class description:
Implement the FreqStack class.
Method signatures and docstrings:
- def __init__(self): 292 ms
- def push(self, x): :type x: int :rtype: void
- def pop(self): :rtype: int
<|skeleton|>
class FreqStack:
def __init__(self):
"""292 ms... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class FreqStack:
def __init__(self):
"""292 ms"""
<|body_0|>
def push(self, x):
""":type x: int :rtype: void"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FreqStack:
def __init__(self):
"""292 ms"""
self.x2Num = collections.defaultdict(int)
self.numList = collections.defaultdict(list)
self.max = 0
def push(self, x):
""":type x: int :rtype: void"""
self.x2Num[x] += 1
key = self.x2Num[x]
self.nu... | the_stack_v2_python_sparse | MaximumFrequencyStack_HARD_895.py | 953250587/leetcode-python | train | 2 | |
3244bf8ea0d56d10eea595fbe67aa8ccbe21fafd | [
"super(WrongLaneTest, self).__init__(name, actor, 0, None, optional)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._world = self.actor.get_world()\nself._actor = actor\nself._map = CarlaDataProvider.get_map()\nself._infractions = 0\nself._last_lane_id = None\nself._last_road_id = None\nbluepri... | <|body_start_0|>
super(WrongLaneTest, self).__init__(name, actor, 0, None, optional)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._world = self.actor.get_world()
self._actor = actor
self._map = CarlaDataProvider.get_map()
self._infractions = 0
... | This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result | WrongLaneTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WrongLaneTest:
"""This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result"""
def __init__(self, actor, opt... | stack_v2_sparse_classes_36k_train_012686 | 44,616 | permissive | [
{
"docstring": "Construction with sensor setup",
"name": "__init__",
"signature": "def __init__(self, actor, optional=False, name='WrongLaneTest')"
},
{
"docstring": "Check lane invasion count",
"name": "update",
"signature": "def update(self)"
},
{
"docstring": "Cleanup sensor",... | 4 | null | Implement the Python class `WrongLaneTest` described below.
Class description:
This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail resul... | Implement the Python class `WrongLaneTest` described below.
Class description:
This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail resul... | 8ab0894b92e1f994802a218002021ee075c405bf | <|skeleton|>
class WrongLaneTest:
"""This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result"""
def __init__(self, actor, opt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WrongLaneTest:
"""This class contains an atomic test to detect invasions to wrong direction lanes. Important parameters: - actor: CARLA actor to be used for this test - optional [optional]: If True, the result is not considered for an overall pass/fail result"""
def __init__(self, actor, optional=False, ... | the_stack_v2_python_sparse | carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_criteria.py | TinaMenke/Deep-Reinforcement-Learning | train | 9 |
9c5ef105875d8ad12fa8b01fd1b8fd98c6422413 | [
"self.parameters = ['solution', 'n_total', 'levels', 'n_level', 'mean_level', 'var_level', 'cost_per_sample', 'alpha', 'beta', 'gamma']\nself.stopping_crit = stopping_crit\nself.integrand = integrand\nself.true_measure = true_measure\nself.discrete_distrib = discrete_distrib\nself.levels = int(levels_init)\nself.n_... | <|body_start_0|>
self.parameters = ['solution', 'n_total', 'levels', 'n_level', 'mean_level', 'var_level', 'cost_per_sample', 'alpha', 'beta', 'gamma']
self.stopping_crit = stopping_crit
self.integrand = integrand
self.true_measure = true_measure
self.discrete_distrib = discrete_... | Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references. | MLMCData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MLMCData:
"""Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_crit, integrand, true_measure, discrete_distrib, levels_init, n_init, alph... | stack_v2_sparse_classes_36k_train_012687 | 5,331 | permissive | [
{
"docstring": "Initialize data instance Args: stopping_crit (StoppingCriterion): a StoppingCriterion instance integrand (Integrand): an Integrand instance true_measure (TrueMeasure): A TrueMeasure instance discrete_distrib (DiscreteDistribution): a DiscreteDistribution instance levels_init (int): initial numbe... | 3 | stack_v2_sparse_classes_30k_train_004878 | Implement the Python class `MLMCData` described below.
Class description:
Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references.
Method signatures and docstrings:
- def __init__(self, stopping_crit, ... | Implement the Python class `MLMCData` described below.
Class description:
Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references.
Method signatures and docstrings:
- def __init__(self, stopping_crit, ... | 96af0449bafe027191f9d976ceef47557b0127d4 | <|skeleton|>
class MLMCData:
"""Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_crit, integrand, true_measure, discrete_distrib, levels_init, n_init, alph... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MLMCData:
"""Accumulated data for IIDDistribution calculations, and store multi-level mean, variance, and cost values. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_crit, integrand, true_measure, discrete_distrib, levels_init, n_init, alpha0, beta0, ga... | the_stack_v2_python_sparse | qmcpy/accumulate_data/mlmc_data.py | QMCSoftware/QMCSoftware | train | 54 |
5ff9cfe8ed6bb7b83e4e7679ec6a84428f3ccd64 | [
"self.assertEqual(source.add(10, 5), 15)\nself.assertEqual(source.add(-1, 1), 0)\nself.assertEqual(source.add(-1, -1), -2)",
"self.assertEqual(source.sub(10, 5), 5)\nself.assertEqual(source.sub(-1, 1), -2)\nself.assertEqual(source.sub(-1, -1), 0)",
"self.assertEqual(source.mul(10, 5), 50)\nself.assertEqual(sour... | <|body_start_0|>
self.assertEqual(source.add(10, 5), 15)
self.assertEqual(source.add(-1, 1), 0)
self.assertEqual(source.add(-1, -1), -2)
<|end_body_0|>
<|body_start_1|>
self.assertEqual(source.sub(10, 5), 5)
self.assertEqual(source.sub(-1, 1), -2)
self.assertEqual(source... | Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention. | TestSource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSource:
"""Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention."""
def test_add(self):
"""test method for testing add ... | stack_v2_sparse_classes_36k_train_012688 | 1,693 | no_license | [
{
"docstring": "test method for testing add function",
"name": "test_add",
"signature": "def test_add(self)"
},
{
"docstring": "test method for testing sub function",
"name": "test_sub",
"signature": "def test_sub(self)"
},
{
"docstring": "test method for testing mul function",
... | 4 | stack_v2_sparse_classes_30k_train_006568 | Implement the Python class `TestSource` described below.
Class description:
Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention.
Method signatures and docst... | Implement the Python class `TestSource` described below.
Class description:
Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention.
Method signatures and docst... | 52249822e2239113506a65f51a20caff37d8fb14 | <|skeleton|>
class TestSource:
"""Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention."""
def test_add(self):
"""test method for testing add ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSource:
"""Test class to make the methods for testing the original methods All the test methods inside test class should start form the name 'test_' or else the method will be skipped from unit testing. This is by convention."""
def test_add(self):
"""test method for testing add function"""
... | the_stack_v2_python_sparse | Concepts/18_unit_testing/Test1/test_source.py | Silver-Taurus/Python_at_FLT | train | 1 |
87d09532db028aefe26e2c03b59e97b829425a72 | [
"super().__init__()\nself.nup = nup\nself.ndown = ndown\nself.nelec = nup + ndown\nself.cuda = cuda\nself.device = torch.device('cpu')\nif self.cuda:\n self.device = torch.device('cuda')\nself.atoms = atomic_pos.to(self.device)\nself.natoms = atomic_pos.shape[0]\nself.ndim = 3\nself.jastrow_kernel = jastrow_kern... | <|body_start_0|>
super().__init__()
self.nup = nup
self.ndown = ndown
self.nelec = nup + ndown
self.cuda = cuda
self.device = torch.device('cpu')
if self.cuda:
self.device = torch.device('cuda')
self.atoms = atomic_pos.to(self.device)
s... | JastrowFactorElectronNuclei | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JastrowFactorElectronNuclei:
def __init__(self, nup, ndown, atomic_pos, jastrow_kernel, kernel_kwargs={}, cuda=False):
"""Base class for two el-nuc jastrow of the form: .. math:: J = \\prod_{a,i} \\exp(A(r_{ai})) Args: nup (int): number of spin up electons ndow (int): number of spin down... | stack_v2_sparse_classes_36k_train_012689 | 5,188 | permissive | [
{
"docstring": "Base class for two el-nuc jastrow of the form: .. math:: J = \\\\prod_{a,i} \\\\exp(A(r_{ai})) Args: nup (int): number of spin up electons ndow (int): number of spin down electons atomic_pos (tensor): positions of the atoms cuda (bool, optional): Turns GPU ON/OFF. Defaults to False.",
"name"... | 4 | null | Implement the Python class `JastrowFactorElectronNuclei` described below.
Class description:
Implement the JastrowFactorElectronNuclei class.
Method signatures and docstrings:
- def __init__(self, nup, ndown, atomic_pos, jastrow_kernel, kernel_kwargs={}, cuda=False): Base class for two el-nuc jastrow of the form: .. ... | Implement the Python class `JastrowFactorElectronNuclei` described below.
Class description:
Implement the JastrowFactorElectronNuclei class.
Method signatures and docstrings:
- def __init__(self, nup, ndown, atomic_pos, jastrow_kernel, kernel_kwargs={}, cuda=False): Base class for two el-nuc jastrow of the form: .. ... | 439a79e97ee63057e3032d28a1a5ebafd2d5b5e4 | <|skeleton|>
class JastrowFactorElectronNuclei:
def __init__(self, nup, ndown, atomic_pos, jastrow_kernel, kernel_kwargs={}, cuda=False):
"""Base class for two el-nuc jastrow of the form: .. math:: J = \\prod_{a,i} \\exp(A(r_{ai})) Args: nup (int): number of spin up electons ndow (int): number of spin down... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JastrowFactorElectronNuclei:
def __init__(self, nup, ndown, atomic_pos, jastrow_kernel, kernel_kwargs={}, cuda=False):
"""Base class for two el-nuc jastrow of the form: .. math:: J = \\prod_{a,i} \\exp(A(r_{ai})) Args: nup (int): number of spin up electons ndow (int): number of spin down electons atom... | the_stack_v2_python_sparse | qmctorch/wavefunction/jastrows/elec_nuclei/jastrow_factor_electron_nuclei.py | NLESC-JCER/QMCTorch | train | 22 | |
8a7959652c3ad690e8f5536089b278135343e145 | [
"dp = [0] * (n + 1)\ndp[0], dp[1] = (1, 1)\nfor i in range(2, n + 1):\n for j in range(i):\n dp[i] += dp[j] * dp[i - j - 1]\nreturn dp[n]",
"dp = [[False for i in range(n)] for j in range(n)]\n\ndef dfs(left, right, x):\n if dp[len(left)][len(right)] != False:\n return dp[len(left)][len(right)... | <|body_start_0|>
dp = [0] * (n + 1)
dp[0], dp[1] = (1, 1)
for i in range(2, n + 1):
for j in range(i):
dp[i] += dp[j] * dp[i - j - 1]
return dp[n]
<|end_body_0|>
<|body_start_1|>
dp = [[False for i in range(n)] for j in range(n)]
def dfs(left... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numTrees(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numTrees_rec(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [0] * (n + 1)
dp[0], dp[1] = (1, 1)
for i in range... | stack_v2_sparse_classes_36k_train_012690 | 1,585 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "numTrees",
"signature": "def numTrees(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "numTrees_rec",
"signature": "def numTrees_rec(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007131 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numTrees(self, n): :type n: int :rtype: int
- def numTrees_rec(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numTrees(self, n): :type n: int :rtype: int
- def numTrees_rec(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def numTrees(self, n):
""":type n... | ed0837ce14a22660657ffd15ff99d7cb1804e8c1 | <|skeleton|>
class Solution:
def numTrees(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numTrees_rec(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numTrees(self, n):
""":type n: int :rtype: int"""
dp = [0] * (n + 1)
dp[0], dp[1] = (1, 1)
for i in range(2, n + 1):
for j in range(i):
dp[i] += dp[j] * dp[i - j - 1]
return dp[n]
def numTrees_rec(self, n):
""":type... | the_stack_v2_python_sparse | python/096-unique-binary-search-trees.py | ByronHsu/leetcode | train | 5 | |
a288b5290a984b96b89412e8793110670ada3c53 | [
"res = ''\nlevel = [root]\nwhile level:\n new_level = []\n for node in level:\n if not node:\n res += '#'\n continue\n else:\n res += str(node.val) + ' '\n if node.children:\n for c in node.children:\n new_level.append(c)\n ... | <|body_start_0|>
res = ''
level = [root]
while level:
new_level = []
for node in level:
if not node:
res += '#'
continue
else:
res += str(node.val) + ' '
if node.ch... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_012691 | 3,640 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | 815f0cbf54f9ab2ae5f957e417fcc486c4e7146a | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
res = ''
level = [root]
while level:
new_level = []
for node in level:
if not node:
res += '#'
... | the_stack_v2_python_sparse | Python/Serialize_and_Deserialize_N-ary_Tree.py | jadewu/Practices | train | 0 | |
cd4b67090e3409f8da2ac6a07ff6a899510a1805 | [
"points_with_distance = [(point, point[0] ** 2 + point[1] ** 2) for point in points]\npoints_with_distance = sorted(points_with_distance, key=lambda a: a[1])\nreturn [point[0] for point in points_with_distance][:K]",
"import heapq\nh = []\nfor point in points:\n heapq.heappush(h, (-point[0] ** 2 - point[1] ** ... | <|body_start_0|>
points_with_distance = [(point, point[0] ** 2 + point[1] ** 2) for point in points]
points_with_distance = sorted(points_with_distance, key=lambda a: a[1])
return [point[0] for point in points_with_distance][:K]
<|end_body_0|>
<|body_start_1|>
import heapq
h = [... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kClosest(self, points, K):
""":type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)"""
<|body_0|>
def kClosest_1(self, points, K):
"""1308 ms 17.7 MB O(nlgk) :param points: :param K: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_012692 | 4,947 | no_license | [
{
"docstring": ":type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)",
"name": "kClosest",
"signature": "def kClosest(self, points, K)"
},
{
"docstring": "1308 ms 17.7 MB O(nlgk) :param points: :param K: :return:",
"name": "kClosest_1",
"signature": "d... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kClosest(self, points, K): :type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)
- def kClosest_1(self, points, K): 1308 ms 17.7 MB O(nlgk)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kClosest(self, points, K): :type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)
- def kClosest_1(self, points, K): 1308 ms 17.7 MB O(nlgk)... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def kClosest(self, points, K):
""":type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)"""
<|body_0|>
def kClosest_1(self, points, K):
"""1308 ms 17.7 MB O(nlgk) :param points: :param K: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kClosest(self, points, K):
""":type points: List[List[int]] :type K: int :rtype: List[List[int]] 1304 ms 18 MB O(nlgn)"""
points_with_distance = [(point, point[0] ** 2 + point[1] ** 2) for point in points]
points_with_distance = sorted(points_with_distance, key=lambda a: ... | the_stack_v2_python_sparse | KClosestPointsToOrigin_MID_973.py | 953250587/leetcode-python | train | 2 | |
aa13b240637e6a232d48f046e26c3a2aea438009 | [
"alphabet = ascii_letters\nshifted_alphabet = alphabet[shift:] + alphabet[:shift]\ntable = str.maketrans(alphabet, shifted_alphabet) if stealth else str.maketrans(shifted_alphabet, alphabet)\nreturn plaintext.translate(table)",
"shift = randint(15, 32)\nk = self.__crypt(key, shift)\nk = f'{k}{choice(self.__pad)}{... | <|body_start_0|>
alphabet = ascii_letters
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
table = str.maketrans(alphabet, shifted_alphabet) if stealth else str.maketrans(shifted_alphabet, alphabet)
return plaintext.translate(table)
<|end_body_0|>
<|body_start_1|>
shift = ... | Metatron | Metatron | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Metatron:
"""Metatron"""
def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str:
""":param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: crypt/decrypt string"""
<|body_0|>
def __cov... | stack_v2_sparse_classes_36k_train_012693 | 7,045 | no_license | [
{
"docstring": ":param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: crypt/decrypt string",
"name": "__crypt",
"signature": "def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str"
},
{
"docstring": "4 laye... | 6 | stack_v2_sparse_classes_30k_train_008925 | Implement the Python class `Metatron` described below.
Class description:
Metatron
Method signatures and docstrings:
- def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str: :param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: ... | Implement the Python class `Metatron` described below.
Class description:
Metatron
Method signatures and docstrings:
- def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str: :param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: ... | 9f866f3ebd1429532d77b76a37237984ab97d209 | <|skeleton|>
class Metatron:
"""Metatron"""
def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str:
""":param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: crypt/decrypt string"""
<|body_0|>
def __cov... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Metatron:
"""Metatron"""
def __crypt(self, plaintext, shift: int, stealth: bool=True) -> str:
""":param plaintext: text to crypt/decrypt :param shift: a number :param stealth: if true then crypt, if false then decrypt :return: crypt/decrypt string"""
alphabet = ascii_letters
shift... | the_stack_v2_python_sparse | encdec.py | Junaid522/Tesseract | train | 1 |
274694905f133ca35caf2f9289b5d4e445957b49 | [
"try:\n stream = cherrypy.request.wsgi_environ.get('wsgi.errors')\nexcept (AttributeError, KeyError):\n pass\nelse:\n stream.flush()",
"try:\n stream = cherrypy.request.wsgi_environ.get('wsgi.errors')\nexcept (AttributeError, KeyError):\n pass\nelse:\n try:\n msg = self.format(record)\n ... | <|body_start_0|>
try:
stream = cherrypy.request.wsgi_environ.get('wsgi.errors')
except (AttributeError, KeyError):
pass
else:
stream.flush()
<|end_body_0|>
<|body_start_1|>
try:
stream = cherrypy.request.wsgi_environ.get('wsgi.errors')
... | A handler class which writes logging records to environ['wsgi.errors']. | WSGIErrorHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WSGIErrorHandler:
"""A handler class which writes logging records to environ['wsgi.errors']."""
def flush(self):
"""Flushes the stream."""
<|body_0|>
def emit(self, record):
"""Emit a record."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
... | stack_v2_sparse_classes_36k_train_012694 | 9,194 | permissive | [
{
"docstring": "Flushes the stream.",
"name": "flush",
"signature": "def flush(self)"
},
{
"docstring": "Emit a record.",
"name": "emit",
"signature": "def emit(self, record)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000922 | Implement the Python class `WSGIErrorHandler` described below.
Class description:
A handler class which writes logging records to environ['wsgi.errors'].
Method signatures and docstrings:
- def flush(self): Flushes the stream.
- def emit(self, record): Emit a record. | Implement the Python class `WSGIErrorHandler` described below.
Class description:
A handler class which writes logging records to environ['wsgi.errors'].
Method signatures and docstrings:
- def flush(self): Flushes the stream.
- def emit(self, record): Emit a record.
<|skeleton|>
class WSGIErrorHandler:
"""A han... | b851d87737962cb4fa31fba9c5ba39e762f0e410 | <|skeleton|>
class WSGIErrorHandler:
"""A handler class which writes logging records to environ['wsgi.errors']."""
def flush(self):
"""Flushes the stream."""
<|body_0|>
def emit(self, record):
"""Emit a record."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WSGIErrorHandler:
"""A handler class which writes logging records to environ['wsgi.errors']."""
def flush(self):
"""Flushes the stream."""
try:
stream = cherrypy.request.wsgi_environ.get('wsgi.errors')
except (AttributeError, KeyError):
pass
else:
... | the_stack_v2_python_sparse | server/cherrypy/_cplogging.py | netdingo/xmgo | train | 0 |
dd40d76fceb4f0257f441ce73870f30afec6369c | [
"super().__init__()\nself.conv_block = get_conv_block(spatial_dims=spatial_dims, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size)\nself.residual_block = ResidualBlock(spatial_dims=spatial_dims, in_channels=out_channels, out_channels=out_channels, kernel_size=kernel_size)\nself.max_pool =... | <|body_start_0|>
super().__init__()
self.conv_block = get_conv_block(spatial_dims=spatial_dims, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size)
self.residual_block = ResidualBlock(spatial_dims=spatial_dims, in_channels=out_channels, out_channels=out_channels, kernel_... | A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised learning for multimodal deformable image registration <https://arxiv.org/abs/1711.01666>`_. Ad... | LocalNetDownSampleBlock | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalNetDownSampleBlock:
"""A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised learning for multimodal deformable image re... | stack_v2_sparse_classes_36k_train_012695 | 11,454 | permissive | [
{
"docstring": "Args: spatial_dims: number of spatial dimensions. in_channels: number of input channels. out_channels: number of output channels. kernel_size: convolution kernel size. Raises: NotImplementedError: when ``kernel_size`` is even",
"name": "__init__",
"signature": "def __init__(self, spatial... | 2 | null | Implement the Python class `LocalNetDownSampleBlock` described below.
Class description:
A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised lear... | Implement the Python class `LocalNetDownSampleBlock` described below.
Class description:
A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised lear... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class LocalNetDownSampleBlock:
"""A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised learning for multimodal deformable image re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalNetDownSampleBlock:
"""A down-sample module that can be used for LocalNet, based on: `Weakly-supervised convolutional neural networks for multimodal image registration <https://doi.org/10.1016/j.media.2018.07.002>`_. `Label-driven weakly-supervised learning for multimodal deformable image registration <h... | the_stack_v2_python_sparse | monai/networks/blocks/localnet_block.py | Project-MONAI/MONAI | train | 4,805 |
63be6e1b8884fa75b3c707692938e812d9aa7519 | [
"input_json = request.data['APIParams']\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None]))\nfetch_all_country = self.fetch_countries(input_json)\nif fetch_all_country.data['Status'] == 'Success':\n... | <|body_start_0|>
input_json = request.data['APIParams']
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None]))
fetch_all_country = self.fetch_countries(input_json)
if fetch_a... | This API cover for fetch all countries | GetAllCountriesAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetAllCountriesAPI:
"""This API cover for fetch all countries"""
def post(self, request):
"""This API cover for fetch all countries."""
<|body_0|>
def fetch_countries(self, request):
"""Function to fetch country from database."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_012696 | 1,996 | no_license | [
{
"docstring": "This API cover for fetch all countries.",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Function to fetch country from database.",
"name": "fetch_countries",
"signature": "def fetch_countries(self, request)"
}
] | 2 | null | Implement the Python class `GetAllCountriesAPI` described below.
Class description:
This API cover for fetch all countries
Method signatures and docstrings:
- def post(self, request): This API cover for fetch all countries.
- def fetch_countries(self, request): Function to fetch country from database. | Implement the Python class `GetAllCountriesAPI` described below.
Class description:
This API cover for fetch all countries
Method signatures and docstrings:
- def post(self, request): This API cover for fetch all countries.
- def fetch_countries(self, request): Function to fetch country from database.
<|skeleton|>
c... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class GetAllCountriesAPI:
"""This API cover for fetch all countries"""
def post(self, request):
"""This API cover for fetch all countries."""
<|body_0|>
def fetch_countries(self, request):
"""Function to fetch country from database."""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetAllCountriesAPI:
"""This API cover for fetch all countries"""
def post(self, request):
"""This API cover for fetch all countries."""
input_json = request.data['APIParams']
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['Availab... | the_stack_v2_python_sparse | Generic/common/location/api/getallcountriesdetails/views_getallcountriesdetails.py | archiemb303/common_backend_django | train | 0 |
7f482ba1a1d468f0cba21a8d257ed4e7ca65268d | [
"self.id = testXMLValue(elem.find(nspath('Name')))\nself.title = testXMLValue(elem.find(nspath('Title')))\nself.abstract = testXMLValue(elem.find(nspath('Abstract')))\nself.keywords = [f.text for f in elem.findall(nspath('Keywords'))]\nself.boundingBox = None\nb = elem.find(nspath('LatLongBoundingBox'))\nsrs = elem... | <|body_start_0|>
self.id = testXMLValue(elem.find(nspath('Name')))
self.title = testXMLValue(elem.find(nspath('Title')))
self.abstract = testXMLValue(elem.find(nspath('Abstract')))
self.keywords = [f.text for f in elem.findall(nspath('Keywords'))]
self.boundingBox = None
... | Abstraction for WFS metadata. Implements IMetadata. | ContentMetadata | [
"GPL-2.0-only",
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"LicenseRef-scancode-mit-old-style",
"dtoa",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain-disclaimer",
"Zlib",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-lic... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for MetadataURL of forma... | stack_v2_sparse_classes_36k_train_012697 | 15,540 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30)"
},
{
"docstring": "Parse remote metadata for MetadataURL of format 'XML' and add it as metadataUrl['metadata']",
"name": "parse_remote_metadata",
"signature": ... | 2 | null | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30): .
- def parse_remote_metadata(self, timeout=30): Parse remote metadata for... | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30): .
- def parse_remote_metadata(self, timeout=30): Parse remote metadata for... | 930d26886fdf8591b51da9d53e2aca743bf128ba | <|skeleton|>
class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for MetadataURL of forma... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30):
"""."""
self.id = testXMLValue(elem.find(nspath('Name')))
self.title = testXMLValue(elem.find(nspath('Title')))
self.abstra... | the_stack_v2_python_sparse | 3/amd64/envs/navigator/lib/python3.6/site-packages/owslib/feature/wfs100.py | DFO-Ocean-Navigator/navigator-toolchain | train | 0 |
8b65546e0921706d76ff03285aaf646194255e69 | [
"if self.current_user == team.owner:\n return True\nraise ApiException(403, '权限错误')",
"team = Team.get_or_404(id=team_id)\nself.has_read_permission(team)\nquery = TeamMemberGroup.select().where(TeamMemberGroup.team == team)\npage = self.paginate_query(query)\ndata = self.get_paginated_data(page=page, alias='gr... | <|body_start_0|>
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
<|end_body_0|>
<|body_start_1|>
team = Team.get_or_404(id=team_id)
self.has_read_permission(team)
query = TeamMemberGroup.select().where(TeamMemberGroup.team == team)
... | 俱乐部分组列表 | TeamMemberGroupHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_36k_train_012698 | 13,604 | no_license | [
{
"docstring": "具有俱乐部分组读取权限",
"name": "has_read_permission",
"signature": "def has_read_permission(self, team)"
},
{
"docstring": "获取俱乐部分组 Args: team_id: int",
"name": "get",
"signature": "def get(self, team_id)"
},
{
"docstring": "新建俱乐部分组 Args: team_id: Returns:",
"name": "p... | 3 | stack_v2_sparse_classes_30k_test_000752 | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns: | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns:
<|skeleton|>
class TeamM... | 49c31d9cce6ca451ff069697913b33fe55028a46 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
team = Team.get_or... | the_stack_v2_python_sparse | PaiDuiGuanJia/yiyun/handlers/rest/team.py | haoweiking/image_tesseract_private | train | 0 |
57a7cd7346f7ceb3a5f5b9c5d8841e129b844b98 | [
"nin = self.observation_space.shape[0]\nself.fc1 = nn.Linear(nin, 32)\nself.fc2 = nn.Linear(32, 32)\nself.fc3 = nn.Linear(32, 32)\nself.qvalue = nn.Linear(32, self.action_space.n)",
"x = F.relu(self.fc1(x))\nx = F.relu(self.fc2(x))\nx = F.relu(self.fc3(x))\nreturn self.qvalue(x)"
] | <|body_start_0|>
nin = self.observation_space.shape[0]
self.fc1 = nn.Linear(nin, 32)
self.fc2 = nn.Linear(32, 32)
self.fc3 = nn.Linear(32, 32)
self.qvalue = nn.Linear(32, self.action_space.n)
<|end_body_0|>
<|body_start_1|>
x = F.relu(self.fc1(x))
x = F.relu(self... | Q network. | QFBase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QFBase:
"""Q network."""
def build(self):
"""Build Network."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nin = self.observation_space.shape[0]
self.fc1 = nn.Linear(nin, 32)
self.... | stack_v2_sparse_classes_36k_train_012699 | 5,956 | no_license | [
{
"docstring": "Build Network.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Forward.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019976 | Implement the Python class `QFBase` described below.
Class description:
Q network.
Method signatures and docstrings:
- def build(self): Build Network.
- def forward(self, x): Forward. | Implement the Python class `QFBase` described below.
Class description:
Q network.
Method signatures and docstrings:
- def build(self): Build Network.
- def forward(self, x): Forward.
<|skeleton|>
class QFBase:
"""Q network."""
def build(self):
"""Build Network."""
<|body_0|>
def forwar... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class QFBase:
"""Q network."""
def build(self):
"""Build Network."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QFBase:
"""Q network."""
def build(self):
"""Build Network."""
nin = self.observation_space.shape[0]
self.fc1 = nn.Linear(nin, 32)
self.fc2 = nn.Linear(32, 32)
self.fc3 = nn.Linear(32, 32)
self.qvalue = nn.Linear(32, self.action_space.n)
def forward(se... | the_stack_v2_python_sparse | dl/rl/algorithms/sac_discrete.py | cbschaff/dl | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.