source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from todo.api import get_tasks, create_task, finish_task, delete_task
def test_list_tasks(test_app):
# make sure there are no existing tasks
assert get_tasks() == []
create_task('buy milk')
create_task('buy cookies')
assert len(get_tasks()) == 2
def test_create_task(test_app):
create_task('G... | [
{
"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/test_app.py | samdis/TodoApp |
import requests
import socket
import threading
requests.packages.urllib3.disable_warnings() # noqa
class ScanPort:
def __init__(self, target, start_port=None, end_port=None):
self.target = target
self.from_port = start_port
self.to_port = end_port
self.ports = []
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | webpt/port_scanner.py | cool-RR/webpt |
from typing import Callable
class Solution:
def setZeroes(self, matrix: list[list[int]]) -> None:
"""Do not return anything, modify matrix in-place instead."""
first_column_zero = False
for row in matrix:
for j, cell in enumerate(row):
if cell != 0:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | set_matrix_zeroes.py | tusharsadhwani/leetcode |
class BaseRecordingProvider:
def __init__(self, event):
self.event = event
super().__init__()
def get_recording(self, submission):
"""
Returns a dictionary {"iframe": …, "csp_header": …}
Both the iframe and the csp_header should be strings.
"""
raise Not... | [
{
"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 | src/pretalx/agenda/recording.py | realitygaps/pretalx |
from problems.problem import Problem
def generate_pythagorean_triples(ub: int) -> []:
# https://en.wikipedia.org/wiki/Pythagorean_triple
result = []
for a in range(1, ub):
aa = a * a
b = a + 1
c = b + 1
while c <= ub:
cc = aa + b * b
while c * c < cc:
c += 1
if c * c == ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | ProjectEulerPython/problems/problem_039.py | geo-desic/project-euler |
from django import forms
from django.utils.safestring import mark_safe
from django.conf import settings
import json
class ImgerWidget(forms.Widget):
def __init__(self, attrs=None, **kwargs):
self.imger_settings = attrs['imger_settings']
super(ImgerWidget, self).__init__(**kwargs)
class Media... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | imger/widgets.py | 4shaw/django-imger |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from setuptools import setup, find_packages
def get_version():
filepath = os.path.join(
os.path.dirname(__file__),
"interpro7dw",
"__init__.py"
)
with open(filepath) as fh:
text = fh.read()
m = re.sear... | [
{
"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 | setup.py | matthiasblum/i7dw |
import sys
import numpy as np
import cv2
import time
import argparse
import yolov2tiny
def resize_input(im):
imsz = cv2.resize(im, (416, 416))
imsz = imsz / 255.0
imsz = imsz[:, :, ::-1]
return np.asarray(imsz, dtype=np.float32)
def image_object_detection(in_image, out_image, debug):
frame = cv... | [
{
"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 | proj4/src/__init__.py | hsyis/object-detection-yolo2-tiny |
import os
import mitogen
import mitogen.lxc
try:
any
except NameError:
from mitogen.core import any
import unittest2
import testlib
def has_subseq(seq, subseq):
return any(seq[x:x+len(subseq)] == subseq for x in range(0, len(seq)))
class ConstructorTest(testlib.RouterMixin, testlib.TestCase):
lx... | [
{
"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 | tests/lxc_test.py | webcoast-dk/mitogen |
from prettytable import PrettyTable
class StackTable(PrettyTable):
def __init__(self, multicloud_stack):
super().__init__()
self.field_names = ["Attribute", "Value"]
self.align["Attribute"] = "r"
self.align["Value"] = "l"
self.add_row(["Name", multicloud_stack.stack_name... | [
{
"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 | src/heatspreader/shell/views.py | acticloud/heat-spreader |
import re
with open('input.txt') as file:
CMDS = []
for line in file:
cmd, v = line.strip().split(' ')
CMDS.append((cmd, int(v)))
def go(cmds):
visited = []
acc = 0
index = 0
while True:
if index in visited:
return acc
visited.append(index)
... | [
{
"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 | 2020/Day 8/8.py | Brollof/Advent-of-Code |
from typing import Any, Dict, Optional, Union
from sqlalchemy.orm import Session
from app.core.security import get_password_hash, verify_password
from app.crud.base import CRUDBase
from app.models.user import User
from app.schemas.user import UserCreate, UserUpdate
class CRUDUser(CRUDBase[User, UserCreate, UserUpda... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | backend/app/crud/crud_user.py | ralphribeiro/debito_automatico |
### This gears will pre-compute (encode) all sentences using BERT tokenizer for QA
tokenizer = None
def loadTokeniser():
global tokenizer
from transformers import BertTokenizerFast
tokenizer = BertTokenizerFast.from_pretrained("bert-large-uncased-whole-word-masking-finetuned-squad")
# tokenizer = Aut... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | the-pattern-api/qasearch/tokeniser_gears_redisai.py | redis-developer/the-pattern |
"""
Module: 'math' on esp32 1.10.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.10.0', version='v1.10 on 2019-01-25', machine='ESP32 module with ESP32')
# Stubber: 1.3.2
def acos():
pass
def acosh():
pass
def asin():
pass
def asinh():
pass
def atan():
pass
def atan2():
pass
de... | [
{
"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 | stubs/micropython-esp32-1_10/math.py | RonaldHiemstra/micropython-stubs |
from sys import stderr
class Logger:
ERROR=0
QUIET=0
BASIC=1
WARNING=2
DETAIL=3
DEBUG=4
io_level = 0
@classmethod
def set_io_level(cls, lev):
cls.io_level = lev
@classmethod
def basic(cls, message):
if cls.io_level >= cls.BASIC:
print(message)
... | [
{
"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 | xmot/logger.py | velatkilic/mot |
from abc import abstractmethod
from utils.utils import init_sess
class Gan:
def __init__(self):
self.oracle = None
self.generator = None
self.discriminator = None
self.gen_data_loader = None
self.dis_data_loader = None
self.oracle_data_loader = None
self.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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | models/Gan.py | debashishc/texygan-analysis |
import pytest
import os
import sys
sys.path.append (os.getcwd () + "/src")
from config import Config
class TestConfig:
@pytest.mark.parametrize ("string, pickit_type, include, exclude, include_type",
[
("0",0, [], [], "OR"), ("1",1, [], [], "OR"), ("2",2, [], [], "OR"),
("1, (AMAZONSKILLER, ASSASINSKIL... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | test/config_test.py | Cho0joy/botty |
from pydantic import BaseModel
from .utils import BaseEvent
class MainPublisherEvent(BaseEvent):
pass
class CheckStatus(MainPublisherEvent):
channel: str
class WaitLiveVideo(MainPublisherEvent):
pass
class WaitStream(MainPublisherEvent):
time: int
class DownloaderEvent(BaseEvent):
pass
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | twlived/events.py | tausackhn/twlived |
import pytest
@pytest.mark.slow
def test_long_computation():
...
@pytest.mark.timeout(10, method="thread")
def test_topology_sort():
...
def test_foo():
pass
| [
{
"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 | Code Bundle/Chapter03/tests/test_slow.py | ghanigreen/pytest_code |
import os
def main():
try:
while True:
while True:
mode = input('Mode: ').lower()
if 'search'.startswith(mode):
mode = False
break
elif 'destroy'.startswith(mode):
mode = True
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 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 self/... | 3 | tests/data23/recipe-511429.py | JohannesBuchner/pystrict3 |
import ast, sys
ast.FunctionDef
class AstTransformer():
# Processes an individual AST node attribute
def _processAttribute(self, attrib):
return self.visit(attrib) if isinstance(attrib, ast.AST) else attrib
# Processes an AST node attribute that might be a list
def _processAttributeList(self, attrib):
ret... | [
{
"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 | server/languages/python/module/AstTransformer.py | adamrehn/language-toolbox |
class QuizBrain:
def __init__(self, question_list):
self.question_number = 0
self.question_list = question_list
self.score = 0
def next_question(self):
current_q = self.question_list[self.question_number]
self.question_number += 1
user_answer = input(f"Q.{self.question_number}: {current_... | [
{
"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 | 100_days_of_code/Intermediate/day_17/quiz_brain.py | Tiago-S-Ribeiro/Python-Pro-Bootcamp |
from flask import current_app, render_template
from flask_restful import Resource, reqparse
from flask_mail import Message
from utils.authorizations import admin_required
from models.user import UserModel
class Email(Resource):
NO_REPLY = "noreply@codeforpdx.org" # Should this be dwellingly address?
parser ... | [
{
"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 | resources/email.py | donovan-PNW/dwellinglybackend |
from abstract.expresion import *
from tools.tabla_tipos import *
from abstract.retorno import *
class tableId(expresion):
def __init__(self, valor, line, column, tipo, num_nodo):
super().__init__(line, column)
self.valor = valor
self.tipo = tipo
#Nodo AST
self.nodo = nodo... | [
{
"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 | parser/team23/expresion/tableId.py | 18SebastianVC/tytus |
class Graph:
graph_dict={}
def addEdge(self,node,neighbour):
if node not in self.graph_dict:
self.graph_dict[node]=[neighbour]
else:
self.graph_dict[node].append(neighbour)
def show_edges(self):
for node in self.graph_dict:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | main/codeSamples/DataStructures/graph.py | JKUATSES/dataStructuresAlgorithms |
# -*- coding: utf-8 -*-
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
# Copyright (c) 2021 Ingram Micro. All Rights Reserved.
import os
import sys
def unimport():
for m in ('connect.cli.plugins.play.commands', 'connect.cli.ccli'):
if m in sys.modules:
del sys.modules... | [
{
"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 | tests/plugins/play/test_play_commands.py | cloudblue/product-sync |
import typing
__all__ = ['remove_suffix', 'remove_prefix', 'row_pad_prefix']
def remove_suffix(string: str, suffix: str):
if string.endswith(suffix):
return string[:len(string) - len(suffix)]
return string
def remove_prefix(string: str, prefix: str):
if string.startswith(prefix):
return... | [
{
"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 | third_party/pytools/pytools/pyutils/misc/string/helpers.py | Kipsora/docker-curator |
"""Platzigram middleware catalog."""
# Django
from django.shortcuts import redirect
from django.urls import reverse
class ProfileCompletionMiddleware:
"""Profile completion middleware.
Ensure every user that is interacting with the platform
have their profile picture and biography.
"""
def __in... | [
{
"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 | platzigram/middleware.py | eicarranza/platzigram |
from typing import List
from rich import box
from rich.panel import Panel
from rich.table import Table
from vaccibot.models import AppointmentMatch
# ----- Data ----- #
COLUMNS_SETTINGS = {
"CENTER": dict(
justify="left",
header_style="bold",
style="bold",
), # no_wrap=True),
"C... | [
{
"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 | vaccibot/render.py | fsoubelet/vaccibot |
import argparse
import os
import torch
from tinynn.converter import TFLiteConverter
from tinynn.util.converter_util import export_converter_files, parse_config
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__))
def export_files():
from models.cifar10.mobilenet import DEFAULT_STATE_DICT, Mobilenet
mo... | [
{
"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/converter/convert_from_json.py | steven0129/TinyNeuralNetwork |
import pytest
import numpy as np
import random
from cem.backend import backend, NumpyBackend
try:
from cem.backend import CuPyBackend
import cupy as cp
skip_cupy_test = False
except ImportError:
skip_cupy_test = True
def test_numpy_backend():
X = random.randint(0, 10) * 10
Y = random.randint... | [
{
"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 | tests/test_backend.py | dantehustg/cem |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def assign(service,arg):
if service == "qibocms":
return True, arg
def audit(arg):
payload = "f/job.php?job=getzone&typeid=zone&fup=..\..\do\js&id=514125&webdb[web_open]=1&webdb[cache_time_js]=-1&pre=qb_label%20where%20lid=-1%20UNION%20SELECT%201,2,3,4,5,6,0,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": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | Bugscan_exploits-master/exp_list/exp-356.py | csadsl/poc_exp |
import sys
import chess
import re
def print_game(game):
'''
print Game data and moves
'''
game = " ".join(game)
game = re.sub("\d+\.", " ", game).strip()
moves = re.split("\s+", game)
board = chess.Bitboard()
end = moves[-1]
moves = moves[:-1]
after_str = str(board)
for move in moves:
mv = board.push_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | chess/checkmateclassifier/process_data.py | nivm/learningchess |
#
# 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... | [
{
"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 | airflow/migrations/versions/0090_30867afad44a_rename_concurrency_column_in_dag_table_.py | npodewitz/airflow |
from injector import inject
from backend_application.repository import DatabaseRepository
class ProjectService:
@inject
def __init__(self, repository: DatabaseRepository):
self.repository = repository
"""
returns project relevant data, like application
domains, projects per application d... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | visualization/backend/backend_application/service/project_service.py | INSO-TUWien/portfoliometrix |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framework.test_framework import GuldenTestFramework
... | [
{
"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 | test/functional/rpc_named_arguments.py | orobio/gulden-official |
from ward import raises, test
from learning.entities import Todo
from learning.errors import TitleLengthError
@test("create todo")
def _():
todo = Todo("test todo")
assert todo.title == "test todo"
assert not todo.id
assert not todo.done
assert not todo.created_at
@test("title length is less t... | [
{
"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 | ward_tests/test_entities.py | koichiro8/learning |
from django.core.management.base import BaseCommand
from ksiazkaadresowa.models import Person
class Command(BaseCommand):
help = 'Moj tekst pomocy'
def add_arguments(self, parser):
parser.add_argument(
'--file',
dest='file',
nargs='?',
help='Log File',
... | [
{
"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 | django/solution/untitled/ksiazkaadresowa/management/commands/clean.py | giserh/book-python |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
email = "test@test.com"
password = "Testpass_12345"
user = get_user_model().objects.create_user(
email_address=email,
... | [
{
"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 | app/core/tests/test_models.py | YevheniiM/RecipeDjangoApp |
import os
import sys
from pathlib import Path
sys.path.insert(1, '../Phase1')
sys.path.insert(2, '../Phase2')
import misc
import numpy as np
class Feedback:
def __init__(self):
self.task5_result = None
self.reduced_pickle_file_folder = os.path.join(Path(os.path.dirname(__file__)).parent,
... | [
{
"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 | Phase3/Feedback.py | Surya97/MWDB-project |
from firebase_admin import auth
from package_tests.models import User
# Stubs
stub_firebase_token = 'stub_firebase_token'
stub_firebase_uid = 'stub_firebase_uid'
stub_email = 'daniel@danieljs.tech'
stub_username = 'dspacejs'
# Mock classes
class MockUserRecord(object):
email = None
display_name = None
... | [
{
"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 | package_tests/tests/helpers.py | oleo65/graphene-django-firebase-auth |
import pandas as pd
import hiquant as hq
class StrategyLongHold( hq.BasicStrategy ):
symbol_max_value = {}
symbol_cost = {}
def __init__(self, fund):
super().__init__(fund, __file__)
self.max_stocks = 10
self.max_weight = 1.0
fund.set_name('耐心持有策略')
def schedule_task(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_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | strategy/000_long_hold.py | floatinghotpot/hiquant |
class Jumble(object):
def __init__(self):
self.dict = self.make_dict()
def make_dict(self):
dic = {}
f = open('/usr/share/dict/words', 'r')
for word in f:
word = word.strip().lower()
sort = ''.join(sorted(word))
dic[sort] = word
return dic
def unjumble(self, lst):
for ... | [
{
"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 | Code/word_jumble.py | Nyapal/CS1.3 |
from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
from Crypto.Cipher import PKCS1_OAEP, Salsa20
from Crypto.Hash import SHA256
from Crypto.Cipher import DES
from Crypto.Cipher import AES
import zlib
def encrypt(message):
encrypt_key = RSA.generate(2048)
encrypted_message = PKCS1_OAEP.new(... | [
{
"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 | source/auth/client_protocol.py | raldenprog/electronic_vote |
# -*- coding: utf-8 -*-
"""
Created on Tue May 26 13:17:06 2020
@author: Chandan
"""
import engine as en
from engine import Engine, wait_for_command
import query
import process
ass = Engine()
ass.engine_rate(210)
def listen():
command = en.wait_for_command()
try:
result = None
if query... | [
{
"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 | main.py | chandannaidu/virtual-assistant-jarvis- |
def table(name=None, primary_key="id", column_map=None):
"""数据据保存的表名"""
def decorate(clazz):
setattr(clazz, "__table_name__", clazz.__name__ if name is None else name)
setattr(clazz, "__primary_key__", primary_key)
setattr(clazz, "__column_map__", None if column_map is None else column_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": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | db_hammer/entity.py | liuzhuogood/db-hammer |
"""
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | [
{
"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 | s2e_env/utils/memoize.py | michaelbrownuc/s2e-env |
"""Add required grants
Revision ID: e9fbe7694450
Revises: c0b039d92792
Create Date: 2021-04-19 12:59:52.861502
"""
from alembic import op
import sqlalchemy as sa
from app import app
# revision identifiers, used by Alembic.
revision = 'e9fbe7694450'
down_revision = 'c0b039d92792'
branch_labels = None
depends_on = N... | [
{
"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 | webapp/migrations/versions/e9fbe7694450_add_required_grants.py | ramboldio/steuerlotse |
from .parser import EnsemblParser
import biothings.hub.dataload.uploader as uploader
from biothings.utils.common import dump2gridfs
class EnsemblGeneUploader(uploader.MergerSourceUploader):
name = "ensembl_gene"
main_source = "ensembl"
__metadata__ = {"mapper" : 'ensembl2entrez'}
def load_data(self, ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | src/hub/dataload/sources/ensembl/gene_upload.py | inambioinfo/mygene.info |
# -*- coding: UTF-8 -*-
import sys
from correctores.common.corrector_variables import corrector_variables
########################################################################
#### Esto es lo que hay que cambiar en cada problema: ####
#### - epsilon: para comparar floats y complex, si lo necesitas ... | [
{
"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 | temas/Python3/correctores/asignaciones/asig1.py | emartinm/TutorialesInteractivos |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestMrpMulticompany(common.TransactionCase):
def setUp(self):
super(TestMrpMulticompany, self).setUp()
group_user = self.env.ref('base.group_user')
grou... | [
{
"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 | addons/mrp/tests/test_multicompany.py | jjiege/odoo |
# RPS bot
import random
name = 'adaptivebot'
class RPSBot(object):
name = name
def __init__(self):
self.winners = {"R": "P", "P": "S", "S": "R"}
def get_hint(self, other_past, my_past):
is_other_constant = len(set([other_claim for other_claim, other_move in other_past[-2:]])) == 1
... | [
{
"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 | adaptivebot.py | coolioasjulio/Rock-Paper-Scissors-Royale |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import requests
import json
class KodiController(object):
__serverconf = None
def __init__(self, serverconf):
self.__serverconf = serverconf
def post(self,command):
url = "http://" + self.__serverconf["... | [
{
"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 | scripts/kodicontroller.py | koji88/kodi-gpio-controller |
from stability.Utility import limitByRate, mapInput, limit
from stability.filters import LowPassFilter
class Actuator:
# class for the control surface actuator
def __init__(self, max, servo_to_hinge, rate):
self.max = max # max min limit of the FINAL control surface deflection in degrees (e.g. 30 degre... | [
{
"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 | pycom/lib/stability/Actuator.py | o-gent/aero_one |
class FittingAngleUsage(Enum, IComparable, IFormattable, IConvertible):
"""
An enumerated type representing the options for how to limit the angle values applicable to fitting content.
enum FittingAngleUsage,values: UseAnAngleIncrement (1),UseAnyAngle (0),UseSpecificAngles (2)
"""
def __eq__(se... | [
{
"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 | release/stubs.min/Autodesk/Revit/DB/__init___parts/FittingAngleUsage.py | YKato521/ironpython-stubs |
import os
import time
import click
from . import procs
class Interpreter:
def __init__(self, ctx, verbose):
self.ctx = ctx
self.verbose = verbose
self.lines = []
self.in_comment = False
def feed(self, line):
if len(self.lines) > 0:
# End of multi-line comment
if self.lines[0].startswith('#==') and... | [
{
"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 | dish/interpreter.py | dullbananas/dish |
import configparser
import functools
from os import path
from pathlib import Path
class Config():
"""Config wrapper that reads global config and user config."""
PROJECT_ROOT = path.join(path.dirname(path.realpath(__file__)), '..')
CONFIG_INI = path.join(PROJECT_ROOT, 'config.ini')
HOME_DIR = Path.hom... | [
{
"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 | src/cicd/utils/config.py | szn/snowflake-cicd |
import kfserving
from typing import Optional
from adserver.base.model import CEModel
from alibi_detect.utils.saving import load_detector, Data
class AlibiDetectModel(CEModel): # pylint:disable=c-extension-no-member
def __init__(self, name: str, storage_uri: str, model: Optional[Data] = None):
"""
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | components/alibi-detect-server/adserver/base/alibi_model.py | glindsell/seldon-core |
""" Simple utilities for figures"""
import numpy as np
import matplotlib as mpl
def log_me(val, err):
"""
Generate log and error from linear input
Args:
val (float):
err (float):
Returns:
float, (float/None):
Returns none if the err is negative
"""
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | frb/figures/utils.py | Lachimax/FRB |
from ..resources.I18nResources import I18nLanguageListResponse, I18nRegionListResponse
from googleapiclient.discovery import Resource
class I18n:
def __init__(self, client: Resource) -> None:
self.client = client
def list_languages(self):
req = self.client.i18nLanguages().list(part='sn... | [
{
"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/ytwrapper/apis/I18ns.py | Robert-Phan/yt-wrapper |
# parser.py
#
# Author: Jan Piotr Buchmann <jan.buchmann@sydney.edu.au>
# Description:
#
# Version: 0.0
import sys
from . import sequence
class FastaParser:
def __init__(self):
self.sequences = {}
self.doFhClose = False
self.src = sys.stdin
def parse(self, src=None, fil=None, stream=False):
... | [
{
"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 | lib/fasta/parser.py | NCBI-Hackathons/VirusML |
"""
-----
soup:
-----
find
find_all
select
find_by_class
find_by_id
find_by_tag
find_by_text
--------
selenium:
--------
find_element_by_id(id_)
find_elements_by_id(id_)
find_element_by_class_name(name)
find_elements_by_class_name(name)
find_element_by_css_selector(css_selector)
find_elements_by_css_selector(css_select... | [
{
"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 | login/lib/step_helper.py | sifeng86/crawla-the-spider-tool |
import unittest
from unittest.mock import mock_open, patch, MagicMock
from unittest import mock
from src.zad3.friendships_storage import FriendshipsStorage
from src.zad3.friendships import Friendships
class TestFriendshipsStorage(unittest.TestCase):
def test_friendships_storage_add_raises_typeError_with_not_frie... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_friendships_storage.py | TestowanieAutomatyczneUG/laboratorium-11-maciejSzcz |
"""empty message
Revision ID: eb02de174736
Revises: c0de0819f9f0
Create Date: 2020-02-04 18:29:57.302993
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eb02de174736'
down_revision = 'c0de0819f9f0'
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 | starter_code/migrations/versions/eb02de174736_.py | nkatwesigye/project_furry |
from __future__ import absolute_import, division, print_function, unicode_literals
from echomesh.util.string import Flag
from echomesh.util.TestCase import TestCase
class FlagTest(TestCase):
def test_empty(self):
self.assertEqual(Flag.split_flag(''), (u'', True))
def test_single_dash(self):
self.assertE... | [
{
"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 | code/python/echomesh/util/string/Flag_test.py | silky/echomesh |
# -*- coding: utf-8 -*-
class MetaSingleton(type):
def __call__(cls, *args, **kwargs):
if not cls.__dict__.get("_instance"):
cls._instance = cls.__new__(cls, *args)
cls._instance.__init__(*args, **kwargs)
return cls._instance
class Singleton(object):
__metaclass__ = MetaSingleton
@classmethod
def Inst... | [
{
"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 | common/singleton.py | hellosword/MDNote |
class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def display(self):
temp = self.head
ll = []
while(temp):
ll.append(temp.data)
temp = temp.next
... | [
{
"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... | 3 | Leetcode-python/5_LinkedList/ll.py | gnsalok/algo-ds-python |
from django.db import models
from meiduoshop.utils.models import BaseModel
# Create your models here.
class ContentCategory(BaseModel):
"""广告内容类别"""
name = models.CharField(max_length=50, verbose_name='名称')
key = models.CharField(max_length=50, verbose_name='类别键名')
class Meta:
db_table = 'tb_... | [
{
"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 | meiduoshop/meiduoshop/apps/contents/models.py | juntao66/meiduoshopping |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_cron_job.py | Scalr/kubernetes-client-python |
from eventsourcing.domain import Aggregate, event
from uuid import uuid5, NAMESPACE_URL
class Account(Aggregate):
"""A simple-as-can-be bank account"""
@event('Created')
def __init__(self):
self.balance = 0
@event('Credited')
def credit(self, amount: int):
self.balance += amount
... | [
{
"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 | event_sourced_bank/domain_model.py | sfinnie/event_sourced_bank |
import biathlonresults as api
def test_cups():
res = api.cups(1819)
assert isinstance(res, list)
assert len(res) == 37
def test_cup_results():
res = api.cup_results("BT1819SWRLCP__SMTS")
assert isinstance(res, dict)
assert isinstance(res["Rows"], list)
assert res["Rows"][0]["Name"] == "B... | [
{
"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 | tests/test_api.py | prtkv/biathlonresults |
"""
Reference: https://github.com/mfaruqui/eval-word-vectors
"""
import math
import numpy
from operator import itemgetter
from numpy.linalg import norm
EPSILON = 1e-6
def euclidean(vec1, vec2):
diff = vec1 - vec2
return math.sqrt(diff.dot(diff))
def cosine_sim(vec1, vec2):
vec1 += EPSILON * numpy.ones(len(vec... | [
{
"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 | eval/ranking.py | blackredscarf/pytorch-SkipGram |
import asyncio
import decimal
import unittest
class DecimalContextTest(unittest.TestCase):
def test_asyncio_task_decimal_context(self):
async def fractions(t, precision, x, y):
with decimal.localcontext() as ctx:
ctx.prec = precision
a = decimal.Deci... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | Tools/python37/Lib/test/test_asyncio/test_context.py | xxroot/android_universal |
import re
from urlresolver import common
from urlresolver.plugins.lib import helpers
from urlresolver.resolver import UrlResolver, ResolverError
class RacatyResolver(UrlResolver):
name = "racaty"
domains = ['racaty.com']
pattern = '(?://|\.)(racaty\.com)/([0-9a-zA-Z]+)'
def __init__(self):
se... | [
{
"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 | libs/urlresolver_plugins/racaty.py | manishrawat4u/plugin.video.bloimediaplayer |
from .node import Node
class LinkedList:
"""
create a linked list
"""
def __init__(self, iterable=[]):
"""Constructor for the LinkedList object"""
self.head = None
self._size = 0
if type(iterable) is not list:
raise TypeError('Invalid iterable')
for... | [
{
"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 | interviews/is_palindrome/linked_list.py | zarkle/data-structures-and-algorithms |
#coding=utf-8
import requests
import tempfile
import os
import re
import random
import time
import datetime
#from bs4 import BeautifulSoup
from collections import defaultdict
from flask import Flask, request, abort
import sqlite3
from linebot import LineBotApi, WebhookHandler
from linebot.exceptions impo... | [
{
"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 | test.py | adgj5472/python-linebot-sdk |
import math
class CustomType(type):
def __new__(mcls, name, bases, class_dict):
print(f'Using custom metaclass {mcls} to create class {name}...')
cls_obj = super().__new__(mcls, name, bases, class_dict)
cls_obj.circ = lambda self: 2 * math.pi * self.r
return cls_obj
class Circle(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 | Back-End/Python/Basics/Part -4- OOP/07 - Metaprogramming/04_metaclass.py | ASHISHKUMAR2411/Programming-CookBook |
import pytest
from adventofcode.year_2016.day_09_2016 import part_one
from adventofcode.year_2016.day_09_2016 import part_two
@pytest.mark.parametrize(
["line", "expected"],
[
("ADVENT", 6),
("A(1x5)BC", 7),
("(3x3)XYZ", 9),
("A(2x2)BCD(2x2)EFG", 11),
("(6x1)(1x3)A", 6)... | [
{
"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/adventofcode/year_2016/test_day_09_2016.py | Frazzer951/Advent-Of-Code |
'''
Description:
email: 359066432@qq.com
Author: lhj
software: vscode
Date: 2021-09-19 17:28:48
platform: windows 10
LastEditors: lhj
LastEditTime: 2021-09-20 20:01:05
'''
from dataclasses import dataclass
@dataclass
class UserBriefInfo(object):
user_id:str
user_name:str
@classmethod
def from_user(c... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | TianJiPlanBackend/core/utils.py | weridolin/tianji-plan |
# ------------------------------------------------------------------------------------------------------
# Copyright (c) Leo Hanisch. All rights reserved.
# Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information.
# ---------------------------------------------------------... | [
{
"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 | swarmlib/woa/woa_problem.py | HaaLeo/ant-colony-optimization |
import pytest
import logging
import sys
LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")
logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
logger.propagate = True
stdout_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stdout_handler)
logging.getLogger("faker").setLevel(logging.ER... | [
{
"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 | tests/test_pytest_fold_2.py | jeffwright13/pytest-fold |
import Anreal
class RendererBuildDesc(Anreal.BuildDesc) :
def SetDependency(self) :
self.DependencyList.append("Core")
self.DependencyList.append("RHI")
def SetOther(self) :
self.ModuleName = "Renderer"
def GetBuildDesc() :
return RendererBuildDesc()
| [
{
"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 | Engine/Source/Runtime/Renderer/RendererBuild.py | zxwnstn/AnrealEngine |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self, init_list: list = None):
self.head = None
if init_list:
for value in init_list:
self.append(value)
def append(self, value):
i... | [
{
"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 | 3. data_structures/linked_list/linked_lists_circular.py | sourcery-ai-bot/udacity-datastructures-algorithms |
def get_sidereal_time(time: float, date: (int, int, int), longitude: float) -> float:
year, month, day = date
# Calculate the Julian Day
A = int(year/100)
B = 2 - A + int(A/4)
jd = int(365.25*(year + 4716)) + int(30.6001*(month + 1)) + day + B - 1524.5
# Calculate Greenwich Sidereal Time
T = (jd + time/... | [
{
"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 | skyfall.py | jopetty/skyfall |
from typing import List, Union, Tuple
from lab.logger.colors import StyleCode
class Destination:
def log(self, parts: List[Union[str, Tuple[str, StyleCode]]], *,
is_new_line=True):
raise NotImplementedError()
def new_line(self):
raise NotImplementedError()
| [
{
"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 | lab/logger/destinations/__init__.py | gear/lab |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.museum/status_registered
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse ... | [
{
"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 | test/record/parser/test_response_whois_museum_status_registered.py | huyphan/pyyawhois |
import os
class UserHandler:
def __init__(self, user):
self.user = user
def check_user_dir(self):
path = f"home/{self.user}"
if not os.path.exists(path):
os.mkdir(path)
return f"/{path}"
else:
return f"/{path}"
| [
{
"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 | src/users.py | novus-alex/PyShell |
import pandas as pd
import numpy as np
import gc
import os
from pathlib import Path
p = Path(__file__).parents[1]
ROOT_DIR=os.path.abspath(os.path.join(p, '..', 'data/raw/'))
def convert(data, num_users, num_movies):
''' Making a User-Movie-Matrix'''
new_data=[]
for id_user in range(1, num_user... | [
{
"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 | src/data/preprocess_data.py | artem-oppermann/Deep-Autoencoders-For-Collaborative-Filtering |
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.template
class Tool(benchexec.tools... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | benchexec/tools/ufo.py | SvenUmbricht/benchexec |
from flask import Blueprint, request
from app.spiders.core import *
from app.utils import build_result
from app.constants import code
core = Blueprint('core', __name__)
@core.route('/login', methods=['POST'])
def login():
data = request.form
username = data.get('username')
password = data.get('password'... | [
{
"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 | app/api/core.py | Aneureka/njuapi |
from abc import ABC
from enum import Enum
from erica.domain.Shared.BaseDomainModel import BasePayload
class StateAbbreviation(str, Enum):
bw = "bw"
by = "by"
be = "be"
bb = "bb"
hb = "hb"
hh = "hh"
he = "he"
mv = "mv"
nd = "nd"
nw = "nw"
rp = "rp"
sl = "sl"
sn = "s... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},... | 3 | erica/domain/tax_number_validation/check_tax_number.py | digitalservice4germany/erica |
import codecs
import yaml
from .filebased import FileBasedSource
__all__ = (
'YamlFileSource',
)
class YamlFileSource(FileBasedSource):
def __init__(self, *args, **kwargs):
self.encoding = kwargs.pop('encoding', 'utf-8')
super(YamlFileSource, self).__init__(*args, **kwargs)
def get_se... | [
{
"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/djangoreactredux/djrenv/lib/python3.5/site-packages/setoptconf/source/yamlfile.py | m2jobe/c_x |
import pytest
import tempfile
import zipfile
import zipfile_deflate64
from pathlib import Path
from skultrafast.quickcontrol import QC1DSpec, QC2DSpec, parse_str, QCFile
from skultrafast.data_io import get_example_path, get_twodim_dataset
def test_parse():
assert (parse_str('-8000.000000') == -8000.0)
assert... | [
{
"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 | skultrafast/tests/test_quickcontrol.py | Tillsten/skultrafast |
"""Utility functions"""
import json
import os
import datetime
import logging
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
def load_config_json(name):
json_path = os.path.abspath(os.path.join(BASE_DIR, 'microservice')) + '/' + name + '.json'
... | [
{
"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 | composite/utils/files.py | Skydipper/Composite |
from sqlalchemy.orm.exc import NoResultFound
from zeeguu_core.model import User, Language, UserWord, Text, Bookmark
def own_or_crowdsourced_translation(user, word: str, from_lang_code: str, context: str):
own_past_translation = get_own_past_translation(user, word, from_lang_code, context)
if own_past_trans... | [
{
"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 | zeeguu_core/crowd_translations/__init__.py | C0DK/Zeeguu-Core |
import logging
import time
from threading import Event
from watchdog.observers import Observer
from .OutputEventHandler import OutputEventHandler
class FileSystemObserver(object):
def __init__(self, test_output_dir):
self.test_output_dir = test_output_dir
# Start observing output dir
s... | [
{
"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 | docker/test/integration/minifi/core/FileSystemObserver.py | galshi/nifi-minifi-cpp |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
class MandatoryOptions(object):
def __init__(self,options):
self.options=options
def __getattr__(self,name):
call=getattr(self.options,name)
def require(*args,**kwargs):
value=call(*args,*... | [
{
"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 | .waf-1.9.8-6657823688b736c1d1a4e2c4e8e198b4/waflib/extras/wurf/mandatory_options.py | looopTools/sw9-source |
import crypto_tools
import crypto_native
def openssl_aes_128_little_doc():
return "short example of encryption and decryption using openssl"
def openssl_aes_128_full_doc():
return """
openssl_aes_128_full_doc
"""
def openssl_aes_128_pre_processing(key, iv):
if len(key) > 16:
raise Valu... | [
{
"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 | algo/openssl_aes_128.py | dkushche/Crypto |
def indeterminados_posicion(*args):
# print(args)
for arg in args:
print(arg)
indeterminados_posicion(5,"hola a todos", [1,2,4])
def indeterminados_nombre(**kwargs):
# print(kwargs)
for kwarg in kwargs:
print("clave: {}, valor: {}".format(kwarg,kwargs[kwarg]))
indeterminados_nombre(n... | [
{
"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 | curso_hector/08-funciones.py/parametros_indeterminados.py | corahama/python |
"""
Flake8 plugin to encourage correct string literal concatenation.
Forbid implicitly concatenated string literals on one line such as those
introduced by Black.
Forbid all explicitly concatenated strings, in favour of implicit concatenation.
"""
from __future__ import generator_stop
import ast
import tokenize
from... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | flake8_implicit_str_concat.py | graingert/flake8-implicit-str-concat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.