source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import onfido
from onfido.regions import Region
import io
api = onfido.Api("<AN_API_TOKEN>", region=Region.EU)
fake_uuid = "58a9c6d2-8661-4dbd-96dc-b9b9d344a7ce"
def test_upload_photo(requests_mock):
mock_upload = requests_mock.post("https://api.eu.onfido.com/v3.2/live_photos/", json=[])
sample_file = open... | [
{
"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 | tests/test_live_photos.py | onfido/onfido-python |
import unittest
from model import calculator
class PricerTest(unittest.TestCase):
"""This python unit test file is intended to test calculator.py"""
def setUp(self):
"""Method automatically called before each unit test"""
self.params_1 = {"S":100,"K":100,"Vol":0.2,"R":0.05,"T":1}
self.... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | unittest/pricer-unittest.py | AlexMout/OptionPricer |
import numpy as np
import tensorflow as tf
from .module import Module
from .dense import Dense
class Embedding(Module):
def __init__(self, n_embeddings, dim,
embedding_init=None,
trainable=True,
name=None):
self._n_embeddings = n_embeddings
self.... | [
{
"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 | src/schnet/nn/layers/embedding.py | Yidansong/SchNet |
from resource_management import *
from resource_management.core.resources.system import Execute
from resource_management.libraries.script.script import Script
from client import install_flink, config_flink
from resource_management.libraries.functions.check_process_status import check_process_status
class Historyserv... | [
{
"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 | stacks/XIAOMATECH/1.0/services/FLINK/package/scripts/historyserver.py | tvorogme/dataops |
import sys
offset = "\t\t"
woms_keys = {
"title": "title",
"composer": "composer",
"mm_uid": "mm-uid"
}
def assert_and_report(element, one, another):
print(f"{offset} asserting that {element} is {one} ...")
try:
assert one == another
print(f"{offset}\u2713 {one} is {element}!")
... | [
{
"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 | functests/helpers/func_test_helpers.py | jwdashel/woms |
import db_con
class write_db:
def __init__(self):
self.db = db_con.connect_DB()
def write_db(self, sql_query, vals):
self.db.query(sql_query, vals)
self.db.commit()
| [
{
"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 | Web crawler/db_write.py | Alex-NKG/gun-violence-news-data-analysis |
# Copyright 2021 Spencer Phillip Young
#
# 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 app... | [
{
"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 | pyclip/__init__.py | aleasto/pyclip |
# Copyright (c) 2015 Walt Chen
#
# 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
class ParserException(Exception):
pass
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
},... | 3 | cstock/model.py | dwarf-miner/midas |
# sum of elements in given range
import math
def buildSparseTable(arr,n):
for i in range(n):
lookup[i][0]=arr[i]
j=1
for j in range(1,k+1):
for i in range(n-(1<<j)+1):
lookup[i][j]=lookup[i][j-1]+lookup[i+(1<<(j-1))][j-1]
def SumInRange(L,R):
ans=0
for j in range... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | Practice/Sparse Table Query_3.py | rajansh87/Algorithms-Implementations |
import time
import pytest
from tools import utils, constants
PARAMS = ['--connections', '500']
# TODO parameterize test
@pytest.mark.baker
@pytest.mark.multinode
@pytest.mark.slow
@pytest.mark.incremental
class TestManyBakers:
"""Run 5 bakers and num nodes, wait and check logs"""
def test_init(self, sandb... | [
{
"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": true... | 3 | tests_python/tests/test_many_bakers.py | noclouds/tezos-master |
#####################
### Dependencies ###
#####################
from flask import Flask, request, render_template, redirect
################
### Globals ###
################
app = Flask(__name__)
# Constants
DebugMode = "DEBUG"
ReleaseMode = "RELEASE"
admin_username = "admin"
admin_password = "admin"
staff_usernam... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | DevShelterCareApp/flask_app.py | Hack4Eugene/hiv-alliance-sheltercare-quack-for-a-cause-2019 |
from django.contrib.auth.models import User
from pytest import mark
from rest_framework.test import APIClient
from rest_framework_api_key.models import APIKey
@mark.usefixtures("authorization_required")
def test_anonymous_client_cannot_access_api_without_api_key():
api_client = APIClient()
response = api_clie... | [
{
"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 | geo_search/tests/test_permissions.py | City-of-Helsinki/geo-search |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, unicode_literals
from exmail.client.api.base import EmailBaseAPI
class Department(EmailBaseAPI):
def create(self, department_data):
'''
创建部门
:param department_data: 创建部门所需数据
:return:
'''
return self._... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | exmail/client/api/department.py | ni-ning/exmail-sdk |
import json
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from azorean.core.model import Model
from PIL import Image
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.layer1 = nn.Sequential(
nn.Conv2d(1, 16, kernel_size=5, paddi... | [
{
"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 | src/score/score.py | hangzh-msft/MLOpsDatabricks |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from jsngram.users import models as user_models
from jsngram.images import models as image_models
class Notification(image_models.TimeStampedModel):
TYPE_CHOICES = (
('like', 'Like'), # 첫 번째는 데이터베이스를 위해, 두 번째는 어드민 ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | jsngram/notifications/models.py | jjh0106/jsngram |
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random
image = Image.open("../../res/images/man.jpg")
w, h = image.size
image.thumbnail((w // 2, h // 2))
image.save("../res/images/thumbMan.jpg", 'jpeg')
image2 = image.filter(ImageFilter.BLUR)
image2.save("../res/images/blurImage.jpg", 'jpeg')
# 随机字母... | [
{
"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 | code/fs/img.py | zhangsucheng/Python-pracive |
import requests
api_url = 'https://api.pitcher.com'
pitcher_file_categories = ['presentation', 'zip', 'interface']
def request(method, url, token=None, **kwargs):
return getattr(requests, method)(
api_url + url,
headers={
'Authorization': 'Token %s' % token
} if token else Non... | [
{
"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 | kudu/api.py | torfeld6/kudu |
import os
def iterate_files(directory):
for root, dirs, filenames in os.walk(directory):
for filename in filenames:
if _is_log_file(filename):
yield os.path.join(root, filename)
def _is_log_file(filename):
basename, extension = os.path.splitext(filename)
return ((exte... | [
{
"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 | chat_unifier/file_iterators/trillian_xml.py | mtlynch/chat_unifier |
from controller import get_logger
START = "startMessage"
class Parser:
logger = get_logger("Parser")
def __init__(self):
self._data = None
def parse(self, data):
self.logger.debug("Parsing data: \"%s\"", data)
if data.startswith(START):
self._data = data
... | [
{
"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 | social/parser.py | RegadorAutomaticoConsciente/RACAP |
import numpy as np
from gym import utils
from gym_env_mujoco150 import mujoco_env
import mujoco_py
class Walker2dEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, "walker2d_150.xml", 4)
utils.EzPickle.__init__(self)
def _step(self, a):
... | [
{
"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 | gym_env_mujoco150/walker2d.py | pfnet/gym-env-mujoco150 |
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..models.contact_address import ContactAddress
from ..types import UNSET, Unset
T = TypeVar("T", bound="UpdateContactAddressResponse200")
@attr.s(auto_attribs=True)
class UpdateContactAddressResponse200:
"""
Attributes:
objec... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | sevdesk/client/models/update_contact_address_response_200.py | HpLightcorner/SevDesk-Python-Client |
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from scipy.spatial import distance
import random
def euc(a, b):
return distance.euclidean(a, b)
# random classifier
class ScrappyRandom:
def fit(self, x_train, y_train):
self.... | [
{
"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 | learn_anaconda/learn_ml/ep5.py | yehonadav/yonadav_tutorials |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Copyright (c) 2018 by SN Systems Ltd., Sony Interactive Entertainment Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | [
{
"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 | dex/dextIR/CommandListIR.py | jmorse/dexter |
#! /usr/bin/env python3
from tinkoff.cloud.tts.v1 import tts_pb2_grpc, tts_pb2
from auth import authorization_metadata
from audio import audio_open_write
from common import (
BaseSynthesisParser,
make_channel,
build_synthesis_request,
)
def synthesize():
args = BaseSynthesisParser().parse_args()
if... | [
{
"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 | audio/python/synthesize_stream.py | oleges1/tinkoff_bot |
# -*- coding: utf-8 -*-
from django.apps import apps
from django.test import TestCase
# from django.core.management import call_command
from django_extensions.management.commands.sqldiff import SqliteSQLDiff, Command
class SqlDiffTests(TestCase):
def _include_proxy_models_testing(self, should_include_proxy_model... | [
{
"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": true... | 3 | tests/test_sqldiff.py | behconsci/django-extensions |
from R_ev3dev.peripheral import BackgroundPeripheralCommand, PeripheralAction
from R_ev3dev.interpreter import Command
from R_ev3dev.ev3 import ev3dev2
class ListMotors(Command):
""" list all motors """
def invoke(self, interpreter_context, args):
return [{'driver_name': m.driver_name, 'address': m.ad... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | R_ev3dev/motor/motor.py | thomasvolk/R_ev3dev |
###
### Copyright (C) 2018-2020 Intel Corporation
###
### SPDX-License-Identifier: BSD-3-Clause
###
from ....lib import *
from ....lib.gstreamer.msdk.util import *
from ....lib.gstreamer.msdk.decoder import DecoderTest
spec = load_test_spec("av1", "decode", "8bit")
@slash.requires(*platform.have_caps("decode", "av1_... | [
{
"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 | test/gst-msdk/decode/av1.py | Bin-CI/vaapi-fits |
from utilities.models import ConnectionInfo
from ucscsdk.ucschandle import UcscHandle
from ucsmsdk.ucshandle import UcsHandle
conn, _ = ConnectionInfo.objects.get_or_create(name='Cisco UCS')
try:
handle = UcscHandle(conn.ip, conn.username, conn.password, conn.port)
except Exception:
# not a UCS central serve... | [
{
"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 | blueprints/cisco/sync.py | hciudad/cloudbolt-forge |
from __future__ import absolute_import
from functools import wraps
from django.core.urlresolvers import reverse
from social_auth.backends import get_backend
from social_auth.exceptions import WrongBackend
def dsa_view(redirect_name=None):
"""Decorate djangos-social-auth views. Will check and retrieve backend
... | [
{
"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/social_auth/decorators.py | AlexWayfer/sentry |
from taichi.core import tc_core
from taichi.tools.transform import Transform
from taichi.misc.util import *
import traceback
current_transform = [tc_core.Matrix4(1.0)]
class TransformScope:
def __init__(self, transform=None, translate=None, rotation=None, scale=None):
self.transform = Transform(transform... | [
{
"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 | python/taichi/scoping/transform_scope.py | willFederer/taichi |
class User:
'''
Class that generates new Usernames and passwords
'''
pass
users_list=[]
def __init__(self,name,password):
'''
A function to create username and password
'''
self.name = name
self.password= password
def save_user(self):
'''
... | [
{
"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 | user.py | BrianTinega/password-locker |
"""
Problem:
The function 'doubler' takes a word as input.
It should create and print
a string, where each character in the string is doubled, for example:
"test" -> "tteesstt"
Tests:
>>> doubler("test")
tteesstt
>>> doubler("original")
oorriiggiinnaall
>>> doubler("hihihi")
hhiihhi... | [
{
"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 | p03.2/double_letters.py | LukeBriggsDev/GCSE-Code-Tasks |
from django.db import models
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager,
PermissionsMixin)
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Create and save a new user"""
if no... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | app/core/models.py | jonatan-parra/recipe-app-api |
from cleanser import Cleanser
def test_spaces():
text = "I have some extra spaces. "
expected = "I have some extra spaces."
assert Cleanser(text).whitespaces().text == expected
def test_tabs():
text = "I have a tab or two in me."
expected = "I have a tab or two in me."
... | [
{
"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 | tests/core/generic/test_whitespaces.py | mholtzscher/cleanser |
import requests
from django.contrib.auth import get_user_model
from .conf import conf
from .links import ACCESS_TOKEN_URL, PROFILE_DATA_URL
User = get_user_model()
class GithubOAuthentication(object):
def authenticate(self, code):
payload = {'code': code, 'client_id': conf.CLIENT_ID, 'client_secret': ... | [
{
"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 | github_oauth/authentication.py | allangoncalves/django-github-oauth |
from gatekeeping.db import get_db
from flask import abort
def get_exchange_rates():
return get_db().execute(
'SELECT * FROM exchange_rate'
).fetchall()
def get_exchange_rate(id):
exchange_rate = get_db().execute(
'SELECT *'
' FROM exchange_rate '
' WHERE id = ?',
... | [
{
"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 | web/gatekeeping/api/exchange_rate.py | gabegm/Headcount-Planning-Management-System |
import turtle
WIDTH = 15
BRANCH_LENGTH = 120
ROTATION_LENGTH = 27
class Tree_Fractal(turtle.Turtle):
def __init__(self, level):
super(Tree_Fractal, self).__init__()
self.level = level
self.hideturtle()
self.speed('fastest')
self.left(90)
self.width(WIDTH)
s... | [
{
"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 | Exercices/test1.py | FredC94/MOOC-Python3 |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from dc.generated import dclegacy_pb2
class P2PBaseObserver(object):
def __init__(self):
pass
@staticmethod
def _validate_message(message: dclega... | [
{
"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 | src/dc/core/p2p/p2pObserver.py | dc-blockchain/dc-core |
import nltk
class LearningDictionary():
def __init__(self, sentence):
self.words = nltk.word_tokenize(sentence)
self.tagged = nltk.pos_tag(self.words)
self.buildDictionary()
self.buildReverseDictionary()
def buildDictionary(self):
self.dictionary = {}
for (word,... | [
{
"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 | Section03/Dictionary.py | fosterleejoe/Developing-NLP-Applications-Using-NLTK-in-Python |
import twilltestlib
import twill
from twill import namespaces, commands
from twill.errors import TwillAssertionError
from mechanize import BrowserStateError
def setup_module():
global url
url = twilltestlib.get_url()
def test_select_multiple():
namespaces.new_local_dict()
twill.commands.reset_browser(... | [
{
"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 | tests/test-checkbox.py | JonathanRRogers/twill |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/EXT/draw_range_elements.py | ShujaKhalid/deep-rl |
import hashlib
import getpass
import sqlite3
import new_user
def register():
App = new_user.NewUser()
App.run()
def login():
username = input("Enter username: ")
pwd = getpass.getpass("Enter password: ")
auth = pwd.encode()
auth_hash = hashlib.md5(auth).hexdigest()
# connect to local sqli... | [
{
"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 | local-shell/login_system.py | dpe22/health-application |
from django import forms
from django import template
from django.template.loader import render_to_string
register = template.Library()
@register.filter
def semanticui_form(form):
return render_to_string('semanticui/form.html', {'form': form})
@register.filter
def semanticui_field(field):
return render_to_s... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | semanticuiform/templatetags/semanticui.py | saeed617/django-semanticui-form |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...chart import Chart
class TestInitialisation(unittest.Test... | [
{
"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 | xlsxwriter/test/chart/test_initialisation.py | Rippling/XlsxWriter-1 |
from django.db.models import CharField, BooleanField, TextField
from apps.vadmin.op_drf.models import CoreModel
class CeleryLog(CoreModel):
name = CharField(max_length=256, verbose_name='任务名称', help_text='任务名称')
func_name = CharField(max_length=256, verbose_name='执行函数名称', help_text='执行函数名称')
kwargs = Tex... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | dvadmin-backend/apps/vadmin/system/models/celery_log.py | yuanlaimantou/vue-django-admin |
# qubit number=4
# total number=41
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += CNOT(0,3) # number=13
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | benchmark/startPyquil3077.py | UCLA-SEAL/QDiff |
import numpy
import wave
class Audiostream(object):
def __init__(self, volume_prio=1):
self.volume_prio = volume_prio
def get_data(self, frame_count, channels, width, rate):
return "".join(["\x00"]*frames*self.channels*self.width)
def get_volume_priority(self)... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | audiostream.py | ITNano/soundserver |
import sys
import time
import scrapy
import json
class DctSpider(scrapy.Spider):
name = 'dct_crawler'
dapil_id = '4782' # ID Dapil Cianjur 2
current_ts = round(time.time() * 1000)
start_urls = ['https://infopemilu.kpu.go.id/pileg2019/pencalonan/pengajuan-calon/' + \
str(dapil_id) + '/calonDct.... | [
{
"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 | kpurawler.py | rendybjunior/kpurawler |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict
from refinery.lib.structures import MemoryFile
from refinery.lib import xml
from refinery.units.sinks.ppxml import ppxml
from refinery.units.formats import PathExtractorUnit, UnpackResult
class xtxml(PathExtractorUnit):
... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | refinery/units/formats/xml.py | bronxc/refinery |
from asyncio import iscoroutinefunction
from types import MethodType
from typing import Any
__all__ = ("VirtualStep",)
class VirtualStep:
def __init__(self, orig_step: MethodType) -> None:
self._orig_step: MethodType = orig_step
@property
def name(self) -> str:
return self._orig_step.__n... | [
{
"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 | vedro/_core/_virtual_step.py | nikitanovosibirsk/vedro |
from django.apps import apps
from organizational_area.models import OrganizationalStructure
from uni_ticket.utils import user_is_in_default_office
def chat_operator(user, structure_slug):
if not structure_slug: return False
if not user: return False
structure = OrganizationalStructure.objects.filter(slug... | [
{
"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 | chat/utils.py | libremente/uniTicket |
import csv
import re
def main():
run = True
I_NUMBERS = 0
STUDENT_NAME = 1
path = 'E:/GitHub/2021-cs111-programming-with-functions/w09-text-files/teach-/students.csv'
students = get_dictionary(path, I_NUMBERS, STUDENT_NAME)
while run:
print()
number_student = input('Please enter an I-Number (xx-xxx-xxxx): ... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | w09-text-files/teach-search-student-number/students.py | carloswm85/2021-cs111-programming-with-functions |
"""
Contains functions related to calculations important for characterizing molecule structure.
"""
import numpy as np
def calculate_distance(rA, rB):
"""
This function calculates the distance between two points given as numpy arrays.
Parameters
----------
rA, rB : np.adarray
The coordina... | [
{
"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 | molecool/measure.py | cadalyjr/molecool |
import unittest
from typing import Any, Dict, List, Tuple
import spacy
from replacy import ReplaceMatcher
from replacy.db import get_match_dict
class MatchDictTestHelper(unittest.TestCase):
@staticmethod
def generate_cases(match_dict: Dict[str, Any]) -> Tuple[List[Tuple[str, str]], List[Tuple[str, str]]]:
... | [
{
"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 | replacy/test_helper.py | writerai/replaCy |
from xsdata.codegen.handlers import AttributeEffectiveChoiceHandler
from xsdata.codegen.models import Restrictions
from xsdata.utils.testing import AttrFactory
from xsdata.utils.testing import ClassFactory
from xsdata.utils.testing import FactoryTestCase
class AttributeEffectiveChoiceHandlerTests(FactoryTestCase):
... | [
{
"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": false... | 3 | tests/codegen/handlers/test_attribute_effect_choice.py | pashashocky/xsdata |
from flask import Flask
from flask_login import LoginManager
from little_notes.ext.db.models import User
from .main import blueprint
login_manager = LoginManager()
def init_app(app: Flask):
login_manager.init_app(app=app)
login_manager.login_view = "auth.login"
@login_manager.user_loader
def load_... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | little_notes/ext/auth/__init__.py | GabrielIFPB/little-notes |
# -*- coding: utf-8 -
"""
自定义的MySQL 的Column,为了支持MySQL不支持的复杂类型
Reference: https://yiyibooks.cn/wizard/sqlalchemy_11/orm_extensions_mutable.html
"""
from __future__ import unicode_literals
from sqlalchemy.types import TypeDecorator, VARCHAR
from sqlalchemy.ext.mutable import Mutable
import json
class JSONEncodedDict(... | [
{
"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 | books/common/db_utils/columns.py | jhgdike/books |
#!/usr/bin/env python
'''
Copyright 2021 Joāo Ferreira Nunes
This script is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version... | [
{
"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 | getMitoLength.py | ClaudiaPaetzold/MitoHiFi |
import unittest
from conans.server.crypto.jwt.jwt_credentials_manager import JWTCredentialsManager
from conans.server.crypto.jwt.jwt_manager import JWTManager
from datetime import timedelta
import time
import jwt
from jwt import DecodeError
class JwtTest(unittest.TestCase):
def setUp(self):
unittest.Test... | [
{
"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 | conans/test/server/crypto/jwt_test.py | datalogics-kam/conan |
# -*- coding: utf-8 -*-
__author__ = 'bars'
from io import StringIO
import pandas as pd
from collections import defaultdict
class Bed:
"""description"""
def __init__(self, bed_file, mode='file'):
self.bed_file = bed_file
self.mode = mode
def get_header(self):
lines_to_skip = 0
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | dove/utils/bed.py | barslmn/dove |
import numpy as np
import scipy.stats as stats
class Classifier:
# Class Variables
_n_class = _p_m_s = None
# Constructor
def __init__(self, col_1, col_2, n_class):
self._init_var(col_1, col_2, n_class)
# Methods
def _init_var(self, col_1, col_2, n_class):
self.... | [
{
"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 | bayes_rule_classifier.py | sundogu/ML-Bayes-Rule-Classification |
from checkov.common.models.consts import ANY_VALUE
from checkov.common.models.enums import CheckCategories
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
class CloudfrontDistributionEnabled(BaseResourceValueCheck):
def __init__(self):
name = "Ensure Cloudfr... | [
{
"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 | checkov/terraform/checks/resource/aws/CloudfrontDistributionEnabled.py | pmalkki/checkov |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley NV
#
# 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 l... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/rogerthat/restapi/build_api/to.py | goubertbrent/oca-backend |
"""Multiple Correspondence Analysis (MCA)"""
import numpy as np
from sklearn import utils
from . import ca
from . import one_hot
class MCA(ca.CA):
def fit(self, X, y=None):
if self.check_input:
utils.check_array(X, dtype=[str, np.number])
n_initial_columns = X.shape[1]... | [
{
"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 | light_famd/mca.py | marlon27/Light_FAMD |
import random
class PseudoSensor():
"""
init_val:
max_val:
min_val:
max_delta: maximum number of value that is incremented or decremented.
max_steps: maximum times that the value is incremented or decremented.
init_sign: direction to up or down.
"""
def __init__(self, init_val=20, m... | [
{
"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 | PseudoSensor.py | tanupoo/pseudo_sensor |
#!/bin/usr/pyhton3
"""Test Review"""
import unittest
from models.base_model import BaseModel
from models.review import Review
class TestReview(unittest.TestCase):
"""Test review"""
def test_class(self):
"""Test class"""
self.assertEqual(Review.place_id, "")
self.assertEqual(Review.us... | [
{
"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 | tests/test_models/test_review.py | jblanco75/AirBnB_clone |
try:
from .._torch_blade._mlir import *
_is_available = True
except ImportError as e:
# MLIR support is disable
_is_available = False
import contextlib
from torch_blade import utils
from torch_blade.config import OptPipelines
from torch_blade.mlir.disc_engine_conversion import (
_optimize_mlir,
... | [
{
"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 | pytorch_blade/torch_blade/mlir/__init__.py | zhiqwang/BladeDISC |
# Copyright 2021 Jacob Baumbach
#
# 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 writin... | [
{
"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 | src/adorn/exception/configuration_error.py | pyadorn/adorn |
from flask import Flask, jsonify, request
from flask_jwt_simple import JWTManager, jwt_required, create_jwt
app = Flask(__name__)
app.config['JWT_SECRET_KEY'] = 'super-secret' # Change this!
jwt = JWTManager(app)
# Using the expired_token_loader decorator, we will now call
# this function whenever an expired but o... | [
{
"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 | examples/change_behaviors.py | sanjaymsh/flask-jwt-simple |
"""
makes python operators of Attribute instances use the attribute value.
the reasoning was to make attribute access less verbose and making all Attribute
operators useful.
NOT USED BECAUSE:
- can already be done using the attr value and python zen says:
There should be one-- and preferably only one --obvious way t... | [
{
"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 | sandbox/maya_attribute_operators.py | parzival-roethlein/mapya |
import json
import os
from json.decoder import JSONDecodeError
from best_buy_bullet_bot.data import SHARED_DIR
COOKIES_DIR = os.path.join(SHARED_DIR, "login_cookies.json")
def save_cookies(driver):
with open(COOKIES_DIR, "w+") as f:
json.dump(driver.get_cookies(), f)
def load_cookies(driver):
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 | best_buy_bullet_bot/data/browser_login.py | LeonShams/BestBuyBulletBot |
# Copyright 2021 The Blqs Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
{
"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 | blqs/blqs/iterable_test.py | ionq/blqs |
from flask_restful import Resource
from flask import request
from models.notes import NotesModel
from models.tickets import TicketModel
from utils.authorizations import pm_level_required
from schemas.notes import NotesSchema
from flask_jwt_extended import get_jwt_identity
class Notes(Resource):
@pm_level_required... | [
{
"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 | resources/notes.py | whiletrace/dwellinglybackend |
from flask import Flask, send_from_directory
import os
import connexion
from connexion.resolver import RestyResolver
from flask_socketio import SocketIO, send, emit
# Constants
STATIC_FILES_DIR = 'static'
# The application server
app = connexion.FlaskApp(__name__, specification_dir='swagger/', resolver=RestyResolver(... | [
{
"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 | VrDemoServer/server.py | svdh2/SerceerVrDemo |
from shapely.geometry import Polygon
class GeographyBase:
def __init__(self, level : str , coordinates : list, validate : bool):
self.level = level
p = Polygon(coordinates)
if validate:
if not isinstance(coordinates, list):
raise TypeError("Coordinates must be a l... | [
{
"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 | Droit/views/GeographyBase.py | Halleloya/DBAC |
import openal
from .coordinates_transformer import CoordinatesTransformer
class Source(openal.Source):
def __init__(self, buffer, destroy_buffer, coordinates_divider, coordinate_decimal_places, coordinate_system, origin):
super().__init__(buffer, destroy_buffer)
self._transformer = Coordinate... | [
{
"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": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | app/sound_manager/source.py | tyrylu/feel-the-streets |
from invoke import task
from tasks.common import COMMON_TARGETS_AS_STR, VENV_PREFIX
@task
def flake8(ctx):
"""Check style through flake8"""
ctx.run(f"{VENV_PREFIX} flake8 --config=setup.cfg")
@task
def mypy(ctx):
"""Check style through mypy"""
ctx.run(f"{VENV_PREFIX} mypy")
@task
def black_check(... | [
{
"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 | tasks/style.py | allen91wu/Discord-bot |
from backend.models.postgis.application import Application
from backend.models.postgis.utils import NotFound
from backend.services.users.authentication_service import AuthenticationService
class ApplicationService:
@staticmethod
def create_token(user_id: int) -> Application:
application = Application(... | [
{
"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 | backend/services/application_service.py | majdal/tasking-manager |
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
DATABASE_URL = 'mysql+pymysql://root:@localhost/atcv'
engine = create_engine(DATABASE_URL, convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=Fal... | [
{
"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 | jwtauth/database.py | Katzuno/BACKEND-Automation-Testing-with-Computer-Vision |
# Autogenerated, do not edit. All changes will be undone.
from typing import List
from uuid import UUID
from pyhap.characteristic import (
Characteristic,
CharacteristicPermission,
)
class Name(Characteristic):
@property
def characteristic_uuid(self) -> UUID:
return UUID('00000023-0000-1000-... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | pyhap/characteristics/name.py | drakebrian/pyhap |
""" generate random strings of logic
v2 - randomly adds 'not' before values
TODO: 1. add random parentheses, 2. add expressions like 'i==1' or 'print()' for values
TODO: Make it more explicit as to which True or False value it is evaluating to.
The cycle:
1. Start with a True
a. keep doing 'and Tru... | [
{
"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 | chain_of_logic_advanced.py | rdmunden/logic_chain |
import random
def guess_random_number(tries, start, stop):
number = random.randint(start, stop)
while tries != 0:
print('Number of tries left: ', tries)
guess = int(input("Guess a number between 1 and 10: "))
tries -= 1
if guess < number:
print('Guess high... | [
{
"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 | week5/workshop5.py | jaycvilla/nucamppython_fundamentals |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# Licensed to Elasticsearch B.V. under one ... | [
{
"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 | it/list_test.py | ankitkala/opensearch-benchmark |
import time
from threading import Thread, Condition
class StingySpendy:
money = 100
cv = Condition()
def stingy(self):
for i in range(1000000):
self.cv.acquire()
self.money += 10
self.cv.notify()
self.cv.release()
print("Stingy Done")
d... | [
{
"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 | condition_variables/stingy_spendy_cond_variable.py | zahedul/multithreadinginpython |
import tensorflow as tf
class RNVP(tf.Module):
"""Affine half (aka Real Non-Volume Preserving) flow (x = z * exp(s) + t),
where a randomly selected half z1 of the dimensions in z are transformed as an
affine function of the other half z2, i.e. scaled by s(z2) and shifted by t(z2).
From "Density estim... | [
{
"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 | tf_mnf/flows/rnvp.py | janosh/mnf-bnn |
import unittest
from pyquilted.builder.details import HeadingDetailsBuilder
from pyquilted.yaml_loader import YamlLoader
class TestBuilderHeadingDetails(unittest.TestCase):
def setUp(self):
with open('test/validations/heading.yml') as f:
self.odata = YamlLoader.ordered_load(f)
def test_de... | [
{
"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": true... | 3 | test/test_builder_details.py | cocoroutine/pyquilted |
from ..P6_string_compression import compress, uncompress
# Testing the compress function
# --------------------------------
def test_compress_empty():
assert compress('') == ''
def test_compress_one_element():
assert compress('a') == 'a'
def test_compressible_3():
assert compress('aaa') == 'a3'
def... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | src/challenges/CtCI/arrays/tests/test_P3_compress.py | Ursidours/pythonic_interviews |
from typing import ClassVar
from dataclasses import dataclass
from resotolib.baseresources import BaseResource
@dataclass(eq=False)
class SomeTestResource(BaseResource):
kind: ClassVar[str] = "some_test_resource"
def delete(self, graph) -> bool:
return False
def test_resource():
r = SomeTestRes... | [
{
"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 | resotolib/test/test_baseresources.py | MrMarvin/cloudkeeper |
import webbrowser as web
def tutorial_hindi() -> None:
"""Watch tutorial on how to use this library on YouTube in Hindi"""
web.open("https://youtu.be/o6WV9zFJg1o")
def tutorial_english() -> None:
"""Watch tutorial on how to use this library on YouTube in English"""
web.open("https://yo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | pywhatkit/wwd.py | apoorvthedude/PyWhatKit |
from sagemaker_rl.coach_launcher import SageMakerCoachPresetLauncher
class MyLauncher(SageMakerCoachPresetLauncher):
def default_preset_name(self):
"""This points to a .py file that configures everything about the RL job.
It can be overridden at runtime by specifying the RLCOACH_PRESET hyperparame... | [
{
"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": true... | 3 | reinforcement_learning/rl_portfolio_management_coach_customEnv/src/train-coach.py | jerrypeng7773/amazon-sagemaker-examples |
from apscheduler.schedulers.background import BackgroundScheduler
from django_apscheduler.jobstores import DjangoJobStore
from django_apscheduler.jobstores import register_events
from django_apscheduler.models import DjangoJobExecution
scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), "default... | [
{
"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 | scripts/clean_tasks.py | joshand/adaptive-policy-sync |
import subprocess
import time
from pathlib import Path
from itertools import chain
from werkzeug.utils import secure_filename
import models
from app import api
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in models.ALLOWED_EXTENSIONS
def get_pictures(filepath):
... | [
{
"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 | controller/file_controller.py | ayanasu-iot/LEDMatrix-WebApi |
import logging
import yaml
from scanapi.config_loader import load_config_file
from scanapi.errors import (
BadConfigurationError,
EmptyConfigFileError,
InvalidKeyError,
InvalidPythonCodeError,
)
from scanapi.exit_code import ExitCode
from scanapi.reporter import Reporter
from scanapi.session import se... | [
{
"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 | scanapi/scan.py | hebertjulio/scanapi |
import pytest
from core.base import BaseProduct
from core.products import TangibleProduct, NoInstanceAccessError
class TestBaseProduct:
def test_class_exists(self):
assert globals().get('BaseProduct') == BaseProduct
def test_base_fails_without_implementing_abstracts(self):
wit... | [
{
"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": true... | 3 | tests/test_base/test_base.py | luckyadogun/tally |
import random
class Matriz_esferica():
def __init__(self, tamanho):
self.tamanho = tamanho
def get_vizinho_esquerda(self, indice_x: int, indice_y: int):
return self.checa_limite_matriz(indice_x), self.checa_limite_matriz(indice_y -1)
def get_vizinho_direita(self, indice_x: int... | [
{
"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 | .history/src/Matriz_esferica_20200707125723.py | eduardodut/Trabalho_final_estatistica_cd |
import os
import pytest
from dotenv import load_dotenv
from tmdb.three import TMDb
load_dotenv()
@pytest.fixture(scope="module")
def tmdb():
api_key = os.getenv("api_key", None)
return TMDb(api_key) if api_key else None
@pytest.fixture(scope="module")
def session_id(tmdb):
username = os.getenv("usern... | [
{
"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 | tests/three/conftest.py | zehengl/ezapi_tmdb |
import pytest
from django.urls import reverse
from webdev.produtos.models import Produto, Categoria
from django.contrib.auth.models import User
# Novo Produto
@pytest.fixture
def resposta_novo_produto(client, db):
usr = User.objects.create_user(username='TestUser', password='MinhaSenha123')
client.login(userna... | [
{
"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 | webdev/produtos/tests/test_produtos_post.py | h-zanetti/jewelry-manager |
class ComplicateNamespace:
@classmethod
def init_with_data(cls, **data):
instance = cls()
for key, value in data.items():
if key in ["id_", "user", "location"]:
setattr(instance, key, value)
return instance
cn = ComplicateNamespace.init_with_data(id... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | KIS_principle_test.py | njw0308/python_clean_code |
import numpy as np
def make_histograms(x, bins=40, interval=[1e-1, 1]):
intervals = np.linspace(interval[0], interval[1], bins)
flat_x = x.reshape((x.shape[0], -1))
hist_x = np.zeros((x.shape[0], bins))
for i in range(1, bins):
mask = flat_x <= intervals[i]
mask = np.logical_and(mask, f... | [
{
"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 | src/event_representations.py | ATTPC/VAE-event-classification |
"""Test the authentication functionality."""
from pytest_mock import MockerFixture
from ceiba.user_authentication import (authenticate_username,
is_user_authenticated)
from .test_mongo_interface import get_database
class MockReply(dict):
"""Mock requests reply.""... | [
{
"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 | tests/test_authentication.py | cffbots/ceiba |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.