source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#
# author: Jungtaek Kim (jtkim@postech.ac.kr)
# last updated: February 8, 2021
#
import numpy as np
import pytest
from bayeso_benchmarks.inf_dim_ackley import *
class_fun = Ackley
TEST_EPSILON = 1e-5
def test_init():
obj_fun = class_fun(2)
with pytest.raises(TypeError) as error:
class_fun()
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": f... | 3 | tests/test_inf_dim_ackley.py | jungtaekkim/bayeso-benchmarks |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | solum/tests/api/camp/v1_1/test_extensions.py | openstack/solum |
from torch import nn
from torch.nn import Module
def determine_conv_class(n_dim, transposed=False):
if n_dim is 1:
if not transposed:
return nn.Conv1d
else:
return nn.ConvTranspose1d
elif n_dim is 2:
if not transposed:
return nn.Conv2d
else:
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | irim/external/invertible_rim/irim/utils/torch_utils.py | victorychain/FNAF-fastMRI |
class Tiger:
def __init__(self, name, gender, age):
self.name = name
self.gender = gender
self.age = age
def __repr__(self):
return f"Name: {self.name}, Age: {self.age}, Gender: {self.gender}"
@staticmethod
def get_needs():
return 45
| [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | encapsulation/wild_cat_zoo_exe/tiger.py | PetkoAndreev/Python-OOP |
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500 | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | app/main/errors.py | ykarmouta/flask_template |
# DADSA - Assignment 1
# Reece Benson
from classes import Player as Player
class Season():
_app = None
_j_data = None
_name = None
_players = { }
_rounds = { }
_rounds_raw = { }
_settings = { }
def __init__(self, _app, name, j_data):
# Set our application as a variable
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | .history/classes/Season_20171106233457.py | reecebenson/DADSA-Tennis-PartA |
from __future__ import annotations
from typing import Optional, Type, TYPE_CHECKING
import actor
from actions.ai import BasicMonster
import graphic
from inventory import Inventory
if TYPE_CHECKING:
from actions import Action
from location import Location
class Fighter(graphic.Graphic):
render_order = ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | races/__init__.py | Belvarm/roguelike-tutorial |
#!/usr/bin/env python
import rospy
from duckietown_msgs.msg import WheelsCmdStamped, FSMState
class WheelsCmdSwitchNode(object):
def __init__(self):
self.node_name = rospy.get_name()
rospy.loginfo("[%s] Initializing " %(self.node_name))
# Read parameters
self.mappings = rospy.get_para... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | catkin_ws/src/dagu_car/src/wheels_cmd_switch_node.py | OSLL/Dickietown-Software |
from functools import wraps
from flask import abort
from flask_login import current_user
from app.models import Permission
def permission_require(permission):
def wrapper(f):
@wraps(f)
def decorator_func(*args,**kw):
if not current_user.can(permission):
# print '403'
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | app/lib/auth_decorators.py | huguge/flask-bms |
from django.test import TestCase
from django.urls import reverse
from studies.models import Book, UserBookMany
from studies.tests.speed_set_up import SpeedSetUP
class DeleteBookView(TestCase):
def setUp(self):
speed_set_up = SpeedSetUP()
self.user_a = speed_set_up.set_up_user_a()
self.boo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | studies/tests/tests_integration/test_delete_book_view.py | tbuglioni/unlimited-studies |
#! python3
# __author__ = "YangJiaHao"
# date: 2018/2/1
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def mergeTwoLists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: Li... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | Python3/21_Merge_Two_Sorted_List.py | yangjiahao106/LeetCode |
# -*- coding: utf-8 -*-
from base import *
from requests import *
class TestMimeType1(CurlRequest):
URL = "/test.txt"
EXPECT_RESPONSE_BODY = ""
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [ ("Content-Type", "text/plain; charset=utf-8") ]
class TestMimeType2(CurlRequest):
URL = "/test.xt"
EXPECT_RESPO... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | tests/t-mime-type.py | kurtace72/lighttpd2 |
''' device.py
'''
from transitions import Machine
from core.clock import ClockReference
from core.message_router import MessageRouter
class Device:
''' Device:
A base class that all accelerator components inherit from.
A device requires a clock-reference and a message-router (to communicate)
Args:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | core/device.py | ngiambla/nnflex |
from kao_decorators import lazy_property
import re
class RegexHelper:
""" Helper class to cleanup usage of the regex string """
def __init__(self, originalRegEx, dependencyHelper):
""" Initialize the Helper with the string """
self.originalRegEx = originalRegEx
self.depend... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | kao_parser/regex_helper.py | cloew/KaoParser |
def test_error(invalid_fixture):
pass
class Test:
def test_error(self, invalid_fixture):
assert True
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | examples/test_error.py | ak1ra24/pytest-md-report |
from backpack.core.derivatives.linear import LinearDerivatives
from backpack.extensions.curvmatprod.hmp.hmpbase import HMPBase
class HMPLinear(HMPBase):
def __init__(self):
super().__init__(derivatives=LinearDerivatives(), params=["weight", "bias"])
def weight(self, ext, module, g_inp, g_out, backpro... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | backpack/extensions/curvmatprod/hmp/linear.py | jabader97/backpack |
#!/usr/bin/env python3
# pylint: disable=unused-import
import collections
import functools
import io
import itertools
import operator as op
import re
import timeit
import numpy as np
import aocd
YEAR = 2021
DAY = 11
def step(grid):
grid += 1
flash = np.zeros_like(grid, dtype=bool)
while np.any(grid[~fl... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/11.py | vulpicastor/advent-of-code-2021 |
__author__ = 'achamseddine'
from django.core.management.base import BaseCommand
from internos.activityinfo.tasks import migrate_tag
class Command(BaseCommand):
help = 'migrate_tag'
def add_arguments(self, parser):
parser.add_argument('--from_tag', default=None)
parser.add_argument('--to_tag'... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | internos/activityinfo/management/commands/migrate_tag.py | UNICEFLebanonInnovation/Staging-Neuro |
import torch
import torch.nn.functional as F
def dice_score(inputs, targets, smooth=1):
# Flatten label and prediction tensors
inputs = inputs.view(-1)
targets = targets.view(-1)
intersection = (inputs * targets).sum()
dice_score = (2.*intersection + smooth)/(inputs.sum... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | kaggle_SIIM-ACR_Pneumothorax_Segmentation/utils/loss.py | allen050883/Project |
import dataclasses
import os
from typing import List
import hydra
@dataclasses.dataclass
class ModelConfig:
"""Configuration for the model.
Note that `block_sizes` must be specified using the `dataclasses.field`
function, as you are not allowed to supply default values for mutable fields.
Instead, t... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | lecture3/bootcamp3/script.py | wendazhou/cds-bootcamp |
import hypothesis
from granula.pattern import Environment
from tests.strategies import WORD
@hypothesis.given(WORD, WORD, WORD)
@hypothesis.example('..config', 'testing', 'yaml') # must ignore leading dots
def test_no_environment(name, environment, extension):
filename = u'{}.{}'.format(name, extension)
a... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | tests/unit/pattern/test_environment.py | ojomio/granula |
from fastai.vision import models,cnn_learner,error_rate,accuracy
from fastai.basic_train import LearnerCallback,dataclass,nn
from rx.subjects import Subject
@dataclass
class ProgressCallback(LearnerCallback):
batch_end_subject:Subject
def on_batch_end(self, **kwargs):
print("batch end")
self.bat... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | python-sanic/classifier/train.py | yonatanMedan/ui_classifier |
from lithopscloud.modules.gen2.endpoint import EndpointConfig
from typing import Any, Dict
from lithopscloud.modules.utils import get_region_by_endpoint
class RayEndpointConfig(EndpointConfig):
def __init__(self, base_config: Dict[str, Any]) -> None:
super().__init__(base_config)
base_endpoin... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/lithopscloud/modules/gen2/ray/endpoint.py | Cohen-J-Omer/lithopscloud |
"""
geonames/exceptions
~~~~~~~~~~~~~~~~~~~
"""
from . import base
def ignore_foreign_key_constraint(db, options, record: base.T, exception: Exception) -> bool:
return 'FOREIGN KEY constraint failed' in str(exception)
def ignore_unique_key_constraint(db, options, record: base.T, exception: Exception) ->... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | geonames/exceptions.py | flyingdice/geonames-sqlite |
from chocs.http_error import HttpError
from chocs.http_request import HttpRequest
from chocs.http_response import HttpResponse
from chocs.routing import Router
from chocs.serverless.serverless import ServerlessFunction
from .middleware import Middleware, MiddlewareHandler
class ApplicationMiddleware(Middleware):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | chocs/middleware/application_middleware.py | danballance/chocs |
from napari.layers import Labels
import magicgui
from qtpy.QtWidgets import QLabel, QVBoxLayout, QPushButton, QWidget
from superqt.collapsible import QCollapsible
from .skeleton_pruner import SkeletonPruner
class QtSkeletonSelector(QWidget):
def __init__(self, napari_viewer):
super().__init__()
s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | splineslicer/skeleton/_qt_skeleton_pruner.py | kevinyamauchi/splineslicer |
from collections import defaultdict
def condense_line(line):
necessary = line.replace(' bags', '').replace(' bag', '').replace('.', '')
segmented = necessary.replace(' contain ', ':').replace(', ', ':').split(':')
return segmented[0], segmented[1:]
def decode_bag_rules(rules):
bags = defaultdict(set... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | day07/d7a.py | AlexMabry/aoc20 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""email package exception classes."""
class MessageError(Exception):
"""Base class for errors in the email package."""
class MessageParseError(MessageError):
"""Base class for message parsing erro... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | from_cpython/Lib/email/errors.py | aisk/pyston |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2
from telethon.tl.types import ChannelParticipantsAdmins
from darkbot.utils import admin_cmd, sudo_cmd, edit_or_reply
from us... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | userbot/plugins/tagall.py | LUCKYRAJPUTOP/EllipsUserbot |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | examples/test/test_aws_kms_encrypted_examples.py | robin-aws/aws-dynamodb-encryption-python |
from datetime import datetime as dt
from pathlib import PosixPath
from typing import Any, Dict, List, Tuple, Union
# TODO: uncomment after release (causes flake8 to fail)
# from _echopype_version import version as ECHOPYPE_VERSION
from typing_extensions import Literal
ProcessType = Literal["conversion", "processing"]... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | echopype/utils/prov.py | mbdunn/echopype |
def setup():
size(500, 500)
smooth()
background(255)
strokeWeight(30)
noLoop()
def draw():
i = 1
while i < 8:
stroke(20*i)
line(i*50, 200, 150 + (i-1)*50, 300)
stroke(160-20*i)
line(i*50 + 100, 200, 50 + (i-1)*50, 300)
i+=1
| [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | Processing/Section 5/Task_5_6/Task_5_6.pyde | Grigory526/2019-fall-polytech-cs |
from django.shortcuts import render, redirect
from .models import Impassionuser
from django.http import HttpResponse
from django.contrib.auth.hashers import make_password, check_password
from .forms import LoginForm
# Create your views here.
def home(request):
return render(request, 'home.html')
def about_us(requ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | projects/20130381/3rd/impassion_community/impassionuser/views.py | sisobus/WebStudio2019 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Student(models.Model):
SEX_ITEMS = [
(1, '男'),
(2, '女'),
(0, '未知'),
]
STATUS_ITEMS = [
(0, '申请'),
(1, '通过'),
(2, '拒绝'),
]
name = models.CharField(max_... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | student_sys/student/models.py | the5fire/student_house |
import pytest
import ray
import mars
import mars.dataframe as md
import pyarrow as pa
@pytest.fixture(scope="module")
def ray_start_regular(request): # pragma: no cover
try:
yield ray.init(num_cpus=16)
finally:
ray.shutdown()
def test_mars(ray_start_regular):
import pandas as pd
cl... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | python/ray/data/tests/test_mars.py | mgelbart/ray |
from smlb import (
params,
Data,
Features,
TabularData,
)
from smlb.feature_selection.selector_protocol_sklearn import SelectorProtocolSklearn
class FeatureSelectorSklearn(Features):
"""Base class for feature selection strategies that use one of scikit-learn's feature selection methods.
This ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | smlb/feature_selection/feature_selector_sklearn.py | CitrineInformatics/smlb |
"""users table
Revision ID: 1bd480e682e0
Revises:
Create Date: 2020-12-29 22:37:15.050661
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1bd480e682e0'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto genera... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | migrations/versions/1bd480e682e0_users_table.py | koksalkapucuoglu/MicroBlogwFlask |
import tensorflow as tf
import numpy as np
def switch_case_cond(cases, default_case):
if cases:
condition, effect = cases[0]
return tf.cond(condition, effect, lambda: switch_case_cond(cases[1:], default_case))
return default_case()
def switch_case_where(cases, default_case):
if cases:
condition, effect = c... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | elpips/util.py | niopeng/elpips |
from flask import Blueprint
from google.cloud import firestore
application = Blueprint('task', __name__)
@application.route("/task")
def index():
return 'this is task directory'
@application.route("/task/sample")
def sample():
db = firestore.Client()
novels = db.collection(u'novels').order_by(u'novel... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tasks/sample.py | wataken44/kushimori |
import pytest
import jax
import netket as nk
import numpy as np
from functools import partial
@pytest.mark.parametrize("jit", [False, True])
@pytest.mark.parametrize("batch_size", [None, 16, 10000, 1000000])
@pytest.mark.parametrize("return_forward", [False, True])
@pytest.mark.parametrize("batch_argnums", [1, (1,)]... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | test/jax/test_vjp_batched.py | mmezic/netket |
from objectives.results._objective_result import *
from objectives.results._add_sub_stat import add_stat_all, sub_stat_all
MAG_PWR_ADDRESS = 0x161d
add_mag_pwr = add_stat_all(MAG_PWR_ADDRESS, "mag_pwr")
sub_mag_pwr = sub_stat_all(MAG_PWR_ADDRESS, "mag_pwr")
class Field(field_result.Result):
def src(self, count):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | objectives/results/mag_pwr_all.py | HansGR/WorldsCollide |
from dataclasses import dataclass
from typing import Iterable, Optional, Sequence, Set
from di.core.element import Dependency, Value
class Matcher:
def iterate(self, dependency: Dependency, values: Set[Value]) -> Iterable[Value]:
raise NotImplementedError
class ValuesMapper:
def map(self, objects: ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | di/core/assignment/base.py | dlski/python-di |
import numpy as np
def binary_classification_metrics(prediction, ground_truth):
'''
Computes metrics for binary classification
Arguments:
prediction, np array of bool (num_samples) - model predictions
ground_truth, np array of bool (num_samples) - true labels
Returns:
precision, recall, f1... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | assignments/assignment1/metrics.py | veras222/cs231n-assignment |
import json
from os import listdir
from os.path import isfile, join
class File:
_memes_path = "./Memes/"
@staticmethod
def loadConfig():
try:
return json.load(open("./config.json", "r"))
except FileNotFoundError:
print("O arquivo config.json não foi encontrado.")
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | Utilities/Files.py | Lucas-Uchiha/FuinhaBot |
import pwd
import subprocess
from jadi import component
from aj.api.http import url, HttpPlugin
from aj.api.endpoint import endpoint
@component(HttpPlugin)
class Handler(HttpPlugin):
def __init__(self, context):
self.context = context
@url(r'/api/passwd/list')
@endpoint(api=True)
def handle... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | plugins/passwd/views.py | lllanos/InfraDocker_Ajenti |
import pytest
from risks.validation_helpers import get_non_matching_fields
@pytest.fixture
def regexes():
return ['abc', '^onlythis$', '^.{7}$']
field_values = ['abcd', 'onlythis', '123f567']
@pytest.fixture
def fields():
return [
{'value': v} for v in field_values
]
class TestGetNonMatching... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | backend/risks/tests/unit/test_validation_helpers.py | andrew-snek/project-x |
'''Validation tools for input and output data
'''
from jsonschema import validate
import yaml
try:
import importlib.resources as resources
except ImportError: # pragma: no cover
import importlib_resources as resources
def _validate_dict(input_dict, schema_name, **kwargs):
schema = yaml.load(
re... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | pullnrun/validate.py | kangasta/pullnrun |
import unittest
from fixtures.base import BaseTestCase
from pages.forgot_password_page import ForgotPasswordPage
from pages.login_page import LoginPage
from parameters.parameters import *
class ForgotPasswordTestCase(BaseTestCase):
def setUp(self):
super(ForgotPasswordTestCase, self).setUp()
self.... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | ASK/tests/POM_Forgot_password.py | SQAPractical/AssesmentControlePython |
from datetime import datetime
from functools import partial
from typing import Callable, List, Union
from symbiotic.schedule import Schedule
class Action(object):
def __init__(self, callback: Callable, *args, **kwargs):
self._callback: partial = partial(callback, *args, **kwargs)
self._schedule:... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | symbiotic/actions.py | StefanoFrazzetto/symbiotic |
# Copyright © 2021 Ingram Micro Inc. All rights reserved.
from multiprocessing import Process
from dj_cqrs.registries import ReplicaRegistry
from dj_cqrs.transport import current_transport
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Starts CQRS worker,... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | dj_cqrs/management/commands/cqrs_consume.py | jhenriquezs/django-cqrs |
import gpustat
import numpy as np
from keras.callbacks import Callback
class GPUUtilizationSampler(Callback):
"""
Measure GPU utilization at the end of 1% of all batches.
(The more frequent the measuring, the slower and less accurate this callback becomes.)
If GPU is not present, report 0 utilization.... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | training/gpu_util_sampler.py | toolkmit/algotrading |
#-
# Copyright (c) 2015 Michael Roe
# All rights reserved.
#
# This software was developed by the University of Cambridge Computer
# Laboratory as part of the Rigorous Engineering of Mainstream Systems (REMS)
# project, funded by EPSRC grant EP/K008528/1.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BERI Open System... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tests/mem/test_swl.py | capt-hb/cheritest |
from account import Account
from taxable import TaxableMixIn
class AccountChecking(Account, TaxableMixIn):
def __init__(self, number, customer, balance, limit=1000.0):
super().__init__(number, customer, balance, 'Checking', limit)
def update(self, tax):
self._balance += self._balance * ta... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | oo/account_checking.py | learning-foundation/python-oo-ds |
# -*- coding: utf-8 -*-
#
import numpy
from .. import helpers
def integrate(f, rule, dot=numpy.dot):
flt = numpy.vectorize(float)
return dot(f(flt(rule.points).T), flt(rule.weights))
def show(scheme, backend="mpl"):
"""Displays scheme for E_3^r quadrature.
"""
helpers.backend_to_function[backen... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | quadpy/e3r/tools.py | gdmcbain/quadpy |
import tkinter as tk
from tkinter import ttk
from tkinter.constants import NSEW, VERTICAL
from tkinter.messagebox import showinfo
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title('Treeview demo')
self.geometry('620x200')
self.tree = self.create_tree_widget()
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | paraVerComoFuncionaAlgumasCoisas/tkinter-coisas/treeview_tutoriais/estudos/2-OOP_treeView.py | jonasht/pythonEstudos |
import pandas as pd
import io
from joblib import load
import logging
logging.getLogger().setLevel(logging.INFO)
def generate_data():
new_data = pd.DataFrame({
'Pclass':[3,2,1],
'Sex': ['male', 'female', 'male'],
'Age':[4, 22, 28]
})
return new_data
def load_model():
try:
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | hermione/module_templates/__IMPLEMENTED_BASE__/src/predict.py | RodrigoATorres/hermione |
import shutil
from ngslite.fasta import FastaParser, FastaWriter
from .setup import setup_dirs, TestCase
class TestFastaParser(TestCase):
def setUp(self):
self.indir, self.workdir, self.outdir = setup_dirs(__file__)
def tearDown(self):
shutil.rmtree(self.workdir)
shutil.r... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test/test_fasta.py | nebiolabs/ngslite |
import torch
from .wrapper import Wrapper
class PyTorchWrapper(Wrapper):
def __init__(self, model, tokenizer):
super(PyTorchWrapper, self).__init__()
self._model = model
self._tokenizer = tokenizer
self.unk_token = self._tokenizer.unk_token
def _forward(self, text_list):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | taattack/victims/wrappers/pytorch_warpper.py | linerxliner/ValCAT |
"""
Validate that instances of `affine.Affine()` can be pickled and unpickled.
"""
import pickle
from multiprocessing import Pool
import affine
def test_pickle():
a = affine.Affine(1, 2, 3, 4, 5, 6)
assert pickle.loads(pickle.dumps(a)) == a
def _mp_proc(x):
# A helper function - needed for test_with_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | my_env/lib/python3.6/site-packages/affine/tests/test_pickle.py | wilsonfilhodev/gis |
from .WordTokenizer import WordTokenizer
from .SentenceTokenizer import SentenceTokenizer
from .HamshahriReader import HamshahriReader
from .PersicaReader import PersicaReader
from .BijankhanReader import BijankhanReader
from .PeykareReader import PeykareReader
from .VerbValencyReader import VerbValencyReader
from .Da... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | hazm/__init__.py | ahangarha/hazm |
import platform
import os.path
import subprocess # nosec - see usage below
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
BIN_PATH = (
'http://download.gna.org', 'wkhtmltopdf', '0.12', '0.12.3',
'wkhtmltox-0.12.3_linux-generic-amd64.tar.xz',
)
class Com... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | regulations/management/commands/fetch_wkhtmltox.py | navigo/regulations-site |
from django.contrib import admin
from core.models import EventPageContent
from .models import Sponsor, Donor
class SponsorInline(admin.TabularInline):
model = EventPageContent.sponsors.through
extra = 1
verbose_name_plural = 'Sponsors'
class SponsorAdmin(admin.ModelAdmin):
list_display = ('id', 'na... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | sponsor/admin.py | crydotsnake/djangogirls |
import string
import re
# before running this script , please run the datacleaning script and set the folder to read from to train_pos_full and train_neg_full to generate the vocabullary
# for the respective files
def loadText(fileName):
with open(fileName) as f:
content = f.readlines()
content = [x.strip() ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | src/scripts/clean_tweets.py | EPFLMachineLearningTeamYoor/Project02 |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from __future__ import abs... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | lte/gateway/python/magma/mobilityd/ip_allocator_base.py | ekfuhrmann/magma-old |
from . import api_v1
from flog.errors import api_err_response
def bad_request(message):
return api_err_response(400, "bad request", message)
def unauthorized(message):
return api_err_response(401, "unauthorized", message)
def forbidden(message):
return api_err_response(403, "forbidden", message)
cla... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | flog/api/v1/errors.py | rice0208/Flog |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AntOcrVehicleplateIdentifyModel(object):
def __init__(self):
self._image = None
self._type = None
@property
def image(self):
return self._image
@image.setter... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | alipay/aop/api/domain/AntOcrVehicleplateIdentifyModel.py | alipay/alipay-sdk-python-all |
import nltk
import numpy as np
#nltk.download('punkt') #downloading a package with a pretrained tokenizer
from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()
def tokenize(sentence): #splitting a string into meaningful units
return nltk.word_tokenize(sentence)
def stem(word): ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | nltk_utils.py | Serkanbezek/Chatbot-NLP-PyTorch |
from unittest import TestCase
from doccano_transformer import utils
class TestUtils(TestCase):
def test_get_offsets(self):
text = ' This is Doccano Transformer . '
tokens = text.split()
result = utils.get_offsets(text, tokens)
expected = [1, 6, 9, 17, 29]
self.assertListE... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_utils.py | duranbe/doccano-transformer |
from main import app
from schemas import *
from utils import *
@app.get('/')
async def index():
data = test()
return data
@app.post('/api/v1/summarize-text')
async def summarize_text(payload: Corpus):
corpus = payload.text
num_words = payload.num_words
num_sentences = payload.num_sentences
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | routes.py | vnurhaqiqi/indonesian-text-summarization-fastapi |
import numpy as np
import matplotlib.pyplot as plt
from sal_timer import timer
def plot_1():
# ...
data = {
'a': np.arange(50),
'c': np.random.randint(0, 50, 50),
'd': np.random.randn(50)
}
data['b'] = data['a'] + 10 * np.random.randn(50)
data['d'] = np.abs(data['d']) * ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tutorial/basic/ex3.py | SalAlba/matplotlib |
#!/usr/bin/env python3
"""
Author : abennett1 <abennett1@localhost>
Date : 2021-09-20
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Do Re Mi solfege',... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | assignments/03_solfege/solfege.py | ABennett97/be434-fall-2021 |
from django.utils.translation import ugettext as _
class StatusCode:
@classmethod
def items(cls):
return cls.options.items()
@classmethod
def label(cls, value):
""" Return the status code label associated with the provided value """
return cls.options.get(value, value)
clas... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | InvenTree/InvenTree/status_codes.py | linucks/InvenTree |
#!/usr/bin/env python
import csv
import os
import argparse
import dateutil.parser
import json
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dir", type=str, required=True,
help="name of the data directory")
args = parser.parse_args()
return ar... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | jhu2json.py | florath/jhu2db |
from unittest import TestCase
class TestNumbers2Words(TestCase):
from numbers2words import numbers2words
# 1-10
def test_one(self):
self.assertEqual(numbers2words(1), "one")
def test_two(self):
self.assertEqual(numbers2words(2), "two")
def test_three(self):
self.assertEqual(numbers2words(3), ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/test_n2w.py | gnuchu/n2w |
#! /usr/bin/python3
import sys, os, time, tempfile
import pytest
import util_test
from util_test import CURR_DIR
from fixtures.vectors import UNITTEST_VECTOR
from fixtures.params import DEFAULT_PARAMS as DP
from lib import (config, util, api, database)
import counterpartyd
def setup_module():
counterpartyd.set_op... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | test/unit_test.py | ouziel-slama/counterpartyd |
#!/usr/bin/env python
"""
CREATED AT: 2021/10/7
Des:
https://leetcode.com/problems/ugly-number/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Easy
"""
class Solution:
def isUgly(self, n: int) -> bool:
"""
1013 / 1013 test cases passed.
Status: Accepted
Runtime: 32 ms
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/263-UglyNumber.py | Jiezhi/myleetcode |
from checkov.terraform.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_check import BaseResourceCheck
class AzureInstancePassword(BaseResourceCheck):
def __init__(self):
name = "Ensure Azure Instance does not use basic authentication(Use SSH Key Instead)"
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | checkov/terraform/checks/resource/azure/AzureInstancePassword.py | mgmt1pyro/Test-Theme |
#!/bin/env python
import numpy as np
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.ops as ops
import nvidia.dali.types as types
try:
from matplotlib import pyplot as plt
has_matplotlib = True
except ImportError:
has_matplotlib = False
BATCH_SIZE=4
COUNT=5
VIDEO_FILES=["prepared.mp4"]
ITE... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | docs/examples/video/video_example.py | rajkaramchedu/DALI |
from typing import *
T = TypeVar('T')
MAGIC_ATTR = "__cxxpy_s13s__"
def template(cls: T) -> T:
s13s = {}
setattr(cls, MAGIC_ATTR, s13s)
def __class_getitem__(args):
if not isinstance(args, tuple):
args = (args,)
if args not in s13s:
name = cls.__name__ + ", ".join(map(str, args... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | py/template_specialization_3.py | coalpha/coalpha.github.io |
class Student:
def __init__(self,name):
self.name = name
self.exp = 0
self.lesson = 0
self.AddEXP(10)
def Hello(self):
print('Hello World! My name is {}!'.format(self.name))
def Coding(self):
print('{}: Currently coding...'.format(self.name))
self.exp += 5
self.lesson += 1
def Sho... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | GemmyTheNerd/studentclass.py | GemmyTheGeek/GemmyTheNerd |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : fedhf\api\dpm\laplace_noise.py
# @Time : 2022-05-02 22:39:42
# @Author : Bingjie Yan
# @Email : bj.yan.pa@qq.com
# @License : Apache License 2.0
import numpy as np
import torch
def laplace_noise(sensitivity, size, epsilon, **kwargs):
"""
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | fedhf/api/dpm/laplace.py | beiyuouo/fedhf |
import re
from six import string_types
class Nullify(object):
def __init__(self):
self.need_underscore = re.compile(r'^_*NULL$')
self.has_underscore = re.compile(r'^_(_*NULL)$')
pass
def stringy(self, value):
return isinstance(value, string_types)
def encode_null(self, v... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},... | 3 | catsql/nullify.py | paulfitz/catsql |
import os,sys
import numpy as np
import h5py, time, argparse, itertools, datetime
from scipy import ndimage
import torchvision.utils as vutils
# tensorboardX
from tensorboardX import SummaryWriter
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | torch_connectomics/io/misc.py | ygCoconut/pytorch_connectomics |
import paddle
import paddle.nn as nn
class ContrastiveLoss(nn.Layer):
"""
Compute contrastive loss
"""
def __init__(self, margin=0, max_violation=False):
super(ContrastiveLoss, self).__init__()
self.margin = margin
self.max_violation = max_violation
def forward(self, score... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | paddlemm/models/retrieval/layers/contrastive.py | njustkmg/PaddleMM |
from .ble_attribute_abstract import BleAttributeAbstract
class BleRemoteAttributeAbstract(BleAttributeAbstract):
def __init__(self, params):
super().__init__(params)
self.isRemote = False
self.discoverdOnRemote = False
@property
def ws_child_uuid_name(self):
children_name... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | obniz/obniz/libs/embeds/ble/ble_remote_attribute_abstract.py | izm51/obniz-python-sdk |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from libvcs.shortcuts import create_repo_from_pip_url
from libvcs.util import run
@pytest.fixture
def tmpdir_repoparent(tmpdir_factory, scope='function'):
"""Return temporary directory for repository c... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/conftest.py | gitter-badger/vcspull |
import requests
import sys
import json
requests.packages.urllib3.disable_warnings()
from requests.packages.urllib3.exceptions import InsecureRequestWarning
SDWAN_IP = "10.10.20.90"
SDWAN_USERNAME = "admin"
SDWAN_PASSWORD = "C1sco12345"
class rest_api_lib:
def __init__(self, vmanage_ip, username, password):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | app/Http/Controllers/Dashboard/Wan_edge_Health.py | victornguyen98/luanvan2020 |
from flask import render_template
import app.charts as charts
from . import app
@app.route("/")
def search():
return render_template('search.html', title='Search')
@app.route("/dashboard")
def hello():
_dashboard = charts.dashboard.create_charts()
return render_template('base.html',
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | app/views.py | thumlx12/MirrorTrading |
import datetime
class Swimmer:
class Time:
def __init__(self, name, date, time):
self.name = name
self.time = time
self.date = date
def __str__(self):
if self.time is None:
return "DQ"
time = round(self.time, 2)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | fetch/swimmer.py | Ilikepi739/swim |
from django.dispatch import receiver
from django.db.models.signals import pre_save,post_save
from django.contrib.auth.models import User
from django.contrib.auth.signals import user_logged_out,user_logged_in
from .models import Profile
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | neigh1/signals.py | SteveMitto/neighborhood |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | kubernetes_asyncio/test/test_v2beta1_pods_metric_status.py | PidgeyBE/kubernetes_asyncio |
from flask import render_template, request
from flask.ext.classy import FlaskView
from . import contacts_bluesrprints
class ContactView(FlaskView):
route_base = '/'
def get_context_data(self):
context = {
'info': {
'title': 'Contact - Clean Blog',
'head': '... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | apps/contacts/views.py | tuanquanghpvn/flask-intro |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Particl Core developers
# Copyright (c) 2020 The Falcon Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_particl import ParticlTestFramew... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | test/functional/rpc_part_burn.py | ProjectFalcon/FNC |
"""empty message
Revision ID: 1bef3c3fc7a5
Revises: 11550468b927
Create Date: 2019-11-30 19:49:08.083542
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1bef3c3fc7a5'
down_revision = '11550468b927'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/1bef3c3fc7a5_.py | AnvarGaliullin/LSP |
import os
import sys
sys.path.append(os.path.dirname(__file__))
class AbstractSystemMeter:
"""Common system meter interface for all resource monitorings.
For each system resource to monitor, a wrapper class will be written as subclass of this one. This way we have
a common "interface" for all system resou... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | measure/system/AbstractSystemMeter.py | surfmachine/language-detection |
from random import randint
class Rect:
def __init__(self, x, y, w, h):
self.x1 = x
self.y1 = y
self.width = w
self.height = h
self.x2 = x + w
self.y2 = y + h
def center(self):
center_x = int(self.x1 + (self.width // 2))
center_y = int(self.y1 + (... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | map_objects/rectangle.py | Kehvarl/roguelike_tutorial_2019 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | xlsxwriter/test/comparison/test_chart_combined03.py | timgates42/XlsxWriter |
from dagster import Field, Int, ModeDefinition, execute_pipeline, pipeline, resource, solid
@resource(config=Field(Int, is_required=False))
def a_resource(context):
raise Exception("Bad Resource")
resources = {'BadResource': a_resource}
@solid(required_resource_keys={'BadResource'})
def one(_):
return 1
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | examples/dagster_examples/toys/resources_error.py | JPeer264/dagster-fork |
from fastapi import APIRouter, Depends
from app.db.crud import get_video_captions
from app.db.session import get_db
from app.model import tf_idf
words_router = r = APIRouter()
@r.get("/topics/{topic}/{number_of_words}")
def by_topic(topic: str, number_of_words: int):
most_important_words = tf_idf.run(topic, num... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | backend/app/api/api_v1/routers/words.py | davipaula/learn-with-me |
"""
Command line interface (cli) for aiida_abinit.
Register new commands either via the "console_scripts" entry point or plug them
directly into the 'verdi' command by using AiiDA-specific entry points like
"aiida.cmdline.data" (both in the setup.json file).
"""
import sys
import click
from aiida.cmdline.utils import... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | aiida_abinit/cli.py | gpetretto/aiida-abinit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.