blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ac1034028c8499681321515eb904e8dd1f60571c | [
"m = len(matrix)\nif m == 0:\n return 0\nn = len(matrix[0])\nheight = [[0] * n for row in range(m)]\nfor i in range(m):\n for j in range(n):\n k = ord(matrix[i][j]) - ord('0')\n height[i][j] = (height[i - 1][j] + 1) * k\nmaximum = 0\nfor i in range(m):\n maximum = max(maximum, self.largestRec... | <|body_start_0|>
m = len(matrix)
if m == 0:
return 0
n = len(matrix[0])
height = [[0] * n for row in range(m)]
for i in range(m):
for j in range(n):
k = ord(matrix[i][j]) - ord('0')
height[i][j] = (height[i - 1][j] + 1) * k
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
"""Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area."""
<|body_0|>
def largestRectangleArea(self, height):
"""Given n non-negative integers representing ... | stack_v2_sparse_classes_75kplus_train_067000 | 1,688 | no_license | [
{
"docstring": "Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.",
"name": "maximalRectangle",
"signature": "def maximalRectangle(self, matrix)"
},
{
"docstring": "Given n non-negative integers representing the histogram's bar ... | 2 | stack_v2_sparse_classes_30k_train_044595 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
- def largestRectangleAr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalRectangle(self, matrix): Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
- def largestRectangleAr... | d16e4724ee34a0046cb2a8b0b13139b43d284e83 | <|skeleton|>
class Solution:
def maximalRectangle(self, matrix):
"""Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area."""
<|body_0|>
def largestRectangleArea(self, height):
"""Given n non-negative integers representing ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximalRectangle(self, matrix):
"""Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area."""
m = len(matrix)
if m == 0:
return 0
n = len(matrix[0])
height = [[0] * n for row in rang... | the_stack_v2_python_sparse | Maximal Rectangle.py | KnightChan/LeetCode-Python | train | 0 | |
ebe7c84d252565bea095b1b834f11e2d60df9b2b | [
"try:\n return (services.appointment_service().get_all(), 200)\nexcept Exception as e:\n nsp.abort(500, 'An internal error has occurred: {}'.format(e))",
"try:\n appointment = request.json\n services.appointment_service().upsert_appointment(appointment)\n return ({'message': 'Successfully added app... | <|body_start_0|>
try:
return (services.appointment_service().get_all(), 200)
except Exception as e:
nsp.abort(500, 'An internal error has occurred: {}'.format(e))
<|end_body_0|>
<|body_start_1|>
try:
appointment = request.json
services.appointment... | Appointments | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Appointments:
def get(self):
"""Get all appointments"""
<|body_0|>
def post(self):
"""Post a new appointment"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
return (services.appointment_service().get_all(), 200)
except Excep... | stack_v2_sparse_classes_75kplus_train_067001 | 5,973 | no_license | [
{
"docstring": "Get all appointments",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Post a new appointment",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `Appointments` described below.
Class description:
Implement the Appointments class.
Method signatures and docstrings:
- def get(self): Get all appointments
- def post(self): Post a new appointment | Implement the Python class `Appointments` described below.
Class description:
Implement the Appointments class.
Method signatures and docstrings:
- def get(self): Get all appointments
- def post(self): Post a new appointment
<|skeleton|>
class Appointments:
def get(self):
"""Get all appointments"""
... | df826cf7098aee59e0a1ced6f465c2e8bb3df9a5 | <|skeleton|>
class Appointments:
def get(self):
"""Get all appointments"""
<|body_0|>
def post(self):
"""Post a new appointment"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Appointments:
def get(self):
"""Get all appointments"""
try:
return (services.appointment_service().get_all(), 200)
except Exception as e:
nsp.abort(500, 'An internal error has occurred: {}'.format(e))
def post(self):
"""Post a new appointment"""
... | the_stack_v2_python_sparse | patient_portal/patient_portal/api/appointments.py | bkh148/patient-cloud | train | 0 | |
620e6244d1969215d76512ea24d19e9492a8e3c3 | [
"\"\"\"\n case 1: A point is influenced by an edge.\n\n (1,5) *\n (0,0)*-----------* (10,0)\n\n \"\"\"\nvertices1 = np.array([[0, 0], [5, 1], [10, 0]])\nd1 = 5\ngradients1 = np.array([[0, 0], [0, 8], [0, 0]])\nenergy1 = 16\n'\\n case 2: Case 1 in inverse order\\n ... | <|body_start_0|>
"""
case 1: A point is influenced by an edge.
(1,5) *
(0,0)*-----------* (10,0)
"""
vertices1 = np.array([[0, 0], [5, 1], [10, 0]])
d1 = 5
gradients1 = np.array([[0, 0], [0, 8], [0, 0]])
... | TestEdgeConstraint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEdgeConstraint:
def setUp(self):
""":return:"""
<|body_0|>
def test_edge_constraint_grad(self):
"""Tests whether the vertex_constraint_grad function works."""
<|body_1|>
def test_vertex_constraint(self):
"""Tests whether the edge_constraint f... | stack_v2_sparse_classes_75kplus_train_067002 | 19,054 | no_license | [
{
"docstring": ":return:",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests whether the vertex_constraint_grad function works.",
"name": "test_edge_constraint_grad",
"signature": "def test_edge_constraint_grad(self)"
},
{
"docstring": "Tests whether the ed... | 3 | stack_v2_sparse_classes_30k_train_014599 | Implement the Python class `TestEdgeConstraint` described below.
Class description:
Implement the TestEdgeConstraint class.
Method signatures and docstrings:
- def setUp(self): :return:
- def test_edge_constraint_grad(self): Tests whether the vertex_constraint_grad function works.
- def test_vertex_constraint(self): ... | Implement the Python class `TestEdgeConstraint` described below.
Class description:
Implement the TestEdgeConstraint class.
Method signatures and docstrings:
- def setUp(self): :return:
- def test_edge_constraint_grad(self): Tests whether the vertex_constraint_grad function works.
- def test_vertex_constraint(self): ... | 63cbf87823d772c9db18d285f7ff211d18551472 | <|skeleton|>
class TestEdgeConstraint:
def setUp(self):
""":return:"""
<|body_0|>
def test_edge_constraint_grad(self):
"""Tests whether the vertex_constraint_grad function works."""
<|body_1|>
def test_vertex_constraint(self):
"""Tests whether the edge_constraint f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestEdgeConstraint:
def setUp(self):
""":return:"""
"""
case 1: A point is influenced by an edge.
(1,5) *
(0,0)*-----------* (10,0)
"""
vertices1 = np.array([[0, 0], [5, 1], [10, 0]])
d1 = 5
... | the_stack_v2_python_sparse | main_directory/test_energies.py | Jeronics/cac-segmenter | train | 3 | |
fb2c453c65c2f841524a88762455289022a9871e | [
"username = self.cleaned_data.get('username')\npassword = self.cleaned_data.get('password')\nif not username or not password:\n raise forms.ValidationError('Alle felt er påkrevd')\nelse:\n user = authenticate(username=username, password=password)\n if not user:\n raise forms.ValidationError('Feil br... | <|body_start_0|>
username = self.cleaned_data.get('username')
password = self.cleaned_data.get('password')
if not username or not password:
raise forms.ValidationError('Alle felt er påkrevd')
else:
user = authenticate(username=username, password=password)
... | Login form class. Creates and handles the login form. | LoginForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginForm:
"""Login form class. Creates and handles the login form."""
def clean(self):
"""Override the form clean method. Provide custom error messages for form and fields :return:"""
<|body_0|>
def login(self, request):
"""Login method. Authenticate user using ... | stack_v2_sparse_classes_75kplus_train_067003 | 7,625 | no_license | [
{
"docstring": "Override the form clean method. Provide custom error messages for form and fields :return:",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Login method. Authenticate user using provided username and password. :param request: :return: User object",
"name":... | 2 | stack_v2_sparse_classes_30k_train_011492 | Implement the Python class `LoginForm` described below.
Class description:
Login form class. Creates and handles the login form.
Method signatures and docstrings:
- def clean(self): Override the form clean method. Provide custom error messages for form and fields :return:
- def login(self, request): Login method. Aut... | Implement the Python class `LoginForm` described below.
Class description:
Login form class. Creates and handles the login form.
Method signatures and docstrings:
- def clean(self): Override the form clean method. Provide custom error messages for form and fields :return:
- def login(self, request): Login method. Aut... | ad28229e8c066e8f825097d12d159b444e5b2ccd | <|skeleton|>
class LoginForm:
"""Login form class. Creates and handles the login form."""
def clean(self):
"""Override the form clean method. Provide custom error messages for form and fields :return:"""
<|body_0|>
def login(self, request):
"""Login method. Authenticate user using ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoginForm:
"""Login form class. Creates and handles the login form."""
def clean(self):
"""Override the form clean method. Provide custom error messages for form and fields :return:"""
username = self.cleaned_data.get('username')
password = self.cleaned_data.get('password')
... | the_stack_v2_python_sparse | main/forms.py | MrTrulsen/StudEval | train | 0 |
66f6568b7fb0f33aec67a0146b9243e9a4e58247 | [
"self.reponame = os.environ['reponame']\nself.model = os.environ['model']\nself.qa_model_name = os.environ['qa_yaml_name']\nself.rd_model_name = os.environ['rd_yaml_path']\nself.log_dir = 'logs'\nself.log_name = 'train_prim_single.log'\nself.log_path = os.path.join(os.getcwd(), self.log_dir, self.reponame, self.qa_... | <|body_start_0|>
self.reponame = os.environ['reponame']
self.model = os.environ['model']
self.qa_model_name = os.environ['qa_yaml_name']
self.rd_model_name = os.environ['rd_yaml_path']
self.log_dir = 'logs'
self.log_name = 'train_prim_single.log'
self.log_path = o... | case执行结束后 | PaddleSeg_End | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaddleSeg_End:
"""case执行结束后"""
def __init__(self):
"""初始化"""
<|body_0|>
def get_loss(self, log_path):
"""获取loss值"""
<|body_1|>
def draw_curve(self):
"""绘制曲线"""
<|body_2|>
def build_end(self):
"""执行准备过程"""
<|body_3... | stack_v2_sparse_classes_75kplus_train_067004 | 3,788 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "获取loss值",
"name": "get_loss",
"signature": "def get_loss(self, log_path)"
},
{
"docstring": "绘制曲线",
"name": "draw_curve",
"signature": "def draw_curve(self)"
},
{
"docst... | 4 | stack_v2_sparse_classes_30k_train_038138 | Implement the Python class `PaddleSeg_End` described below.
Class description:
case执行结束后
Method signatures and docstrings:
- def __init__(self): 初始化
- def get_loss(self, log_path): 获取loss值
- def draw_curve(self): 绘制曲线
- def build_end(self): 执行准备过程 | Implement the Python class `PaddleSeg_End` described below.
Class description:
case执行结束后
Method signatures and docstrings:
- def __init__(self): 初始化
- def get_loss(self, log_path): 获取loss值
- def draw_curve(self): 绘制曲线
- def build_end(self): 执行准备过程
<|skeleton|>
class PaddleSeg_End:
"""case执行结束后"""
def __init... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class PaddleSeg_End:
"""case执行结束后"""
def __init__(self):
"""初始化"""
<|body_0|>
def get_loss(self, log_path):
"""获取loss值"""
<|body_1|>
def draw_curve(self):
"""绘制曲线"""
<|body_2|>
def build_end(self):
"""执行准备过程"""
<|body_3... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PaddleSeg_End:
"""case执行结束后"""
def __init__(self):
"""初始化"""
self.reponame = os.environ['reponame']
self.model = os.environ['model']
self.qa_model_name = os.environ['qa_yaml_name']
self.rd_model_name = os.environ['rd_yaml_path']
self.log_dir = 'logs'
... | the_stack_v2_python_sparse | models_restruct/PaddleSeg/tools/end.py | PaddlePaddle/PaddleTest | train | 42 |
48362a21ec5120d0cc3ce65915d39dd9d28fa82d | [
"Movable.__init__(self, canvas, cx, cy, thr, colorstr)\nself.radius = radius\nself.localCoords = [(0.0, 0.0), (self.radius, 0.0)]\nself.updateGlobalCoords()\nself.createObjects()",
"p = list(map(self.canvas.tfm.transform, self.globalCoords))\nr = self.canvas.tfm.transform_scale(self.radius, 0.0)\nself.canvas.coor... | <|body_start_0|>
Movable.__init__(self, canvas, cx, cy, thr, colorstr)
self.radius = radius
self.localCoords = [(0.0, 0.0), (self.radius, 0.0)]
self.updateGlobalCoords()
self.createObjects()
<|end_body_0|>
<|body_start_1|>
p = list(map(self.canvas.tfm.transform, self.glo... | MovableCircle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovableCircle:
def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0):
"""the MovableCircle constructor"""
<|body_0|>
def updatePixelCoords(self):
"""redraws the object it represents on the canvas"""
<|body_1|>
def createObjec... | stack_v2_sparse_classes_75kplus_train_067005 | 40,655 | no_license | [
{
"docstring": "the MovableCircle constructor",
"name": "__init__",
"signature": "def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0)"
},
{
"docstring": "redraws the object it represents on the canvas",
"name": "updatePixelCoords",
"signature": "def updateP... | 3 | stack_v2_sparse_classes_30k_train_015163 | Implement the Python class `MovableCircle` described below.
Class description:
Implement the MovableCircle class.
Method signatures and docstrings:
- def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0): the MovableCircle constructor
- def updatePixelCoords(self): redraws the object it r... | Implement the Python class `MovableCircle` described below.
Class description:
Implement the MovableCircle class.
Method signatures and docstrings:
- def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0): the MovableCircle constructor
- def updatePixelCoords(self): redraws the object it r... | eced0cc854c7165f688ce55b573331492b370e7e | <|skeleton|>
class MovableCircle:
def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0):
"""the MovableCircle constructor"""
<|body_0|>
def updatePixelCoords(self):
"""redraws the object it represents on the canvas"""
<|body_1|>
def createObjec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovableCircle:
def __init__(self, canvas, cx=0.0, cy=0.0, thr=0.0, colorstr='black', radius=10.0):
"""the MovableCircle constructor"""
Movable.__init__(self, canvas, cx, cy, thr, colorstr)
self.radius = radius
self.localCoords = [(0.0, 0.0), (self.radius, 0.0)]
self.upd... | the_stack_v2_python_sparse | Robotics/RobotCanvas.py | divir94/Python-Projects | train | 0 | |
588cf5ea38e0427b76ee911ff2e234d93cc7ecdf | [
"if request.user.is_superuser:\n return True\nif view.action in ['list', 'retrieve', 'destroy']:\n return True\nuser_organization_role = request.user.get_role_for_organization(request.data['organization'])\nif not user_organization_role or user_organization_role.name not in ['org-admin', 'super-admin']:\n ... | <|body_start_0|>
if request.user.is_superuser:
return True
if view.action in ['list', 'retrieve', 'destroy']:
return True
user_organization_role = request.user.get_role_for_organization(request.data['organization'])
if not user_organization_role or user_organizati... | Permission check for organization-user mapping. | OrganizationUserPermission | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationUserPermission:
"""Permission check for organization-user mapping."""
def has_permission(self, request, view):
"""View-level permissions for organization-user. This determines whether the request can access organization-user instances or not."""
<|body_0|>
de... | stack_v2_sparse_classes_75kplus_train_067006 | 3,327 | permissive | [
{
"docstring": "View-level permissions for organization-user. This determines whether the request can access organization-user instances or not.",
"name": "has_permission",
"signature": "def has_permission(self, request, view)"
},
{
"docstring": "Object-level permissions for organization-user. T... | 2 | stack_v2_sparse_classes_30k_train_033959 | Implement the Python class `OrganizationUserPermission` described below.
Class description:
Permission check for organization-user mapping.
Method signatures and docstrings:
- def has_permission(self, request, view): View-level permissions for organization-user. This determines whether the request can access organiza... | Implement the Python class `OrganizationUserPermission` described below.
Class description:
Permission check for organization-user mapping.
Method signatures and docstrings:
- def has_permission(self, request, view): View-level permissions for organization-user. This determines whether the request can access organiza... | 11896f17d0a30d1ae7e7f0ee8ccd6ab7652b25a7 | <|skeleton|>
class OrganizationUserPermission:
"""Permission check for organization-user mapping."""
def has_permission(self, request, view):
"""View-level permissions for organization-user. This determines whether the request can access organization-user instances or not."""
<|body_0|>
de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrganizationUserPermission:
"""Permission check for organization-user mapping."""
def has_permission(self, request, view):
"""View-level permissions for organization-user. This determines whether the request can access organization-user instances or not."""
if request.user.is_superuser:
... | the_stack_v2_python_sparse | users/permissions.py | pkmanish2611/plio-backend | train | 0 |
0052cc0ddd40c3b05c537ea96ca6e3d5d2ddfeac | [
"self.click_(self.loc_wode)\nsleep(5)\nself.click_(self.loc_vip_tubiao)\nsleep(5)\nresult_1 = self.is_element_Exist(self.loc_dy_title)\nresult_2 = self.is_element_Exist(self.loc_dy_touxiang)\nresult_3 = self.is_element_Exist(self.loc_dy_mingzi)\nresult_4 = self.is_element_Exist(self.loc_dy_viptubiao)\nresult_5 = se... | <|body_start_0|>
self.click_(self.loc_wode)
sleep(5)
self.click_(self.loc_vip_tubiao)
sleep(5)
result_1 = self.is_element_Exist(self.loc_dy_title)
result_2 = self.is_element_Exist(self.loc_dy_touxiang)
result_3 = self.is_element_Exist(self.loc_dy_mingzi)
r... | 配音秀会员 | Vip | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vip:
"""配音秀会员"""
def display(self):
"""配音秀会员-页面显示"""
<|body_0|>
def record(self):
"""交易记录"""
<|body_1|>
def alipay_12(self):
"""支付宝-12个月"""
<|body_2|>
def alipay_36(self):
"""支付宝-36各月"""
<|body_3|>
def wechat... | stack_v2_sparse_classes_75kplus_train_067007 | 5,312 | no_license | [
{
"docstring": "配音秀会员-页面显示",
"name": "display",
"signature": "def display(self)"
},
{
"docstring": "交易记录",
"name": "record",
"signature": "def record(self)"
},
{
"docstring": "支付宝-12个月",
"name": "alipay_12",
"signature": "def alipay_12(self)"
},
{
"docstring": "支付... | 6 | stack_v2_sparse_classes_30k_train_029301 | Implement the Python class `Vip` described below.
Class description:
配音秀会员
Method signatures and docstrings:
- def display(self): 配音秀会员-页面显示
- def record(self): 交易记录
- def alipay_12(self): 支付宝-12个月
- def alipay_36(self): 支付宝-36各月
- def wechat_12(self): 微信-12个月
- def wechat_36(self): 微信-36个月 | Implement the Python class `Vip` described below.
Class description:
配音秀会员
Method signatures and docstrings:
- def display(self): 配音秀会员-页面显示
- def record(self): 交易记录
- def alipay_12(self): 支付宝-12个月
- def alipay_36(self): 支付宝-36各月
- def wechat_12(self): 微信-12个月
- def wechat_36(self): 微信-36个月
<|skeleton|>
class Vip:
... | 9d8ad54fc982d3b2f8244e439705bcfee12ebd0c | <|skeleton|>
class Vip:
"""配音秀会员"""
def display(self):
"""配音秀会员-页面显示"""
<|body_0|>
def record(self):
"""交易记录"""
<|body_1|>
def alipay_12(self):
"""支付宝-12个月"""
<|body_2|>
def alipay_36(self):
"""支付宝-36各月"""
<|body_3|>
def wechat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vip:
"""配音秀会员"""
def display(self):
"""配音秀会员-页面显示"""
self.click_(self.loc_wode)
sleep(5)
self.click_(self.loc_vip_tubiao)
sleep(5)
result_1 = self.is_element_Exist(self.loc_dy_title)
result_2 = self.is_element_Exist(self.loc_dy_touxiang)
res... | the_stack_v2_python_sparse | wyt/page/vip.py | mengmengxidi/wyt-APP-Automation-code | train | 0 |
84ca4d432805197086e85f4fa0a0adb8adc6d790 | [
"self.path = path\nself.jsonFiles = [pos_json for pos_json in os.listdir(path) if pos_json.endswith('.json')]\nself.skeleton = self.getSkeleton(pr, nr)\nself.fullske = self.getFullSkeleton(pr, nr)",
"dic = {}\nfor j in self.jsonFiles:\n with open(self.path + j) as f:\n data = json.load(f)\n name ... | <|body_start_0|>
self.path = path
self.jsonFiles = [pos_json for pos_json in os.listdir(path) if pos_json.endswith('.json')]
self.skeleton = self.getSkeleton(pr, nr)
self.fullske = self.getFullSkeleton(pr, nr)
<|end_body_0|>
<|body_start_1|>
dic = {}
for j in self.jsonFi... | class Json | Json | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Json:
"""class Json"""
def __init__(self, path, pr, nr):
"""constructor"""
<|body_0|>
def getSkeleton(self, pr, nr):
"""extract complete skeleton data from json files"""
<|body_1|>
def getFullSkeleton(self, pr, nr):
"""extract complete skelet... | stack_v2_sparse_classes_75kplus_train_067008 | 4,035 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, path, pr, nr)"
},
{
"docstring": "extract complete skeleton data from json files",
"name": "getSkeleton",
"signature": "def getSkeleton(self, pr, nr)"
},
{
"docstring": "extract complete skeleton d... | 6 | stack_v2_sparse_classes_30k_train_030587 | Implement the Python class `Json` described below.
Class description:
class Json
Method signatures and docstrings:
- def __init__(self, path, pr, nr): constructor
- def getSkeleton(self, pr, nr): extract complete skeleton data from json files
- def getFullSkeleton(self, pr, nr): extract complete skeleton data from js... | Implement the Python class `Json` described below.
Class description:
class Json
Method signatures and docstrings:
- def __init__(self, path, pr, nr): constructor
- def getSkeleton(self, pr, nr): extract complete skeleton data from json files
- def getFullSkeleton(self, pr, nr): extract complete skeleton data from js... | 2d2383a86c680ebaa6a47ada2f7476924065b74f | <|skeleton|>
class Json:
"""class Json"""
def __init__(self, path, pr, nr):
"""constructor"""
<|body_0|>
def getSkeleton(self, pr, nr):
"""extract complete skeleton data from json files"""
<|body_1|>
def getFullSkeleton(self, pr, nr):
"""extract complete skelet... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Json:
"""class Json"""
def __init__(self, path, pr, nr):
"""constructor"""
self.path = path
self.jsonFiles = [pos_json for pos_json in os.listdir(path) if pos_json.endswith('.json')]
self.skeleton = self.getSkeleton(pr, nr)
self.fullske = self.getFullSkeleton(pr, n... | the_stack_v2_python_sparse | Project/Sandbox/Code/Json.py | emersonff/CMEECourseWork | train | 1 |
5868c972ff8320e9830c2658436fc8e247b3b7f9 | [
"if self.df.empty:\n return self.df._default_to_pandas(lambda df: df.iloc[key])\nif isinstance(key, tuple):\n key = self._validate_key_length(key)\nrow_loc, col_loc, ndim = self._parse_row_and_column_locators(key)\nrow_scalar = is_scalar(row_loc)\ncol_scalar = is_scalar(col_loc)\nself._check_dtypes(row_loc)\n... | <|body_start_0|>
if self.df.empty:
return self.df._default_to_pandas(lambda df: df.iloc[key])
if isinstance(key, tuple):
key = self._validate_key_length(key)
row_loc, col_loc, ndim = self._parse_row_and_column_locators(key)
row_scalar = is_scalar(row_loc)
... | An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on. | _iLocIndexer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _iLocIndexer:
"""An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on."""
def __getitem__(self, key):
"""Retrieve dataset according to `key`. Parameters ---------- key : callable or tuple The global row numbers ... | stack_v2_sparse_classes_75kplus_train_067009 | 41,072 | permissive | [
{
"docstring": "Retrieve dataset according to `key`. Parameters ---------- key : callable or tuple The global row numbers to retrieve data from. Returns ------- DataFrame or Series Located dataset. See Also -------- pandas.DataFrame.iloc",
"name": "__getitem__",
"signature": "def __getitem__(self, key)"... | 4 | stack_v2_sparse_classes_30k_val_002509 | Implement the Python class `_iLocIndexer` described below.
Class description:
An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on.
Method signatures and docstrings:
- def __getitem__(self, key): Retrieve dataset according to `key`. Parameters -... | Implement the Python class `_iLocIndexer` described below.
Class description:
An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on.
Method signatures and docstrings:
- def __getitem__(self, key): Retrieve dataset according to `key`. Parameters -... | 8f6e00378e095817deccd25f4140406c5ee6c992 | <|skeleton|>
class _iLocIndexer:
"""An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on."""
def __getitem__(self, key):
"""Retrieve dataset according to `key`. Parameters ---------- key : callable or tuple The global row numbers ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _iLocIndexer:
"""An indexer for modin_df.iloc[] functionality. Parameters ---------- modin_df : modin.pandas.DataFrame DataFrame to operate on."""
def __getitem__(self, key):
"""Retrieve dataset according to `key`. Parameters ---------- key : callable or tuple The global row numbers to retrieve d... | the_stack_v2_python_sparse | modin/pandas/indexing.py | modin-project/modin | train | 9,241 |
a21094d6d2949c5d17c3c702715f087a0d0f2dce | [
"bikes = [bike.serialize(self.bike_connection_manager, self.rental_manager, self.reservation_manager, include_location=user is not None and user.type is not UserType.USER) for bike in await get_bikes()]\nif self.request.query.get('available') == 'true':\n bikes = (bike for bike in bikes if bike['status'] == 'ava... | <|body_start_0|>
bikes = [bike.serialize(self.bike_connection_manager, self.rental_manager, self.reservation_manager, include_location=user is not None and user.type is not UserType.USER) for bike in await get_bikes()]
if self.request.query.get('available') == 'true':
bikes = (bike for bike ... | Gets the bikes, or adds a new bike. | BikesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BikesView:
"""Gets the bikes, or adds a new bike."""
async def get(self, user):
"""Gets all the bikes from the system."""
<|body_0|>
async def post(self):
"""Registers a bike with the system."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
bikes... | stack_v2_sparse_classes_75kplus_train_067010 | 19,359 | permissive | [
{
"docstring": "Gets all the bikes from the system.",
"name": "get",
"signature": "async def get(self, user)"
},
{
"docstring": "Registers a bike with the system.",
"name": "post",
"signature": "async def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050023 | Implement the Python class `BikesView` described below.
Class description:
Gets the bikes, or adds a new bike.
Method signatures and docstrings:
- async def get(self, user): Gets all the bikes from the system.
- async def post(self): Registers a bike with the system. | Implement the Python class `BikesView` described below.
Class description:
Gets the bikes, or adds a new bike.
Method signatures and docstrings:
- async def get(self, user): Gets all the bikes from the system.
- async def post(self): Registers a bike with the system.
<|skeleton|>
class BikesView:
"""Gets the bik... | fc6f9230e4701cbddcb16d7257fddb9ff08bddb9 | <|skeleton|>
class BikesView:
"""Gets the bikes, or adds a new bike."""
async def get(self, user):
"""Gets all the bikes from the system."""
<|body_0|>
async def post(self):
"""Registers a bike with the system."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BikesView:
"""Gets the bikes, or adds a new bike."""
async def get(self, user):
"""Gets all the bikes from the system."""
bikes = [bike.serialize(self.bike_connection_manager, self.rental_manager, self.reservation_manager, include_location=user is not None and user.type is not UserType.US... | the_stack_v2_python_sparse | server/views/bikes.py | dragorhast/server | train | 6 |
1366f408b1a93a1949ff38fae0829bb8efa0f8c6 | [
"self.broker = broker\nself.port = port\nself.clientID = clientID\nself.pub_topic = pub_topic\nself._paho_mqtt = PahoMQTT.Client(clientID, False)\nself._paho_mqtt.connect(self.broker, self.port)\nself._paho_mqtt.loop_start()\nprint('Successfully connected to the broker')",
"b = random.randint(20, 800)\ndiz = {'bn... | <|body_start_0|>
self.broker = broker
self.port = port
self.clientID = clientID
self.pub_topic = pub_topic
self._paho_mqtt = PahoMQTT.Client(clientID, False)
self._paho_mqtt.connect(self.broker, self.port)
self._paho_mqtt.loop_start()
print('Successfully c... | brightness_sensor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class brightness_sensor:
def __init__(self, clientID, broker, port, pub_topic):
"""Create an MQTT client that connects to a broker and register its self as a device and as a service to a catalog via given topics. All the published message are in JSON format"""
<|body_0|>
def brigh... | stack_v2_sparse_classes_75kplus_train_067011 | 1,612 | no_license | [
{
"docstring": "Create an MQTT client that connects to a broker and register its self as a device and as a service to a catalog via given topics. All the published message are in JSON format",
"name": "__init__",
"signature": "def __init__(self, clientID, broker, port, pub_topic)"
},
{
"docstrin... | 2 | stack_v2_sparse_classes_30k_train_049415 | Implement the Python class `brightness_sensor` described below.
Class description:
Implement the brightness_sensor class.
Method signatures and docstrings:
- def __init__(self, clientID, broker, port, pub_topic): Create an MQTT client that connects to a broker and register its self as a device and as a service to a c... | Implement the Python class `brightness_sensor` described below.
Class description:
Implement the brightness_sensor class.
Method signatures and docstrings:
- def __init__(self, clientID, broker, port, pub_topic): Create an MQTT client that connects to a broker and register its self as a device and as a service to a c... | f851da9ba44e79b4909997c142d4187c00315769 | <|skeleton|>
class brightness_sensor:
def __init__(self, clientID, broker, port, pub_topic):
"""Create an MQTT client that connects to a broker and register its self as a device and as a service to a catalog via given topics. All the published message are in JSON format"""
<|body_0|>
def brigh... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class brightness_sensor:
def __init__(self, clientID, broker, port, pub_topic):
"""Create an MQTT client that connects to a broker and register its self as a device and as a service to a catalog via given topics. All the published message are in JSON format"""
self.broker = broker
self.port ... | the_stack_v2_python_sparse | sw/sw_4/mqtt_brightness_sensor.py | DvDUL/tiot-16 | train | 0 | |
faebc0287b60a5ff2175db69fbc5c346b3f85813 | [
"toggle = I2CToggle(self.mudpi, config)\nif toggle:\n self.add_component(toggle)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if conf.get('key') is None:\n raise ConfigError('Missing `key` in i2c toggle config.')\n if not conf.get('address'):\n ... | <|body_start_0|>
toggle = I2CToggle(self.mudpi, config)
if toggle:
self.add_component(toggle)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [config]
for conf in config:
if conf.get('key') is None:
... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load I2C toggle component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the I2C config"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
toggle = I2CToggle(self.mudpi, config)
if toggl... | stack_v2_sparse_classes_75kplus_train_067012 | 3,747 | permissive | [
{
"docstring": "Load I2C toggle component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the I2C config",
"name": "validate",
"signature": "def validate(self, config)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044987 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load I2C toggle component from configs
- def validate(self, config): Validate the I2C config | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load I2C toggle component from configs
- def validate(self, config): Validate the I2C config
<|skeleton|>
class Interface:
def load(self, config):... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load I2C toggle component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the I2C config"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Interface:
def load(self, config):
"""Load I2C toggle component from configs"""
toggle = I2CToggle(self.mudpi, config)
if toggle:
self.add_component(toggle)
return True
def validate(self, config):
"""Validate the I2C config"""
if not isinstance(... | the_stack_v2_python_sparse | mudpi/extensions/i2c/toggle.py | mistasp0ck/mudpi-core | train | 0 | |
8ca5af3235f809578339560990fc5c498f2796d0 | [
"for i in range(len(matrix)):\n if target <= matrix[i][-1]:\n return target in matrix[i]\nreturn False",
"m, n = (len(matrix), len(matrix[0]))\nl, r = (0, m * n - 1)\nwhile l <= r:\n m = (l + r) / 2\n if matrix[m / n][m % n] == target:\n return True\n elif matrix[m / n][m % n] > target:\... | <|body_start_0|>
for i in range(len(matrix)):
if target <= matrix[i][-1]:
return target in matrix[i]
return False
<|end_body_0|>
<|body_start_1|>
m, n = (len(matrix), len(matrix[0]))
l, r = (0, m * n - 1)
while l <= r:
m = (l + r) / 2
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def searchMatrix2(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus_train_067013 | 1,206 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix, target)"
},
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrix2",
"signature": "def search... | 2 | stack_v2_sparse_classes_30k_train_008476 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :typ... | 31b2b4dc1e5c3b1c53b333fe30b98ed04b0bdacc | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def searchMatrix2(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
for i in range(len(matrix)):
if target <= matrix[i][-1]:
return target in matrix[i]
return False
def searchMatrix2(self, matrix, target)... | the_stack_v2_python_sparse | prob074_search_2d_matrix.py | Hu-Wenchao/leetcode | train | 0 | |
2599df9f5dd544c1919cc88697b9cce75b5cf2d7 | [
"self.temp_path = mkdtemp(prefix='pelicantests.')\nself.temp_cache = mkdtemp(prefix='pelican_cache.')\nos.chdir(TEST_DATA_DIR)",
"rmtree(self.temp_path)\nrmtree(self.temp_cache)\nos.chdir(PLUGIN_DIR)",
"base_path = os.path.dirname(os.path.abspath(__file__))\nbase_path = os.path.join(base_path, 'test_data')\ncon... | <|body_start_0|>
self.temp_path = mkdtemp(prefix='pelicantests.')
self.temp_cache = mkdtemp(prefix='pelican_cache.')
os.chdir(TEST_DATA_DIR)
<|end_body_0|>
<|body_start_1|>
rmtree(self.temp_path)
rmtree(self.temp_cache)
os.chdir(PLUGIN_DIR)
<|end_body_1|>
<|body_start_2... | Test running Pelican with the Plugin | TestFullRun | [
"AGPL-3.0-only",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFullRun:
"""Test running Pelican with the Plugin"""
def setUp(self):
"""Create temporary output and cache folders"""
<|body_0|>
def tearDown(self):
"""Remove output and cache folders"""
<|body_1|>
def test_generic_tag_with_config(self):
"... | stack_v2_sparse_classes_75kplus_train_067014 | 2,091 | permissive | [
{
"docstring": "Create temporary output and cache folders",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Remove output and cache folders",
"name": "tearDown",
"signature": "def tearDown(self)"
},
{
"docstring": "Test generation of site with a generic tag tha... | 3 | stack_v2_sparse_classes_30k_train_029334 | Implement the Python class `TestFullRun` described below.
Class description:
Test running Pelican with the Plugin
Method signatures and docstrings:
- def setUp(self): Create temporary output and cache folders
- def tearDown(self): Remove output and cache folders
- def test_generic_tag_with_config(self): Test generati... | Implement the Python class `TestFullRun` described below.
Class description:
Test running Pelican with the Plugin
Method signatures and docstrings:
- def setUp(self): Create temporary output and cache folders
- def tearDown(self): Remove output and cache folders
- def test_generic_tag_with_config(self): Test generati... | b5d68070b6f15677a183424c84e30440e128e1ea | <|skeleton|>
class TestFullRun:
"""Test running Pelican with the Plugin"""
def setUp(self):
"""Create temporary output and cache folders"""
<|body_0|>
def tearDown(self):
"""Remove output and cache folders"""
<|body_1|>
def test_generic_tag_with_config(self):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFullRun:
"""Test running Pelican with the Plugin"""
def setUp(self):
"""Create temporary output and cache folders"""
self.temp_path = mkdtemp(prefix='pelicantests.')
self.temp_cache = mkdtemp(prefix='pelican_cache.')
os.chdir(TEST_DATA_DIR)
def tearDown(self):
... | the_stack_v2_python_sparse | plugins/liquid_tags/test_generic.py | JackMcKew/jackmckew.dev | train | 15 |
3f83768c5a7eedde914eed225b6aca5165f1d72b | [
"slide = openslide.OpenSlide(wsi_name)\ndimensions = slide.dimensions\nlevels = slide.level_count\nlevel = levels - 1\ndownsample = slide.level_downsamples[level]\nprint(level, downsample)\nthumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0), level, slide.level_dimensions[level]).convert('RGB')), cv2.C... | <|body_start_0|>
slide = openslide.OpenSlide(wsi_name)
dimensions = slide.dimensions
levels = slide.level_count
level = levels - 1
downsample = slide.level_downsamples[level]
print(level, downsample)
thumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0)... | WSIROI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WSIROI:
def __init__(self, wsi_name):
"""get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle"""
... | stack_v2_sparse_classes_75kplus_train_067015 | 5,710 | no_license | [
{
"docstring": "get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle",
"name": "__init__",
"signature": "def __init__(... | 2 | stack_v2_sparse_classes_30k_train_043620 | Implement the Python class `WSIROI` described below.
Class description:
Implement the WSIROI class.
Method signatures and docstrings:
- def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in... | Implement the Python class `WSIROI` described below.
Class description:
Implement the WSIROI class.
Method signatures and docstrings:
- def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in... | d77cec4438364deab94c37b45bdfde3e0b03b879 | <|skeleton|>
class WSIROI:
def __init__(self, wsi_name):
"""get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WSIROI:
def __init__(self, wsi_name):
"""get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle"""
slide = ope... | the_stack_v2_python_sparse | train_c1/roi_extract/WSI_ROI.py | liyu10000/tct | train | 15 | |
05755007b9e0103b91991e0c39085a1574aa512c | [
"index = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[index] = nums[i]\n index += 1\nfor i in range(index, len(nums)):\n nums[i] = 0\nreturn nums",
"index = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[index], nums[i] = (nums[i], nums[index])\n index += 1... | <|body_start_0|>
index = 0
for i in range(len(nums)):
if nums[i] != 0:
nums[index] = nums[i]
index += 1
for i in range(index, len(nums)):
nums[i] = 0
return nums
<|end_body_0|>
<|body_start_1|>
index = 0
for i in ra... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Complexity: O(n). However, the total number of operations are still sub-optimal. The total operatio... | stack_v2_sparse_classes_75kplus_train_067016 | 1,708 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Complexity: O(n). However, the total number of operations are still sub-optimal. The total operations (array writes) that code does is nn (Total num... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Co... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Co... | 96dd15210bcf9efe1f8cf31ce0566a7eabb3e221 | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Complexity: O(n). However, the total number of operations are still sub-optimal. The total operatio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. Space Complexity : O(1). Only constant space is used. Time Complexity: O(n). However, the total number of operations are still sub-optimal. The total operations (array writ... | the_stack_v2_python_sparse | Python/Move_Zeroes.py | abhi-verma/LeetCode-Algo | train | 0 | |
f0a0375bda5c0043c8c9a1196b39b15ff3defb35 | [
"local_num = 0\nglob_num = 0\nfor i in range(0, len(A) - 1):\n if A[i] > A[i + 1]:\n local_num += 1\n for j in range(i + 1, len(A)):\n if A[i] > A[j]:\n glob_num += 1\nreturn local_num == glob_num",
"\"\"\"\n 因为数字是在0---n-1的。所有的local-inverse都是glob-inverse,所以一旦一个位置比她上面的数差2以上,lo... | <|body_start_0|>
local_num = 0
glob_num = 0
for i in range(0, len(A) - 1):
if A[i] > A[i + 1]:
local_num += 1
for j in range(i + 1, len(A)):
if A[i] > A[j]:
glob_num += 1
return local_num == glob_num
<|end_body_0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIdealPermutation_timeout(self, A):
""":type A: List[int] :rtype: bool"""
<|body_0|>
def isIdealPermutation(self, A):
""":type A: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
local_num = 0
glob_num = ... | stack_v2_sparse_classes_75kplus_train_067017 | 945 | no_license | [
{
"docstring": ":type A: List[int] :rtype: bool",
"name": "isIdealPermutation_timeout",
"signature": "def isIdealPermutation_timeout(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: bool",
"name": "isIdealPermutation",
"signature": "def isIdealPermutation(self, A)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIdealPermutation_timeout(self, A): :type A: List[int] :rtype: bool
- def isIdealPermutation(self, A): :type A: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIdealPermutation_timeout(self, A): :type A: List[int] :rtype: bool
- def isIdealPermutation(self, A): :type A: List[int] :rtype: bool
<|skeleton|>
class Solution:
def... | 09b7121628df824f432b8cdd25c55f045b013c0b | <|skeleton|>
class Solution:
def isIdealPermutation_timeout(self, A):
""":type A: List[int] :rtype: bool"""
<|body_0|>
def isIdealPermutation(self, A):
""":type A: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isIdealPermutation_timeout(self, A):
""":type A: List[int] :rtype: bool"""
local_num = 0
glob_num = 0
for i in range(0, len(A) - 1):
if A[i] > A[i + 1]:
local_num += 1
for j in range(i + 1, len(A)):
if A[i] >... | the_stack_v2_python_sparse | array_775.py | cainingning/leetcode | train | 1 | |
8e4e4a35f4942b6840ad9f4ca265a1e33fe8d3ff | [
"if not g.isPublic:\n if g.user.seqid != g.artUserid:\n g.isPublic = 1\n else:\n g.isPublic = 2\nif g.artUserid and (not g.artSeqid):\n _tmpRes = g.tableArticle.get_user_all_arts(g.artUserid, g.isPublic)\n if _tmpRes:\n g.retMsg['status'] = 1\n g.retMsg['data'] = _tmpRes\n ... | <|body_start_0|>
if not g.isPublic:
if g.user.seqid != g.artUserid:
g.isPublic = 1
else:
g.isPublic = 2
if g.artUserid and (not g.artSeqid):
_tmpRes = g.tableArticle.get_user_all_arts(g.artUserid, g.isPublic)
if _tmpRes:
... | GetUpdateArticle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetUpdateArticle:
def get(self):
"""获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开"""
<|body_0|>
def post(self):
"""发布动态 params: artText params: *isPublic params: *imgName params: *imgPath"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_067018 | 5,961 | no_license | [
{
"docstring": "获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "发布动态 params: artText params: *isPublic params: *imgName params: *imgPath",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `GetUpdateArticle` described below.
Class description:
Implement the GetUpdateArticle class.
Method signatures and docstrings:
- def get(self): 获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开
- def post(self): 发布动态 params: artText params: *isPublic params: *im... | Implement the Python class `GetUpdateArticle` described below.
Class description:
Implement the GetUpdateArticle class.
Method signatures and docstrings:
- def get(self): 获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开
- def post(self): 发布动态 params: artText params: *isPublic params: *im... | 6648df93ec978516826573d3bb8222224f837bb4 | <|skeleton|>
class GetUpdateArticle:
def get(self):
"""获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开"""
<|body_0|>
def post(self):
"""发布动态 params: artText params: *isPublic params: *imgName params: *imgPath"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetUpdateArticle:
def get(self):
"""获取动态 params: artUserid 获取用户所有动态 params: artSeqid 获取单个动态 params: *isPublic 是否公开"""
if not g.isPublic:
if g.user.seqid != g.artUserid:
g.isPublic = 1
else:
g.isPublic = 2
if g.artUserid and (not g... | the_stack_v2_python_sparse | app/web/articles.py | Lcd7/TimeZoom | train | 1 | |
898844c574a735ddd0b2c73f92daf849c700c4e1 | [
"adm = ApplikationsAdministration()\narticle = adm.get_artikel_by_id(id)\nadm.delete_artikel(article)\nreturn ('', 200)",
"adm = ApplikationsAdministration()\na = Artikel.from_dict(api.payload)\nif a is not None:\n a.set_id(id)\n adm.update_artikel(a)\n return ('', 200)\nelse:\n return ('', 500)"
] | <|body_start_0|>
adm = ApplikationsAdministration()
article = adm.get_artikel_by_id(id)
adm.delete_artikel(article)
return ('', 200)
<|end_body_0|>
<|body_start_1|>
adm = ApplikationsAdministration()
a = Artikel.from_dict(api.payload)
if a is not None:
... | ArtikelOperations | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtikelOperations:
def delete(self, id):
"""Löschen eines Artikels anhand einer id"""
<|body_0|>
def put(self, id):
"""Update eines durch eine id bestimmten Artikel"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
adm = ApplikationsAdministration()
... | stack_v2_sparse_classes_75kplus_train_067019 | 23,456 | no_license | [
{
"docstring": "Löschen eines Artikels anhand einer id",
"name": "delete",
"signature": "def delete(self, id)"
},
{
"docstring": "Update eines durch eine id bestimmten Artikel",
"name": "put",
"signature": "def put(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016134 | Implement the Python class `ArtikelOperations` described below.
Class description:
Implement the ArtikelOperations class.
Method signatures and docstrings:
- def delete(self, id): Löschen eines Artikels anhand einer id
- def put(self, id): Update eines durch eine id bestimmten Artikel | Implement the Python class `ArtikelOperations` described below.
Class description:
Implement the ArtikelOperations class.
Method signatures and docstrings:
- def delete(self, id): Löschen eines Artikels anhand einer id
- def put(self, id): Update eines durch eine id bestimmten Artikel
<|skeleton|>
class ArtikelOpera... | d4a2b196f21a5379188cb78b31c59d69f739964f | <|skeleton|>
class ArtikelOperations:
def delete(self, id):
"""Löschen eines Artikels anhand einer id"""
<|body_0|>
def put(self, id):
"""Update eines durch eine id bestimmten Artikel"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArtikelOperations:
def delete(self, id):
"""Löschen eines Artikels anhand einer id"""
adm = ApplikationsAdministration()
article = adm.get_artikel_by_id(id)
adm.delete_artikel(article)
return ('', 200)
def put(self, id):
"""Update eines durch eine id bestim... | the_stack_v2_python_sparse | src/main.py | SvenjaHolzinger/SoftwarePraktikum | train | 0 | |
44a5dc1823ac343557f16975f27b008b249c6ae8 | [
"match = {}\nfor key in set(keys):\n value = top_level.get(key, None)\n if value is not None:\n match[key] = value\nreturn match",
"file_object = file_entry.GetFileObject()\ntry:\n plist_file = plist.PlistFile()\n plist_file.Read(file_object)\n match = self._GetTopLevelKeys(plist_file.root_k... | <|body_start_0|>
match = {}
for key in set(keys):
value = top_level.get(key, None)
if value is not None:
match[key] = value
return match
<|end_body_0|>
<|body_start_1|>
file_object = file_entry.GetFileObject()
try:
plist_file =... | MacOS user accounts plugin. | MacOSUserAccountsPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetTopLevelKeys(self, top_level, keys):
"""Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of the top-level keys that should be retrieved. Returns:... | stack_v2_sparse_classes_75kplus_train_067020 | 9,081 | permissive | [
{
"docstring": "Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of the top-level keys that should be retrieved. Returns: dict[str, str]: values of the requested keys or an empty dictionary if no corresponding top-level keys were found.",
... | 2 | null | Implement the Python class `MacOSUserAccountsPlugin` described below.
Class description:
MacOS user accounts plugin.
Method signatures and docstrings:
- def _GetTopLevelKeys(self, top_level, keys): Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names... | Implement the Python class `MacOSUserAccountsPlugin` described below.
Class description:
MacOS user accounts plugin.
Method signatures and docstrings:
- def _GetTopLevelKeys(self, top_level, keys): Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetTopLevelKeys(self, top_level, keys):
"""Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of the top-level keys that should be retrieved. Returns:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MacOSUserAccountsPlugin:
"""MacOS user accounts plugin."""
def _GetTopLevelKeys(self, top_level, keys):
"""Retrieves top-level plist keys. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of the top-level keys that should be retrieved. Returns: dict[str, st... | the_stack_v2_python_sparse | plaso/preprocessors/macos.py | log2timeline/plaso | train | 1,506 |
7fff115d8f6b206f43540daefa8b5f29055d61aa | [
"post_url = 'http://www.renren.com/PLogin.do'\nform_data = {'email': '670566875@qq.com', 'password': 'rr9877'}\nyield scrapy.FormRequest(post_url, formdata=form_data, callback=self.parse)",
"urls = ['http://www.renren.com/893897109/profile', 'http://www.renren.com/890297976/profile']\nfor url in urls:\n yield ... | <|body_start_0|>
post_url = 'http://www.renren.com/PLogin.do'
form_data = {'email': '670566875@qq.com', 'password': 'rr9877'}
yield scrapy.FormRequest(post_url, formdata=form_data, callback=self.parse)
<|end_body_0|>
<|body_start_1|>
urls = ['http://www.renren.com/893897109/profile', 'h... | RenrenSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RenrenSpider:
def start_requests(self):
"""登录并发送登录的post请求,登录成功则记录cookie"""
<|body_0|>
def parse(self, response):
"""直接发送好友的页面请求,scrapy会自动传递cookie"""
<|body_1|>
def parse_page(self, response):
"""处理每个好友页面的response响应"""
<|body_2|>
<|end_sk... | stack_v2_sparse_classes_75kplus_train_067021 | 1,448 | no_license | [
{
"docstring": "登录并发送登录的post请求,登录成功则记录cookie",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "直接发送好友的页面请求,scrapy会自动传递cookie",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "处理每个好友页面的response响应",
"name": "pars... | 3 | stack_v2_sparse_classes_30k_train_033767 | Implement the Python class `RenrenSpider` described below.
Class description:
Implement the RenrenSpider class.
Method signatures and docstrings:
- def start_requests(self): 登录并发送登录的post请求,登录成功则记录cookie
- def parse(self, response): 直接发送好友的页面请求,scrapy会自动传递cookie
- def parse_page(self, response): 处理每个好友页面的response响应 | Implement the Python class `RenrenSpider` described below.
Class description:
Implement the RenrenSpider class.
Method signatures and docstrings:
- def start_requests(self): 登录并发送登录的post请求,登录成功则记录cookie
- def parse(self, response): 直接发送好友的页面请求,scrapy会自动传递cookie
- def parse_page(self, response): 处理每个好友页面的response响应
<... | 298869fa9fb0291b9e364fbf4a6d8bd992840eb2 | <|skeleton|>
class RenrenSpider:
def start_requests(self):
"""登录并发送登录的post请求,登录成功则记录cookie"""
<|body_0|>
def parse(self, response):
"""直接发送好友的页面请求,scrapy会自动传递cookie"""
<|body_1|>
def parse_page(self, response):
"""处理每个好友页面的response响应"""
<|body_2|>
<|end_sk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RenrenSpider:
def start_requests(self):
"""登录并发送登录的post请求,登录成功则记录cookie"""
post_url = 'http://www.renren.com/PLogin.do'
form_data = {'email': '670566875@qq.com', 'password': 'rr9877'}
yield scrapy.FormRequest(post_url, formdata=form_data, callback=self.parse)
def parse(sel... | the_stack_v2_python_sparse | Scrapy/Renren/Renren/Renren/spiders/renren_login.py | AssassinHotstrip/personal_spider_pra | train | 0 | |
6e168021802fc75666a4f003b9ad1303d0924f53 | [
"super().__init__()\nself.file_path = None\nself.method = None\nself.params = {}",
"known_vars = list(vars(self))\nall_inps = process_args(conf, factory=None, str_keys=['file_path', 'method'])\nself.file_path = all_inps['file_path']\nself.method = all_inps['method']\nself.params = {k: v for k, v in all_inps.items... | <|body_start_0|>
super().__init__()
self.file_path = None
self.method = None
self.params = {}
<|end_body_0|>
<|body_start_1|>
known_vars = list(vars(self))
all_inps = process_args(conf, factory=None, str_keys=['file_path', 'method'])
self.file_path = all_inps['fi... | A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method. | SolverParser | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolverParser:
"""A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method."""
def __init__(self):
"""Initializer for ... | stack_v2_sparse_classes_75kplus_train_067022 | 1,402 | permissive | [
{
"docstring": "Initializer for the SolverParser class.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Parse the SOLVER section of the config into the required attributes. Args: conf (configparser section or dict): The full SOLVER section from the config.",
"name"... | 2 | null | Implement the Python class `SolverParser` described below.
Class description:
A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method.
Method signatur... | Implement the Python class `SolverParser` described below.
Class description:
A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method.
Method signatur... | cc4e7f7b9abb498893aaa05e2b25416f513905b0 | <|skeleton|>
class SolverParser:
"""A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method."""
def __init__(self):
"""Initializer for ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SolverParser:
"""A parser for the solver section of the config file. Attributes: file_path (string): The location to save the output to. method (string): The method to use for the solve. params (dict): Any parameters for the selected method."""
def __init__(self):
"""Initializer for the SolverPar... | the_stack_v2_python_sparse | TTiP/parsers/solver_parser.py | AndrewLister-STFC/TTiP | train | 0 |
377f49af42580e4c790f5437fcf3de51d704e849 | [
"result = ErrorResponse()\nrecords = json_obj.get(self.RECORDS)\nif type(records) != list:\n result.add_message(\"Airtable API response missing list property 'records'\")\n return result\nlanguages = []\nfor record in records:\n result1 = self.extract_language_from_json(record)\n if result1.has_error():... | <|body_start_0|>
result = ErrorResponse()
records = json_obj.get(self.RECORDS)
if type(records) != list:
result.add_message("Airtable API response missing list property 'records'")
return result
languages = []
for record in records:
result1 = s... | Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor | AirtableLanguageExtractor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AirtableLanguageExtractor:
"""Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor"""
def extract_languages_from_json(self, json_obj):
"""Extract list of Language objects from Airtable API response JSON Args: json_obj (dict): Respon... | stack_v2_sparse_classes_75kplus_train_067023 | 2,964 | no_license | [
{
"docstring": "Extract list of Language objects from Airtable API response JSON Args: json_obj (dict): Response from Airtable API Returns: ErrorResponse: Response object containing list of Language objects",
"name": "extract_languages_from_json",
"signature": "def extract_languages_from_json(self, json... | 2 | stack_v2_sparse_classes_30k_train_036747 | Implement the Python class `AirtableLanguageExtractor` described below.
Class description:
Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor
Method signatures and docstrings:
- def extract_languages_from_json(self, json_obj): Extract list of Language objects from... | Implement the Python class `AirtableLanguageExtractor` described below.
Class description:
Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor
Method signatures and docstrings:
- def extract_languages_from_json(self, json_obj): Extract list of Language objects from... | d38b9370c9ea90ae3a751dc7aab427e9688cf7ae | <|skeleton|>
class AirtableLanguageExtractor:
"""Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor"""
def extract_languages_from_json(self, json_obj):
"""Extract list of Language objects from Airtable API response JSON Args: json_obj (dict): Respon... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AirtableLanguageExtractor:
"""Utility for extracting Language objects from Airtable API response JSON Args: IAirtableLanguageExtractor"""
def extract_languages_from_json(self, json_obj):
"""Extract list of Language objects from Airtable API response JSON Args: json_obj (dict): Response from Airta... | the_stack_v2_python_sparse | wikitongues/wikitongues/data_store/airtable/airtable_language_extractor.py | vivianrdu/Language-Indexing | train | 1 |
85907978edce07f7e16b0d945df19aa10656894e | [
"self.pos = Vector2D(cf.X_POS, cf.Y_POS)\nself.dir = Vector2D(0, -1)\nself.vel = 0.0\nself.two_d_pos = Vector2D(0, 0)",
"try:\n one = self.dir.rotate(cf.ROTATION[0]).normalized() * cf.SCALING[0]\n two = self.dir.rotate(cf.ROTATION[1]).normalized() * cf.SCALING[1]\n three = self.dir.rotate(cf.ROTATION[2])... | <|body_start_0|>
self.pos = Vector2D(cf.X_POS, cf.Y_POS)
self.dir = Vector2D(0, -1)
self.vel = 0.0
self.two_d_pos = Vector2D(0, 0)
<|end_body_0|>
<|body_start_1|>
try:
one = self.dir.rotate(cf.ROTATION[0]).normalized() * cf.SCALING[0]
two = self.dir.rotat... | Make an arrow that can be drawn, displayed and rotated. | Arrow | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Arrow:
"""Make an arrow that can be drawn, displayed and rotated."""
def __init__(self):
"""Initializing all attributes 'Arrow' needs."""
<|body_0|>
def draw(self, screen):
"""Draw a polygon that takes the shape of a big arrow. Makes the polygon from seven 'Vecto... | stack_v2_sparse_classes_75kplus_train_067024 | 3,495 | permissive | [
{
"docstring": "Initializing all attributes 'Arrow' needs.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Draw a polygon that takes the shape of a big arrow. Makes the polygon from seven 'Vector2D' objects that are all based on the 'dir'-attribute of the arrow. Argume... | 3 | stack_v2_sparse_classes_30k_train_050264 | Implement the Python class `Arrow` described below.
Class description:
Make an arrow that can be drawn, displayed and rotated.
Method signatures and docstrings:
- def __init__(self): Initializing all attributes 'Arrow' needs.
- def draw(self, screen): Draw a polygon that takes the shape of a big arrow. Makes the poly... | Implement the Python class `Arrow` described below.
Class description:
Make an arrow that can be drawn, displayed and rotated.
Method signatures and docstrings:
- def __init__(self): Initializing all attributes 'Arrow' needs.
- def draw(self, screen): Draw a polygon that takes the shape of a big arrow. Makes the poly... | d1cc3d9861febd4848821c602141dbcd48b6e0e1 | <|skeleton|>
class Arrow:
"""Make an arrow that can be drawn, displayed and rotated."""
def __init__(self):
"""Initializing all attributes 'Arrow' needs."""
<|body_0|>
def draw(self, screen):
"""Draw a polygon that takes the shape of a big arrow. Makes the polygon from seven 'Vecto... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Arrow:
"""Make an arrow that can be drawn, displayed and rotated."""
def __init__(self):
"""Initializing all attributes 'Arrow' needs."""
self.pos = Vector2D(cf.X_POS, cf.Y_POS)
self.dir = Vector2D(0, -1)
self.vel = 0.0
self.two_d_pos = Vector2D(0, 0)
def draw... | the_stack_v2_python_sparse | gps_pygame/arrow.py | engeir/bladeGPS-Game | train | 0 |
4921ae59e580edd7b5c2c208725a2c0e3f924110 | [
"log.info('Getting list of simulations.')\ntry:\n self.sim_list = get_simulations(uut)\n log.info('Successfully got the list of simulations: {}'.format(self.sim_list))\nexcept Exception as e:\n raise Exception('Unable to get list of simulations.')",
"log.info('stopping simulation {}'.format(simulation_na... | <|body_start_0|>
log.info('Getting list of simulations.')
try:
self.sim_list = get_simulations(uut)
log.info('Successfully got the list of simulations: {}'.format(self.sim_list))
except Exception as e:
raise Exception('Unable to get list of simulations.')
<|en... | Trigger class to start/stop simulation | TriggerStopStartSimulation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerStopStartSimulation:
"""Trigger class to start/stop simulation"""
def get_simulations(self, uut):
"""Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results"""
<|body_0|>
def stop_simulation(self, uut, simulation_name):
"""Stop... | stack_v2_sparse_classes_75kplus_train_067025 | 4,753 | permissive | [
{
"docstring": "Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results",
"name": "get_simulations",
"signature": "def get_simulations(self, uut)"
},
{
"docstring": "Stop simulations Args: uut (`obj`): Device object simulation_name (`str`): simulation name Returns: N... | 3 | stack_v2_sparse_classes_30k_train_042795 | Implement the Python class `TriggerStopStartSimulation` described below.
Class description:
Trigger class to start/stop simulation
Method signatures and docstrings:
- def get_simulations(self, uut): Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results
- def stop_simulation(self, uut, s... | Implement the Python class `TriggerStopStartSimulation` described below.
Class description:
Trigger class to start/stop simulation
Method signatures and docstrings:
- def get_simulations(self, uut): Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results
- def stop_simulation(self, uut, s... | e42e51475cddcb10f5c7814d0fe892ac865742ba | <|skeleton|>
class TriggerStopStartSimulation:
"""Trigger class to start/stop simulation"""
def get_simulations(self, uut):
"""Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results"""
<|body_0|>
def stop_simulation(self, uut, simulation_name):
"""Stop... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TriggerStopStartSimulation:
"""Trigger class to start/stop simulation"""
def get_simulations(self, uut):
"""Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results"""
log.info('Getting list of simulations.')
try:
self.sim_list = get_simulat... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/triggers/virl/virl.py | CiscoTestAutomation/genielibs | train | 109 |
3fa660f36039d098d2c67ac30cbe66e7dd2c45b9 | [
"self.sample = sample\nnew_col1 = when(col('alleles')[0] != u'NO_CALL', 1).otherwise(when(col('alleles')[0] == u'NO_CALL', 2))\ncallrateData = genotypeDataset.toDF().sample(False, self.sample).withColumn('calledstatus', new_col1).groupBy('sampleid', 'calledstatus').count().collect()\ndata_called = {}\ndata_missing ... | <|body_start_0|>
self.sample = sample
new_col1 = when(col('alleles')[0] != u'NO_CALL', 1).otherwise(when(col('alleles')[0] == u'NO_CALL', 2))
callrateData = genotypeDataset.toDF().sample(False, self.sample).withColumn('calledstatus', new_col1).groupBy('sampleid', 'calledstatus').count().collect(... | GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset. | GenotypeCallRatesDistribution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenotypeCallRatesDistribution:
"""GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset."""
def __init__(self, ss, genotypeDataset, sample=1.0):
"""Initializes a GenotypeCallRatesDistributio... | stack_v2_sparse_classes_75kplus_train_067026 | 10,087 | permissive | [
{
"docstring": "Initializes a GenotypeCallRatesDistribution class. Retrieves counts of called and missing genotypes from a genotypeDataset. Args: :param ss: SparkContext :param genotypeDataset: genolake.adam.rdd.GenotypeDataset :param sample: Fraction to sample GenotypeDataset. Should be between 0 and 1",
"... | 2 | stack_v2_sparse_classes_30k_train_021002 | Implement the Python class `GenotypeCallRatesDistribution` described below.
Class description:
GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset.
Method signatures and docstrings:
- def __init__(self, ss, genotypeDataset... | Implement the Python class `GenotypeCallRatesDistribution` described below.
Class description:
GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset.
Method signatures and docstrings:
- def __init__(self, ss, genotypeDataset... | c9cab1848f7b2afc8055325f8076d2d60706ea23 | <|skeleton|>
class GenotypeCallRatesDistribution:
"""GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset."""
def __init__(self, ss, genotypeDataset, sample=1.0):
"""Initializes a GenotypeCallRatesDistributio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GenotypeCallRatesDistribution:
"""GenotypeCallRatesDistribution class. GenotypeCallRatesDistribution computes a distribution of per-sample genotype call rates from a genotypeDataset."""
def __init__(self, ss, genotypeDataset, sample=1.0):
"""Initializes a GenotypeCallRatesDistribution class. Retr... | the_stack_v2_python_sparse | tahoe-python/genolake/tahoe/genotypes.py | genolake/tahoe | train | 0 |
01e72a11d481da82ba937e2357d97383367e2149 | [
"try:\n item = ScriptFiles.objects.get(id=ids)\nexcept (ScriptFiles.DoesNotExist, ScriptFiles.MultipleObjectsReturned) as err:\n logger.error(err)\n return Response(data={'success': 1, 'data': {'total': 0, 'start': 0, 'count': 0, 'info': []}})\nexcept Exception as err:\n logger.error(err)\n JsonRespo... | <|body_start_0|>
try:
item = ScriptFiles.objects.get(id=ids)
except (ScriptFiles.DoesNotExist, ScriptFiles.MultipleObjectsReturned) as err:
logger.error(err)
return Response(data={'success': 1, 'data': {'total': 0, 'start': 0, 'count': 0, 'info': []}})
except ... | 处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求 | ScriptFileHandlerDetail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScriptFileHandlerDetail:
"""处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求"""
def get(self, request, version, ids):
"""处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:"""
<|body_0|>
def put(self, request, version, ids):
"""处理PUT请求 ... | stack_v2_sparse_classes_75kplus_train_067027 | 36,120 | no_license | [
{
"docstring": "处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:",
"name": "get",
"signature": "def get(self, request, version, ids)"
},
{
"docstring": "处理PUT请求 alter one item :param request: :param version: API版本号 :param ids: 待修改记录的id",
"name": "put",
... | 2 | stack_v2_sparse_classes_30k_train_003830 | Implement the Python class `ScriptFileHandlerDetail` described below.
Class description:
处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求
Method signatures and docstrings:
- def get(self, request, version, ids): 处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:
- def put(self, request, ve... | Implement the Python class `ScriptFileHandlerDetail` described below.
Class description:
处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求
Method signatures and docstrings:
- def get(self, request, version, ids): 处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:
- def put(self, request, ve... | 427c26a0d851e59c392c6c67c82eacec84b6d6f6 | <|skeleton|>
class ScriptFileHandlerDetail:
"""处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求"""
def get(self, request, version, ids):
"""处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:"""
<|body_0|>
def put(self, request, version, ids):
"""处理PUT请求 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScriptFileHandlerDetail:
"""处理 api/v1/ops/hosts_oper/scripts/{id}/ 请求"""
def get(self, request, version, ids):
"""处理GET请求,查询一条脚本信息 :param request: :param version: API版本号 :param ids: 待查询记录的id :return:"""
try:
item = ScriptFiles.objects.get(id=ids)
except (ScriptFiles.Do... | the_stack_v2_python_sparse | yunwei/ops_server/hosts_oper/views.py | wll1014/KKB | train | 1 |
bbdaea12a663570e0a24047c8a882d95e4c899d3 | [
"self.rulesFuzzyDisplay = rulesFuzzyDisplay\nself.fuzzy_sets = rulesFuzzyDisplay.fuzzy_sets\nself.new_rule_root = Toplevel()\nself.new_rule_root.title(\"Création d'une nouvelle règle\")\nLabel(self.new_rule_root, text='Conditions :').grid(row=0, padx='0.3c')\nLabel(self.new_rule_root, text='Nom du fait').grid(row=1... | <|body_start_0|>
self.rulesFuzzyDisplay = rulesFuzzyDisplay
self.fuzzy_sets = rulesFuzzyDisplay.fuzzy_sets
self.new_rule_root = Toplevel()
self.new_rule_root.title("Création d'une nouvelle règle")
Label(self.new_rule_root, text='Conditions :').grid(row=0, padx='0.3c')
Lab... | RuleCreation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuleCreation:
def __init__(self, rulesFuzzyDisplay):
"""Allows the user to create a new rule. a description is automatically generated"""
<|body_0|>
def validate(self):
"""This function is called when the button "creer" is pressed in the creation form. It saves the n... | stack_v2_sparse_classes_75kplus_train_067028 | 8,831 | no_license | [
{
"docstring": "Allows the user to create a new rule. a description is automatically generated",
"name": "__init__",
"signature": "def __init__(self, rulesFuzzyDisplay)"
},
{
"docstring": "This function is called when the button \"creer\" is pressed in the creation form. It saves the new rule in... | 2 | stack_v2_sparse_classes_30k_val_002238 | Implement the Python class `RuleCreation` described below.
Class description:
Implement the RuleCreation class.
Method signatures and docstrings:
- def __init__(self, rulesFuzzyDisplay): Allows the user to create a new rule. a description is automatically generated
- def validate(self): This function is called when t... | Implement the Python class `RuleCreation` described below.
Class description:
Implement the RuleCreation class.
Method signatures and docstrings:
- def __init__(self, rulesFuzzyDisplay): Allows the user to create a new rule. a description is automatically generated
- def validate(self): This function is called when t... | 989f4050816d1241e41e36e4e6d95784ff4dff1c | <|skeleton|>
class RuleCreation:
def __init__(self, rulesFuzzyDisplay):
"""Allows the user to create a new rule. a description is automatically generated"""
<|body_0|>
def validate(self):
"""This function is called when the button "creer" is pressed in the creation form. It saves the n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RuleCreation:
def __init__(self, rulesFuzzyDisplay):
"""Allows the user to create a new rule. a description is automatically generated"""
self.rulesFuzzyDisplay = rulesFuzzyDisplay
self.fuzzy_sets = rulesFuzzyDisplay.fuzzy_sets
self.new_rule_root = Toplevel()
self.new_r... | the_stack_v2_python_sparse | User_interface/UI_Rules_Fuzzy.py | brieglhostis/ExpertSystems | train | 0 | |
435b2f192cd22e0af748734c701b465bcc46ee9f | [
"agent = request.user.userinfo.agent\ndata = ModelMessage.get_cloud_info(agent_id=agent.id)\ndata['password'] = ''\ncontext = {'status': 200, 'msg': '获取数据成功', 'data': data}\nreturn Response(context)",
"agent = request.user.userinfo.agent\nemail = ModelMessage.objects.get_or_create(agent=agent, type=4)[0]\ncloud_e... | <|body_start_0|>
agent = request.user.userinfo.agent
data = ModelMessage.get_cloud_info(agent_id=agent.id)
data['password'] = ''
context = {'status': 200, 'msg': '获取数据成功', 'data': data}
return Response(context)
<|end_body_0|>
<|body_start_1|>
agent = request.user.userinf... | 邮件配置信息 | CloudEmail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CloudEmail:
"""邮件配置信息"""
def get(self, request):
"""获取邮件配置信息"""
<|body_0|>
def put(self, request):
"""修改邮件配置信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
agent = request.user.userinfo.agent
data = ModelMessage.get_cloud_info(agent_i... | stack_v2_sparse_classes_75kplus_train_067029 | 32,690 | no_license | [
{
"docstring": "获取邮件配置信息",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "修改邮件配置信息",
"name": "put",
"signature": "def put(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013824 | Implement the Python class `CloudEmail` described below.
Class description:
邮件配置信息
Method signatures and docstrings:
- def get(self, request): 获取邮件配置信息
- def put(self, request): 修改邮件配置信息 | Implement the Python class `CloudEmail` described below.
Class description:
邮件配置信息
Method signatures and docstrings:
- def get(self, request): 获取邮件配置信息
- def put(self, request): 修改邮件配置信息
<|skeleton|>
class CloudEmail:
"""邮件配置信息"""
def get(self, request):
"""获取邮件配置信息"""
<|body_0|>
def pu... | d6e025d7e9d9e3aecfd399c77f376130edd8a2df | <|skeleton|>
class CloudEmail:
"""邮件配置信息"""
def get(self, request):
"""获取邮件配置信息"""
<|body_0|>
def put(self, request):
"""修改邮件配置信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CloudEmail:
"""邮件配置信息"""
def get(self, request):
"""获取邮件配置信息"""
agent = request.user.userinfo.agent
data = ModelMessage.get_cloud_info(agent_id=agent.id)
data['password'] = ''
context = {'status': 200, 'msg': '获取数据成功', 'data': data}
return Response(context)... | the_stack_v2_python_sparse | soc_system/views/set_views.py | sundw2015/841 | train | 4 |
1bd51f95a2baf714c322213714d1e00b613203fe | [
"state = super().get_updated_state(current_stream_state, latest_record)\nif state:\n state[self.cursor_field] = int(state[self.cursor_field])\nreturn state",
"params = super().request_params(**kwargs)\nparams['include'] = 'comment_count'\nreturn params"
] | <|body_start_0|>
state = super().get_updated_state(current_stream_state, latest_record)
if state:
state[self.cursor_field] = int(state[self.cursor_field])
return state
<|end_body_0|>
<|body_start_1|>
params = super().request_params(**kwargs)
params['include'] = 'comm... | Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/ | Tickets | [
"MIT",
"Elastic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tickets:
"""Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/"""
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
"""Save state as integer"""
... | stack_v2_sparse_classes_75kplus_train_067030 | 20,471 | permissive | [
{
"docstring": "Save state as integer",
"name": "get_updated_state",
"signature": "def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]"
},
{
"docstring": "Adds the field 'comment_count'",
"name": "request_params",... | 2 | stack_v2_sparse_classes_30k_train_011722 | Implement the Python class `Tickets` described below.
Class description:
Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/
Method signatures and docstrings:
- def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[s... | Implement the Python class `Tickets` described below.
Class description:
Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/
Method signatures and docstrings:
- def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[s... | 802a8184cdd11c1eb905a54ed07c8732b0c0b807 | <|skeleton|>
class Tickets:
"""Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/"""
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
"""Save state as integer"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tickets:
"""Tickets stream: https://developer.zendesk.com/api-reference/ticketing/ticket-management/incremental_exports/"""
def get_updated_state(self, current_stream_state: MutableMapping[str, Any], latest_record: Mapping[str, Any]) -> Mapping[str, Any]:
"""Save state as integer"""
state... | the_stack_v2_python_sparse | airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py | Velocity-Engineering/airbyte | train | 0 |
e8cdd5a31a81ba6252d02232dcdcd7d0d602c153 | [
"if campo is None:\n return ''\nif campo in request.POST:\n return request.POST[campo].strip().encode('utf8')\nreturn ''",
"if campo is None:\n return ''\nif campo in request.FILES:\n return request.FILES[campo]\nreturn ''"
] | <|body_start_0|>
if campo is None:
return ''
if campo in request.POST:
return request.POST[campo].strip().encode('utf8')
return ''
<|end_body_0|>
<|body_start_1|>
if campo is None:
return ''
if campo in request.FILES:
return reques... | UtilsForAll | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UtilsForAll:
def getfromPost(self, request, campo=None):
"""Given a field return its value if exists. Return an empty string otherwise."""
<|body_0|>
def getfilefromPost(self, request, campo=None):
"""Given a field return its value if exists. Return an empty string o... | stack_v2_sparse_classes_75kplus_train_067031 | 914 | no_license | [
{
"docstring": "Given a field return its value if exists. Return an empty string otherwise.",
"name": "getfromPost",
"signature": "def getfromPost(self, request, campo=None)"
},
{
"docstring": "Given a field return its value if exists. Return an empty string otherwise.",
"name": "getfilefrom... | 2 | stack_v2_sparse_classes_30k_train_022338 | Implement the Python class `UtilsForAll` described below.
Class description:
Implement the UtilsForAll class.
Method signatures and docstrings:
- def getfromPost(self, request, campo=None): Given a field return its value if exists. Return an empty string otherwise.
- def getfilefromPost(self, request, campo=None): Gi... | Implement the Python class `UtilsForAll` described below.
Class description:
Implement the UtilsForAll class.
Method signatures and docstrings:
- def getfromPost(self, request, campo=None): Given a field return its value if exists. Return an empty string otherwise.
- def getfilefromPost(self, request, campo=None): Gi... | 7a390f98fec62825360c462f65944018ace7c265 | <|skeleton|>
class UtilsForAll:
def getfromPost(self, request, campo=None):
"""Given a field return its value if exists. Return an empty string otherwise."""
<|body_0|>
def getfilefromPost(self, request, campo=None):
"""Given a field return its value if exists. Return an empty string o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UtilsForAll:
def getfromPost(self, request, campo=None):
"""Given a field return its value if exists. Return an empty string otherwise."""
if campo is None:
return ''
if campo in request.POST:
return request.POST[campo].strip().encode('utf8')
return ''
... | the_stack_v2_python_sparse | Welpe/site_utils.py | itziar/Welpe | train | 1 | |
4393175a87503cfa3c6ae932c20525f65eb8ee5e | [
"for i in range(len(array)):\n for j in range(len(array[0])):\n if target == array[i][j]:\n return True\nreturn False",
"row = 0\ncol = len(array[0]) - 1\nwhile row <= len(array) - 1 and col >= 0:\n if target == array[row][col]:\n return True\n elif target > array[row][col]:\n ... | <|body_start_0|>
for i in range(len(array)):
for j in range(len(array[0])):
if target == array[i][j]:
return True
return False
<|end_body_0|>
<|body_start_1|>
row = 0
col = len(array[0]) - 1
while row <= len(array) - 1 and col >= 0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find(self, target, array):
"""直接遍历"""
<|body_0|>
def Find(self, target, array):
"""指针法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for i in range(len(array)):
for j in range(len(array[0])):
if target == ... | stack_v2_sparse_classes_75kplus_train_067032 | 1,726 | no_license | [
{
"docstring": "直接遍历",
"name": "find",
"signature": "def find(self, target, array)"
},
{
"docstring": "指针法",
"name": "Find",
"signature": "def Find(self, target, array)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027740 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find(self, target, array): 直接遍历
- def Find(self, target, array): 指针法 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find(self, target, array): 直接遍历
- def Find(self, target, array): 指针法
<|skeleton|>
class Solution:
def find(self, target, array):
"""直接遍历"""
<|body_0|>
... | e7756162dc4848ce69f0a78d839e6a287a6ac7a3 | <|skeleton|>
class Solution:
def find(self, target, array):
"""直接遍历"""
<|body_0|>
def Find(self, target, array):
"""指针法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def find(self, target, array):
"""直接遍历"""
for i in range(len(array)):
for j in range(len(array[0])):
if target == array[i][j]:
return True
return False
def Find(self, target, array):
"""指针法"""
row = 0
... | the_stack_v2_python_sparse | 算法设计基础/剑指offer/python/Find.py | zzg-971030/Learn_ML_in_Python | train | 0 | |
3a8e504c19d672ae1e44c704f51e2173d714e8ab | [
"auth_org = self.obtain_auth_organization()\nresult = db_Result.get(id)\nif not result:\n return ({'msg': f'Result id={id} not found!'}, HTTPStatus.NOT_FOUND)\nif not self.r.v_glo.can():\n c_orgs = result.task.collaboration.organizations\n if not (self.r.v_org.can() and auth_org in c_orgs):\n return... | <|body_start_0|>
auth_org = self.obtain_auth_organization()
result = db_Result.get(id)
if not result:
return ({'msg': f'Result id={id} not found!'}, HTTPStatus.NOT_FOUND)
if not self.r.v_glo.can():
c_orgs = result.task.collaboration.organizations
if no... | Resource for /api/result | Result | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Result:
"""Resource for /api/result"""
def get(self, id):
"""Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Globa... | stack_v2_sparse_classes_75kplus_train_067033 | 12,589 | permissive | [
{
"docstring": "Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Global|View|❌|❌|View any result| |Result|Organization|View|✅|✅|View the result... | 2 | stack_v2_sparse_classes_30k_train_031897 | Implement the Python class `Result` described below.
Class description:
Resource for /api/result
Method signatures and docstrings:
- def get(self, id): Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to ... | Implement the Python class `Result` described below.
Class description:
Resource for /api/result
Method signatures and docstrings:
- def get(self, id): Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to ... | b3ff6e91ac4caeaf31c12c20f73dfc61cfd9baca | <|skeleton|>
class Result:
"""Resource for /api/result"""
def get(self, id):
"""Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Globa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Result:
"""Resource for /api/result"""
def get(self, id):
"""Get a single result --- description: >- Returns a result from a task specified by an id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Result|Global|View|❌|❌|Vi... | the_stack_v2_python_sparse | vantage6-server/vantage6/server/resource/result.py | vantage6/vantage6 | train | 15 |
cade0cb9bd8e15ffe2b29e0b72731b760f9ca964 | [
"from bisect import bisect_left\nnums_sort = sorted([i + i for i in nums])\ncount = 0\nfor i in range(len(nums)):\n pos = bisect_left(nums_sort, nums[i] + nums[i])\n nums_sort = nums_sort[:pos] + nums_sort[pos + 1:]\n count += bisect_left(nums_sort, nums[i])\nreturn count",
"from bisect import bisect_lef... | <|body_start_0|>
from bisect import bisect_left
nums_sort = sorted([i + i for i in nums])
count = 0
for i in range(len(nums)):
pos = bisect_left(nums_sort, nums[i] + nums[i])
nums_sort = nums_sort[:pos] + nums_sort[pos + 1:]
count += bisect_left(nums_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reversePairs1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def reversePairs(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from bisect import bisect_left
num... | stack_v2_sparse_classes_75kplus_train_067034 | 3,287 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "reversePairs1",
"signature": "def reversePairs1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "reversePairs",
"signature": "def reversePairs(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031575 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reversePairs1(self, nums): :type nums: List[int] :rtype: int
- def reversePairs(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reversePairs1(self, nums): :type nums: List[int] :rtype: int
- def reversePairs(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def reverseP... | 4a1747b6497305f3821612d9c358a6795b1690da | <|skeleton|>
class Solution:
def reversePairs1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def reversePairs(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reversePairs1(self, nums):
""":type nums: List[int] :rtype: int"""
from bisect import bisect_left
nums_sort = sorted([i + i for i in nums])
count = 0
for i in range(len(nums)):
pos = bisect_left(nums_sort, nums[i] + nums[i])
nums_so... | the_stack_v2_python_sparse | Contests/c019.py | sevenhe716/LeetCode | train | 0 | |
1374aa5f072eeeb4465aa83b0383350599d100a8 | [
"if isinstance(init, type(self)):\n self.impl = dedalus_field(init.impl)\n self.expl = dedalus_field(init.expl)\nelif isinstance(init, de.Domain) or isinstance(init, tuple):\n self.impl = dedalus_field(init)\n self.expl = dedalus_field(init)\nelse:\n raise DataError('something went wrong during %s in... | <|body_start_0|>
if isinstance(init, type(self)):
self.impl = dedalus_field(init.impl)
self.expl = dedalus_field(init.expl)
elif isinstance(init, de.Domain) or isinstance(init, tuple):
self.impl = dedalus_field(init)
self.expl = dedalus_field(init)
... | RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part | rhs_imex_dedalus_field | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class rhs_imex_dedalus_field:
"""RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part"""
def __init__(self, init, val=0.0):
... | stack_v2_sparse_classes_75kplus_train_067035 | 11,938 | permissive | [
{
"docstring": "Initialization routine Args: init: can either be a tuple (one int per dimension) or a number (if only one dimension is requested) or another rhs_imex_field object val (float): an initial number (default: 0.0) Raises: DataError: if init is none of the types above",
"name": "__init__",
"si... | 4 | null | Implement the Python class `rhs_imex_dedalus_field` described below.
Class description:
RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part
Metho... | Implement the Python class `rhs_imex_dedalus_field` described below.
Class description:
RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part
Metho... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class rhs_imex_dedalus_field:
"""RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part"""
def __init__(self, init, val=0.0):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class rhs_imex_dedalus_field:
"""RHS data type for meshes with implicit and explicit components This data type can be used to have RHS with 2 components (here implicit and explicit) Attributes: impl (mesh.mesh): implicit part expl (mesh.mesh): explicit part"""
def __init__(self, init, val=0.0):
"""Init... | the_stack_v2_python_sparse | pySDC/playgrounds/deprecated/Dedalus/dedalus_field.py | Parallel-in-Time/pySDC | train | 30 |
981db8e6227436fa28617cab2656a7401f230519 | [
"self.set_header('content-type', 'application/json')\ntry:\n strategy = StrategyCustDao().get_strategy_by_app_and_name(app, name).get_dict()\n if self.group.is_root():\n self.process_error(-1, 'root用户组没有权限查询策略')\n elif self.group.is_manager():\n self.finish(json_dumps({'status': 200, 'msg': '... | <|body_start_0|>
self.set_header('content-type', 'application/json')
try:
strategy = StrategyCustDao().get_strategy_by_app_and_name(app, name).get_dict()
if self.group.is_root():
self.process_error(-1, 'root用户组没有权限查询策略')
elif self.group.is_manager():
... | StrategyQueryHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: n... | stack_v2_sparse_classes_75kplus_train_067036 | 20,036 | permissive | [
{
"docstring": "get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path required: true type: string description: the n... | 3 | stack_v2_sparse_classes_30k_train_015162 | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebul... | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebul... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path r... | the_stack_v2_python_sparse | nebula/views/strategy.py | threathunterX/nebula_web | train | 2 | |
ae5cbd882c78ebb5413b5c645474fa006abb3c63 | [
"super(MEGNet, self).__init__()\ntry:\n from torch_geometric.nn import Set2Set\nexcept ModuleNotFoundError:\n raise ImportError('MEGNet model requires torch_geometric to be installed')\nif mode not in ['classification', 'regression']:\n raise ValueError(\"mode must be either 'classification' or 'regression... | <|body_start_0|>
super(MEGNet, self).__init__()
try:
from torch_geometric.nn import Set2Set
except ModuleNotFoundError:
raise ImportError('MEGNet model requires torch_geometric to be installed')
if mode not in ['classification', 'regression']:
raise Va... | MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs = 5, 2 >>> n_global_features = 4 >... | MEGNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MEGNet:
"""MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs ... | stack_v2_sparse_classes_75kplus_train_067037 | 11,170 | permissive | [
{
"docstring": "Parameters ---------- n_node_features: int Number of features in a node n_edge_features: int Number of features in a edge n_global_features: int Number of global features n_blocks: int Number of GraphNetworks block to use in update is_undirected: bool, optional (default True) True when the graph... | 2 | stack_v2_sparse_classes_30k_test_000689 | Implement the Python class `MEGNet` described below.
Class description:
MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_feat... | Implement the Python class `MEGNet` described below.
Class description:
MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_feat... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class MEGNet:
"""MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MEGNet:
"""MatErials Graph Network A model for predicting crystal and molecular properties using GraphNetworks. Example ------- >>> import numpy as np >>> from torch_geometric.data import Batch >>> from deepchem.feat import GraphData >>> n_nodes, n_node_features = 5, 10 >>> n_edges, n_edge_attrs = 5, 2 >>> n_... | the_stack_v2_python_sparse | deepchem/models/torch_models/megnet.py | deepchem/deepchem | train | 4,876 |
caa6a6ac0fe59627a6ea889972f66422774f7bb8 | [
"params = super().get_default_params(with_embedding=True, with_multi_layer_perceptron=True)\nparams.add(engine.Param(name='mask_value', value=-1, desc='The value to be masked from inputs.'))\nparams['optimizer'] = 'adam'\nparams['input_shapes'] = [(5,), (5, 30)]\nreturn params",
"query = keras.layers.Input(name='... | <|body_start_0|>
params = super().get_default_params(with_embedding=True, with_multi_layer_perceptron=True)
params.add(engine.Param(name='mask_value', value=-1, desc='The value to be masked from inputs.'))
params['optimizer'] = 'adam'
params['input_shapes'] = [(5,), (5, 30)]
retu... | DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.compile() | DRMM | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DRMM:
"""DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.co... | stack_v2_sparse_classes_75kplus_train_067038 | 4,114 | permissive | [
{
"docstring": ":return: model default parameters.",
"name": "get_default_params",
"signature": "def get_default_params(cls) -> engine.ParamTable"
},
{
"docstring": "Build model structure.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Performs attention on ... | 3 | stack_v2_sparse_classes_30k_train_022027 | Implement the Python class `DRMM` described below.
Class description:
DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(ve... | Implement the Python class `DRMM` described below.
Class description:
DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(ve... | 1fe2afca7bc2aa0fd8af8f80df84a2665367d13c | <|skeleton|>
class DRMM:
"""DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DRMM:
"""DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.compile()"""
... | the_stack_v2_python_sparse | matchzoo/models/drmm.py | zhanzecheng/MatchZoo | train | 2 |
1de1eedafdc4267c974c8a81ab99cba543bf4734 | [
"self.dataproc = dataproc\nself._session2key = {self.dataproc.messages.JupyterConfig: 'jupyterSession'}\nself._engine2key = {self.dataproc.messages.SparkConfig: 'spark'}\nself.runtime_config_factory = runtime_config_factory_override or rcf.RuntimeConfigFactory(self.dataproc, use_config_property=True)\nself.environm... | <|body_start_0|>
self.dataproc = dataproc
self._session2key = {self.dataproc.messages.JupyterConfig: 'jupyterSession'}
self._engine2key = {self.dataproc.messages.SparkConfig: 'spark'}
self.runtime_config_factory = runtime_config_factory_override or rcf.RuntimeConfigFactory(self.dataproc,... | Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments. | SessionMessageFactory | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionMessageFactory:
"""Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments."""
def __init__(self, dataproc, runtime_config_factory_override=None, environment_config_factory_override=None, jupyter_config_... | stack_v2_sparse_classes_75kplus_train_067039 | 5,116 | permissive | [
{
"docstring": "Builder class for Session message. Session message factory. Only the flags added in AddArguments are handled. User need to provide session type specific message during message creation. Args: dataproc: A api_lib.dataproc.Dataproc instance. runtime_config_factory_override: Override the default Ru... | 2 | null | Implement the Python class `SessionMessageFactory` described below.
Class description:
Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments.
Method signatures and docstrings:
- def __init__(self, dataproc, runtime_config_factory_over... | Implement the Python class `SessionMessageFactory` described below.
Class description:
Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments.
Method signatures and docstrings:
- def __init__(self, dataproc, runtime_config_factory_over... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class SessionMessageFactory:
"""Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments."""
def __init__(self, dataproc, runtime_config_factory_override=None, environment_config_factory_override=None, jupyter_config_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SessionMessageFactory:
"""Factory class for Session message. Factory class for configuring argument parser and creating a Session message from the parsed arguments."""
def __init__(self, dataproc, runtime_config_factory_override=None, environment_config_factory_override=None, jupyter_config_factory_overr... | the_stack_v2_python_sparse | lib/googlecloudsdk/command_lib/dataproc/sessions/session_message_factory.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
eceb26243ded75f079f8e26594fbb2453b2dfadc | [
"pis = norm.cdf(self.score(X)[0])\nif integrate:\n return pis.mean(axis=0)\nelse:\n return pis",
"m, k = (self.n_models, x.shape[1])\ngammas, means, sds = self.score(x)\ngrads = np.zeros((m, k))\nfor i, mod in enumerate(self.models):\n d_mean, d_sd = mod.grad_input(x)\n d_gamma = (d_mean - gammas[i] *... | <|body_start_0|>
pis = norm.cdf(self.score(X)[0])
if integrate:
return pis.mean(axis=0)
else:
return pis
<|end_body_0|>
<|body_start_1|>
m, k = (self.n_models, x.shape[1])
gammas, means, sds = self.score(x)
grads = np.zeros((m, k))
for i, ... | Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition function accumulates the probability mass above the current best observation given the poster... | ImprovementProbability | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImprovementProbability:
"""Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition function accumulates the probability mass a... | stack_v2_sparse_classes_75kplus_train_067040 | 1,454 | permissive | [
{
"docstring": "Implementation of abstract base class method.",
"name": "evaluate",
"signature": "def evaluate(self, X, integrate=True)"
},
{
"docstring": "Implementation of abstract base class method.",
"name": "grad_input",
"signature": "def grad_input(self, x)"
}
] | 2 | null | Implement the Python class `ImprovementProbability` described below.
Class description:
Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition func... | Implement the Python class `ImprovementProbability` described below.
Class description:
Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition func... | cb63d6dd476eba7dfe701643dc21694089ed881b | <|skeleton|>
class ImprovementProbability:
"""Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition function accumulates the probability mass a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImprovementProbability:
"""Improvement Probability Acquisition Function Class The improvement probability acquisition function leverages the idea of probability of improvement to select the next hyperparameter configuration to evaluate. This acquisition function accumulates the probability mass above the curr... | the_stack_v2_python_sparse | sif/acquisitions/improvement_probability.py | afcarl/Sif-1 | train | 0 |
8ef06415f8fbed000d998c445de1098f9d1a8722 | [
"self.ui = ui\nself.server = host\nself.username = user\nself.password = pwd\nself.port = port\nsuper(SmarterConnection, self).__init__(host=host, user=user, pwd=pwd, port=port)",
"logger.verbose('Establishing connection to %s:%s...', self.server, self.port)\ntry:\n return super(SmarterConnection, self).__ente... | <|body_start_0|>
self.ui = ui
self.server = host
self.username = user
self.password = pwd
self.port = port
super(SmarterConnection, self).__init__(host=host, user=user, pwd=pwd, port=port)
<|end_body_0|>
<|body_start_1|>
logger.verbose('Establishing connection to... | A smarter version of pyVmomi's SmartConnection context manager. | SmarterConnection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmarterConnection:
"""A smarter version of pyVmomi's SmartConnection context manager."""
def __init__(self, ui, host, user, pwd, port=443):
"""Create a connection to the given server. Args: ui (UI): User interface instance. For the other parameters, see :class:`pyVim.connect.SmartCon... | stack_v2_sparse_classes_75kplus_train_067041 | 22,034 | permissive | [
{
"docstring": "Create a connection to the given server. Args: ui (UI): User interface instance. For the other parameters, see :class:`pyVim.connect.SmartConnection`",
"name": "__init__",
"signature": "def __init__(self, ui, host, user, pwd, port=443)"
},
{
"docstring": "Establish a connection a... | 4 | stack_v2_sparse_classes_30k_train_011415 | Implement the Python class `SmarterConnection` described below.
Class description:
A smarter version of pyVmomi's SmartConnection context manager.
Method signatures and docstrings:
- def __init__(self, ui, host, user, pwd, port=443): Create a connection to the given server. Args: ui (UI): User interface instance. For... | Implement the Python class `SmarterConnection` described below.
Class description:
A smarter version of pyVmomi's SmartConnection context manager.
Method signatures and docstrings:
- def __init__(self, ui, host, user, pwd, port=443): Create a connection to the given server. Args: ui (UI): User interface instance. For... | 0811b96311881a8293f28f2e300f6bed1b77ee31 | <|skeleton|>
class SmarterConnection:
"""A smarter version of pyVmomi's SmartConnection context manager."""
def __init__(self, ui, host, user, pwd, port=443):
"""Create a connection to the given server. Args: ui (UI): User interface instance. For the other parameters, see :class:`pyVim.connect.SmartCon... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SmarterConnection:
"""A smarter version of pyVmomi's SmartConnection context manager."""
def __init__(self, ui, host, user, pwd, port=443):
"""Create a connection to the given server. Args: ui (UI): User interface instance. For the other parameters, see :class:`pyVim.connect.SmartConnection`"""
... | the_stack_v2_python_sparse | COT/commands/deploy_esxi.py | glennmatthews/cot | train | 88 |
2517c41ce64eee4c9f7450d3bd7ce38717123f70 | [
"left = self.binarySearch(nums, target, 0, len(nums) - 1)\nif left == -1:\n return [-1, -1]\nright = left\nwhile nums[left] == target and left > 0:\n left -= 1\nif nums[left] != target:\n left += 1\nwhile nums[right] == target and right < len(nums) - 1:\n right += 1\nif nums[right] != target:\n right... | <|body_start_0|>
left = self.binarySearch(nums, target, 0, len(nums) - 1)
if left == -1:
return [-1, -1]
right = left
while nums[left] == target and left > 0:
left -= 1
if nums[left] != target:
left += 1
while nums[right] == target and ... | Solution | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def binarySearch(self, nums, target, left, right):
"""Binary Search for log(n) time"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067042 | 2,210 | permissive | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "searchRange",
"signature": "def searchRange(self, nums, target)"
},
{
"docstring": "Binary Search for log(n) time",
"name": "binarySearch",
"signature": "def binarySearch(self, nums, target, left, right)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def binarySearch(self, nums, target, left, right): Binary Search for log(n) time | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def binarySearch(self, nums, target, left, right): Binary Search for log(n) time
... | 4c21ab38b75389cfb71f12f995e3860e4cd8641a | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def binarySearch(self, nums, target, left, right):
"""Binary Search for log(n) time"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
left = self.binarySearch(nums, target, 0, len(nums) - 1)
if left == -1:
return [-1, -1]
right = left
while nums[left] == target and left > 0:
... | the_stack_v2_python_sparse | leetcode/34-Medium-Find-First-And-Last-Position-Of-Element-In-Sorted-Array/answer.py | BenDataAnalyst/Practice-Coding-Questions | train | 0 | |
03290573509782957b78362f1e42cfa560d5a89b | [
"Parametre.__init__(self, 'conquérir', 'conquer')\nself.tronquer = True\nself.aide_courte = 'conquit un navire et équipage'\nself.aide_longue = \"Cette commande permet de conquérir un navire adverse : si vous en avez le droit, vous en deviendrez son propriétaire. Vous aurez également les droits de commander les mat... | <|body_start_0|>
Parametre.__init__(self, 'conquérir', 'conquer')
self.tronquer = True
self.aide_courte = 'conquit un navire et équipage'
self.aide_longue = "Cette commande permet de conquérir un navire adverse : si vous en avez le droit, vous en deviendrez son propriétaire. Vous aurez é... | Commande 'équipage conquérir'. | PrmConquerir | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmConquerir:
"""Commande 'équipage conquérir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Para... | stack_v2_sparse_classes_75kplus_train_067043 | 4,608 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016759 | Implement the Python class `PrmConquerir` described below.
Class description:
Commande 'équipage conquérir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmConquerir` described below.
Class description:
Commande 'équipage conquérir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmConquerir:
"""Commande... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmConquerir:
"""Commande 'équipage conquérir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrmConquerir:
"""Commande 'équipage conquérir'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'conquérir', 'conquer')
self.tronquer = True
self.aide_courte = 'conquit un navire et équipage'
self.aide_longue = "Cette commande permet... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/equipage/conquerir.py | vincent-lg/tsunami | train | 5 |
385d55e83946f3cb1b06c1927a9ba0cf26873749 | [
"self._registry_url = registry_url\nself.catalog = None\nself.tags = {}\nself.manifests = []\nself._load_info()",
"catalog_url = self._registry_url + '/_catalog'\ntags_info = '/tags/list'\nc = request_url(catalog_url)\nif c:\n self.catalog = json.load(c)['repositories']\nelse:\n raise Exception('Could not g... | <|body_start_0|>
self._registry_url = registry_url
self.catalog = None
self.tags = {}
self.manifests = []
self._load_info()
<|end_body_0|>
<|body_start_1|>
catalog_url = self._registry_url + '/_catalog'
tags_info = '/tags/list'
c = request_url(catalog_url... | Stores/Caches metadata from specified registry | RegistryInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
<|body_0|>
def _load_info(self):
"""Loads the information about the registry to refer la... | stack_v2_sparse_classes_75kplus_train_067044 | 3,045 | no_license | [
{
"docstring": "Initialize the info object :param registry_url: The URL of registry",
"name": "__init__",
"signature": "def __init__(self, registry_url)"
},
{
"docstring": "Loads the information about the registry to refer later.",
"name": "_load_info",
"signature": "def _load_info(self)... | 2 | stack_v2_sparse_classes_30k_train_004160 | Implement the Python class `RegistryInfo` described below.
Class description:
Stores/Caches metadata from specified registry
Method signatures and docstrings:
- def __init__(self, registry_url): Initialize the info object :param registry_url: The URL of registry
- def _load_info(self): Loads the information about the... | Implement the Python class `RegistryInfo` described below.
Class description:
Stores/Caches metadata from specified registry
Method signatures and docstrings:
- def __init__(self, registry_url): Initialize the info object :param registry_url: The URL of registry
- def _load_info(self): Loads the information about the... | 4b59184c3453ae706d5e352306fe9e551c90dc41 | <|skeleton|>
class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
<|body_0|>
def _load_info(self):
"""Loads the information about the registry to refer la... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
self._registry_url = registry_url
self.catalog = None
self.tags = {}
self.manifests = []
... | the_stack_v2_python_sparse | container_pipeline/cleanup_registry/lib.py | eupraxialabs/container-pipeline-service | train | 0 |
a5d3a11b6f0db1c7876ec3ad242b5f60799fa71c | [
"context = super().get_context_data(**kwargs)\ncontext['page_title'] = 'IPs All'\ncontext['table_title'] = 'Overview of all IPs in our infrastructure'\nreturn context",
"qs1 = Netdev.objects.all().order_by('decomissioned')\nqs2 = Server.objects.all().order_by('decomissioned')\nqs4 = Vserver.objects.all().order_by... | <|body_start_0|>
context = super().get_context_data(**kwargs)
context['page_title'] = 'IPs All'
context['table_title'] = 'Overview of all IPs in our infrastructure'
return context
<|end_body_0|>
<|body_start_1|>
qs1 = Netdev.objects.all().order_by('decomissioned')
qs2 = ... | Queries all the existing objects in the DB for devices, Then return them as context for the view | IPlist_All | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPlist_All:
"""Queries all the existing objects in the DB for devices, Then return them as context for the view"""
def get_context_data(self, **kwargs):
"""Feeds more context data to the template, see Stations_Sept_Receivers comments."""
<|body_0|>
def get_queryset(self)... | stack_v2_sparse_classes_75kplus_train_067045 | 7,905 | no_license | [
{
"docstring": "Feeds more context data to the template, see Stations_Sept_Receivers comments.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "We have a qs per model to be queried, then is merged using the chain and returned to the view",
... | 2 | null | Implement the Python class `IPlist_All` described below.
Class description:
Queries all the existing objects in the DB for devices, Then return them as context for the view
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Feeds more context data to the template, see Stations_Sept_Receivers co... | Implement the Python class `IPlist_All` described below.
Class description:
Queries all the existing objects in the DB for devices, Then return them as context for the view
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Feeds more context data to the template, see Stations_Sept_Receivers co... | 12aafa53b362c1e093db70903d7cc3a70208986a | <|skeleton|>
class IPlist_All:
"""Queries all the existing objects in the DB for devices, Then return them as context for the view"""
def get_context_data(self, **kwargs):
"""Feeds more context data to the template, see Stations_Sept_Receivers comments."""
<|body_0|>
def get_queryset(self)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IPlist_All:
"""Queries all the existing objects in the DB for devices, Then return them as context for the view"""
def get_context_data(self, **kwargs):
"""Feeds more context data to the template, see Stations_Sept_Receivers comments."""
context = super().get_context_data(**kwargs)
... | the_stack_v2_python_sparse | inetrecomgr/views.py | mamedxanli/centurion | train | 0 |
a6c784bae4053d08de3b26943c37f9876833ce81 | [
"if n < 2:\n return 0\nif n == 2:\n return 1\nif n == 3:\n return 2\nresult = [0] * (n + 1)\nresult[1], result[2], result[3] = (1, 2, 3)\nfor i in range(4, n + 1):\n maxVal = i\n for j in range(1, (i + 2) // 2):\n temp = result[j] * result[i - j]\n if temp > maxVal:\n maxVal ... | <|body_start_0|>
if n < 2:
return 0
if n == 2:
return 1
if n == 3:
return 2
result = [0] * (n + 1)
result[1], result[2], result[3] = (1, 2, 3)
for i in range(4, n + 1):
maxVal = i
for j in range(1, (i + 2) // 2):... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def cutRope1(self, n):
""":type n:int :rtype:int"""
<|body_0|>
def cutRope2(self, n):
""":type n:int :rtype:int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 2:
return 0
if n == 2:
return 1
... | stack_v2_sparse_classes_75kplus_train_067046 | 1,422 | no_license | [
{
"docstring": ":type n:int :rtype:int",
"name": "cutRope1",
"signature": "def cutRope1(self, n)"
},
{
"docstring": ":type n:int :rtype:int",
"name": "cutRope2",
"signature": "def cutRope2(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018764 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def cutRope1(self, n): :type n:int :rtype:int
- def cutRope2(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 cutRope1(self, n): :type n:int :rtype:int
- def cutRope2(self, n): :type n:int :rtype:int
<|skeleton|>
class Solution:
def cutRope1(self, n):
""":type n:int :rt... | 42a15943394ae533dcd0d5bbf52e4366ab0756ab | <|skeleton|>
class Solution:
def cutRope1(self, n):
""":type n:int :rtype:int"""
<|body_0|>
def cutRope2(self, n):
""":type n:int :rtype:int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def cutRope1(self, n):
""":type n:int :rtype:int"""
if n < 2:
return 0
if n == 2:
return 1
if n == 3:
return 2
result = [0] * (n + 1)
result[1], result[2], result[3] = (1, 2, 3)
for i in range(4, n + 1):
... | the_stack_v2_python_sparse | test14.py | nihao-hit/jianzhiOffer | train | 0 | |
a82240962ae724108cb69cba8d44ff031e71d652 | [
"super(BotDispatcher, self).__init__()\nself.settingsInstance = src.settings.Settings()\nself.dispatch()",
"servers = self.settingsInstance.settings['servers']\nfor name, info in servers.items():\n self.botObjects[name] = src.irc.botObject.BotObject(self.settingsInstance.settings, info)\n thread = threading... | <|body_start_0|>
super(BotDispatcher, self).__init__()
self.settingsInstance = src.settings.Settings()
self.dispatch()
<|end_body_0|>
<|body_start_1|>
servers = self.settingsInstance.settings['servers']
for name, info in servers.items():
self.botObjects[name] = src.i... | The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjects class variable. | BotDispatcher | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BotDispatcher:
"""The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjects class variable."""
def __init__... | stack_v2_sparse_classes_75kplus_train_067047 | 2,303 | permissive | [
{
"docstring": "Prepare the object and fire off the dispatch method.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create one Bot object for each server and start it in threads.",
"name": "dispatch",
"signature": "def dispatch(self)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_train_025569 | Implement the Python class `BotDispatcher` described below.
Class description:
The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjec... | Implement the Python class `BotDispatcher` described below.
Class description:
The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjec... | cf8382dd394547f7fbd14871e83d5bc503ebf497 | <|skeleton|>
class BotDispatcher:
"""The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjects class variable."""
def __init__... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BotDispatcher:
"""The BotDispatcher object handles the delegation of the various bots on the various specified servers. One Bot object for each server (call name), meaning several bots can be connected to the same address. All bots are stored in the botObjects class variable."""
def __init__(self):
... | the_stack_v2_python_sparse | src/irc/botDispatcher.py | Tehnix/PyIRCb | train | 1 |
e368400f4c1fab5620a90fdc8a7aaef7a7e22185 | [
"self.name = 'Save selected features'\nself.group = 'Vector general tools'\nself.addParameter(ParameterVector(self.INPUT_LAYER, 'Input layer', ParameterVector.VECTOR_TYPE_ANY, False))\nself.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer with selected features'))",
"inputFilename = self.getParameterValue(... | <|body_start_0|>
self.name = 'Save selected features'
self.group = 'Vector general tools'
self.addParameter(ParameterVector(self.INPUT_LAYER, 'Input layer', ParameterVector.VECTOR_TYPE_ANY, False))
self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer with selected features'))
<|e... | This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and explain methods and variables used to do it. An algorithm like this will be available in... | SaveSelectedFeatures | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SaveSelectedFeatures:
"""This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and explain methods and variables used to do... | stack_v2_sparse_classes_75kplus_train_067048 | 4,761 | no_license | [
{
"docstring": "Here we define the inputs and output of the algorithm, along with some other properties",
"name": "defineCharacteristics",
"signature": "def defineCharacteristics(self)"
},
{
"docstring": "Here is where the processing itself takes place",
"name": "processAlgorithm",
"sign... | 2 | stack_v2_sparse_classes_30k_train_038517 | Implement the Python class `SaveSelectedFeatures` described below.
Class description:
This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and e... | Implement the Python class `SaveSelectedFeatures` described below.
Class description:
This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and e... | b86cc4c91c1f4f00a085ea34c1fa5d1cc0c96b75 | <|skeleton|>
class SaveSelectedFeatures:
"""This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and explain methods and variables used to do... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SaveSelectedFeatures:
"""This is an example algorithm that takes a vector layer and creates a new one just with just those features of the input layer that are selected. It is meant to be used as an example of how to create your own SEXTANTE algorithms and explain methods and variables used to do it. An algor... | the_stack_v2_python_sparse | algs18/SaveSelectedFeatures.py | pka/qgisenterprise-sextante-plugin | train | 0 |
cf21d673dc4128b73082d232da42955973f3603b | [
"write('<value><i8>')\nwrite(str(value))\nwrite('</i8></value>\\n')",
"try:\n return self.dump_int_orig(value, write)\nexcept OverflowError:\n return self.dump_i8(value, write)",
"try:\n return self.dump_long_orig(value, write)\nexcept OverflowError:\n return self.dump_i8(value, write)"
] | <|body_start_0|>
write('<value><i8>')
write(str(value))
write('</i8></value>\n')
<|end_body_0|>
<|body_start_1|>
try:
return self.dump_int_orig(value, write)
except OverflowError:
return self.dump_i8(value, write)
<|end_body_1|>
<|body_start_2|>
... | Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed. | CliMarshaller | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CliMarshaller:
"""Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed."""
def dump_i8(self, value, write):
"""Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not be converted by original method, try to convert it using... | stack_v2_sparse_classes_75kplus_train_067049 | 4,829 | permissive | [
{
"docstring": "Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not be converted by original method, try to convert it using 'dump_i8' method.",
"name": "dump_i8",
"signature": "def dump_i8(self, value, write)"
},
{
"docstring": "Override base class... | 3 | stack_v2_sparse_classes_30k_train_050444 | Implement the Python class `CliMarshaller` described below.
Class description:
Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed.
Method signatures and docstrings:
- def dump_i8(self, value, write): Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not... | Implement the Python class `CliMarshaller` described below.
Class description:
Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed.
Method signatures and docstrings:
- def dump_i8(self, value, write): Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not... | 2007bf3fe66edfe704e485141c55caed54fe13aa | <|skeleton|>
class CliMarshaller:
"""Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed."""
def dump_i8(self, value, write):
"""Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not be converted by original method, try to convert it using... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CliMarshaller:
"""Convert INT-64 value to XML-RPC chunk. Notes: No direct calls supposed."""
def dump_i8(self, value, write):
"""Override base class method. Notes: Allow processing INT-64 values in CLI.If passed value could not be converted by original method, try to convert it using 'dump_i8' me... | the_stack_v2_python_sparse | taf/testlib/xmlrpc_proxy.py | AndriyZabavskyy/taf | train | 0 |
b0f8fd33aa7f8b89e5bcf0f6a9806b5c920442f7 | [
"Server.__init__(self, filter_colors)\nself.connection = Connection(host, port)\nself.host = host\nself.port = port\nself.rcon_password = rcon_password",
"command = 'rcon \"%s\" %s' % (self.rcon_password, command)\nstatus, data = self.connection.command(command)\nif status.startswith(('Bad rcon', 'No rcon')):\n ... | <|body_start_0|>
Server.__init__(self, filter_colors)
self.connection = Connection(host, port)
self.host = host
self.port = port
self.rcon_password = rcon_password
<|end_body_0|>
<|body_start_1|>
command = 'rcon "%s" %s' % (self.rcon_password, command)
status, da... | Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces. | Administrator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Administrator:
"""Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces."""
def __init__(self, host, port, rcon_password, filter_colors=True):
"""TODO"""
<|body_0|>
def rcon_command(... | stack_v2_sparse_classes_75kplus_train_067050 | 16,244 | permissive | [
{
"docstring": "TODO",
"name": "__init__",
"signature": "def __init__(self, host, port, rcon_password, filter_colors=True)"
},
{
"docstring": "Execute an RCON command through the underlying connection and return the (type, data) response pair.",
"name": "rcon_command",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_013166 | Implement the Python class `Administrator` described below.
Class description:
Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces.
Method signatures and docstrings:
- def __init__(self, host, port, rcon_password, filter_colors... | Implement the Python class `Administrator` described below.
Class description:
Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces.
Method signatures and docstrings:
- def __init__(self, host, port, rcon_password, filter_colors... | deb1d2ed6c06d17bf3005d75a03e4f2eb7a9938e | <|skeleton|>
class Administrator:
"""Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces."""
def __init__(self, host, port, rcon_password, filter_colors=True):
"""TODO"""
<|body_0|>
def rcon_command(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Administrator:
"""Server implementation that can perform any command an administrator can. The right class if you're in the business of writing admin interfaces."""
def __init__(self, host, port, rcon_password, filter_colors=True):
"""TODO"""
Server.__init__(self, filter_colors)
s... | the_stack_v2_python_sparse | munerator/vendor/pyquake3.py | aequitas/munerator | train | 0 |
c9c2cfb4bebd5240bd55de061a9cc616f01cfe6a | [
"if v and isinstance(v, dict):\n return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': values.get('context')})})\nretu... | <|body_start_0|>
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': valu... | Args passed to image.remove. | ImageRemoveArgs | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageRemoveArgs:
"""Args passed to image.remove."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of `... | stack_v2_sparse_classes_75kplus_train_067051 | 4,357 | permissive | [
{
"docstring": "Set the value of ``ecr_repo``.",
"name": "_set_ecr_repo",
"signature": "def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any"
},
{
"docstring": "Set the value of ``repo``.",
"name": "_set_repo",
"signature": "def _set_repo(cls, v: Optional[str], values: Dict[str,... | 3 | null | Implement the Python class `ImageRemoveArgs` described below.
Class description:
Args passed to image.remove.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str... | Implement the Python class `ImageRemoveArgs` described below.
Class description:
Args passed to image.remove.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str... | 0763b06aee07d2cf3f037a49ca0cb81a048c5deb | <|skeleton|>
class ImageRemoveArgs:
"""Args passed to image.remove."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of `... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageRemoveArgs:
"""Args passed to image.remove."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry... | the_stack_v2_python_sparse | runway/cfngin/hooks/docker/image/_remove.py | onicagroup/runway | train | 156 |
77d8723cd663e9ab9e74c203ccad8ad6582ab89d | [
"if not s:\n return True\ns = s.lower()\nnum = len(s)\ni = 0\nj = num - 1\nwhile j - i >= 1:\n if not (s[i] >= 'a' and s[i] <= 'z' or (s[i] >= 'A' and s[i] <= 'Z') or (s[i] >= '0' and s[i] <= '9')):\n i += 1\n continue\n if not (s[j] >= 'a' and s[j] <= 'z' or (s[j] >= 'A' and s[j] <= 'Z') or ... | <|body_start_0|>
if not s:
return True
s = s.lower()
num = len(s)
i = 0
j = num - 1
while j - i >= 1:
if not (s[i] >= 'a' and s[i] <= 'z' or (s[i] >= 'A' and s[i] <= 'Z') or (s[i] >= '0' and s[i] <= '9')):
i += 1
con... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s:
return True
s = s.lower()
... | stack_v2_sparse_classes_75kplus_train_067052 | 1,152 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome2",
"signature": "def isPalindrome2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001323 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome2(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome2(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isPalindrome(self, s):
... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome2(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
if not s:
return True
s = s.lower()
num = len(s)
i = 0
j = num - 1
while j - i >= 1:
if not (s[i] >= 'a' and s[i] <= 'z' or (s[i] >= 'A' and s[i] <= 'Z') or (s[i... | the_stack_v2_python_sparse | 125. Valid Palindrome/palindrome.py | Macielyoung/LeetCode | train | 1 | |
64ae921e93e401e1a750e1d5ae8dcc8ba87a85d4 | [
"self.featureParams = dict(maxCorners=50, qualityLevel=0.3, minDistance=7, blockSize=7)\nself.opticalFlowParams = dict(winSize=(15, 15), maxLevel=4, criteria=(cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03))\nself.smoothingWindow = window\nself.xTrajectory = []\nself.yTrajectory = []",
"stable = new.fr... | <|body_start_0|>
self.featureParams = dict(maxCorners=50, qualityLevel=0.3, minDistance=7, blockSize=7)
self.opticalFlowParams = dict(winSize=(15, 15), maxLevel=4, criteria=(cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, 10, 0.03))
self.smoothingWindow = window
self.xTrajectory = []
... | The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into the calcOpticalFlowPyrLK function :ivar smoothingWindow: the amount of frames... | Stabilizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stabilizer:
"""The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into the calcOpticalFlowPyrLK function :ivar... | stack_v2_sparse_classes_75kplus_train_067053 | 3,364 | no_license | [
{
"docstring": "Initalizes smoothingWindow, xTrajectory, yTrajectory, and the parameters for optical flow and good features functions.",
"name": "__init__",
"signature": "def __init__(self, window=100)"
},
{
"docstring": "Calculates the movement from frame to frame, calculates the average moveme... | 2 | null | Implement the Python class `Stabilizer` described below.
Class description:
The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into ... | Implement the Python class `Stabilizer` described below.
Class description:
The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into ... | 576b799fd6f85768cc4e0ad44b0a787fb5c80b29 | <|skeleton|>
class Stabilizer:
"""The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into the calcOpticalFlowPyrLK function :ivar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Stabilizer:
"""The Stabilizer class performs a stabilization algorithm on the current frame that is based on the previous frame. :ivar featureParams: the parameters feed into the goodFeaturesToTrack function :ivar opticalFlowParams: the parameters feed into the calcOpticalFlowPyrLK function :ivar smoothingWin... | the_stack_v2_python_sparse | MV/stabilizer.py | bohongbobo/draft-GUI | train | 0 |
1cc7bee84a65dac140c99794833d195c713410fa | [
"endpoint = '/api/user/profile'\nresult = self._api_get(endpoint, params={'user_id': user_id, 'room_id': room_id})\nreturn result",
"endpoint = '/api/user/is_birthday_registered'\nresult = self._api_get(endpoint)\nreturn result.get('is_birthday_registered')",
"endpoint = '/api/account/'\nresult = self._api_get(... | <|body_start_0|>
endpoint = '/api/user/profile'
result = self._api_get(endpoint, params={'user_id': user_id, 'room_id': room_id})
return result
<|end_body_0|>
<|body_start_1|>
endpoint = '/api/user/is_birthday_registered'
result = self._api_get(endpoint)
return result.ge... | UserEndpointsMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserEndpointsMixin:
def user_profile(self, user_id, room_id=None):
"""Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :return:"""
<|body_0|>
def is_birthday_registered(self):
"""Whether the currently logged ... | stack_v2_sparse_classes_75kplus_train_067054 | 2,915 | permissive | [
{
"docstring": "Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :return:",
"name": "user_profile",
"signature": "def user_profile(self, user_id, room_id=None)"
},
{
"docstring": "Whether the currently logged in user has registered their... | 6 | stack_v2_sparse_classes_30k_train_010665 | Implement the Python class `UserEndpointsMixin` described below.
Class description:
Implement the UserEndpointsMixin class.
Method signatures and docstrings:
- def user_profile(self, user_id, room_id=None): Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :re... | Implement the Python class `UserEndpointsMixin` described below.
Class description:
Implement the UserEndpointsMixin class.
Method signatures and docstrings:
- def user_profile(self, user_id, room_id=None): Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :re... | 18faa89b98d3c4cdc671f8291747e4f0f776529a | <|skeleton|>
class UserEndpointsMixin:
def user_profile(self, user_id, room_id=None):
"""Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :return:"""
<|body_0|>
def is_birthday_registered(self):
"""Whether the currently logged ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserEndpointsMixin:
def user_profile(self, user_id, room_id=None):
"""Can be called with just user_id, room_id only seems to affect the url field :param user_id: :param room_id: :return:"""
endpoint = '/api/user/profile'
result = self._api_get(endpoint, params={'user_id': user_id, 'roo... | the_stack_v2_python_sparse | showroom/api/endpoints/user.py | amane1234/showroom | train | 0 | |
0e36dc62490d5b419fe7adde8c849a6fd7fbe2d7 | [
"myThread = threading.currentThread()\ndaoFactory = DAOFactory(package='WMCore.WMBS', logger=myThread.logger, dbinterface=myThread.dbi)\nstateDAO = daoFactory(classname='Jobs.NewestStateChangeForSub')\nresults = stateDAO.execute(subscription=self.subscription['id'])\nif len(results) > 0:\n for result in results:... | <|body_start_0|>
myThread = threading.currentThread()
daoFactory = DAOFactory(package='WMCore.WMBS', logger=myThread.logger, dbinterface=myThread.dbi)
stateDAO = daoFactory(classname='Jobs.NewestStateChangeForSub')
results = stateDAO.execute(subscription=self.subscription['id'])
... | _Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job and the creation of a new job. | Periodic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Periodic:
"""_Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job and the creation of a new job."""
... | stack_v2_sparse_classes_75kplus_train_067055 | 3,497 | no_license | [
{
"docstring": "_outstandingJobs_ Determine whether or not there are outstanding jobs and whether or not enough time has elapsed from the previous job to warrant creating a new job.",
"name": "outstandingJobs",
"signature": "def outstandingJobs(self, jobPeriod)"
},
{
"docstring": "_algorithm_ Pr... | 2 | stack_v2_sparse_classes_30k_train_052450 | Implement the Python class `Periodic` described below.
Class description:
_Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job ... | Implement the Python class `Periodic` described below.
Class description:
_Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job ... | 2b8fe0434d60542c5d5360cbe5e918ac5db98720 | <|skeleton|>
class Periodic:
"""_Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job and the creation of a new job."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Periodic:
"""_Periodic_ Periodically create jobs to process all files in a fileset. A job will not be created until the previous job has been completed and new data has arrived. Note that the period here refers to the amount of time between the end of a job and the creation of a new job."""
def outstandi... | the_stack_v2_python_sparse | src/python/WMCore/JobSplitting/Periodic.py | dmwm/WMCore-legacy | train | 0 |
f7945ebad1c8797345bc4de760c571331569a6b5 | [
"try:\n with open(file_name, 'w') as f:\n conn = create_connection()\n cur = conn.cursor()\n result = cur.execute('SELECT * FROM ' + table_name)\n items = [dict(zip([key[0] for key in cur.description], row)) for row in result]\n json_records = json.dumps({table_name: items})\n ... | <|body_start_0|>
try:
with open(file_name, 'w') as f:
conn = create_connection()
cur = conn.cursor()
result = cur.execute('SELECT * FROM ' + table_name)
items = [dict(zip([key[0] for key in cur.description], row)) for row in result]
... | Exporter class holds methods to export data to different formats. | Exporter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exporter:
"""Exporter class holds methods to export data to different formats."""
def export_as_json(file_name):
"""Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (str): name of the file. Pass employee_filename function. ... | stack_v2_sparse_classes_75kplus_train_067056 | 4,354 | no_license | [
{
"docstring": "Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (str): name of the file. Pass employee_filename function. Returns: str: json file content. Raises: IOError: If file not found or path is incorrect. TypeError: If trying to pass NoneType ... | 3 | null | Implement the Python class `Exporter` described below.
Class description:
Exporter class holds methods to export data to different formats.
Method signatures and docstrings:
- def export_as_json(file_name): Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (... | Implement the Python class `Exporter` described below.
Class description:
Exporter class holds methods to export data to different formats.
Method signatures and docstrings:
- def export_as_json(file_name): Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (... | 559a64aae2db51e11812cea5ff602f25953e8070 | <|skeleton|>
class Exporter:
"""Exporter class holds methods to export data to different formats."""
def export_as_json(file_name):
"""Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (str): name of the file. Pass employee_filename function. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Exporter:
"""Exporter class holds methods to export data to different formats."""
def export_as_json(file_name):
"""Gets salespeople records from database and Exports them to json file using json module. Parameters: file_name (str): name of the file. Pass employee_filename function. Returns: str:... | the_stack_v2_python_sparse | argparsing/exporter/exporter.py | nbiadrytski-zz/python-training | train | 0 |
1145fe4fc1c4883a54c78b7faf9108e16a4e1071 | [
"self.game = Game(numberOfPlayers, names)\nscreen = GameScreen(self.game)\nConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})",
"if self.game.over:\n self.stopRunning()\nelse:\n self.runController(RoundController(self.game.getNewRound()))\n if self.game.over:\n self.screen... | <|body_start_0|>
self.game = Game(numberOfPlayers, names)
screen = GameScreen(self.game)
ConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})
<|end_body_0|>
<|body_start_1|>
if self.game.over:
self.stopRunning()
else:
self.runContro... | Controller for a Game | GameController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameController:
"""Controller for a Game"""
def __init__(self, numberOfPlayers, names):
"""Initialize the Game Controller"""
<|body_0|>
def nextMessage(self, event):
"""Tell the screen to print the next message"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_067057 | 1,075 | no_license | [
{
"docstring": "Initialize the Game Controller",
"name": "__init__",
"signature": "def __init__(self, numberOfPlayers, names)"
},
{
"docstring": "Tell the screen to print the next message",
"name": "nextMessage",
"signature": "def nextMessage(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030612 | Implement the Python class `GameController` described below.
Class description:
Controller for a Game
Method signatures and docstrings:
- def __init__(self, numberOfPlayers, names): Initialize the Game Controller
- def nextMessage(self, event): Tell the screen to print the next message | Implement the Python class `GameController` described below.
Class description:
Controller for a Game
Method signatures and docstrings:
- def __init__(self, numberOfPlayers, names): Initialize the Game Controller
- def nextMessage(self, event): Tell the screen to print the next message
<|skeleton|>
class GameControl... | c46f2e7809b4ffc6443b279ee86edb4a0ac99a09 | <|skeleton|>
class GameController:
"""Controller for a Game"""
def __init__(self, numberOfPlayers, names):
"""Initialize the Game Controller"""
<|body_0|>
def nextMessage(self, event):
"""Tell the screen to print the next message"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameController:
"""Controller for a Game"""
def __init__(self, numberOfPlayers, names):
"""Initialize the Game Controller"""
self.game = Game(numberOfPlayers, names)
screen = GameScreen(self.game)
ConsoleController.__init__(self, screen, commands={ENDL: self.nextMessage})
... | the_stack_v2_python_sparse | src/View/Console/Game/game_controller.py | cloew/KaoPhaseTen | train | 0 |
84a8e7d43edb3e0ae5ead1342b199ead178ab1c8 | [
"super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug)\nself.delta_x = self.sensitivity\nself.delta_y = self.sensitivity // 2\nself.set_points(100 * lives)",
"if self.touch_edge():\n self.delta_x = -self.delta_x\n if len(self.sprites) == 2:\n if ... | <|body_start_0|>
super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug)
self.delta_x = self.sensitivity
self.delta_y = self.sensitivity // 2
self.set_points(100 * lives)
<|end_body_0|>
<|body_start_1|>
if self.touch_edge():
... | Scout | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Scout:
def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool):
"""Main class for the scout ship"""
<|body_0|>
def update(self) -> None:
"""Overridden update class for the scout boss... | stack_v2_sparse_classes_75kplus_train_067058 | 1,874 | permissive | [
{
"docstring": "Main class for the scout ship",
"name": "__init__",
"signature": "def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool)"
},
{
"docstring": "Overridden update class for the scout boss",
"nam... | 2 | stack_v2_sparse_classes_30k_test_000430 | Implement the Python class `Scout` described below.
Class description:
Implement the Scout class.
Method signatures and docstrings:
- def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): Main class for the scout ship
- def update... | Implement the Python class `Scout` described below.
Class description:
Implement the Scout class.
Method signatures and docstrings:
- def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): Main class for the scout ship
- def update... | 6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9 | <|skeleton|>
class Scout:
def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool):
"""Main class for the scout ship"""
<|body_0|>
def update(self) -> None:
"""Overridden update class for the scout boss... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Scout:
def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool):
"""Main class for the scout ship"""
super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug)
... | the_stack_v2_python_sparse | Space_Invaders/classes/Game/Sprites/Scout.py | Jh123x/Orbital | train | 4 | |
a7e9bccb4b45d7b4798815cece15639e206a52cd | [
"PeakDetector.__init__(self, recording, return_output=return_output)\nself.peak_detector_node = peak_detector_node\nself.waveform_extraction_node = waveform_extraction_node\nself.waveform_denoising_node = waveform_denoising_node\nself.num_iterations = num_iterations\nself.tresholds = tresholds",
"internal_pipelin... | <|body_start_0|>
PeakDetector.__init__(self, recording, return_output=return_output)
self.peak_detector_node = peak_detector_node
self.waveform_extraction_node = waveform_extraction_node
self.waveform_denoising_node = waveform_denoising_node
self.num_iterations = num_iterations
... | A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found. | IterativePeakDetector | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IterativePeakDetector:
"""A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found."""
def __init__(self, recording: BaseRecording... | stack_v2_sparse_classes_75kplus_train_067059 | 40,308 | permissive | [
{
"docstring": "Initialize the iterative peak detector. Parameters ---------- recording : BaseRecording The recording to process. peak_detector_node : PeakDetector The peak detector node to use. waveform_extraction_node : WaveformsNode The waveform extraction node to use. waveform_denoising_node The waveform de... | 5 | stack_v2_sparse_classes_30k_train_042667 | Implement the Python class `IterativePeakDetector` described below.
Class description:
A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.
Method sign... | Implement the Python class `IterativePeakDetector` described below.
Class description:
A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found.
Method sign... | ee2237b3f5ce2347b2ec9df90e97b0ee6c738dcf | <|skeleton|>
class IterativePeakDetector:
"""A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found."""
def __init__(self, recording: BaseRecording... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IterativePeakDetector:
"""A class that iteratively detects peaks in the recording by applying a peak detector, waveform extraction, and waveform denoising node. The algorithm runs for a specified number of iterations or until no peaks are found."""
def __init__(self, recording: BaseRecording, peak_detect... | the_stack_v2_python_sparse | src/spikeinterface/sortingcomponents/peak_detection.py | SpikeInterface/spikeinterface | train | 295 |
d5efc2259da8b3d46a3351a0db2a244985a47030 | [
"self.finishingTime = 0\nself.sccs = {}\nself.secondDFSStack = Stack()",
"i.setExplored(True)\nself.sccs[leader].append(i)\nfor j in i.getConnections():\n if not j.isExplored():\n self.dfs(j, leader, isFirstDFSLoopCall)\nself.finishingTime += 1\ni.setFinish(self.finishingTime)\nif isFirstDFSLoopCall:\n ... | <|body_start_0|>
self.finishingTime = 0
self.sccs = {}
self.secondDFSStack = Stack()
<|end_body_0|>
<|body_start_1|>
i.setExplored(True)
self.sccs[leader].append(i)
for j in i.getConnections():
if not j.isExplored():
self.dfs(j, leader, isFirs... | SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph | KosarajuAlgo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KosarajuAlgo:
"""SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph"""
def __init__(self):
"""Global variables for finishing time and leader, dictionary of sccs"""
<|body_0|>
def dfs(self, i, leader, isFirstDFSLoopCall=True):
... | stack_v2_sparse_classes_75kplus_train_067060 | 7,070 | no_license | [
{
"docstring": "Global variables for finishing time and leader, dictionary of sccs",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "DFS from start DFSNode i triggered by a dfsLoop since DFSNode leader",
"name": "dfs",
"signature": "def dfs(self, i, leader, isFir... | 4 | stack_v2_sparse_classes_30k_train_005997 | Implement the Python class `KosarajuAlgo` described below.
Class description:
SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph
Method signatures and docstrings:
- def __init__(self): Global variables for finishing time and leader, dictionary of sccs
- def dfs(self, i, leader, i... | Implement the Python class `KosarajuAlgo` described below.
Class description:
SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph
Method signatures and docstrings:
- def __init__(self): Global variables for finishing time and leader, dictionary of sccs
- def dfs(self, i, leader, i... | 0491ce3afbb6d338a30c2a1129dcc210a6819fcf | <|skeleton|>
class KosarajuAlgo:
"""SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph"""
def __init__(self):
"""Global variables for finishing time and leader, dictionary of sccs"""
<|body_0|>
def dfs(self, i, leader, isFirstDFSLoopCall=True):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KosarajuAlgo:
"""SCCs Algorithm from Kosaraju to compute strongly connected component of a directed graph"""
def __init__(self):
"""Global variables for finishing time and leader, dictionary of sccs"""
self.finishingTime = 0
self.sccs = {}
self.secondDFSStack = Stack()
... | the_stack_v2_python_sparse | algo1week4_sccs.py | acrodeon/coursera-algo1 | train | 1 |
c933d66ac34d6796ab61d6495fdc343b87012891 | [
"for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return [i, j]\nreturn 0",
"for i in range(len(nums)):\n if target - nums[i] in nums:\n j = nums.index(target - nums[i])\n if i == j:\n continue\n return [i, j... | <|body_start_0|>
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
return 0
<|end_body_0|>
<|body_start_1|>
for i in range(len(nums)):
if target - nums[i] in nums:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twoSum2(self, nums, targe... | stack_v2_sparse_classes_75kplus_train_067061 | 1,437 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum1",
"signature": "def twoSum1(self, nums, target)"
}... | 3 | stack_v2_sparse_classes_30k_train_047212 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | 5b55e35f15c7bf098203a6aabbb7aad6b14579fa | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twoSum2(self, nums, targe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return [i, j]
return 0
def twoSum1... | the_stack_v2_python_sparse | leetcode/1.py | queryor/algorithms | train | 0 | |
9e968ee613042a84ab7b799a6e79375bdbfd4308 | [
"super(DSSM, self).__init__()\nself.dictionary = dictionary\nself.config = args\nself.generate_semantic_feature = nn.Sequential(nn.Linear(len(dictionary), self.config.nhid), nn.Tanh(), nn.Linear(self.config.nhid, self.config.nhid), nn.Tanh(), nn.Linear(self.config.nhid, self.config.nhid_output), nn.Tanh())",
"w12... | <|body_start_0|>
super(DSSM, self).__init__()
self.dictionary = dictionary
self.config = args
self.generate_semantic_feature = nn.Sequential(nn.Linear(len(dictionary), self.config.nhid), nn.Tanh(), nn.Linear(self.config.nhid, self.config.nhid), nn.Tanh(), nn.Linear(self.config.nhid, self... | Implementation of the deep semantic similarity model. | DSSM | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DSSM:
"""Implementation of the deep semantic similarity model."""
def __init__(self, dictionary, args):
""""Constructor of the class."""
<|body_0|>
def cosine_similarity(x1, x2, dim=1, eps=1e-08):
"""Returns cosine similarity between x1 and x2, computed along dim... | stack_v2_sparse_classes_75kplus_train_067062 | 2,640 | permissive | [
{
"docstring": "\"Constructor of the class.",
"name": "__init__",
"signature": "def __init__(self, dictionary, args)"
},
{
"docstring": "Returns cosine similarity between x1 and x2, computed along dim. # taken from http://pytorch.org/docs/master/_modules/torch/nn/functional.html#cosine_similarit... | 3 | stack_v2_sparse_classes_30k_train_002179 | Implement the Python class `DSSM` described below.
Class description:
Implementation of the deep semantic similarity model.
Method signatures and docstrings:
- def __init__(self, dictionary, args): "Constructor of the class.
- def cosine_similarity(x1, x2, dim=1, eps=1e-08): Returns cosine similarity between x1 and x... | Implement the Python class `DSSM` described below.
Class description:
Implementation of the deep semantic similarity model.
Method signatures and docstrings:
- def __init__(self, dictionary, args): "Constructor of the class.
- def cosine_similarity(x1, x2, dim=1, eps=1e-08): Returns cosine similarity between x1 and x... | 5bd241fb49f08fa4937539991e12e5a502d5a072 | <|skeleton|>
class DSSM:
"""Implementation of the deep semantic similarity model."""
def __init__(self, dictionary, args):
""""Constructor of the class."""
<|body_0|>
def cosine_similarity(x1, x2, dim=1, eps=1e-08):
"""Returns cosine similarity between x1 and x2, computed along dim... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DSSM:
"""Implementation of the deep semantic similarity model."""
def __init__(self, dictionary, args):
""""Constructor of the class."""
super(DSSM, self).__init__()
self.dictionary = dictionary
self.config = args
self.generate_semantic_feature = nn.Sequential(nn.L... | the_stack_v2_python_sparse | ranking_baselines/DSSM/model.py | polaris79/mnsrf_ranking_suggestion | train | 0 |
bbda1018cacb1590e5985c5bc1588e09791c2cf5 | [
"self.Wxh = torch.randn(num_hidden, num_in)\nself.Wxh = self.Wxh * math.pow(2 / (num_in + num_hidden), 0.5)\nself.Bxh = torch.zeros(num_hidden, 1)\nself.Whh = torch.randn(num_hidden, num_hidden)\nself.Whh = self.Whh * math.pow(2 / (num_hidden + num_hidden), 0.5)\nself.Bhh = torch.zeros(num_hidden, 1)\nself.paramete... | <|body_start_0|>
self.Wxh = torch.randn(num_hidden, num_in)
self.Wxh = self.Wxh * math.pow(2 / (num_in + num_hidden), 0.5)
self.Bxh = torch.zeros(num_hidden, 1)
self.Whh = torch.randn(num_hidden, num_hidden)
self.Whh = self.Whh * math.pow(2 / (num_hidden + num_hidden), 0.5)
... | Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer. | MultiRNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiRNN:
"""Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer."""
def __init__(self, num_in, num_hidden... | stack_v2_sparse_classes_75kplus_train_067063 | 5,430 | no_license | [
{
"docstring": "num_in = size of the one-hot encoded input \"word\". One element of such a batch will have many such \"words\".",
"name": "__init__",
"signature": "def __init__(self, num_in, num_hidden, activation=torch.tanh)"
},
{
"docstring": "For transferring to GPU device",
"name": "cuda... | 5 | stack_v2_sparse_classes_30k_train_042229 | Implement the Python class `MultiRNN` described below.
Class description:
Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer.
Metho... | Implement the Python class `MultiRNN` described below.
Class description:
Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer.
Metho... | 73e083a71ee19346be494ec7026ac82a343823bb | <|skeleton|>
class MultiRNN:
"""Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer."""
def __init__(self, num_in, num_hidden... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiRNN:
"""Consists of only input and the computed hidden states are the outputs, which will be inputs for the next such layer. The last RNN should have only one output, that is only the final hidden state, after which we would apply a Linear Layer."""
def __init__(self, num_in, num_hidden, activation=... | the_stack_v2_python_sparse | Assignment 4/MultiRNN.py | rohitrango/CS763 | train | 1 |
b19cf19c060844003a63f33517e6b5b53710acb3 | [
"super().__init__(*args, **kwargs)\nself.fields['item_column'].label = _('Key column to use for file name prefix (Participant id if ' + 'Moodle ZIP)')\nself.set_fields_from_dict(['user_fname_column', 'file_suffix', 'zip_for_moodle'])\nself.fields['user_fname_column'].queryset = self.columns\nself.order_fields(['ite... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.fields['item_column'].label = _('Key column to use for file name prefix (Participant id if ' + 'Moodle ZIP)')
self.set_fields_from_dict(['user_fname_column', 'file_suffix', 'zip_for_moodle'])
self.fields['user_fname_column'].queryse... | Form to create a ZIP. | ZipActionRunForm | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZipActionRunForm:
"""Form to create a ZIP."""
def __init__(self, *args, **kwargs):
"""Store column names, action and payload, adjust fields."""
<|body_0|>
def clean(self) -> Dict:
"""Detect uniques values in one column, and different column names."""
<|bo... | stack_v2_sparse_classes_75kplus_train_067064 | 20,457 | permissive | [
{
"docstring": "Store column names, action and payload, adjust fields.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Detect uniques values in one column, and different column names.",
"name": "clean",
"signature": "def clean(self) -> Dict"
... | 2 | stack_v2_sparse_classes_30k_train_000410 | Implement the Python class `ZipActionRunForm` described below.
Class description:
Form to create a ZIP.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Store column names, action and payload, adjust fields.
- def clean(self) -> Dict: Detect uniques values in one column, and different column n... | Implement the Python class `ZipActionRunForm` described below.
Class description:
Form to create a ZIP.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Store column names, action and payload, adjust fields.
- def clean(self) -> Dict: Detect uniques values in one column, and different column n... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class ZipActionRunForm:
"""Form to create a ZIP."""
def __init__(self, *args, **kwargs):
"""Store column names, action and payload, adjust fields."""
<|body_0|>
def clean(self) -> Dict:
"""Detect uniques values in one column, and different column names."""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZipActionRunForm:
"""Form to create a ZIP."""
def __init__(self, *args, **kwargs):
"""Store column names, action and payload, adjust fields."""
super().__init__(*args, **kwargs)
self.fields['item_column'].label = _('Key column to use for file name prefix (Participant id if ' + 'Mo... | the_stack_v2_python_sparse | ontask/action/forms/run.py | abelardopardo/ontask_b | train | 43 |
6c34b031f0f7cc5a37411de1a90419d03dcdda1e | [
"self.counter = 0\nself.data = list()\nself.tz = TIMEZONE\nself.sym = sym\nself.exchange = exchange\nself.recording = record_data\nself.db = self.collection = None\nif self.recording:\n LOGGER.info('\\nDatabase: [%s is recording %s]\\n' % (self.exchange, self.sym))",
"LOGGER.info('init_db_connection for {}...'... | <|body_start_0|>
self.counter = 0
self.data = list()
self.tz = TIMEZONE
self.sym = sym
self.exchange = exchange
self.recording = record_data
self.db = self.collection = None
if self.recording:
LOGGER.info('\nDatabase: [%s is recording %s]\n' % ... | Database | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Database:
def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA):
"""Database constructor."""
<|body_0|>
def init_db_connection(self) -> None:
"""Initiate database connection to Arctic. :return: (void)"""
<|body_1|>
def new_tick(self,... | stack_v2_sparse_classes_75kplus_train_067065 | 5,018 | no_license | [
{
"docstring": "Database constructor.",
"name": "__init__",
"signature": "def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA)"
},
{
"docstring": "Initiate database connection to Arctic. :return: (void)",
"name": "init_db_connection",
"signature": "def init_db_conne... | 5 | null | Implement the Python class `Database` described below.
Class description:
Implement the Database class.
Method signatures and docstrings:
- def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA): Database constructor.
- def init_db_connection(self) -> None: Initiate database connection to Arctic. ... | Implement the Python class `Database` described below.
Class description:
Implement the Database class.
Method signatures and docstrings:
- def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA): Database constructor.
- def init_db_connection(self) -> None: Initiate database connection to Arctic. ... | 078081e5715cadeae9c798a3d759c9d59d2041bc | <|skeleton|>
class Database:
def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA):
"""Database constructor."""
<|body_0|>
def init_db_connection(self) -> None:
"""Initiate database connection to Arctic. :return: (void)"""
<|body_1|>
def new_tick(self,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Database:
def __init__(self, sym: str, exchange: str, record_data: bool=RECORD_DATA):
"""Database constructor."""
self.counter = 0
self.data = list()
self.tz = TIMEZONE
self.sym = sym
self.exchange = exchange
self.recording = record_data
self.db ... | the_stack_v2_python_sparse | data_recorder/database/database.py | sadighian/crypto-rl | train | 676 | |
2576852ff473db893495aa0e8bb22818fbf1e13f | [
"kw['id_item_detalle'] = id\ndetalle = DBSession.query(DetalleItem).get(id)\ntmpl_context.widget = detalle_item_edit_form\nvalue = detalle_item_edit_filler.get_value(kw)\nself.params['id_item_detalle'] = id\nself.params['valor'] = detalle.valor\nself.params['tipo_atributo'] = int(detalle.atributo_tipo_item.tipo_id)... | <|body_start_0|>
kw['id_item_detalle'] = id
detalle = DBSession.query(DetalleItem).get(id)
tmpl_context.widget = detalle_item_edit_form
value = detalle_item_edit_filler.get_value(kw)
self.params['id_item_detalle'] = id
self.params['valor'] = detalle.valor
self.par... | Controlador del detalle del item | ItemDetalleController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemDetalleController:
"""Controlador del detalle del item"""
def edit(self, id, **kw):
"""Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id : Integer @param id : Identificador del Detalle del item. ... | stack_v2_sparse_classes_75kplus_train_067066 | 2,893 | no_license | [
{
"docstring": "Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id : Integer @param id : Identificador del Detalle del item. @type kw : Hash @param kw : Keywords @rtype : Diccionario @return : El diccionario que sera utilizado e... | 2 | stack_v2_sparse_classes_30k_train_054149 | Implement the Python class `ItemDetalleController` described below.
Class description:
Controlador del detalle del item
Method signatures and docstrings:
- def edit(self, id, **kw): Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id :... | Implement the Python class `ItemDetalleController` described below.
Class description:
Controlador del detalle del item
Method signatures and docstrings:
- def edit(self, id, **kw): Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id :... | f3da55a822dd45ed577844479c58eea69cdad754 | <|skeleton|>
class ItemDetalleController:
"""Controlador del detalle del item"""
def edit(self, id, **kw):
"""Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id : Integer @param id : Identificador del Detalle del item. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ItemDetalleController:
"""Controlador del detalle del item"""
def edit(self, id, **kw):
"""Encargado de cargar el widget para editar las instancias,solo tienen acceso aquellos usuarios que posean el premiso de editar @type id : Integer @param id : Identificador del Detalle del item. @type kw : Ha... | the_stack_v2_python_sparse | Tg-SAP/sap/controllers/item_detalle.py | mbaez/SAP | train | 1 |
b2fe2eb05f5dadf33ad9212f2cb30a482a335671 | [
"if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host",
"headers = {'org': org, 'user': user}\nroute_name = ''\nserv... | <|body_start_0|>
if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):
raise Exception('server_ip和server_port必须同时指定')
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
<|end_bod... | TaskClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_75kplus_train_067067 | 4,360 | permissive | [
{
"docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com",
"name": "__ini... | 3 | null | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,serve... | the_stack_v2_python_sparse | flowable_sdk/api/task/task_client.py | easyopsapis/easyops-api-python | train | 5 | |
496d6df7362fe1318c5f70ff619548e167a045ba | [
"processed_dict = {}\nfor key, value in request.GET.items():\n processed_dict[key] = value\nsign = processed_dict.pop('sign', None)\nalipay = AliPay(appid='', app_notify_url='http://127.0.0.1:8000/alipay/return/', app_private_key_path=private_key_path, alipay_public_key_path=ali_pub_key_path, debug=True, return_... | <|body_start_0|>
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = processed_dict.pop('sign', None)
alipay = AliPay(appid='', app_notify_url='http://127.0.0.1:8000/alipay/return/', app_private_key_path=private_key_path, alipay_publi... | AlipayView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlipayView:
def get(self, request):
"""处理支付宝的return_url返回 :param request: :return:"""
<|body_0|>
def post(self, request):
"""处理支付宝的notify_url :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
processed_dict = {}
for ke... | stack_v2_sparse_classes_75kplus_train_067068 | 10,636 | no_license | [
{
"docstring": "处理支付宝的return_url返回 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "处理支付宝的notify_url :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `AlipayView` described below.
Class description:
Implement the AlipayView class.
Method signatures and docstrings:
- def get(self, request): 处理支付宝的return_url返回 :param request: :return:
- def post(self, request): 处理支付宝的notify_url :param request: :return: | Implement the Python class `AlipayView` described below.
Class description:
Implement the AlipayView class.
Method signatures and docstrings:
- def get(self, request): 处理支付宝的return_url返回 :param request: :return:
- def post(self, request): 处理支付宝的notify_url :param request: :return:
<|skeleton|>
class AlipayView:
... | d3c15e9494c030d60348731e7a02e9a41eefb94e | <|skeleton|>
class AlipayView:
def get(self, request):
"""处理支付宝的return_url返回 :param request: :return:"""
<|body_0|>
def post(self, request):
"""处理支付宝的notify_url :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlipayView:
def get(self, request):
"""处理支付宝的return_url返回 :param request: :return:"""
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = processed_dict.pop('sign', None)
alipay = AliPay(appid='', app_notify_url='htt... | the_stack_v2_python_sparse | apps/trade/views.py | GoYMS/MxShopDRF | train | 1 | |
5d1aadb7c69aab49f4a3ba6a4c20d9919aaa38fb | [
"iqLabelChoice.__init__(self, parent, wx.NewId(), '<...>')\nself.SetForegroundColour(wx.Colour(0, 128, 0))\nif compare_funcs:\n self.setItems(compare_funcs)",
"selection = self.getCurrentSelection()\nif selection >= 0:\n return self.items[selection]\nreturn None"
] | <|body_start_0|>
iqLabelChoice.__init__(self, parent, wx.NewId(), '<...>')
self.SetForegroundColour(wx.Colour(0, 128, 0))
if compare_funcs:
self.setItems(compare_funcs)
<|end_body_0|>
<|body_start_1|>
selection = self.getCurrentSelection()
if selection >= 0:
... | Function choice control. | iqFuncLabelChoice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqFuncLabelChoice:
"""Function choice control."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
<|body_0|>
def getSelectedFunc(self):
"""Get selected function data."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
iqLabelChoi... | stack_v2_sparse_classes_75kplus_train_067069 | 19,825 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, parent, compare_funcs=None)"
},
{
"docstring": "Get selected function data.",
"name": "getSelectedFunc",
"signature": "def getSelectedFunc(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_048290 | Implement the Python class `iqFuncLabelChoice` described below.
Class description:
Function choice control.
Method signatures and docstrings:
- def __init__(self, parent, compare_funcs=None): Constructor.
- def getSelectedFunc(self): Get selected function data. | Implement the Python class `iqFuncLabelChoice` described below.
Class description:
Function choice control.
Method signatures and docstrings:
- def __init__(self, parent, compare_funcs=None): Constructor.
- def getSelectedFunc(self): Get selected function data.
<|skeleton|>
class iqFuncLabelChoice:
"""Function c... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqFuncLabelChoice:
"""Function choice control."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
<|body_0|>
def getSelectedFunc(self):
"""Get selected function data."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class iqFuncLabelChoice:
"""Function choice control."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
iqLabelChoice.__init__(self, parent, wx.NewId(), '<...>')
self.SetForegroundColour(wx.Colour(0, 128, 0))
if compare_funcs:
self.setItems(compare... | the_stack_v2_python_sparse | iq/components/wx_filterchoicectrl/filter_builder_ctrl.py | XHermitOne/iq_framework | train | 1 |
7f1d2b2082f245c77e8eb674c818e62f3c00ff50 | [
"QStyledItemDelegate.__init__(self, parent)\nself._controller = controller\nself._model = model",
"if index.isValid():\n item = self._model.item(index.row(), index.column())\n if index.column() > 0:\n return item.createEditor(parent)",
"if index.isValid():\n levelName = editor.currentText()\n ... | <|body_start_0|>
QStyledItemDelegate.__init__(self, parent)
self._controller = controller
self._model = model
<|end_body_0|>
<|body_start_1|>
if index.isValid():
item = self._model.item(index.row(), index.column())
if index.column() > 0:
return it... | Implements an item delegate to provide a suitable editor (combination box) for changing access level values. | _AccessLevelItemDelegate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _AccessLevelItemDelegate:
"""Implements an item delegate to provide a suitable editor (combination box) for changing access level values."""
def __init__(self, controller, model, parent=None):
"""Constructor."""
<|body_0|>
def createEditor(self, parent, _, index):
... | stack_v2_sparse_classes_75kplus_train_067070 | 14,313 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, controller, model, parent=None)"
},
{
"docstring": "@see: L{createEditor<PyQt4.QtGui.QItemDelegate.createEditor>}",
"name": "createEditor",
"signature": "def createEditor(self, parent, _, index)"
},
{... | 3 | stack_v2_sparse_classes_30k_train_032576 | Implement the Python class `_AccessLevelItemDelegate` described below.
Class description:
Implements an item delegate to provide a suitable editor (combination box) for changing access level values.
Method signatures and docstrings:
- def __init__(self, controller, model, parent=None): Constructor.
- def createEditor... | Implement the Python class `_AccessLevelItemDelegate` described below.
Class description:
Implements an item delegate to provide a suitable editor (combination box) for changing access level values.
Method signatures and docstrings:
- def __init__(self, controller, model, parent=None): Constructor.
- def createEditor... | 958fda4f3064f9f6b2034da396a20ac9d9abd52f | <|skeleton|>
class _AccessLevelItemDelegate:
"""Implements an item delegate to provide a suitable editor (combination box) for changing access level values."""
def __init__(self, controller, model, parent=None):
"""Constructor."""
<|body_0|>
def createEditor(self, parent, _, index):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _AccessLevelItemDelegate:
"""Implements an item delegate to provide a suitable editor (combination box) for changing access level values."""
def __init__(self, controller, model, parent=None):
"""Constructor."""
QStyledItemDelegate.__init__(self, parent)
self._controller = control... | the_stack_v2_python_sparse | src/datafinder/gui/user/dialogs/privilege_dialog/privileges.py | DLR-SC/DataFinder | train | 9 |
0102b4a85f0076319eaef6bd0a742fb0d22167ff | [
"dev = qml.device('default.gaussian', wires=2)\nn = 0.543\na = -0.654\nwith JacobianTape() as tape:\n qml.ThermalState(n, wires=0)\n qml.Displacement(a, 0, wires=0)\n qml.var(qml.NumberOperator(0))\ntape.trainable_params = {0, 1}\nres = tape.jacobian(dev)\nassert res.shape == (1, 2)\nexpected = np.array([2... | <|body_start_0|>
dev = qml.device('default.gaussian', wires=2)
n = 0.543
a = -0.654
with JacobianTape() as tape:
qml.ThermalState(n, wires=0)
qml.Displacement(a, 0, wires=0)
qml.var(qml.NumberOperator(0))
tape.trainable_params = {0, 1}
... | Intgration tests for the Jacobian method and CV circuits | TestJacobianCVIntegration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestJacobianCVIntegration:
"""Intgration tests for the Jacobian method and CV circuits"""
def test_single_output_value(self, tol):
"""Tests correct Jacobian and output shape for a CV tape with a single output"""
<|body_0|>
def test_multiple_output_values(self, tol):
... | stack_v2_sparse_classes_75kplus_train_067071 | 25,459 | permissive | [
{
"docstring": "Tests correct Jacobian and output shape for a CV tape with a single output",
"name": "test_single_output_value",
"signature": "def test_single_output_value(self, tol)"
},
{
"docstring": "Tests correct output shape and evaluation for a tape with multiple outputs",
"name": "tes... | 3 | stack_v2_sparse_classes_30k_train_036630 | Implement the Python class `TestJacobianCVIntegration` described below.
Class description:
Intgration tests for the Jacobian method and CV circuits
Method signatures and docstrings:
- def test_single_output_value(self, tol): Tests correct Jacobian and output shape for a CV tape with a single output
- def test_multipl... | Implement the Python class `TestJacobianCVIntegration` described below.
Class description:
Intgration tests for the Jacobian method and CV circuits
Method signatures and docstrings:
- def test_single_output_value(self, tol): Tests correct Jacobian and output shape for a CV tape with a single output
- def test_multipl... | 0c1c805fd5dfce465a8955ee3faf81037023a23e | <|skeleton|>
class TestJacobianCVIntegration:
"""Intgration tests for the Jacobian method and CV circuits"""
def test_single_output_value(self, tol):
"""Tests correct Jacobian and output shape for a CV tape with a single output"""
<|body_0|>
def test_multiple_output_values(self, tol):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestJacobianCVIntegration:
"""Intgration tests for the Jacobian method and CV circuits"""
def test_single_output_value(self, tol):
"""Tests correct Jacobian and output shape for a CV tape with a single output"""
dev = qml.device('default.gaussian', wires=2)
n = 0.543
a = -... | the_stack_v2_python_sparse | artifacts/old_dataset_versions/original_commits_backup/pennylane/pennylane#1349/after/test_jacobian_tape.py | MattePalte/Bugs-Quantum-Computing-Platforms | train | 4 |
6e91cb5f8b18080d07f3d167f9944bc1c04f91d8 | [
"if self.path == '/play':\n type = 'text/xml'\n self.send_response(200)\n self.send_header('Content-type', type)\n self.end_headers()\n self.wfile.write(str.encode(self.play()))\nelse:\n self.send_error(404)\nreturn",
"if self.path.lstrip('/').endswith('.mp3'):\n type = 'audio/mpeg'\n if o... | <|body_start_0|>
if self.path == '/play':
type = 'text/xml'
self.send_response(200)
self.send_header('Content-type', type)
self.end_headers()
self.wfile.write(str.encode(self.play()))
else:
self.send_error(404)
return
<|end_... | Class for handling get requests to the server. | RequestHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequestHandler:
"""Class for handling get requests to the server."""
def do_POST(self):
"""Handle POST request."""
<|body_0|>
def do_GET(self):
"""Handle GET request."""
<|body_1|>
def play(self):
"""Return valid TwiML to Twilio for call."""
... | stack_v2_sparse_classes_75kplus_train_067072 | 2,076 | permissive | [
{
"docstring": "Handle POST request.",
"name": "do_POST",
"signature": "def do_POST(self)"
},
{
"docstring": "Handle GET request.",
"name": "do_GET",
"signature": "def do_GET(self)"
},
{
"docstring": "Return valid TwiML to Twilio for call.",
"name": "play",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_016108 | Implement the Python class `RequestHandler` described below.
Class description:
Class for handling get requests to the server.
Method signatures and docstrings:
- def do_POST(self): Handle POST request.
- def do_GET(self): Handle GET request.
- def play(self): Return valid TwiML to Twilio for call. | Implement the Python class `RequestHandler` described below.
Class description:
Class for handling get requests to the server.
Method signatures and docstrings:
- def do_POST(self): Handle POST request.
- def do_GET(self): Handle GET request.
- def play(self): Return valid TwiML to Twilio for call.
<|skeleton|>
clas... | 0ab63e896d2f78668592a787960456f438c2b8d0 | <|skeleton|>
class RequestHandler:
"""Class for handling get requests to the server."""
def do_POST(self):
"""Handle POST request."""
<|body_0|>
def do_GET(self):
"""Handle GET request."""
<|body_1|>
def play(self):
"""Return valid TwiML to Twilio for call."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RequestHandler:
"""Class for handling get requests to the server."""
def do_POST(self):
"""Handle POST request."""
if self.path == '/play':
type = 'text/xml'
self.send_response(200)
self.send_header('Content-type', type)
self.end_headers()
... | the_stack_v2_python_sparse | call_server.py | Forcepoint/fp-bd-secure-xmas | train | 0 |
c7c9300228ca476ad57ce4ff5325ae86adad5048 | [
"Gtk.Window.__init__(self, title='Modificar Clientes')\nbbdd = dbapi2.connect('bbdd.dat')\nself.cursor = bbdd.cursor()\nself.empresas = []\ncursorEmpresa = self.cursor.execute('select nombreEmpresa from Clientes')\nfor row in cursorEmpresa:\n self.empresas.append(row[0])\nbuilder = Gtk.Builder()\nbuilder.add_fro... | <|body_start_0|>
Gtk.Window.__init__(self, title='Modificar Clientes')
bbdd = dbapi2.connect('bbdd.dat')
self.cursor = bbdd.cursor()
self.empresas = []
cursorEmpresa = self.cursor.execute('select nombreEmpresa from Clientes')
for row in cursorEmpresa:
self.emp... | Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o cliente seleccionado on_btnModificar_clicked -- modifica o cliente seleccionado | ModificarClientes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModificarClientes:
"""Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o cliente seleccionado on_btnModificar_clicked... | stack_v2_sparse_classes_75kplus_train_067073 | 5,593 | no_license | [
{
"docstring": "Constructor da clase ModificarClientes (Window) Formulario que recolle o cliente desexado mediante un ComboBox e mostra todos os seus datos para poder visualizalos e modificalos/eliminalos se e o que desexamos :param None Excepcions: -Non ten",
"name": "__init__",
"signature": "def __ini... | 4 | null | Implement the Python class `ModificarClientes` described below.
Class description:
Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o clien... | Implement the Python class `ModificarClientes` described below.
Class description:
Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o clien... | f075ba00e1d53bf841c856e9805ec37a8d39c7a5 | <|skeleton|>
class ModificarClientes:
"""Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o cliente seleccionado on_btnModificar_clicked... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModificarClientes:
"""Formulario para modificar ou eliminar clientes da base de datos do programa de xestion da fruteria. Metodos: __init__ --Constructor on_btnBuscar_clicked -- recolle o cliente a modificar/eliminar on_btnEliminar_clicked -- elimina o cliente seleccionado on_btnModificar_clicked -- modifica ... | the_stack_v2_python_sparse | ModificarClientes.py | bfmiriam/Fruteria_Python | train | 0 |
e6b6b78063d2d230530ec60150915b70f8435708 | [
"with open(fullpath, 'r') as json_file_readed:\n json_readed = json.load(json_file_readed)\nreturn json_readed",
"if jupyter:\n dirpath = os.getcwd()\nelse:\n dirpath = __file__\nfor i in range(num):\n dirpath = os.path.dirname(dirpath)\nsys.path.append(dirpath)\nreturn dirpath"
] | <|body_start_0|>
with open(fullpath, 'r') as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
<|end_body_0|>
<|body_start_1|>
if jupyter:
dirpath = os.getcwd()
else:
dirpath = __file__
for i in range(num):
... | Folders | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Folders:
def read_json(fullpath):
"""Reads json file and returns it."""
<|body_0|>
def add_path(num, jupyter=True):
"""Adds a path to sys. Args: - num: number of times to get the dirname until reaching the rootpath."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_067074 | 749 | no_license | [
{
"docstring": "Reads json file and returns it.",
"name": "read_json",
"signature": "def read_json(fullpath)"
},
{
"docstring": "Adds a path to sys. Args: - num: number of times to get the dirname until reaching the rootpath.",
"name": "add_path",
"signature": "def add_path(num, jupyter=... | 2 | stack_v2_sparse_classes_30k_train_018201 | Implement the Python class `Folders` described below.
Class description:
Implement the Folders class.
Method signatures and docstrings:
- def read_json(fullpath): Reads json file and returns it.
- def add_path(num, jupyter=True): Adds a path to sys. Args: - num: number of times to get the dirname until reaching the r... | Implement the Python class `Folders` described below.
Class description:
Implement the Folders class.
Method signatures and docstrings:
- def read_json(fullpath): Reads json file and returns it.
- def add_path(num, jupyter=True): Adds a path to sys. Args: - num: number of times to get the dirname until reaching the r... | b63e72213d77ad885e356a995c27626d58a6e996 | <|skeleton|>
class Folders:
def read_json(fullpath):
"""Reads json file and returns it."""
<|body_0|>
def add_path(num, jupyter=True):
"""Adds a path to sys. Args: - num: number of times to get the dirname until reaching the rootpath."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Folders:
def read_json(fullpath):
"""Reads json file and returns it."""
with open(fullpath, 'r') as json_file_readed:
json_readed = json.load(json_file_readed)
return json_readed
def add_path(num, jupyter=True):
"""Adds a path to sys. Args: - num: number of tim... | the_stack_v2_python_sparse | EDA_FINAL/src/utils/folders_tb.py | leosanchezsoler/bridge_datascience_JorgeGarcia | train | 0 | |
26ab3f6f7388a720d81be8da784acd5299f98d9b | [
"if line == 'ping':\n self.sendLine('pong')\nelse:\n log('lineReceived', line)\n message = Message.create_message(line)\n self.factory.network.peers.add_message(message)",
"remote_ip = self.transport.getPeer().host\nif not self.factory.network.peers.assert_ip(remote_ip):\n self.transport.loseConnec... | <|body_start_0|>
if line == 'ping':
self.sendLine('pong')
else:
log('lineReceived', line)
message = Message.create_message(line)
self.factory.network.peers.add_message(message)
<|end_body_0|>
<|body_start_1|>
remote_ip = self.transport.getPeer().h... | ProfileServerProtocol | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileServerProtocol:
def lineReceived(self, line):
"""incomming connection from other peer"""
<|body_0|>
def connectionMade(self):
"""a peer has connect to us"""
<|body_1|>
def connectionLost(self, reason):
"""called when transfer complete"""
... | stack_v2_sparse_classes_75kplus_train_067075 | 4,415 | no_license | [
{
"docstring": "incomming connection from other peer",
"name": "lineReceived",
"signature": "def lineReceived(self, line)"
},
{
"docstring": "a peer has connect to us",
"name": "connectionMade",
"signature": "def connectionMade(self)"
},
{
"docstring": "called when transfer compl... | 3 | stack_v2_sparse_classes_30k_train_052665 | Implement the Python class `ProfileServerProtocol` described below.
Class description:
Implement the ProfileServerProtocol class.
Method signatures and docstrings:
- def lineReceived(self, line): incomming connection from other peer
- def connectionMade(self): a peer has connect to us
- def connectionLost(self, reaso... | Implement the Python class `ProfileServerProtocol` described below.
Class description:
Implement the ProfileServerProtocol class.
Method signatures and docstrings:
- def lineReceived(self, line): incomming connection from other peer
- def connectionMade(self): a peer has connect to us
- def connectionLost(self, reaso... | 12c2face0ed3398f3733595190abcecb372796e7 | <|skeleton|>
class ProfileServerProtocol:
def lineReceived(self, line):
"""incomming connection from other peer"""
<|body_0|>
def connectionMade(self):
"""a peer has connect to us"""
<|body_1|>
def connectionLost(self, reason):
"""called when transfer complete"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfileServerProtocol:
def lineReceived(self, line):
"""incomming connection from other peer"""
if line == 'ping':
self.sendLine('pong')
else:
log('lineReceived', line)
message = Message.create_message(line)
self.factory.network.peers.add... | the_stack_v2_python_sparse | trunk/contrib/profile/network/server_protocol.py | BackupTheBerlios/solipsis-svn | train | 1 | |
bb9ec6ba0f4c8a09de04c545ffd12c6477dc9617 | [
"self.user_id = user_id\nself.company_id = company_id\nself.modified_time = modified_time\nself.ip_address = ip_address\nself.session_token = session_token\nself.user_agent_string = user_agent_string\nself.metadata = metadata\nself.campaign = campaign\nself.names = {'user_id': 'user_id', 'company_id': 'company_id',... | <|body_start_0|>
self.user_id = user_id
self.company_id = company_id
self.modified_time = modified_time
self.ip_address = ip_address
self.session_token = session_token
self.user_agent_string = user_agent_string
self.metadata = metadata
self.campaign = camp... | Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (string): session token of the user if known. user_agent_string (string): the stri... | UserModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserModel:
"""Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (string): session token of the user if known.... | stack_v2_sparse_classes_75kplus_train_067076 | 3,470 | permissive | [
{
"docstring": "Constructor for the UserModel class",
"name": "__init__",
"signature": "def __init__(self, user_id=None, company_id=None, modified_time=None, ip_address=None, session_token=None, user_agent_string=None, metadata=None, campaign=None)"
},
{
"docstring": "Creates an instance of this... | 2 | stack_v2_sparse_classes_30k_test_002083 | Implement the Python class `UserModel` described below.
Class description:
Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (strin... | Implement the Python class `UserModel` described below.
Class description:
Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (strin... | e65347f1c4fe6ef014648db4e3b25d0392f820d0 | <|skeleton|>
class UserModel:
"""Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (string): session token of the user if known.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserModel:
"""Implementation of the 'models.UserModel' model. API Request Attributes: user_id (string): the id of the user. modified_time (DateTime): Time when modification is made. ip_address (string): IP Address of the client if known. session_token (string): session token of the user if known. user_agent_s... | the_stack_v2_python_sparse | moesifapi/models/user_model.py | Moesif/moesifapi-python | train | 5 |
5f6a5eb63415b5d00565b7d3fd45e50e1be5bd31 | [
"if request.method == 'OPTIONS':\n response = HttpResponse(content_type='text/plain')\n response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n response['Access-Control-Allow-Origin'] = 'http://0.0.0.0:8100'\n response['Access-Control-Allow-Headers'] = 'X-PINGOTHER, Content-Type'\n return r... | <|body_start_0|>
if request.method == 'OPTIONS':
response = HttpResponse(content_type='text/plain')
response['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'
response['Access-Control-Allow-Origin'] = 'http://0.0.0.0:8100'
response['Access-Control-Allow-Heade... | Middleware for handling cross-origin resource share. | CorsMiddleware | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CorsMiddleware:
"""Middleware for handling cross-origin resource share."""
def process_request(self, request):
"""Respond to OPTIONS method to grant access previliges."""
<|body_0|>
def process_response(self, request, response):
"""Add necessary headers to respon... | stack_v2_sparse_classes_75kplus_train_067077 | 1,914 | no_license | [
{
"docstring": "Respond to OPTIONS method to grant access previliges.",
"name": "process_request",
"signature": "def process_request(self, request)"
},
{
"docstring": "Add necessary headers to response.",
"name": "process_response",
"signature": "def process_response(self, request, respo... | 2 | stack_v2_sparse_classes_30k_train_000404 | Implement the Python class `CorsMiddleware` described below.
Class description:
Middleware for handling cross-origin resource share.
Method signatures and docstrings:
- def process_request(self, request): Respond to OPTIONS method to grant access previliges.
- def process_response(self, request, response): Add necess... | Implement the Python class `CorsMiddleware` described below.
Class description:
Middleware for handling cross-origin resource share.
Method signatures and docstrings:
- def process_request(self, request): Respond to OPTIONS method to grant access previliges.
- def process_response(self, request, response): Add necess... | 6a55f10a20b3b156d571527a9d5cdd54b84c2179 | <|skeleton|>
class CorsMiddleware:
"""Middleware for handling cross-origin resource share."""
def process_request(self, request):
"""Respond to OPTIONS method to grant access previliges."""
<|body_0|>
def process_response(self, request, response):
"""Add necessary headers to respon... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CorsMiddleware:
"""Middleware for handling cross-origin resource share."""
def process_request(self, request):
"""Respond to OPTIONS method to grant access previliges."""
if request.method == 'OPTIONS':
response = HttpResponse(content_type='text/plain')
response['A... | the_stack_v2_python_sparse | SocialHub/SocialHub/middlewares.py | jangsutsr/SocialHub | train | 0 |
329c87cb4e874d5aaa281b7afd07ba72a0709dee | [
"header('Content-Type', 'application/json')\ntry:\n scopes = get_scopes(account, vo=ctx.env.get('vo'))\nexcept AccountNotFound as error:\n raise generate_http_error(404, 'AccountNotFound', error.args[0])\nexcept RucioException as error:\n raise generate_http_error(500, error.__class__.__name__, error.args[... | <|body_start_0|>
header('Content-Type', 'application/json')
try:
scopes = get_scopes(account, vo=ctx.env.get('vo'))
except AccountNotFound as error:
raise generate_http_error(404, 'AccountNotFound', error.args[0])
except RucioException as error:
raise ... | Scopes | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Scopes:
def GET(self, account):
"""list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list conta... | stack_v2_sparse_classes_75kplus_train_067078 | 27,871 | permissive | [
{
"docstring": "list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all scope names for an account.",
... | 2 | stack_v2_sparse_classes_30k_train_013130 | Implement the Python class `Scopes` described below.
Class description:
Implement the Scopes class.
Method signatures and docstrings:
- def GET(self, account): list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Acc... | Implement the Python class `Scopes` described below.
Class description:
Implement the Scopes class.
Method signatures and docstrings:
- def GET(self, account): list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Acc... | bf33d9441d3b4ff160a392eed56724f635a03fe6 | <|skeleton|>
class Scopes:
def GET(self, account):
"""list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list conta... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Scopes:
def GET(self, account):
"""list all scopes for an account. HTTP Success: 200 OK HTTP Error: 401 Unauthorized 404 Not Found 406 Not Acceptable 500 InternalError :param Rucio-Account: Account identifier. :param Rucio-Auth-Token: as an 32 character hex string. :returns: A list containing all scop... | the_stack_v2_python_sparse | lib/rucio/web/rest/webpy/v1/account.py | viveknigam3003/rucio | train | 1 | |
9fd618352946074d33d51f9f9d44cacad03a6966 | [
"if not key and (not name):\n raise ValueError('Must pass either a Key or key name into `%s.get`.' % cls.kind())\nif name:\n return cls.__adapter__._get(cls.__keyclass__(cls.kind(), name), **kwargs)\nif isinstance(key, basestring):\n key = cls.__keyclass__.from_urlsafe(key)\nelif isinstance(key, (list, tup... | <|body_start_0|>
if not key and (not name):
raise ValueError('Must pass either a Key or key name into `%s.get`.' % cls.kind())
if name:
return cls.__adapter__._get(cls.__keyclass__(cls.kind(), name), **kwargs)
if isinstance(key, basestring):
key = cls.__keycla... | Provides bridged methods between `model.Model` and the Adapter API. | AdaptedModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaptedModel:
"""Provides bridged methods between `model.Model` and the Adapter API."""
def get(cls, key=None, name=None, **kwargs):
"""Retrieve a persisted version of this model via the current datastore adapter."""
<|body_0|>
def query(cls, *args, **kwargs):
""... | stack_v2_sparse_classes_75kplus_train_067079 | 9,479 | permissive | [
{
"docstring": "Retrieve a persisted version of this model via the current datastore adapter.",
"name": "get",
"signature": "def get(cls, key=None, name=None, **kwargs)"
},
{
"docstring": "Start building a new `model.Query` object, if the underlying adapter implements `IndexedModelAdapter`.",
... | 4 | stack_v2_sparse_classes_30k_train_043287 | Implement the Python class `AdaptedModel` described below.
Class description:
Provides bridged methods between `model.Model` and the Adapter API.
Method signatures and docstrings:
- def get(cls, key=None, name=None, **kwargs): Retrieve a persisted version of this model via the current datastore adapter.
- def query(c... | Implement the Python class `AdaptedModel` described below.
Class description:
Provides bridged methods between `model.Model` and the Adapter API.
Method signatures and docstrings:
- def get(cls, key=None, name=None, **kwargs): Retrieve a persisted version of this model via the current datastore adapter.
- def query(c... | cfc4ef00ec67df97e08b57222ca16aa9f2659a3e | <|skeleton|>
class AdaptedModel:
"""Provides bridged methods between `model.Model` and the Adapter API."""
def get(cls, key=None, name=None, **kwargs):
"""Retrieve a persisted version of this model via the current datastore adapter."""
<|body_0|>
def query(cls, *args, **kwargs):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdaptedModel:
"""Provides bridged methods between `model.Model` and the Adapter API."""
def get(cls, key=None, name=None, **kwargs):
"""Retrieve a persisted version of this model via the current datastore adapter."""
if not key and (not name):
raise ValueError('Must pass eithe... | the_stack_v2_python_sparse | canteen/model/adapter/core.py | ianjw11/canteen | train | 0 |
9e1b05867823c1006a4176147b90c3f24b09447e | [
"lst = rm_dups.linked_lst.LinkedLstNode()\nlst.data = 1\nlst.append_to_tail(2)\nlst.append_to_tail(2)\nlst.append_to_tail(3)\nlst.append_to_tail(3)\nlst = rm_dups.rm_dups(lst)\nself.assertEqual(lst.data, 1)\nself.assertEqual(lst.next.data, 2)\nself.assertEqual(lst.next.next.data, 3)",
"lst = rm_dups.linked_lst.Li... | <|body_start_0|>
lst = rm_dups.linked_lst.LinkedLstNode()
lst.data = 1
lst.append_to_tail(2)
lst.append_to_tail(2)
lst.append_to_tail(3)
lst.append_to_tail(3)
lst = rm_dups.rm_dups(lst)
self.assertEqual(lst.data, 1)
self.assertEqual(lst.next.data, ... | TestRmDupsFromLinkedLst. | TestRmDupsFromLinkedLst | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestRmDupsFromLinkedLst:
"""TestRmDupsFromLinkedLst."""
def test_rm_dups_from_linked_lst(self):
"""Rm from a linked lst."""
<|body_0|>
def test_rm_dups_without_hash(self):
"""Rm from a linked lst."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067080 | 1,131 | no_license | [
{
"docstring": "Rm from a linked lst.",
"name": "test_rm_dups_from_linked_lst",
"signature": "def test_rm_dups_from_linked_lst(self)"
},
{
"docstring": "Rm from a linked lst.",
"name": "test_rm_dups_without_hash",
"signature": "def test_rm_dups_without_hash(self)"
}
] | 2 | null | Implement the Python class `TestRmDupsFromLinkedLst` described below.
Class description:
TestRmDupsFromLinkedLst.
Method signatures and docstrings:
- def test_rm_dups_from_linked_lst(self): Rm from a linked lst.
- def test_rm_dups_without_hash(self): Rm from a linked lst. | Implement the Python class `TestRmDupsFromLinkedLst` described below.
Class description:
TestRmDupsFromLinkedLst.
Method signatures and docstrings:
- def test_rm_dups_from_linked_lst(self): Rm from a linked lst.
- def test_rm_dups_without_hash(self): Rm from a linked lst.
<|skeleton|>
class TestRmDupsFromLinkedLst:
... | 7ea89298b0491878e5be5d5c48112a6cd6e1c0ad | <|skeleton|>
class TestRmDupsFromLinkedLst:
"""TestRmDupsFromLinkedLst."""
def test_rm_dups_from_linked_lst(self):
"""Rm from a linked lst."""
<|body_0|>
def test_rm_dups_without_hash(self):
"""Rm from a linked lst."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestRmDupsFromLinkedLst:
"""TestRmDupsFromLinkedLst."""
def test_rm_dups_from_linked_lst(self):
"""Rm from a linked lst."""
lst = rm_dups.linked_lst.LinkedLstNode()
lst.data = 1
lst.append_to_tail(2)
lst.append_to_tail(2)
lst.append_to_tail(3)
lst.a... | the_stack_v2_python_sparse | ch-2/2-1/python/test_rm_dups.py | zoltankiss/ctci_problems | train | 0 |
e5e8e52d6da9c66eab03583270142fb91e866792 | [
"try:\n if not isinstance(filename, str):\n raise Exception('Error: Invalid Filename passed')\n if not isfile(filename):\n raise Exception(\"Error: File '{}' does not exist\".format(filename))\n self.filename = filename\n self.api = None\n self.connect()\nexcept Exception as e:\n pri... | <|body_start_0|>
try:
if not isinstance(filename, str):
raise Exception('Error: Invalid Filename passed')
if not isfile(filename):
raise Exception("Error: File '{}' does not exist".format(filename))
self.filename = filename
self.api... | Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets. | DeleteBot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteBot:
"""Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets."""
def __init__(self, filename=None):
"""Initialize a new DeleteBot Object KEYWORD ARGUMENTS: filename -- Name of the file which has s... | stack_v2_sparse_classes_75kplus_train_067081 | 14,888 | permissive | [
{
"docstring": "Initialize a new DeleteBot Object KEYWORD ARGUMENTS: filename -- Name of the file which has stored the credentials in the json format",
"name": "__init__",
"signature": "def __init__(self, filename=None)"
},
{
"docstring": "Function to connect to the Twitter API using OAuth based... | 5 | stack_v2_sparse_classes_30k_train_007502 | Implement the Python class `DeleteBot` described below.
Class description:
Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets.
Method signatures and docstrings:
- def __init__(self, filename=None): Initialize a new DeleteBot Object KE... | Implement the Python class `DeleteBot` described below.
Class description:
Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets.
Method signatures and docstrings:
- def __init__(self, filename=None): Initialize a new DeleteBot Object KE... | 31fd3fb1233f39ea2252a7a44160ff8a2140f7bd | <|skeleton|>
class DeleteBot:
"""Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets."""
def __init__(self, filename=None):
"""Initialize a new DeleteBot Object KEYWORD ARGUMENTS: filename -- Name of the file which has s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeleteBot:
"""Base class which contains methods common to all sub-classes such as connecting to the twitter api, fetching tweets and deleting tweets."""
def __init__(self, filename=None):
"""Initialize a new DeleteBot Object KEYWORD ARGUMENTS: filename -- Name of the file which has stored the cre... | the_stack_v2_python_sparse | Python/Delete_Tweets/helper.py | HarshCasper/Rotten-Scripts | train | 1,474 |
eb92c549142e0a37025937949a3b5bfb67912ecf | [
"filterfile = functions.launchcmd('grep -v \"^#\" ' + filename).readlines()\nhostsinfo = []\nfor t in filterfile:\n oneinfo = t.split(':', 2)\n if len(oneinfo) == 3:\n hostsinfo.append(oneinfo)\n elif len(oneinfo) == 2:\n oneinfo.append('')\n hostsinfo.append(oneinfo)\n elif len(one... | <|body_start_0|>
filterfile = functions.launchcmd('grep -v "^#" ' + filename).readlines()
hostsinfo = []
for t in filterfile:
oneinfo = t.split(':', 2)
if len(oneinfo) == 3:
hostsinfo.append(oneinfo)
elif len(oneinfo) == 2:
onei... | tcp business | TcpBusiness | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TcpBusiness:
"""tcp business"""
def getlistinfo(cls, filename):
"""read info from sys :param filename: :return:"""
<|body_0|>
def putlistinfo(cls, request, filename):
"""write info to sys :param request: :param filename: :return:"""
<|body_1|>
def de... | stack_v2_sparse_classes_75kplus_train_067082 | 3,237 | no_license | [
{
"docstring": "read info from sys :param filename: :return:",
"name": "getlistinfo",
"signature": "def getlistinfo(cls, filename)"
},
{
"docstring": "write info to sys :param request: :param filename: :return:",
"name": "putlistinfo",
"signature": "def putlistinfo(cls, request, filename... | 3 | stack_v2_sparse_classes_30k_train_049602 | Implement the Python class `TcpBusiness` described below.
Class description:
tcp business
Method signatures and docstrings:
- def getlistinfo(cls, filename): read info from sys :param filename: :return:
- def putlistinfo(cls, request, filename): write info to sys :param request: :param filename: :return:
- def delete... | Implement the Python class `TcpBusiness` described below.
Class description:
tcp business
Method signatures and docstrings:
- def getlistinfo(cls, filename): read info from sys :param filename: :return:
- def putlistinfo(cls, request, filename): write info to sys :param request: :param filename: :return:
- def delete... | 7f801a569a396a27371d0831752595877c224a6b | <|skeleton|>
class TcpBusiness:
"""tcp business"""
def getlistinfo(cls, filename):
"""read info from sys :param filename: :return:"""
<|body_0|>
def putlistinfo(cls, request, filename):
"""write info to sys :param request: :param filename: :return:"""
<|body_1|>
def de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TcpBusiness:
"""tcp business"""
def getlistinfo(cls, filename):
"""read info from sys :param filename: :return:"""
filterfile = functions.launchcmd('grep -v "^#" ' + filename).readlines()
hostsinfo = []
for t in filterfile:
oneinfo = t.split(':', 2)
... | the_stack_v2_python_sparse | Python_projects/flask_projects/unicorn_project/tcp/business.py | sdtimothy8/Coding | train | 0 |
5d9c9b54a09a9395fb84f66d3bd5cb6df76f30a8 | [
"HTTPBasicAuthHandler.__init__(self, *args, **kwargs)\nself._tried_login: bool = False\nself._otp_token_method: Optional[str] = None\nself._otp_token_attempts: int = 0\nself._last_otp_token: Optional[str] = None",
"otp_header = headers.get(self.OTP_TOKEN_HEADER, '')\nif otp_header and otp_header.startswith('requi... | <|body_start_0|>
HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
self._tried_login: bool = False
self._otp_token_method: Optional[str] = None
self._otp_token_attempts: int = 0
self._last_otp_token: Optional[str] = None
<|end_body_0|>
<|body_start_1|>
otp_header = he... | Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our own retry handler. This also supports two-factor auth, for... | ReviewBoardHTTPBasicAuthHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReviewBoardHTTPBasicAuthHandler:
"""Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our... | stack_v2_sparse_classes_75kplus_train_067083 | 41,597 | permissive | [
{
"docstring": "Initialize the Basic Auth handler. Args: *args (tuple): Positional arguments to pass to the parent class. **kwargs (dict): Keyword arguments to pass to the parent class.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs) -> None"
},
{
"docstring": "Handle an ... | 3 | stack_v2_sparse_classes_30k_train_052228 | Implement the Python class `ReviewBoardHTTPBasicAuthHandler` described below.
Class description:
Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and passwo... | Implement the Python class `ReviewBoardHTTPBasicAuthHandler` described below.
Class description:
Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and passwo... | d1ef3799a021ec0f7af6e2c534d344ae2f03a21f | <|skeleton|>
class ReviewBoardHTTPBasicAuthHandler:
"""Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReviewBoardHTTPBasicAuthHandler:
"""Custom Basic Auth handler that doesn't retry excessively. urllib's HTTPBasicAuthHandler retries over and over, which is useless. This subclass only retries once to make sure we've attempted with a valid username and password. It will then fail so we can use our own retry ha... | the_stack_v2_python_sparse | rbtools/api/request.py | nagyist/rbtools | train | 0 |
a6a184f5363ad9e677d74b3bff6fa89dc4b413d7 | [
"self.use_cuda = not disable_cuda and torch.cuda.is_available()\nif self.use_cuda:\n self.cuda_devices = []\n for i in range(torch.cuda.device_count()):\n prop = torch.cuda.get_device_properties(f'cuda:{i}')\n self.cuda_devices.append({'key': f'cuda:{i}', 'name': prop.name, 'capability': (prop.m... | <|body_start_0|>
self.use_cuda = not disable_cuda and torch.cuda.is_available()
if self.use_cuda:
self.cuda_devices = []
for i in range(torch.cuda.device_count()):
prop = torch.cuda.get_device_properties(f'cuda:{i}')
self.cuda_devices.append({'key'... | 自動的に最適なデバイスを判断して選択するクラス | AutoDevice | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutoDevice:
"""自動的に最適なデバイスを判断して選択するクラス"""
def __init__(self, disable_cuda: bool=False):
"""Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。"""
<|body_0|>
def __call__(self, priority: Optional[int]=None) -> str:
"""自動計算された優先度順でデバイスを返... | stack_v2_sparse_classes_75kplus_train_067084 | 1,745 | permissive | [
{
"docstring": "Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。",
"name": "__init__",
"signature": "def __init__(self, disable_cuda: bool=False)"
},
{
"docstring": "自動計算された優先度順でデバイスを返します。 Args: priority: 特定の優先順位のデバイスを得る場合に指定します。 Returns: デバイスを表す文字列",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_047344 | Implement the Python class `AutoDevice` described below.
Class description:
自動的に最適なデバイスを判断して選択するクラス
Method signatures and docstrings:
- def __init__(self, disable_cuda: bool=False): Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。
- def __call__(self, priority: Optional[int]=None) -> st... | Implement the Python class `AutoDevice` described below.
Class description:
自動的に最適なデバイスを判断して選択するクラス
Method signatures and docstrings:
- def __init__(self, disable_cuda: bool=False): Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。
- def __call__(self, priority: Optional[int]=None) -> st... | 80eb57e704bc28e05e28743fa6c8829b1bdad166 | <|skeleton|>
class AutoDevice:
"""自動的に最適なデバイスを判断して選択するクラス"""
def __init__(self, disable_cuda: bool=False):
"""Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。"""
<|body_0|>
def __call__(self, priority: Optional[int]=None) -> str:
"""自動計算された優先度順でデバイスを返... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AutoDevice:
"""自動的に最適なデバイスを判断して選択するクラス"""
def __init__(self, disable_cuda: bool=False):
"""Args: disable_cuda: CUDAを無効化するかどうか Todo: * 他の尺度も実装する 現在は最大メモリ容量を基準に優先順位を決定している。"""
self.use_cuda = not disable_cuda and torch.cuda.is_available()
if self.use_cuda:
self.cuda_devi... | the_stack_v2_python_sparse | utils/device.py | KazutakaYamanouchi/master-study-lsun | train | 0 |
85764e41ab88554e0b1c2424d28b2e841d8db0d1 | [
"self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]",
"while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ... | <|body_start_0|>
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
<|end_body_0|>
<|body_start_1|>
while len(self.x_values) < self.num_points:
x_direction = choice([1, -1])
x_distance = choice([0, 1, 2, 3, 4])
x_step = x_direction *... | A class to generate random walks. | RandomWalk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalk:
"""A class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk"""
<|body_0|>
def fill_walk(self):
"""Calculate all the points in the walk."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067085 | 2,191 | no_license | [
{
"docstring": "Initialize attributes of a walk",
"name": "__init__",
"signature": "def __init__(self, num_points=5000)"
},
{
"docstring": "Calculate all the points in the walk.",
"name": "fill_walk",
"signature": "def fill_walk(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031404 | Implement the Python class `RandomWalk` described below.
Class description:
A class to generate random walks.
Method signatures and docstrings:
- def __init__(self, num_points=5000): Initialize attributes of a walk
- def fill_walk(self): Calculate all the points in the walk. | Implement the Python class `RandomWalk` described below.
Class description:
A class to generate random walks.
Method signatures and docstrings:
- def __init__(self, num_points=5000): Initialize attributes of a walk
- def fill_walk(self): Calculate all the points in the walk.
<|skeleton|>
class RandomWalk:
"""A c... | 1257f1a863379550e9f91c97d0d111bcde85c0c2 | <|skeleton|>
class RandomWalk:
"""A class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk"""
<|body_0|>
def fill_walk(self):
"""Calculate all the points in the walk."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomWalk:
"""A class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk"""
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def fill_walk(self):
"""Calculate all the points in the walk."""... | the_stack_v2_python_sparse | 15_3_RandomWalk.py | aschiedermeier/Python_Crash_course | train | 0 |
ad8494616fa79f617b37aa9cb59fbcd103124889 | [
"def function(x, n):\n \"\"\" Square root function f(x) = x^2 - n \"\"\"\n return x ** 2 - n\n\ndef newton_raphson(x1, fx1, f1):\n \"\"\" newton raphson formula -> x2 = x1 - fx1 / f1 \n here f1 is derivative of fx1\n \"\"\"\n return x1 - f1 / fx1\nif x == 0 or x == 1:\n ret... | <|body_start_0|>
def function(x, n):
""" Square root function f(x) = x^2 - n """
return x ** 2 - n
def newton_raphson(x1, fx1, f1):
""" newton raphson formula -> x2 = x1 - fx1 / f1
here f1 is derivative of fx1
"""
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt2(self, x):
"""Alternative method using newton integer division method"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def function(x, n):
""" Square root... | stack_v2_sparse_classes_75kplus_train_067086 | 1,218 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
},
{
"docstring": "Alternative method using newton integer division method",
"name": "mySqrt2",
"signature": "def mySqrt2(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041317 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt2(self, x): Alternative method using newton integer division method | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt(self, x): :type x: int :rtype: int
- def mySqrt2(self, x): Alternative method using newton integer division method
<|skeleton|>
class Solution:
def mySqrt(self, ... | b7e92f9a7c4d6652d4901b189f51063ce5520653 | <|skeleton|>
class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt2(self, x):
"""Alternative method using newton integer division method"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mySqrt(self, x):
""":type x: int :rtype: int"""
def function(x, n):
""" Square root function f(x) = x^2 - n """
return x ** 2 - n
def newton_raphson(x1, fx1, f1):
""" newton raphson formula -> x2 = x1 - fx1 / f1
... | the_stack_v2_python_sparse | leetcode/easy/sqrt.py | abkunal/Data-Structures-and-Algorithms | train | 2 | |
5085bf6973a95efefffd2d1568017ef757703235 | [
"mydict = {}\nmydict[']'] = '['\nmydict[')'] = '('\nmydict['}'] = '{'\nmystack = []\nfor item in s:\n if item in mydict.values():\n mystack.append(item)\n if item in mydict.keys():\n if mystack == []:\n return False\n elif mystack[-1] == mydict[item]:\n mystack.pop()... | <|body_start_0|>
mydict = {}
mydict[']'] = '['
mydict[')'] = '('
mydict['}'] = '{'
mystack = []
for item in s:
if item in mydict.values():
mystack.append(item)
if item in mydict.keys():
if mystack == []:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid2(self, s: str) -> bool:
"""20. Valid Parentheses O(n): time O(n): Space"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
mydict = {}
mydict[']'] = '['
... | stack_v2_sparse_classes_75kplus_train_067087 | 2,019 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": "20. Valid Parentheses O(n): time O(n): Space",
"name": "isValid2",
"signature": "def isValid2(self, s: str) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid2(self, s: str) -> bool: 20. Valid Parentheses O(n): time O(n): Space | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid2(self, s: str) -> bool: 20. Valid Parentheses O(n): time O(n): Space
<|skeleton|>
class Solution:
def isValid(... | eaccc82e3068e92b17d76d42666829ccd28e7661 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid2(self, s: str) -> bool:
"""20. Valid Parentheses O(n): time O(n): Space"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
mydict = {}
mydict[']'] = '['
mydict[')'] = '('
mydict['}'] = '{'
mystack = []
for item in s:
if item in mydict.values():
mystack.append(item)
if item... | the_stack_v2_python_sparse | 20_Valid_Parentheses.py | becomeuseless/WeUseless | train | 1 | |
e642a4f58a4ce4b28524aa4b0a6ca77da752a42d | [
"try:\n import annoy\nexcept ImportError:\n raise ValueError('Using `AnnoyNearestNeighbors` requires installing the annoy module. If pip is installed, this can be done with `pip install --user annoy`.')\nself.num_trees = num_trees",
"import annoy\ndata = data.view((len(data), -1))\nprojection_dim = data.sha... | <|body_start_0|>
try:
import annoy
except ImportError:
raise ValueError('Using `AnnoyNearestNeighbors` requires installing the annoy module. If pip is installed, this can be done with `pip install --user annoy`.')
self.num_trees = num_trees
<|end_body_0|>
<|body_start_1|... | This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyurl.com/2p89sb2h and https://github.com/spotify/an... | AnnoyNearestNeighbors | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnnoyNearestNeighbors:
"""This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyu... | stack_v2_sparse_classes_75kplus_train_067088 | 10,067 | permissive | [
{
"docstring": "Args: num_trees (int): The number of trees to use. Increasing this number gives more accurate computation of nearest neighbors, but requires longer setup time to create the trees, as well as memory.",
"name": "__init__",
"signature": "def __init__(self, num_trees: int=10) -> None"
},
... | 3 | stack_v2_sparse_classes_30k_train_048599 | Implement the Python class `AnnoyNearestNeighbors` described below.
Class description:
This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be i... | Implement the Python class `AnnoyNearestNeighbors` described below.
Class description:
This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be i... | 945c582cc0b08885c4e2bfecb020abdfac0122f3 | <|skeleton|>
class AnnoyNearestNeighbors:
"""This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnnoyNearestNeighbors:
"""This is an implementation of `NearestNeighbors` that uses the Annoy module. At a high level, Annoy finds nearest neighbors by constructing binary trees in which vectors reside at leaf nodes. Vectors near each other will tend to be in the same leaf node. See https://tinyurl.com/2p89sb... | the_stack_v2_python_sparse | captum/influence/_utils/nearest_neighbors.py | pytorch/captum | train | 4,230 |
d55b50b108a5e76dcacba7e2f69b1134fbf31e50 | [
"import instrument.elements as ies\ninstrument = ies.instrument('instrument')\ngeometer = Geometer(instrument)\ngeometer.finishRegistration()\nreturn",
"import instrument.elements as ies\ninstrument = ies.instrument('instrument')\nmoderator = ies.moderator('moderator', 100.0, 100.0, 10.0)\ninstrument.addElement(m... | <|body_start_0|>
import instrument.elements as ies
instrument = ies.instrument('instrument')
geometer = Geometer(instrument)
geometer.finishRegistration()
return
<|end_body_0|>
<|body_start_1|>
import instrument.elements as ies
instrument = ies.instrument('instru... | Geometer_TestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
<|body_0|>
def test2(self):
"""Geometer: instrument with one moderator given abs position"""
<|body_1|>
def test3(self):
"""Geometer: instrument with one moderator and monito... | stack_v2_sparse_classes_75kplus_train_067089 | 8,225 | no_license | [
{
"docstring": "Geometer: simplest instrument",
"name": "test1",
"signature": "def test1(self)"
},
{
"docstring": "Geometer: instrument with one moderator given abs position",
"name": "test2",
"signature": "def test2(self)"
},
{
"docstring": "Geometer: instrument with one moderat... | 3 | stack_v2_sparse_classes_30k_train_044112 | Implement the Python class `Geometer_TestCase` described below.
Class description:
Implement the Geometer_TestCase class.
Method signatures and docstrings:
- def test1(self): Geometer: simplest instrument
- def test2(self): Geometer: instrument with one moderator given abs position
- def test3(self): Geometer: instru... | Implement the Python class `Geometer_TestCase` described below.
Class description:
Implement the Geometer_TestCase class.
Method signatures and docstrings:
- def test1(self): Geometer: simplest instrument
- def test2(self): Geometer: instrument with one moderator given abs position
- def test3(self): Geometer: instru... | 7d6fb88e7ec8245c488ab7988a8518de57dd73df | <|skeleton|>
class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
<|body_0|>
def test2(self):
"""Geometer: instrument with one moderator given abs position"""
<|body_1|>
def test3(self):
"""Geometer: instrument with one moderator and monito... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
import instrument.elements as ies
instrument = ies.instrument('instrument')
geometer = Geometer(instrument)
geometer.finishRegistration()
return
def test2(self):
"""Geometer: in... | the_stack_v2_python_sparse | instrument/geometers/Geometer.py | danse-inelastic/instrument | train | 0 | |
4eefe3f2214ed67ab0f3433eaf009ee68aeafb9c | [
"sagemaker_session = sagemaker_session or Session()\nbucket, key_prefix = parse_s3_url(url=s3_uri)\nif kms_key is not None:\n extra_args = {'SSECustomerKey': kms_key}\nelse:\n extra_args = None\nreturn sagemaker_session.download_data(path=local_path, bucket=bucket, key_prefix=key_prefix, extra_args=extra_args... | <|body_start_0|>
sagemaker_session = sagemaker_session or Session()
bucket, key_prefix = parse_s3_url(url=s3_uri)
if kms_key is not None:
extra_args = {'SSECustomerKey': kms_key}
else:
extra_args = None
return sagemaker_session.download_data(path=local_pat... | Contains static methods for downloading directories or files from S3. | S3Downloader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3Downloader:
"""Contains static methods for downloading directories or files from S3."""
def download(s3_uri, local_path, kms_key=None, sagemaker_session=None):
"""Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local... | stack_v2_sparse_classes_75kplus_train_067090 | 8,554 | permissive | [
{
"docstring": "Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local_path (str): A local path to download the file(s) to. kms_key (str): The KMS key to use to decrypt the files. sagemaker_session (sagemaker.session.Session): Session object which... | 4 | stack_v2_sparse_classes_30k_val_001525 | Implement the Python class `S3Downloader` described below.
Class description:
Contains static methods for downloading directories or files from S3.
Method signatures and docstrings:
- def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): Static method that downloads a given S3 uri to the local machi... | Implement the Python class `S3Downloader` described below.
Class description:
Contains static methods for downloading directories or files from S3.
Method signatures and docstrings:
- def download(s3_uri, local_path, kms_key=None, sagemaker_session=None): Static method that downloads a given S3 uri to the local machi... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class S3Downloader:
"""Contains static methods for downloading directories or files from S3."""
def download(s3_uri, local_path, kms_key=None, sagemaker_session=None):
"""Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class S3Downloader:
"""Contains static methods for downloading directories or files from S3."""
def download(s3_uri, local_path, kms_key=None, sagemaker_session=None):
"""Static method that downloads a given S3 uri to the local machine. Args: s3_uri (str): An S3 uri to download from. local_path (str): ... | the_stack_v2_python_sparse | src/sagemaker/s3.py | aws/sagemaker-python-sdk | train | 2,050 |
0b5cb0c0e35752c7cf3dc9672f44a85558b447cd | [
"port = self._client.port.create(address=address, node_uuid=node.uuid, **kwargs)\nif check:\n self.check_port_presence(port)\n assert_that(port.address, equal_to(address))\n assert_that(port.node_uuid, equal_to(node.uuid))\nreturn port",
"def _check_port_presence():\n try:\n self._client.port.g... | <|body_start_0|>
port = self._client.port.create(address=address, node_uuid=node.uuid, **kwargs)
if check:
self.check_port_presence(port)
assert_that(port.address, equal_to(address))
assert_that(port.node_uuid, equal_to(node.uuid))
return port
<|end_body_0|>
... | Ironic port steps. | IronicPortSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IronicPortSteps:
"""Ironic port steps."""
def create_port(self, address, node, check=True, **kwargs):
"""Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node (object): node of the ports should be associated with ch... | stack_v2_sparse_classes_75kplus_train_067091 | 3,937 | no_license | [
{
"docstring": "Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node (object): node of the ports should be associated with check (bool): For checking port presence kwargs: Optional. A dictionary containing the attributes of the resource that ... | 4 | stack_v2_sparse_classes_30k_train_044175 | Implement the Python class `IronicPortSteps` described below.
Class description:
Ironic port steps.
Method signatures and docstrings:
- def create_port(self, address, node, check=True, **kwargs): Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node... | Implement the Python class `IronicPortSteps` described below.
Class description:
Ironic port steps.
Method signatures and docstrings:
- def create_port(self, address, node, check=True, **kwargs): Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node... | 8eecc2d8a6318cea4ba70ce47c3e6d2c944d1827 | <|skeleton|>
class IronicPortSteps:
"""Ironic port steps."""
def create_port(self, address, node, check=True, **kwargs):
"""Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node (object): node of the ports should be associated with ch... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IronicPortSteps:
"""Ironic port steps."""
def create_port(self, address, node, check=True, **kwargs):
"""Step to create ironic port based on a kwargs dictionary of attributes. Args: address (str): MAC address for this port node (object): node of the ports should be associated with check (bool): F... | the_stack_v2_python_sparse | stepler/baremetal/steps/port.py | hayderimran7/stepler | train | 0 |
ec831b00dd6e32c121073cea1b951dc55e66b5f6 | [
"Parametre.__init__(self, 'apparaître', 'spawn')\nself.tronquer = True\nself.schema = '<cle> <ident_salle>'\nself.aide_courte = 'fait apparaître une diligence'\nself.aide_longue = \"Cette commande permet de faire apparaître une diligence de la clé indiquée. Vous devez préciser en premier paramètre la clé de la dili... | <|body_start_0|>
Parametre.__init__(self, 'apparaître', 'spawn')
self.tronquer = True
self.schema = '<cle> <ident_salle>'
self.aide_courte = 'fait apparaître une diligence'
self.aide_longue = "Cette commande permet de faire apparaître une diligence de la clé indiquée. Vous devez ... | Commande 'diligence apparaître'. | PrmApparaitre | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmApparaitre:
"""Commande 'diligence apparaître'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
P... | stack_v2_sparse_classes_75kplus_train_067092 | 3,599 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmApparaitre` described below.
Class description:
Commande 'diligence apparaître'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmApparaitre` described below.
Class description:
Commande 'diligence apparaître'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmApparaitre:
"""Comm... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmApparaitre:
"""Commande 'diligence apparaître'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrmApparaitre:
"""Commande 'diligence apparaître'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'apparaître', 'spawn')
self.tronquer = True
self.schema = '<cle> <ident_salle>'
self.aide_courte = 'fait apparaître une diligence'
... | the_stack_v2_python_sparse | src/secondaires/diligence/commandes/diligence/apparaitre.py | vincent-lg/tsunami | train | 5 |
8ba840a297098e2a6d819e61f94f46f5f6d249da | [
"Component.__init__(self)\nself.name = 'Trailer_default_name'\nself.bus_in = None\nself.bus_out = None\nself.trailer_capacity = 900\nself.fs_destination_storage_threshold = None\nself.hydrogen_needed = 0\nself.fs_origin_available_kg = None\nself.set_parameters(params)\nself.current_ac = 0",
"if self.fs_component_... | <|body_start_0|>
Component.__init__(self)
self.name = 'Trailer_default_name'
self.bus_in = None
self.bus_out = None
self.trailer_capacity = 900
self.fs_destination_storage_threshold = None
self.hydrogen_needed = 0
self.fs_origin_available_kg = None
... | :param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capacity: trailer capacity [kg] :type trailer_capacity: numerical :param fs_destination_storag... | TrailerH2DeliverySingle | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrailerH2DeliverySingle:
""":param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capacity: trailer capacity [kg] :type trail... | stack_v2_sparse_classes_75kplus_train_067093 | 9,518 | permissive | [
{
"docstring": "Constructor method",
"name": "__init__",
"signature": "def __init__(self, params)"
},
{
"docstring": "Prepares the simulation by determining trailer activity and how much hydrogen is needed :param components: List containing each component object :type components: list :return: a... | 3 | null | Implement the Python class `TrailerH2DeliverySingle` described below.
Class description:
:param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capa... | Implement the Python class `TrailerH2DeliverySingle` described below.
Class description:
:param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capa... | 0d4d55d587c18d9e05258f85c1bb41c0b5fdaee7 | <|skeleton|>
class TrailerH2DeliverySingle:
""":param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capacity: trailer capacity [kg] :type trail... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrailerH2DeliverySingle:
""":param name: unqiue name given to the trailer component :type name: str :param bus_in: input hydrogen bus to the trailer :type bus_in: str :param bus_out: output hydrogen bus from the trailer :type bus_out: str :param trailer_capacity: trailer capacity [kg] :type trailer_capacity: ... | the_stack_v2_python_sparse | smooth/components/component_trailer_h2_delivery_single.py | rl-institut/smooth | train | 7 |
938ed24fc50d2f0dc688ff52f14384a5150f2179 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | System and ROS monitor service definition. | MonitorServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorServiceServicer:
"""System and ROS monitor service definition."""
def GetSystemDiagnostics(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def GetSystemWarnings(self, request, context):
"""returns only warn... | stack_v2_sparse_classes_75kplus_train_067094 | 8,389 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file",
"name": "GetSystemDiagnostics",
"signature": "def GetSystemDiagnostics(self, request, context)"
},
{
"docstring": "returns only warnings and errors",
"name": "GetSystemWarnings",
"signature": "def GetSystemWarnings... | 5 | stack_v2_sparse_classes_30k_train_034843 | Implement the Python class `MonitorServiceServicer` described below.
Class description:
System and ROS monitor service definition.
Method signatures and docstrings:
- def GetSystemDiagnostics(self, request, context): Missing associated documentation comment in .proto file
- def GetSystemWarnings(self, request, contex... | Implement the Python class `MonitorServiceServicer` described below.
Class description:
System and ROS monitor service definition.
Method signatures and docstrings:
- def GetSystemDiagnostics(self, request, context): Missing associated documentation comment in .proto file
- def GetSystemWarnings(self, request, contex... | ccee51ebb7f317234067efcba088a8cd61742a30 | <|skeleton|>
class MonitorServiceServicer:
"""System and ROS monitor service definition."""
def GetSystemDiagnostics(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def GetSystemWarnings(self, request, context):
"""returns only warn... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MonitorServiceServicer:
"""System and ROS monitor service definition."""
def GetSystemDiagnostics(self, request, context):
"""Missing associated documentation comment in .proto file"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | Task 4/ROS/yellow_ws/devel/lib/python2.7/dist-packages/fkie_multimaster_msgs/grpc/monitor_pb2_grpc.py | AaryenMehta/learning101 | train | 0 |
c1e287f1ad9aa7f3f2fffae267ba8339c549fb9f | [
"dl = DisplayList()\nam = IAddressManagement(self)\nfor address in am.getAddresses():\n dl.add(address.getId(), address.getName() + ' - ' + address.getAddress1())\nreturn dl",
"dl = DisplayList()\npm = IShippingManagement(self.getShop())\nfor shipping_method in pm.getShippingMethods():\n dl.add(shipping_met... | <|body_start_0|>
dl = DisplayList()
am = IAddressManagement(self)
for address in am.getAddresses():
dl.add(address.getId(), address.getName() + ' - ' + address.getAddress1())
return dl
<|end_body_0|>
<|body_start_1|>
dl = DisplayList()
pm = IShippingManagemen... | A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember in future. | Customer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Customer:
"""A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember i... | stack_v2_sparse_classes_75kplus_train_067095 | 4,537 | no_license | [
{
"docstring": "Returns all addresses as DisplayList.",
"name": "_getAddressesAsDL",
"signature": "def _getAddressesAsDL(self)"
},
{
"docstring": "Returns all shipping methods as DisplayList.",
"name": "_getShippingMethodsAsDL",
"signature": "def _getShippingMethodsAsDL(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_049239 | Implement the Python class `Customer` described below.
Class description:
A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is i... | Implement the Python class `Customer` described below.
Class description:
A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is i... | 26e9a40f8e25684a1c156ac1cea08e6796e4c2d7 | <|skeleton|>
class Customer:
"""A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Customer:
"""A customer can buy products from a shop. A customer has addresses and payment methods. A customer exists additionally to the members of Plone. Whenever a member wants to buy something a customer content object is added for this member. This is intended to be changed to use remember in future."""
... | the_stack_v2_python_sparse | Attic_from_svn_import/easyshop.customer/easyshop/customer/content/customer.py | Easyshop/Easyshop | train | 3 |
bc3a0d116e65333a29cdf7f89e61379e102758d6 | [
"source_dict = self._traverse_tree(self.source_tree)\ntarget_dict = self._traverse_tree(self.target_tree)\nmatching_pairs = {}\nfor comment in source_dict:\n matching_pairs[comment] = (source_dict[comment], target_dict.get(comment, []))\nreturn matching_pairs",
"root = tree.root_node\nstack: Deque = deque([roo... | <|body_start_0|>
source_dict = self._traverse_tree(self.source_tree)
target_dict = self._traverse_tree(self.target_tree)
matching_pairs = {}
for comment in source_dict:
matching_pairs[comment] = (source_dict[comment], target_dict.get(comment, []))
return matching_pair... | The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also parses special comments that specify the flow between the rules. Each template i... | GraphParser | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphParser:
"""The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also parses special comments that specify the ... | stack_v2_sparse_classes_75kplus_train_067096 | 4,463 | permissive | [
{
"docstring": "Executes the actual tree traversal on both 'source_tree' and 'target_tree'. It finds corresponding template pairs using identifiers specified in the comments. It also finds the edges between the templates. This method returns a dictionary of matched template pairs, which serves as a foundation f... | 2 | stack_v2_sparse_classes_30k_train_000951 | Implement the Python class `GraphParser` described below.
Class description:
The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also pa... | Implement the Python class `GraphParser` described below.
Class description:
The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also pa... | 33edaafe82d7b0a03d425700cc156a7c37db278e | <|skeleton|>
class GraphParser:
"""The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also parses special comments that specify the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GraphParser:
"""The TemplateParser class performs depth-first search on two given Abstract Syntax Trees (ASTs) to identify mapping from 'before' code snippet (sub-AST) to 'after' code snippet (sub-AST) required to construct the rules of the graph. It also parses special comments that specify the flow between ... | the_stack_v2_python_sparse | experimental/piranha_playground/rule_inference/graph_parser.py | uber/piranha | train | 2,259 |
667c4f7c989e584e415c4b687f7c85843b60345c | [
"QLabel.__init__(self, parent)\nself.start_animation(self.SLOW_DURATION)\nfont = QFont('Arial', 30)\nself.setFont(font)\nself.setText('Select your layout')\nself.setFixedHeight(100)\nself.setAlignment(Qt.AlignCenter)\nself.setStyleSheet('color: ' + color)",
"self.effect = QGraphicsOpacityEffect()\nself.setGraphic... | <|body_start_0|>
QLabel.__init__(self, parent)
self.start_animation(self.SLOW_DURATION)
font = QFont('Arial', 30)
self.setFont(font)
self.setText('Select your layout')
self.setFixedHeight(100)
self.setAlignment(Qt.AlignCenter)
self.setStyleSheet('color: ' ... | This is a helper class that extends the functioality of the default QLabel with a fade in-out animation | AnimatedLabel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnimatedLabel:
"""This is a helper class that extends the functioality of the default QLabel with a fade in-out animation"""
def __init__(self, parent=None, color='yellow'):
"""Constructor of the class Keyword Arguments: parent {ui.gui.views.main_view.MainView} -- parent of this widg... | stack_v2_sparse_classes_75kplus_train_067097 | 13,667 | no_license | [
{
"docstring": "Constructor of the class Keyword Arguments: parent {ui.gui.views.main_view.MainView} -- parent of this widget (default: {None}) color {str} -- Foreground color of the label (default: {'yellow'})",
"name": "__init__",
"signature": "def __init__(self, parent=None, color='yellow')"
},
{... | 2 | null | Implement the Python class `AnimatedLabel` described below.
Class description:
This is a helper class that extends the functioality of the default QLabel with a fade in-out animation
Method signatures and docstrings:
- def __init__(self, parent=None, color='yellow'): Constructor of the class Keyword Arguments: parent... | Implement the Python class `AnimatedLabel` described below.
Class description:
This is a helper class that extends the functioality of the default QLabel with a fade in-out animation
Method signatures and docstrings:
- def __init__(self, parent=None, color='yellow'): Constructor of the class Keyword Arguments: parent... | a6e40f9778284426a15c05ef362dde243e687888 | <|skeleton|>
class AnimatedLabel:
"""This is a helper class that extends the functioality of the default QLabel with a fade in-out animation"""
def __init__(self, parent=None, color='yellow'):
"""Constructor of the class Keyword Arguments: parent {ui.gui.views.main_view.MainView} -- parent of this widg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnimatedLabel:
"""This is a helper class that extends the functioality of the default QLabel with a fade in-out animation"""
def __init__(self, parent=None, color='yellow'):
"""Constructor of the class Keyword Arguments: parent {ui.gui.views.main_view.MainView} -- parent of this widget (default: ... | the_stack_v2_python_sparse | behavior_studio/ui/gui/views/layout_selection.py | dcharrezt/BehaviorStudio | train | 0 |
0710963adca6f7878c585fb1256372973bf81d57 | [
"import gspread\ntry:\n oauth_json = self.plugin_config['service_account_credentials']\n with tempfile.NamedTemporaryFile(mode='w+', suffix='.json') as ntf:\n json.dump(oauth_json, ntf)\n ntf.seek(0)\n gc = gspread.service_account(filename=ntf.name)\n sheet_url = self.plugin_config['sh... | <|body_start_0|>
import gspread
try:
oauth_json = self.plugin_config['service_account_credentials']
with tempfile.NamedTemporaryFile(mode='w+', suffix='.json') as ntf:
json.dump(oauth_json, ntf)
ntf.seek(0)
gc = gspread.service_acco... | Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the Gradescope assignment ID, student email, and test case name. Implements the ``during_generate... | GoogleSheetsGradeOverride | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleSheetsGradeOverride:
"""Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the Gradescope assignment ID, student email,... | stack_v2_sparse_classes_75kplus_train_067098 | 5,949 | permissive | [
{
"docstring": "Uses the Google Sheets API credentials stored in ``self.plugin_config`` to read in the sheet using ``pandas``. Returns: ``pandas.core.frame.DataFrame``: the sheet as a dataframe",
"name": "_load_df",
"signature": "def _load_df(self)"
},
{
"docstring": "The grade override informat... | 5 | stack_v2_sparse_classes_30k_train_012693 | Implement the Python class `GoogleSheetsGradeOverride` described below.
Class description:
Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the G... | Implement the Python class `GoogleSheetsGradeOverride` described below.
Class description:
Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the G... | e6ece6b53ef2291f2724ff9965f09d910ad10e7e | <|skeleton|>
class GoogleSheetsGradeOverride:
"""Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the Gradescope assignment ID, student email,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GoogleSheetsGradeOverride:
"""Otter plugin for overriding test case scores with values in a Google Sheet on Gradescope. Uses provided Google Service Account credentials to pull in the spreadsheet as a dataframe and edits test case scores by matching on the Gradescope assignment ID, student email, and test cas... | the_stack_v2_python_sparse | otter/plugins/builtin/grade_override.py | ucbds-infra/otter-grader | train | 112 |
e999dbeee8b7d3b8c609be050e9be82f0785ce24 | [
"self.dist = dist\nsamples_ = chaospy.generate_samples(2 * samples, domain=len(dist), rule=rule)\nself.samples1 = samples_.T[:samples].T\nself.samples2 = samples_.T[samples:].T\nself.poly = poly\nself.buffer = {}",
"new = numpy.empty(self.samples1.shape)\nfor idx in range(len(indices)):\n if indices[idx]:\n ... | <|body_start_0|>
self.dist = dist
samples_ = chaospy.generate_samples(2 * samples, domain=len(dist), rule=rule)
self.samples1 = samples_.T[:samples].T
self.samples2 = samples_.T[samples:].T
self.poly = poly
self.buffer = {}
<|end_body_0|>
<|body_start_1|>
new = n... | Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> generator[False, False].round(4) array([... | Saltelli | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Saltelli:
"""Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> gene... | stack_v2_sparse_classes_75kplus_train_067099 | 8,039 | permissive | [
{
"docstring": "Initialize the matrix generator. dist (chaopy.Distribution): distribution to sample from. samples (int): The number of samples to draw for each matrix. poly (numpoly.ndpoly): If provided, evaluated samples through polynomials before returned. rule (str): Scheme for generating random samples.",
... | 3 | stack_v2_sparse_classes_30k_train_005486 | Implement the Python class `Saltelli` described below.
Class description:
Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Sa... | Implement the Python class `Saltelli` described below.
Class description:
Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Sa... | b5959a24e0bd9b214c292485919d7ce58795f5dc | <|skeleton|>
class Saltelli:
"""Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> gene... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Saltelli:
"""Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> generator[False, ... | the_stack_v2_python_sparse | chaospy/saltelli.py | jonathf/chaospy | train | 405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.