source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.contrib.auth.models import User
from .models import Profile
from django.core.mail import send_mail
from django.conf import settings
def createProfile(sender, instance, created, **kwargs):
if created:
... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | users/signals.py | kiman121/mtaani-post |
from socket import socket, AF_INET, SOCK_DGRAM, inet_aton, inet_ntoa
import time
sockets = {}
network = ('127.0.0.1', 12345)
def bytes_to_addr(bytes):
return inet_ntoa(bytes[:4]), int.from_bytes(bytes[4:8], 'big')
def addr_to_bytes(addr):
return inet_aton(addr[0]) + addr[1].to_bytes(4, 'big')
def get_sen... | [
{
"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 | cn_proj/USocket.py | Carl-Rabbit/CS305-CN-Proj |
import importlib
from inspect import isclass
from jeri.core.models import Model
class Application:
def __init__(self, app_name, backend, models):
self.app_name = app_name
self.backend = backend
self.load_models(models)
def load_models(self, models):
if not hasattr(self, '_mo... | [
{
"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 | jeri/core/application/__init__.py | fmorgner/jeri |
from abc import ABC, abstractmethod, abstractclassmethod
class ParserABC(ABC):
def __init__(self, manga):
self._manga = manga
self._page: str = None
self.contents = {}
@abstractclassmethod
def urlparse(cls, url: str)->str:
pass
@abstractmethod
async def parse_info(... | [
{
"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 | getmanga/parsers/abcparser.py | Tynukua/getManga |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author: toddler
import jieba
import re
import os
from collections import Counter
from wordcloud import WordCloud
import matplotlib.pyplot as plt
def cut_analyze(input_file):
"""
:param input_file: 输入带切词分析的文本路径
:return: (list1, list2) list1切词处理后的列表结果, list2输出... | [
{
"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 | nighteen_cpc.py | toddlerya/AnalyzeNPC |
import warnings
import requests
from requests import RequestException
from requests.auth import HTTPProxyAuth
from elastalert.alerts import Alerter
from elastalert.util import EAException, elastalert_logger
class ChatworkAlerter(Alerter):
""" Creates a Chatwork room message for each alert """
required_optio... | [
{
"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 | elastalert/alerters/chatwork.py | vbisserie/elastalert2 |
# local imports
from . import nxadapter
from . import community
from _NetworKit import ParallelPartitionCoarsening
# external imports
import networkx
def save(name, dir="."):
""" Save a figure """
savefig(os.path.join(dir, "{0}.pdf".format(name)), bbox_inches="tight", transparent=True)
def coloringToColorList(G, ... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | networkit/viztasks.py | maxvogel/NetworKit-mirror2 |
from hms_workflow_platform.core.queries.base.base_query import *
class PractitionerScheduleQuery(BaseQuery):
def __init__(self, site):
super().__init__()
self.adapter = self.get_adapter(site)
self.query = self.adapter.query
def practitioner_schedule_create(self, date):
return ... | [
{
"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 | dags/emr/core/queries/tc/practitioner_schedule_query.py | superoutput/airflow-data-analytics |
class Interaction:
def __init__(self, _id, userid, slide_id, result, student_response, time, type, weighting):
self.id = _id
self.userid = userid
self.slide_id = slide_id
self.result = result
self.student_response = student_response
self.time = time
self.typ... | [
{
"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/models/interaction.py | appkabob/moodle_py |
import pprint
class VariableDict(dict):
def __init__(self):
super(VariableDict, self).__init__()
def __setitem__(self, key, value):
# print("你赋值了一个屑变量 %s=%s"%(key,value))
self.__dict__[key]=value
def __getitem__(self, item):
if item not in self.__dict__:
raise... | [
{
"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 | restart/DataStructure/VariableDict.py | yujiecong/yjcL |
from django.db import models
from livesettings import config_value_safe
def shipping_choices():
try:
return config_choice_values('SHIPPING','MODULES')
except SettingNotSet:
return ()
class ShippingChoiceCharField(models.CharField):
def __init__(self, choices="__DYNAMIC__", *args,... | [
{
"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 | satchmo/apps/shipping/fields.py | jtslade/satchmo-svn |
# from https://github.com/python-discord/bot/blob/main/bot/utils/extensions.py to import all extentions
import importlib
import inspect
import pkgutil
from typing import Iterator, NoReturn
import cogs
def unqualify(name: str) -> str:
"""Return an unqualified name given a qualified module/package `name`."""
r... | [
{
"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 | src/Load_stuff/load_exts.py | SuperGamer365/Project_aera |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.interface.get import get_interface_mac_address
class TestGetInterfaceMacAddress(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
R1_xe:
connections:
... | [
{
"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 | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/interface/get/get_interface_mac_address/test_api_get_interface_mac_address.py | CiscoTestAutomation/genielibs |
import json
from sawtooth_lisp.lisp import LISP_NAMESPACE
from lisp_test.lisp_message_factory import LispMessageFactory
from sawtooth_integration.tests.integration_tools import RestClient
class LispClient(RestClient):
def __init__(self, url):
super().__init__(url, LISP_NAMESPACE)
self.factory = L... | [
{
"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 | integration/sawtooth_integration/tests/lisp_client.py | nickdrozd/sawtooth-lisp |
#
# @lc app=leetcode.cn id=543 lang=python3
#
# [543] 二叉树的直径
#
# @lc code=start
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
... | [
{
"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 | LeetCode/daily/543.二叉树的直径.py | xmmmmmovo/MyAlgorithmSolutions |
import codecs
import logging
import pickle
from chemdner_corpus import ChemdnerCorpus
class GproCorpus(ChemdnerCorpus):
"""Chemdner GPRO corpus from BioCreative V"""
def __init__(self, corpusdir, **kwargs):
super(GproCorpus, self).__init__(corpusdir, **kwargs)
self.subtypes = ["NESTED", "IDEN... | [
{
"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 | Scripts/reader/gpro_corpus.py | lasigeBioTM/ULISBOA-at-SemEval-2017 |
"""
Test module for NotFollowerTwFriend model
"""
from django.test import TestCase
from ..models import NotFollowerTwFriend
# Create your tests here.
class NotFollowerTwFriendTestCase(TestCase):
"""
Test class for NotFollowerTwFriend model
"""
def setUp(self):
NotFollowerTwFriend.objects.creat... | [
{
"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 | api/tests/test_models.py | SP-Vita-Tolstikova/avt_checktwfriends |
# Created by: Aditya Dua
# 25 July, 2017
"""
This module contains all common helpful methods used in testing toolbox functionality
"""
import numpy as np
import numpy.testing as npt
def matrix_mismatch_string_builder(rec_mat, exp_mat):
expected_mat_str = np.array2string(np.asarray(exp_mat))
received_mat_str =... | [
{
"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 | robopy/tests/test_common.py | rodosha98/FRPGitHomework |
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
from PIL import Image
Image.MAX_IMAGE_PIXELS = None
from data import get_train_transform, get_test_transform
class CustomDataset(Dataset):
img_aug = True
imgs = []
transform = None
def __init__(self, label_file, image_s... | [
{
"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 | src/data/dataset.py | zmcx16/ReclassifyAnimeCG |
a, b = map(int, input().split())
def primeFactors(n):
primes = []
while n % 2 == 0:
primes.append(2)
n //= 2
for i in range(3, int(n**0.5+1), 2):
while n % i == 0:
primes.append(i)
n //= i
if n > 2:
primes.append(n)
return primes
def fa... | [
{
"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 | DMOJ/DMOPC/DMOPC_19_C6P2_Grade_10_Math.py | Togohogo1/pg |
def set_phrase():
phrase = input('What phrase would you like to hang? ')
template = ['_'] * len(phrase)
space = ' '
indicies = get_index(space, phrase)
template = update(space, indicies, template)
return phrase, template
def get_index(char, phrase):
# return list of index values of ch... | [
{
"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 | hangman/arthur.py | probinso/Intro-to-Python |
from typing import Union, List, Tuple
import subprocess
from multiprocessing import Pool
import os
from pathlib import Path
from datetime import datetime
class Job:
def __init__(self,
command: Union[str, List[str]],
working_directory: Union[str, Path, None],
id: ... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | MhcVizPipe/Tools/jobs.py | kevinkovalchik/MhcVizPipe |
import asyncio
import logging
import sys
from rsocket.extensions.helpers import route, composite, authenticate_simple
from rsocket.extensions.mimetypes import WellKnownMimeTypes
from rsocket.payload import Payload
from rsocket.request_handler import BaseRequestHandler
from rsocket.rsocket_client import RSocketClient
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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | examples/client_reconnect.py | Precognize/rsocket-py |
#! /usr/bin/python3
import sys, os, time
from typing import Tuple, List
def runGenerations(fishes: List[int], generations: int) -> int:
fishCounts = [ 0 ] * 9
for fish in fishes:
fishCounts[fish] += 1
for _ in range(generations):
fishesAtZero = fishCounts[0]
for day in range(8):
... | [
{
"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 | 2021/06/py/run.py | Bigsby/aoc |
# Copyright (C) 2016 Ayan Chakrabarti <ayanc@ttic.edu>
import numpy as np
def trunc(img):
w = img.shape[0]; h = img.shape[1]
w = (w//8)*8
h = (h//8)*8
return img[0:w,0:h,...].copy()
def _clip(img):
return np.maximum(0.,np.minimum(1.,img))
def bayer(img,nstd):
v = np.zeros((img.shape[0],i... | [
{
"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 | run/sensor.py | ayanc/learncfa |
from zope.interface import implements
from twisted.application.service import IServiceMaker
from twisted.application import internet
from twisted.plugin import IPlugin
from twisted.python import usage
from twistedcv import DetectorServerFactory
class Options(usage.Options):
optParameters = [
["port","p",9000,"The... | [
{
"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 | twisted/plugins/detector_plugin.py | dakilasoft/twistedcv |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..odf import MESD
def test_MESD_inputs():
input_map = dict(
args=dict(argstr='%s', ),
bgmask=dict(
argstr='-bgmask %s',
extensions=None,
),
environ=dict(
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},... | 3 | nipype/interfaces/camino/tests/test_auto_MESD.py | vferat/nipype |
from ciscosupportsdk.apisession import ApiSession
SERVICE_BASE_URL = "/software/v4.0"
class AutomatedSoftwareDistributionApi(object):
"""
Cisco Automated Software Distribution service provides software
information and download URLs to assist you in upgrading your
device/application to the latest vers... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | src/ciscosupportsdk/api/asd.py | supermanny81/ciscosupportsdk |
import os
import pygame
from constants import *
from find_data import find_data_file
class Inventory():
def __init__(self):
self.image = pygame.image.load(find_data_file(os.path.join('data', 'images', 'inventory', 'inventory.png'))).convert()
self.rect = self.image.get_rect()
... | [
{
"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 | executable/demo/inventory.py | westgoten/mechanical-apprentice |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2019, Linear Labs Technologies
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
Unles... | [
{
"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": false
}... | 3 | BLOX/Modules/EfficientNetBody.py | linearlabstech/blox |
# This file is part of the standard library of Pycopy project, minimalist
# and lightweight Python implementation.
#
# https://github.com/pfalcon/pycopy
# https://github.com/pfalcon/pycopy-lib
#
# The MIT License (MIT)
#
# Copyright (c) 2019 Paul Sokolovsky
#
# Permission is hereby granted, free of charge, to any perso... | [
{
"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 | byteslib/byteslib.py | MaxTurchin/pycopy-lib |
# encoding: utf-8
import random
from sina.cookies import cookies, init_cookies
from sina.user_agents import agents
class UserAgentMiddleware(object):
""" 换User-Agent """
def process_request(self, request, spider):
agent = random.choice(agents)
request.headers["User-Agent"] = agent
class Coo... | [
{
"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": true
},
{
... | 3 | sina/middlewares.py | xqhjay/WeiboSpider |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import String
from asa_ros_msgs.srv import FindAnchor
class AsaAnchorFindHelper:
def __init__(self):
rospy.init_node("asa_request_helper")
rospy.loginfo("Waiting for asa_ros/find_anchor serivce...")
rospy.Subscriber('spot/asa_ros/reques... | [
{
"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 | spot_tools_core/src/asa/asa_anchor_find_request_helper.py | EricVoll/spot-mr-core |
import bpy
from .... base_types import AnimationNode
from .... algorithms.mesh_generation.cylinder import getCylinderMesh
class CylinderMeshNode(bpy.types.Node, AnimationNode):
bl_idname = "an_CylinderMeshNode"
bl_label = "Cylinder Mesh"
def create(self):
self.newInput("Float", "Radius", "radius",... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | scripts/addons/animation_nodes/nodes/mesh/generation/cylinder.py | Tilapiatsu/blender-custom_conf |
from flask import request
from flask_restful import Resource
from models.category import CategoryModel
from schemas.category import CategorySchema
category_schema = CategorySchema()
category_list_schema = CategorySchema(many=True)
class Category(Resource):
@classmethod
def get(cls, name: str):
cate... | [
{
"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 | paneldata_dash/resources/category.py | clarencejlee/jdp |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
@staticmethod
def init_app(app):
pass
class DevConfig(Config):
DEBUG = True
class TestConfig(Config):
pass
class LiveConfig(Config):
pass
config = {
'dev': DevConfig,
'test': TestConfig,
'live... | [
{
"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 | config.py | olszewskik/Flask-basic-application-template |
"""Illustrate snapshotting a function and restarting it from an
exception handler.
"""
import copy
import logging
import function_checkpointing.save_restore as save_restore
checkpoints = []
def save_checkpoint():
ckpt = save_restore.save_jump()
if ckpt:
checkpoints.append(copy.deepcopy(ckpt))
e... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | examples/in_exception_handler.py | sudomaze/python-checkpointing2 |
from pytest_bdd import scenario, given, when, then, parsers
import contacts
@given("I have a contact book", target_fixture="contactbook")
def contactbook():
return contacts.Application()
@given(parsers.parse("I have a \"{contactname}\" contact"))
def have_a_contact(contactbook, contactname):
contactbook.ad... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | Chapter09/tests/acceptance/steps.py | ibiscum/Crafting-Test-Driven-Software-with-Python |
import asyncio
from loguru import logger
from data import State
from miner import LiteClient, task_benchmark, task_miner, task_statistic_miner
from ws import WebSocketClient
def save_benchmark():
import json
with open('/var/log/gpu_benchmark.json', 'w', encoding='utf-8') as f:
json.dump(... | [
{
"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 | app.py | GRinvest/tonminer |
#!/usr/bin/python3
# part of https://github.com/WolfgangFahl/play-chess-with-a-webcam
from pcwawc.runningstats import RunningStats, ColorStats, MovingAverage
import pytest
from unittest import TestCase
class RunningStatsTest(TestCase):
def test_RunningStats(self):
rs = RunningStats()
rs.push(1... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | tests/test_RunningStats.py | gratuxri/play-chess-with-a-webcam |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import argparse
import llnl.util.tty as tty
import spack.cmd
import spack.repo
description = "revert checked out packag... | [
{
"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 | lib/spack/spack/cmd/restage.py | ttroy50/spack |
# -*- coding: utf-8 -*-
#/*
# * Copyright (c) 2022 Renwei
# *
# * This is a free software; you can redistribute it and/or modify
# * it under the terms of the MIT license. See LICENSE for details.
# */
import string
import sys
import inspect
from ctypes import *
from .dave_dll import dave_dll
davelib = dave_dll()
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | Project/Python/project/public/base/dave_log.py | renwei-release/dave |
"""
Amatino API Python Bindings
Entity Update Arguments
Author: hugh@amatino.io
"""
from amatino.internal.encodable import Encodable
from amatino.internal.entity_create_arguments import NewEntityArguments
from amatino.internal.constrained_string import ConstrainedString
from typing import Optional
class EntityUpdateA... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | amatino/internal/entity_update_arguments.py | Amatino-Code/amatino-python |
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
if is_py2:
from urlparse import urlparse
from urllib import quote
from urlparse import urljoin
import pytz as timezone
from email 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | office365/runtime/compat.py | rikeshtailor/Office365-REST-Python-Client |
class Estimator:
"""Abstract class of an estimator."""
def __init__(self, train, predict):
self.train = train
self.predict = predict
class EstimatorModel:
"""Abstract class of the model of an estimator."""
def __init__(self, weights):
self.weights = weights
| [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | common/estimator.py | gabalz/cvxreg |
from colored import *
import staticconf
"""
You might find the colored documentation very useful:
https://pypi.python.org/pypi/colored
"""
ENABLE_COLORIZER = staticconf.read_string('enable_colorizer', default='false').lower() == 'true'
def colorizer_enabled(function):
"""do not colorize if it's not enabled"""
... | [
{
"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 | colorizer.py | official71/ezmemo |
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from contact_form.forms import ContactForm
def index(request):
return render(request, 'index.html')
def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | contact_form/views.py | smtchahal/django-contact-form |
# pylint: disable=too-few-public-methods, no-member
"""API for scheduling learning rate."""
from .. import symbol as sym
class LRScheduler(object):
"""Base class of a learning rate scheduler.
A scheduler returns a new learning rate based on the number of updates that have
been performed.
Parameters
... | [
{
"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 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/nnvm/python/nnvm/compiler/lr_scheduler.py | mengkai94/training_results_v0.6 |
import datetime
import aiohttp_jinja2
import markdown2
from aiohttp import web
from babel.dates import format_datetime
from app.database.methods.select import get_entity_by_id
from app.handlers.abstract import AbstractView
from app.log import get_logger
from config import Config
log = get_logger()
class UserEntity... | [
{
"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 | src/app/handlers/user/entity.py | roch1990/aiohttp-blog |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_external_documentation.py | reymont/python |
import torch
if torch.cuda.is_available():
import torch_points_kernels.points_cuda as tpcuda
class ChamferFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, xyz1, xyz2):
if not torch.cuda.is_available():
raise NotImplementedError(
"CPU version is not ava... | [
{
"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 | torch_points_kernels/chamfer_dist.py | hzxie/torch-points-kernels |
import serial
import traceback
import time
import decode
class UART:
def __init__(self):
# シリアル通信設定
# ボーレートはラズパイのデフォルト値:115200に設定
try:
self.uartport = serial.Serial(
port="/dev/ttyS0",
baudrate=115200,
bytesize=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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | InfectiousDiseasePrevention_SupportSystem_Kakemizu/program/piRecieve.py | YamashitaTsuyoshi/Graduate-Research-2020 |
import pandas as pd
import numpy as np
def create_subsample(df_var, df_pref, nobj, index):
"""
Create sub-dataframes with the features (alternatives) and target (value in the objective space).
:param df_var:
:param df_pref:
:param nobj:
:param index:
:return:
"""
# C... | [
{
"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 | data_preparation.py | mvoicer/cbic-2021-learning-preferences |
def minimumTotal(triangle):
if not triangle: return 0
res = triangle[-1]
for i in range(len(triangle) -2, -1, -1):
for j in range(len(triangle[i])):
res[j] = min(res[j], res[j+1]) + triangle[i][j]
return res[0]
def minimumTotal1(triangle):
if not triangle:
return 0
... | [
{
"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 | src/python/120Triangle.py | witimlfl/leetcode-exercise |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"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 | aliyun-python-sdk-qualitycheck/aliyunsdkqualitycheck/request/v20190115/ValidateRoleSetRequest.py | sdk-team/aliyun-openapi-python-sdk |
from oeqa.selftest.base import oeSelfTest
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
from oeqa.utils.decorators import testcase
import re
import os
import sys
import logging
class Systemdboot(oeSelfTest):
def _common_setup(self):
"""
Common setup for test cases: 1445, XX... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | meta-yocto-bsp/lib/oeqa/selftest/systemd_boot.py | prakhya/luv_sai |
import komand
from .schema import AppendLineInput, AppendLineOutput, Input, Output, Component
# Custom imports below
class AppendLine(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='append_line',
description=Component.DESCRIPTION,
... | [
{
"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 | google_docs/icon_google_docs/actions/append_line/action.py | killstrelok/insightconnect-plugins |
from enum import Enum
from typing import Optional, Union
import ethicml as em
from ethicml.preprocessing.scaling import ScalerType
from kit import parsable
from kit.torch import TrainingMode
from conduit.fair.data.datamodules.tabular.base import EthicMlDataModule
__all__ = ["HealthDataModule", "HealthSens"]
class ... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 4 | conduit/fair/data/datamodules/tabular/health.py | DavidHurst/palbolts |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
# class declaration
class Element:
"""
The base class for all HTML elements
"""
# public data
tag = None # the element tag, i.e. "div", "p", "table"
attributes = None # a dictionary that maps ... | [
{
"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 | packages/opal/html/Element.py | lijun99/pyre |
# -*- encoding: utf-8 -*-
from django.contrib.syndication.views import Feed
from .models import Article
class AllArticleRssFeed(Feed):
title = '个人博客'
link = '/'
# 需要显示的条目
def items(self):
return Article.objects.all()[:5]
# 显示内容的标题
def item_title(self, item):
return '[%s] %s'... | [
{
"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/feeds.py | sunxr9/django-blog-scrapy |
"""
Bali ModelResource
"""
from .resource import Resource
from ..db.operators import get_filters_expr
from ..schemas import ListRequest
__all__ = ['ModelResource']
class ModelResource(Resource):
"""
`ModelResource` is a fast way to implement resource layer
for model objects
"""
model = None
... | [
{
"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 | bali/resources/model_resource.py | Ed-XCF/bali |
#!/usr/bin/env python3
from .hash_table import HashTable
class QuadraticProbing(HashTable):
"""
Basic Hash Table example with open addressing using Quadratic Probing
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def _colision_resolution(self, key, data=N... | [
{
"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 | data_structures/hashing/quadratic_probing.py | niroshajayasundara/Python |
import numpy as np
from pyrieef.geometry.differentiable_geometry import DifferentiableMap
class LinearTranslation(DifferentiableMap):
"""
Simple linear translation
"""
def __init__(self, p0=np.zeros(2)):
assert isinstance(p0, np.ndarray)
self._p = p0
def forward(self, q):
... | [
{
"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 | lgp/geometry/transform.py | humans-to-robots-motion/lgp |
import sqlite3
import pytest
from gsrest.db.user_db import get_db
def test_get_close_db(app):
with app.app_context():
db = get_db()
assert db is get_db()
with pytest.raises(sqlite3.ProgrammingError) as e:
db.execute('SELECT 1')
assert 'closed' in str(e.value)
def test_init_db_... | [
{
"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 | tests/db/test_user_db.py | dshatz/graphsense-REST |
import time
import logging
from .spotify_client import SpotifyPlaylistClient
from . import config
logger = logging.getLogger(name='spotify_tracker')
class SpotifyWatcherClient(SpotifyPlaylistClient):
def __init__(self):
self.playlist_id = config.get_config_value('watcher_playlist_id')
self.last... | [
{
"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 | spotify_tracker/watcher_client.py | eriktaubeneck/spotifytracker |
from datetime import timedelta
from rest_framework import serializers
from ..models.widget import Widget
class BaseWidgetSerializer(serializers.ModelSerializer):
"""
This is the base serializer class for Widget model.
Other widget serializers must be inherited from it.
"""
class Meta:
m... | [
{
"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 | server/apps/widgets/serializers/widget.py | Sergey-x/SibdevPractice |
import os
EXECUTABLE_PATH_WINDOWS = '/game/bin/win64/dota2.exe'
EXECUTABLE_PATH_LINUX = '/game/dota.sh'
EXECUTABLE_PATH_LINUX = '/game/bin/linuxsteamrt64/dota2'
BOT_PATH = '/game/dota/scripts/vscripts/bots/'
CONSOLE_LOG = '/game/dota/scripts/vscripts/bots/console.log'
SEND_MSG = '/game/dota/scripts/vscripts/bots/IPC_... | [
{
"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 | luafun/game/config.py | Delaunay/LuaFun |
import hw4and5
def test_Sample():
smpl = hw4and5.Sample(0)
assert smpl.oid == 0, "test failed"
def test_Num():
num = hw4and5.Num(0, 'e')
assert num.n == 0, "test failed"
def test_Sym():
sym = hw4and5.Sym(0, 'e')
assert sym.n == 0, "test failed"
def test_Col():
col = hw4and5.Col(0,'e'... | [
{
"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/tests/test_hw4and5.py | andre-motta/sin21 |
from flask_restful import Resource
from api.access_control import login_required
from app import app_main
from constants.constants import BIND_USERS, BIND_MOVIES
def create_test_app(user_db_path, movie_db_path):
test_app = app_main.create_app()
test_app.config.update(
SQLALCHEMY_BINDS={
B... | [
{
"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 | py-backend/test/test_utils.py | smmnloes/MaxMovieRec |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog:
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self.assertEqual... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": f... | 3 | python3/koans/about_monkey_patching.py | Yoshyn/python_koans |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import torch
import onnxruntime_pybind11_state as torch_ort
import os
class OrtEPTests(unittest.TestCase):
def get_test_execution_provider_path(self):
return os.path.join('.', 'libtest_execution_provi... | [
{
"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 | orttraining/orttraining/eager/test/ort_eps_test.py | toothache/onnxruntime |
# -*- coding: utf-8 -*-
"""
Tests that dialects are properly handled during parsing
for all of the parsers defined in parsers.py
"""
import csv
from pandas import DataFrame
from pandas.compat import StringIO
from pandas.errors import ParserWarning
import pandas.util.testing as tm
class DialectTests(object):
... | [
{
"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 | pandas/tests/io/parser/dialect.py | vimalromeo/pandas |
def read_file():
with open('../input/day3_input.txt') as file:
temp = [line.strip() for line in file]
return temp
def puzzle1():
tree_map = read_file()
n = len(tree_map[0])
assert all(len(x) == n for x in tree_map)
index, trees = 0, 0
for line in tree_map:
if line[index] ==... | [
{
"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 | 2020/solutions/day3.py | rsizem2/aoc_2020 |
# -*- coding: utf-8 -*-
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.paths import TMP_STATE_TREE
class PillarModuleTest(ModuleCase):
'''
Validate the pillar module
'''
def test_data(self):
... | [
{
"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 | tests/integration/modules/test_pillar.py | jubrad/salt |
import board
import busio
import time
import random
dotstar = busio.SPI(board.APA102_SCK, board.APA102_MOSI)
#colors = [1, 128, 244] # set colors all to 1
colors = [random.randint(3, 240), random.randint(3, 240), random.randint(3, 240), ] # selects random start color in "safe zone"
steps = [1, 3, 4] # se... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | random_colors.py | electric-blue-green/trinket |
from idom import component, html, use_state
@component
def counter():
count, set_count = use_state(0)
def handle_button(event):
set_count(count + 1)
return html.div(
html.p({"class": "text-white"}, f"The lastest count is {count}"),
html.button({"onClick": handle_button, "class": ... | [
{
"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 | components/counter.py | dyvenia/timeflow_ui |
"""empty message
Revision ID: 270947efbfd8
Revises: 19c82f38f866
Create Date: 2019-03-15 19:15:04.944062
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '270947efbfd8'
down_revision = '19c82f38f866'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/270947efbfd8_.py | CatsAreEvil/box-office-studio |
import numpy as np
from time import sleep
from shutil import rmtree
from cache_decorator import Cache
from .utils import standard_test_arrays
@Cache(
cache_path="{cache_dir}/{_hash}.npz",
cache_dir="./test_cache",
backup=False,
)
def cached_function_single(a):
sleep(2)
return np.array([1, 2, 3])
@... | [
{
"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 | tests/test_npz.py | zommiommy/cache_decorator |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Dpdk(MakefilePackage):
"""DPDK is a set of libraries and drivers for fast packet p... | [
{
"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 | var/spack/repos/builtin/packages/dpdk/package.py | jeanbez/spack |
from jnius import autoclass, JavaException
def _class_call(cls, args: tuple, instantiate: bool):
if not args:
return cls() if instantiate else cls
else:
return cls(*args)
def _browserx_except_cls_call(namespace: str, args: tuple, instantiate: bool):
try:
return _class_call(autocl... | [
{
"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 | kvdroid/jclass/__init__.py | wilsenmuts/Kvdroid |
'''
Base test
'''
def test_index(client):
assert client.get('/').status_code == 302
def test_registration(client):
assert client.post('/registration',
json={"email": "test4@gmail.com", "password": "12345", "name": "PyTest"}).status_code == 200
assert client.post('/registratio... | [
{
"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 | app/tests.py | Sergey-59/magnit_test |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class NewUserForm(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')
def save(self, commit=True... | [
{
"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 | traintravel/forms.py | cntontis/traintravel |
import os
from programy.config.file.factory import ConfigurationFactory
from programy.clients.events.console.config import ConsoleConfiguration
from programytest.config.file.base_file_tests import ConfigurationBaseFileTests
# Hint
# Created the appropriate yaml file, then convert to json and xml using the following ... | [
{
"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 | test/programytest/config/file/test_load_files.py | whackur/chatbot |
import numpy as np
from numpy.core.defchararray import upper
import pandas as pd
from scipy.optimize import minimize
import warnings
from . import utility_functions as utility_functions
import cvxpy as cp
class BaseEstimator:
def __init__(self, tickers) -> None:
self.tickers = tickers
def _get_logret... | [
{
"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 | PortOpt/base_est.py | jingmouren/OptimalPortfolio |
"""
Developer : Naveen Kambham
Description: Unit testing for battery sensor feature extractor code. Majority of the data extraction code has to be tested visually by looking at the plots distributions.
"""
#Importing the required libraries.
import unittest
import numpy as np
from FeatureExtraction import battery_senso... | [
{
"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 | UnitTests/test_battery_sensor_features_extractor.py | naveenkambham/big_five_personality_machine_learning |
import numpy
import os
from src.readers import SimpleBSONReader
def read_train_example(path='../../data/train_example.bson', pca_reduction=True):
read_result = SimpleBSONReader.read_all(path)
pixels = read_result.pixel_matrix
numpy.savetxt("../../out/train_example.csv", pixels, delimiter=",", fmt='%.d')
... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | src/read/read_train_example.py | DSSerialGeneva/cd15c0un7 |
from big_example.Info import Info
from mdsd.item.printto import printto
from mdsd.item_support import adjust_array_sizes_and_variants
from big_example.VersionedData import VersionedData
import io
def test_string_with_print():
i = Info()
i.text1_as_str = 'Hello "Test"'
i.n = 3
adjust_array_sizes_and_va... | [
{
"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 | framework/mdsd_support_library_python/tests/test_print.py | goto40/mdsd |
from pytest import raises
from ..quoted_or_list import quoted_or_list
def test_does_not_accept_an_empty_list():
with raises(StopIteration):
quoted_or_list([])
def test_returns_single_quoted_item():
assert quoted_or_list(["A"]) == '"A"'
def test_returns_two_item_list():
assert quoted_or_list([... | [
{
"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 | graphql/utils/tests/test_quoted_or_list.py | ThanksBoomerang/graphql-core-legacy |
from featuretools import list_primitives
from featuretools.primitives import (
Day,
GreaterThan,
Last,
NumCharacters,
get_aggregation_primitives,
get_transform_primitives
)
from featuretools.primitives.utils import _get_descriptions
def test_list_primitives_order():
df = list_primitives()
... | [
{
"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 | featuretools/tests/utils_tests/test_list_primitives.py | jeffzi/featuretools |
#!/usr/bin/python3
"""This module proccesses an image through YOLO V3 model
using cvlib library and stores and print its output.
Usage:
Function "obj_detect" accepts one argument, call this module like this:
"obj_detect(<img object>)"
"""
from Blob_upload.upload import upload, get_files
from uuid import uuid4
... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | api/objdetwith_blob.py | Seed-Tech/what_do_i_see |
import PIL.Image
from io import BytesIO
from IPython.display import clear_output, Image, display
import numpy as np
def showarray(a, fmt='jpeg'):
a = np.uint8(np.clip(a, 0, 255))
f = BytesIO()
PIL.Image.fromarray(a).save(f, fmt)
display(Image(data=f.getvalue()))
def showtensor(a):
mean = np.arra... | [
{
"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 | chapter9_Computer-Vision/Deep-Dream/util.py | kumi123/pytorch-learning |
from django.http.response import JsonResponse
from django.shortcuts import render
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot.trainers import ListTrainer
import os
import openai
openai.api_key = "OPENAI API KEY"
completion = openai.Completion()
start_chat_log... | [
{
"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 | airbusback/chatbot/views.py | rahulsingh237/Airbus-Aerthon3.0-AirGliders |
# coding=utf-8
# !/usr/bin/python3
from flask import Flask, jsonify, request
from manage.manageProxy import Proxymanager
app = Flask(__name__)
api_list = {
'get': u'get an usable proxy',
'refresh': u'refresh proxy pool',
'get_all': u'get all proxy from proxy pool',
'delete?proxy=127.0.0.1:8080': u'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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | ProxyPools/flask_api/flask_api.py | fst034356/crawler |
from __future__ import division
from leapp.libraries.actor.library import (MIN_AVAIL_BYTES_FOR_BOOT,
check_avail_space_on_boot,
inhibit_upgrade)
from leapp.libraries.common import reporting
from leapp.libraries.common.testutils impor... | [
{
"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 | repos/system_upgrade/el7toel8/actors/checkbootavailspace/tests/unit_test.py | adka1408/leapp-repository |
from datetime import datetime
import requests
class Charges:
"""
The system tracks usage of paid service on an hourly basis.
It doesn't track how much to charge for any particular product, but it will report for each instance,
IP address and snapshot the amount of hours it's in use for.
"""
... | [
{
"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 | civo/charges.py | alejandrojnm/client-python |
from collections import namedtuple
from flask import (
Blueprint,
abort,
current_app,
make_response,
render_template,
request,
)
from shorter.forms.short import ShortCreateForm, ShortDisplayForm
from shorter.models.short import Short
from shorter.start.environment import DELAY_DEF
from shorter... | [
{
"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 | shorter/views/main.py | spookey/shorter |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 22:11:12 2014
@author: spatchcock
"""
import math
import numpy
import matplotlib.pyplot as plt
# Plot the normal distribution function as well as its first and second derivatives
#
# Use the numpy.vectorize function to handle array manupulation
# http://statistics.... | [
{
"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 | normal.py | spatchcock/models |
""" This module provides the unsafe things for targets/numbers.py
"""
from .. import types
from ..extending import intrinsic
from llvmlite import ir
@intrinsic
def viewer(tyctx, val, viewty):
""" Bitcast a scalar 'val' to the given type 'viewty'. """
bits = val.bitwidth
if isinstance(viewty.dtype, types.... | [
{
"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 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/unsafe/numbers.py | BadDevCode/lumberyard |
import urllib.parse
from functools import partial
from astroquery.vizier import Vizier
from ztf_viewer.catalogs.conesearch._base import _BaseCatalogQuery
class GcvsQuery(_BaseCatalogQuery):
id_column = 'GCVS'
type_column = 'VarType'
period_column = 'Period'
_table_ra = 'RAJ2000'
_ra_unit = 'hour... | [
{
"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": false
}... | 3 | ztf_viewer/catalogs/conesearch/gcvs.py | snad-space/ztf-viewer |
import inspect
import ast
from types import FunctionType
import hashlib
from typing import List
import astunparse
from pyminifier import minification
class VerfunException(Exception):
pass
def version_hash_for_function(fn: FunctionType) -> str:
abstract_syntax_tree = ast.parse(inspect.getsource(fn)).body[0... | [
{
"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 | verfun.py | haakondr/verfun |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.