source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is successful"""
email = 'test@mail.com'
password = '123'
user = get_user_model()... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | app/core/tests/test_models.py | ademrizki/recipe-app-api |
import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
'sqlite3_db.db',#current_app.config['DATABASE'],
detect_types = sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sq... | [
{
"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 | flaskr/db.py | mkirby42/flask-tut |
from flask_security.utils import hash_password
from flask_smorest import Blueprint, abort
from ..models.user import User
from ..schemas.paging import PageInSchema, paginate
from ..schemas.user import UserPageOutSchema, UserSchema
from .methodviews import ProtectedMethodView
blueprint = Blueprint('users', 'user')
@b... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | freenit/api/user.py | Veskor/backend-1 |
# coding: utf-8
from lxml import html
from django.test import TestCase
from django.test.client import Client
from quotes.tests.utils import create_test_tag
class TagPageTestCase(TestCase):
def setUp(self):
self.client = Client()
self.dom = ''
self.tag = create_test_tag()
def tearDo... | [
{
"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 | quotes/tests/requests/test_tag_page.py | daviferreira/defprogramming |
import pytest
class First:
@classmethod
def get_sample_results(cls):
return [['first', '1'], ['first', '2']]
class Second:
@classmethod
def get_sample_results(cls):
return [['second', '1'], ['second', '2']]
@pytest.fixture(params=[First, Second])
def plugin_cls(request):
retu... | [
{
"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 | proof-of-concepts/pytest-fixtures-plugins-providing-sample-data-being-converted-to-fixtures-themselves.py | douleutaras/django-performance-testing |
import slcrmit.questions.median_stream as subject
class TestMedianStream(object):
def test_median_stream(self):
ary = [1,2,3,4,5]
expected = [1,1.5,2,2.5,3]
median = subject.median_stream_brute_force(ary)
assert median == expected
def test_median_stream_complex(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/questions/test_median_stream.py | owejow/algorithms |
import iland
import time
import json
CLIENT_ID = ''
CLIENT_SECRET = ''
USERNAME = ''
PASSWORD = ''
COMPANY_ID = ''
api = iland.Api(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, username=USERNAME, password=PASSWORD)
def main():
export_edge_firewalls()
def export_edge_firewalls():
# Get all the edges for... | [
{
"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 | examples/export-firewall-config/export-firewall-config.py | ilanddev/python-sdk |
from hypothesis import given
from tests.utils import (equivalence,
implication)
from wagyu.ring_manager import RingManager
from . import strategies
@given(strategies.ring_managers)
def test_reflexivity(ring_manager: RingManager) -> None:
assert ring_manager == ring_manager
@given(strat... | [
{
"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 | tests/port_tests/ring_manager_tests/test_equals.py | synapticarbors/wagyu |
# coding: utf-8
__all__ = ["PyVideoEditorImprementationError"]
class PyVideoEditorImprementationError(Exception):
"""
Warnings that developers will resolve.
Developers are now solving in a simple stupid way.
"""
class KeyError(KeyError):
def __str__(self):
return ", ".join(self.args)
| [
{
"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 | veditor/utils/_exceptions.py | iwasakishuto/PyVideoEditor |
class BaseDatabaseClient:
"""Encapsulate backend-specific methods for opening a client shell."""
# This should be a string representing the name of the executable
# (e.g., "psql"). Subclasses must override this.
executable_name = None
def __init__(self, connection):
# connection is an inst... | [
{
"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 | Thesis@3.9.1/Lib/site-packages/django/db/backends/base/client.py | nverbois/TFE21-232 |
from sympy.core.numbers import I
from sympy.core.symbol import symbols
from sympy.functions.elementary.exponential import exp
from sympy.functions.elementary.trigonometric import (cos, cot, sin)
from sympy.testing.pytest import _both_exp_pow
x, y, z, n = symbols('x,y,z,n')
@_both_exp_pow
def test_has():
... | [
{
"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 | sympy/simplify/tests/test_rewrite.py | Michal-Gagala/sympy |
import unittest
from unittest.mock import patch
from PIL import Image
import processor
class ProcessorTest(unittest.TestCase):
def test_normalize_input(self):
img = Image.new("RGB", (400, 400), "#ff0000")
normalized = processor.normalize_input(img)
assert normalized.shape == (224, 224, 3... | [
{
"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 | tests/test_processor.py | Tmw/edward |
from dataclasses import dataclass
from beet import Context, Function
HELLO_PATH = f"{__name__}.Hello"
WORLD_PATH = f"{__name__}.World"
@dataclass
class Hello:
ctx: Context
def thing(self):
self.ctx.generate(Function(["say hello"]))
@dataclass
class World:
ctx: Context
def thing(self):
... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | examples/code_inject_import/demo.py | Arcensoth/beet |
import unittest
from approvaltests.core.reporter import Reporter
from approvaltests.reporters.first_working_reporter import FirstWorkingReporter
class TestReporter(Reporter):
def __init__(self, success, additional=None):
if additional is None:
additional = lambda : None
self.additiona... | [
{
"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 | tests/reporters/test_first_working_reporter.py | aaltat/ApprovalTests.Python |
class Fight(object):
def __init__(self, good, bad):
print("FIGHT!!!")
print(
", ".join((i.name for i in good)) + " v " + ", ".join((i.name for i in bad))
)
print()
self.gChars = good
self.bChars = bad
i = 0
while len(self.gChars) != 0 and l... | [
{
"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 | src/python_rpg_game/FightClasses.py | Peilonrayz/Python_RPG_Game |
# Copyright 2013-2019 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 import *
class Tassel(Package):
"""TASSEL is a software package to evaluate traits associations,
e... | [
{
"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 | var/spack/repos/builtin/packages/tassel/package.py | nkianggiss/spack |
import functools
from spaceone.api.cost_analysis.v1 import budget_usage_pb2
from spaceone.core.pygrpc.message_type import *
from spaceone.core import utils
from spaceone.cost_analysis.model.budget_usage_model import BudgetUsage
__all__ = ['BudgetUsageInfo', 'BudgetUsagesInfo']
def BudgetUsageInfo(budget_usage_vo: Bu... | [
{
"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 | src/spaceone/cost_analysis/info/budget_usage_info.py | whdalsrnt/cost-analysis |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import stream_pb2 as stream__pb2
class SoccerStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
sel... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | soccer-match-streaming/stream_pb2_grpc.py | pantuza/grpc-python-examples |
#!/usr/bin/env python3
# date: 2019.08.06
# https://stackoverflow.com/questions/57366488/how-to-pass-the-single-link-in-a-nested-url-scrape
import scrapy
from scrapy.loader import ItemLoader
from scrapy.loader.processors import MapCompose
def clean(text):
text = text.replace('\xa0', ' ')
text = text.strip().... | [
{
"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 | __scraping__/comics.panini.it - scrapy/main-itemloader.py | whitmans-max/python-examples |
import argparse
from rasa.cli.arguments.default_arguments import (
add_nlu_data_param,
add_out_param,
add_data_param,
add_domain_param,
)
def set_convert_arguments(parser: argparse.ArgumentParser):
add_data_param(parser, required=True, default=None, data_type="Rasa NLU ")
add_out_param(
... | [
{
"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 | rasa/cli/arguments/data.py | deepmipt/rasa |
from django.shortcuts import render
from django.template.loader import render_to_string
def home(request):
context_dict = {}
return render(request,'ms2ldaviz/index.html',context_dict)
def people(request):
context_dict = {}
return render(request,'ms2ldaviz/people.html',context_dict)
def about(reque... | [
{
"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 | ms2ldaviz/ms2ldaviz/views.py | sdrogers/ms2ldaviz |
import os
import argparse
"""
Splits a single file of MEDLINE formatted abstracts
into M files of N abstracts.
"""
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("infile", type=str,
help="MEDLINE file to split")
parser.add_argument("outdir", type=str,
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/data/split_medline.py | zhang-informatics/SemRep_DS |
import numpy as np
from torch.utils.data import Dataset
class GrenadeDataset(Dataset):
def __init__(self, X, y):
self.X = X.copy().values.astype(np.float32)
self.y = y.copy().values.astype(np.int64)
def __len__(self):
return len(self.X)
def __getitem__(self, idx):
ret... | [
{
"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 | project/data_modules/dataset.py | kwasniakk/CS-GO-Grenade-Classification |
"""
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... | [
{
"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 | solutions/quick_sort.py | Surbeivol/daily-coding-problems |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: mac_farsi.py
""" Python Character Mapping Codec mac_farsi generated from 'MAPPINGS/VENDORS/APPLE/FARSI.TXT' with gencodec.py.
"""
import codecs
cla... | [
{
"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 | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/mac_farsi.py | bidhata/EquationGroupLeaks |
from django.test import TestCase,Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@gmail.com',
... | [
{
"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 | app/core/tests/test_admin.py | baothi/recipe-app-api |
# (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import annotations
from typing import Optional, Sequence
from pydantic import BaseModel, root_validator, validator
from datadog_checks.base.utils.functions import identity
from datadog_c... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | aspdotnet/datadog_checks/aspdotnet/config_models/instance.py | tdimnet/integrations-core |
import requests
from allauth.socialaccount import app_settings
from allauth.socialaccount.providers.amazon_cognito.provider import (
AmazonCognitoProvider,
)
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
class AmazonCognitoOAuth2Adapt... | [
{
"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 | allauth/socialaccount/providers/amazon_cognito/views.py | lukeburden/django-allauth |
import pytest
from threedframe.config import config
from ..utils import DirectoryFactoryType
@pytest.mark.parametrize("vertex", [1, 3, 42])
def test_fixture_length_less_than_support_length(
director_factory: DirectoryFactoryType, vertex: int
):
config.SUPPORT_SCALE = 0.69
director = director_factory([ve... | [
{
"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/scad/test_fixture.py | ArroyoDev-LLC/vertisee |
from sqlalchemy import Column, Integer, String
from server.db.database import Base
class Book(Base):
""" Books in a library """
__tablename__ = 'books'
id = Column(Integer, primary_key=True)
name = Column(String(50), unique=True)
def __init__(self, name=None, email=None):
self.name = name... | [
{
"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 | server/db/models/book.py | thinkjones/AFSP-Seed |
import os
import warnings
from tqdm import tqdm
import subprocess as sp
import gzip
from io import StringIO
import Bio.SeqIO as bpio
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from bioseq.io.BioIO import BioIO
from Bio import BiopythonWarning, BiopythonParserW... | [
{
"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 | bioseq/management/commands/import_genome.py | ezequieljsosa/sndg-web |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from ...utils import cached_property
from ..._compat import to_unicode, to_string, unicode_compatible
@unicode_compatible
class Sentence(object):
__slots__ = ("_text", "_ca... | [
{
"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 | wikum-env3/lib/python3.7/site-packages/sumy/models/dom/_sentence.py | xuericlin/wikum |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .annealed_guassian import AnnealedGaussianProcess
__author__ = "Christian Heider Nielsen"
# Based on http://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab
import numpy
__all__ = ["OrnsteinUhlenbeckProcess"]
class OrnsteinUhlenb... | [
{
"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 | neodroidagent/utilities/exploration/sampling/random_process/ornstein_uhlenbeck.py | gitter-badger/agent |
import os
from setuptools import Command, find_packages, setup
requirements = [
"numpy",
"pandas",
"plotly",
"jupyter",
"jupytext",
"tqdm",
"matplotlib",
]
dev_requirements = [
"black",
"bumpversion",
"flake8",
"isort",
"pytest",
"coverage",
"pytest-cov",
"... | [
{
"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 | setup.py | KyleHarrison/PoEPricePredictor |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function 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 | qiskit/unroll/_backendexception.py | NickyBar/QIP |
# -*- coding: utf-8 -*-
__author__ = """Christoph Rist"""
__email__ = "c.rist@posteo.de"
import tensorflow as tf
def assert_normalized_quaternion(quaternion: tf.Tensor):
with tf.control_dependencies(
[
tf.debugging.assert_near(
tf.ones_like(quaternion[..., 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 | tf_quat2rot/check.py | risteon/tf_quat2rot |
import logging
from pprint import pprint # noqa
from banal import hash_data
from datetime import datetime
from followthemoney.util import get_entity_id
from aleph.index.util import index_name, index_settings, configure_index
from aleph.index.util import query_delete, index_safe
from aleph.index.util import KEYWORD
l... | [
{
"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 | aleph/index/notifications.py | Rosencrantz/aleph |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
import math
from itertools import combinations
from collections import defaultdict
from ._summarizer import AbstractSummarizer
class TextRankSummarizer(AbstractSummarizer):
"""Source... | [
{
"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 | util_common/nlp/Sumy/summarizers/text_rank.py | cscyuge/pointer-generator |
from resources import BaseResource
from documentation.namespaces import user_ns
from documentation.models import upload_parser, post_response
from accessors import UserAccessor
from resources.auth_resource import requires_auth
@user_ns.doc(security='apiKey')
@user_ns.route('/uploads')
class UserUploads(BaseResource):... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | api/uploads.py | rjvanvoorhis/photomosaic-api-v2 |
def http_status(status):
match status:
case 400:
return "Bad request"
case 401:
return "Unauthorized"
case 403:
return "Forbidden"
case 404:
return "Not found"
# output
def http_status(status):
match status:
case 4... | [
{
"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 | tests/data/preview_310/remove_newline_after match.py | hampuskraft/black |
from common.match_symbols import Match, get_mathml_matches
DEFAULT_TEX_PATH = "tex-path"
DEFAULT_EQUATION_INDEX = 0
def test_matches_self():
mathml = "<mi>x</mi>"
matches = get_mathml_matches([mathml])
assert len(matches) == 1
assert matches[mathml] == [Match(mathml, mathml, 1)]
def test_matches_ch... | [
{
"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 | data-processing/tests/test_match_symbols.py | jusheen/scholar-reader |
class Pizza:
def __init__(self, pizza_name: str):
self.name = pizza_name
def __str__(self):
return self.name
class PizzaPlace:
def __init__(self) -> None:
self.pizzas = {}
def get_pizza(self, pizza_name: str) -> Pizza:
if pizza_name not in self.pizzas:
sel... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | creational/first_lazy_initialization.py | MADTeacher/design-patterns |
# 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": "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 | kubernetes/test/test_v1beta1_validating_webhook_configuration_list.py | reymont/python |
from django.db import models
class Batch(models.Model):
name = models.CharField(max_length=250)
notes = models.TextField(blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def __unicode__(self):
return self.name
class Card(models.Mo... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | cards/models.py | i-DAT-Qualia/Card-Backend |
from abc import ABC, abstractmethod
from app.shared.operation import Operation
class APIModelBase(ABC):
def __init__(self):
self.detail: str = ""
self.status_code: int | None = None
self.was_successful: bool = False
@abstractmethod
def exec(self) -> None:
pass
@abstr... | [
{
"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 | app/blueprints/api/apimodels/__init__.py | neurothrone/project-dot |
from flask import render_template,url_for,flash,redirect,request
from . import auth
from flask_login import login_user,login_required,logout_user
from .forms import RegistrationForm,LoginForm
from ..models import User
from .. import db
from ..email import mail_message
@auth.route('/login',methods=['GET','POST'])
def 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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | app/auth/views.py | Agnes-N/Pitch-App |
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
Series,
)
import pandas._testing as tm
import pandas.core.common as com
def test_detect_chained_assignment():
# Inplace ops, originally from:
# https://stackoverflow.com/questions/20508968/series-fillna-in-a-multiindex-d... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | pandas/tests/indexing/multiindex/test_chaining_and_caching.py | oricou/pandas |
from ..libs import Gtk
from ..window import GtkViewport
from .base import Widget
class SplitContainer(Widget):
def create(self):
# Use Paned widget rather than VPaned and HPaned deprecated widgets
# Note that orientation in toga behave unlike Gtk
if self.interface.VERTICAL:
sel... | [
{
"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 | src/gtk/toga_gtk/widgets/splitcontainer.py | saluk/toga |
from unittest import TestCase
from basketball_reference_web_scraper.http_client import PLAY_BY_PLAY_TIMESTAMP_FORMAT
from basketball_reference_web_scraper.parsers import PeriodTimestampParser
class TestPeriodTimestampParser(TestCase):
def setUp(self):
self.parser = PeriodTimestampParser(timestamp_format=... | [
{
"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/unit/parsers/test_period_timestamp_parser.py | sebasdarius/basketball_reference_web_scraper |
from threading import Lock
class Resource:
def __init__(self, name, count):
self.name = name
self.count = count
self.in_use = 0
self.lock = Lock()
def set_count(self, count):
self.count = count
def get_available(self):
return self.count - self.in_use
| [
{
"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 | Resourses/Resource.py | arash-kariznovi/CPU-Scheduler |
# encoding: utf-8
import paths
from _crc_algorithms import Crc
from _shortcut_generator import ShortcutGenerator
from _shortcut_parser import ShortcutParser
def shortcut_app_id(shortcut):
"""
Generates the app id for a given shortcut. Steam uses app ids as a unique
identifier for games, but since shortcuts don... | [
{
"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 | pysteam/shortcuts.py | Ryochan7/pysteam |
# this is here to avoid a circular import
from collections import namedtuple
class Point(namedtuple("Point", ["x", "y", "group", "fid"])):
@property
def __geo_interface__(self):
return {"type": "Point", "coordinates": (self.x, self.y)}
def as_feature(self):
geometry = self.__geo_interface... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | dorchester/point.py | eyeseast/dorchester |
import asyncio
import aiohttp
import requests
import functools
from PIL import Image
from io import BytesIO
async def run_in_executor(func, **kwargs):
func = functools.partial(func, **kwargs)
data = await asyncio.get_event_loop().run_in_executor(None, func)
return data
def load_image(link:... | [
{
"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 | venv/lib/python3.10/site-packages/easy_pil/utils.py | koushik80/Finfotek_Flask_App |
import pymysql
class SQLHold():
def __init__(self, host: str, user: str, password: str, database: str, port=3306):
self.db = pymysql.connect(host=host, user=user, port=port, database=database, password=password)
self.cursor = self.db.cursor()
def execute_command(self, command: str):
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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | Server/videoProcessServer/mysqlTools.py | kalenforn/video-context-analyze |
#Flask Imports
from flask import Flask
from flask_restful import Api
# DS Logic imports
import pandas as pd
import numpy as np
from math import radians, cos, sin, asin, sqrt
def create_app():
"""
Creates and configures an instance of our Flask API
"""
app = Flask(__name__)
app.run(debug=True)
... | [
{
"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 | Getter_Api/app/app.py | ChanceDurr/forest-fire-watch-ds |
from utils import utils
class ServerTokenMessageSerializer:
data_dict = [
{'name': 'rtid', 'n_bytes': 1, 'cast': None},
{'name': 'len', 'n_bytes': 2, 'cast': utils.bytes_to_int_little}
]
def serialize(self, data: bytes):
raise Exception('Unimplemented Handler: ServerTokenMessageSe... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/medius/rtpackets/servertokenmessage.py | Metroynome/robo |
# Copyright (c) 2021, NVIDIA CORPORATION.
from decimal import Decimal
import pyarrow as pa
import pytest
from cudf.core.column import DecimalColumn
@pytest.mark.parametrize(
"data",
[
[Decimal("1.1"), Decimal("2.2"), Decimal("3.3"), Decimal("4.4")],
[Decimal("-1.1"), Decimal("2.2"), Decimal... | [
{
"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 | python/cudf/cudf/tests/test_decimal.py | BenikaHall/cudf |
class RandomizedSet:
def __init__(self):
"""
Initialize your data structure here.
"""
self.dict = {}
self.list = []
def insert(self, val: int) -> bool:
"""
Inserts a value to the set. Returns true if the set did not already contain the specified element.... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | 1stRound/Medium/380-Insert Delete GetRandom O(1)/Hash+Array.py | ericchen12377/Leetcode-Algorithm-Python |
# -*- coding: utf-8 -*-
"""Config component.
This module defines the config Component.
<config>
</config>
"""
from . import AbstractComponent
class configComponent(AbstractComponent):
def __init__(self):
self._xmlns = {}
self.attributes = {}
self.parent_xmlns = {}
self._childre... | [
{
"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 | pytanga/components/config.py | renatoalmeidaoliveira/Pytanga |
import pytest
from app.routers import taxons
from fastapi.testclient import TestClient
TEST_JSON = {"gbif_id": 15, "canonical_name": "test", "rank": "class"}
TEST_JSON_0 = {
"gbif_id": 0,
"canonical_name": "Canis Lupus Familiaris",
"rank": "subspecies",
}
client = TestClient(taxons.router)
... | [
{
"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 | fastapi-api/src/tests/test_taxon.py | dataforgoodfr/batch8_ceebios |
import time
class ball():
def __init__(self, x = 5, y = 5, sx = 1, sy = 1, sp = 2, w = 10, h = 10):
self.x = x
self.y = y
self.sx = sx
self.sy = sy
self.sp = sp
self.w = w
self.h = h
def move(self):
self.x = self.x + self.sx * self.sp
sel... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | random/ball.py | Dmendoza3/Phyton |
from typing import List, Dict
from DataObjects.ClassCluster import Cluster
from Murphi.ModularMurphi.MurphiTokens import MurphiTokens
from Murphi.ModularMurphi.TemplateClass import TemplateHandler
from DataObjects.ClassMachine import Machine
class GenModStateFunc(MurphiTokens, TemplateHandler):
def __init__(se... | [
{
"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": true
... | 3 | Murphi/ModularMurphi/GenModStateFunc.py | icsa-caps/HieraGen |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...workbook import Workbook
class TestWriteBookViews(unittes... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | xlsxwriter/test/workbook/test_write_book_views.py | Rippling/XlsxWriter-1 |
from odroid_go import GO
from .Block import Block
from .Snake import Snake
SNAKE_COLOR = GO.lcd.colors.GREEN
BACKGROUND_COLOR = GO.lcd.colors.BLACK
FOOD_COLOR = GO.lcd.colors.RED
BORDER_COLOR = GO.lcd.colors.WHITE
SCREEN_WIDTH = 320
SCREEN_HEIGHT = 240
BLOCK_SIZE = 10
#Where borders are drawn
INIT_X = 0
INIT_Y = 20
... | [
{
"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 | src/snake/Entities/Globals.py | willemserruys/Snake |
# Ranorex Webtestit Page Object File
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from pageobjects.checkout_po import CheckoutPo
# Additional data: {"img... | [
{
"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 | pageobjects/cart_po.py | rxse/python-demoshop |
from flask import jsonify
from server import app
@app.route("/health")
def health():
"""health route"""
state = {"status": "UP"}
return jsonify(state)
@app.route('/answer')
def answer():
answer = {'The Answer to Life the Universe and Everything': 42}
return jsonify(answer)
@app.route('/answer/<n... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | server/routes/health.py | Qebuqci/qebuqci-python-microservice |
import datetime
class Filter:
def __init__(self, name):
self._name = name
def _as_params(self):
return {}
class SingleFilter(Filter):
def __call__(self, value):
self._value = value
return self
def _as_params(self):
return {"filter[{}]".format(self._name): 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | amocrm/v2/filters.py | rolldeep/amocrm_api |
#!/usr/bin/env python3
import os
import kong_pdk.pdk.kong as kong
Schema = (
{"message": {"type": "string"}},
)
version = '0.1.0'
priority = 0
# This is an example plugin that add a header to the response
class Plugin(object):
def __init__(self, config):
kong.log.err("saying hi from init phase")
... | [
{
"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 | kong-py-plugins/py-hello.py | srAtKong/kong-custom-plugin-py-tcp |
import unittest
from app.models import Pitch, User
class PitchTest(unittest.TestCase):
def setUp(self):
self.user_iano=User(username='ian', password='', email='joseph@gmail.com')
self.new_pitch=Pitch(title='iano', description='time is money', category='business', user=self.user_iano)
def tearD... | [
{
"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_pitch.py | ian-otieno/pitches-app |
import tornado.web
class FixTasks(tornado.web.UIModule):
def embedded_css(self):
return """
#tasks-table, .dataTable {
table-layout: fixed;
}
#tasks-table th:nth-child(3), .dataTable th:nth-child(3) {
width: 50px !important;
}
#tasks-table th:nth-child(4), .dataTable th:nth-child(4) {
width: 1... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | rpaas/flower_uimodules.py | pedrokiefer/rpaas |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
{
"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 | hybridse/python/tools/sql_magic.py | lotabout/OpenMLDB |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayEcoMycarViolationCityPushModel(object):
def __init__(self):
self._city_code = None
self._push_type = None
self._service_status = None
@property
def city_cod... | [
{
"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 | alipay/aop/api/domain/AlipayEcoMycarViolationCityPushModel.py | snowxmas/alipay-sdk-python-all |
#!/usr/bin/env python3
import unittest
import os
import shutil
from src.data.VideoItem import VideoItem
from src.data.MetaDataItem import MetaDataItem
from src.executor.FaceBlurrer import FaceBlurrer
from numpy.testing import assert_array_equal, assert_raises
class TestAnonymizationExecutor(unittest.TestCase):
TE... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | test/testAnonymizationExecutor.py | AutoDash/AutoDash |
"""
Suppose you have some input data sources `data_in` on which you apply some process `F` parameterized by `args`:
data_out = F(data_in, args)
You want to serialize `data_out`, but also don't want to lose `args`,
to preserve the exact setup that generated the output data.
Now suppose you want to inspect `args` ... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | src/augmented_pickle.py | opskrift/expman |
from datetime import timedelta
from typing import Union
from ariadne import ScalarType
timedelta_scalar = ScalarType("Timedelta")
@timedelta_scalar.serializer
def serialize_timedelta(value: timedelta) -> float:
return value.total_seconds()
@timedelta_scalar.value_parser
def parse_timedelta_value(value: Union... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | ariadne_django/scalars/timedelta.py | aitorres/ariadne_django |
from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()
class Group(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(verbose_name='URL', max_length=50, unique=True, blank=True, null=True)
description = models.TextField(max_length=... | [
{
"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": false
... | 3 | posts/models.py | Vilbert55/yatube |
class TrieNode:
def __init__(self):
self.sub = {}
self.suggestion = []
class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
root = TrieNode()
for product in sorted(products):
self._insert(product, root)
... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | 1268-search-suggestions-system/1268-search-suggestions-system.py | MayaScarlet/leetcode-python |
import Averager as Avg
class Average:
def __init__(self):
self.answer = 0
self.delta_time = 0
def average(self, avg, delta_t):
print("Average: " + str(avg) + " Timespan: " + str(delta_t))
self.answer = avg
self.delta_time = delta_t
def test_averager():
avg = Aver... | [
{
"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_TimeAverager.py | chipgarner/yourair |
import tkinter as tk
pad = 1
width = 12
class Entry(tk.Entry):
def __init__(self, master, **kwargs):
kwargs['width'] = 12
command = kwargs['command']
del(kwargs['command'])
if type(kwargs['textvariable']) is UfloatVar:
kwargs['justify'] = 'right'
else:
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | utility/tk_objects.py | Baharis/pRuby |
# Copyright 2018, Erlang Solutions Ltd, and S2HC Sweden AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
{
"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 | pyrlang/net_kernel.py | rlouf/Pyrlang |
from math import fabs
import random
import graph
import solve_linalg
import stabilization
PRECISION = 5
def generate_matrix(size):
return [
[round(random.random(), PRECISION) if i != j else 0.0 for j in range(size)]
for i in range(size)
]
def output(title, caption, data):
print(title)
... | [
{
"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 | lab3/main.py | Winterpuma/bmstu_MR |
import pandas as pd
import numpy as np
import os
from fire import Fire
from pipeline.tensorflow.Reader import Reader
class Datasets(Reader):
def __init__(self, data_path):
self.data_path = data_path
super(Datasets, self).__init__()
def read(self):
train_file = os.path.join(self.d... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | pipeline/tensorflow/Datasets.py | k920049/brunch-hgru |
from dataclasses import dataclass
import asyncio
@dataclass
class Message:
_type: str
data: dict
def handle_world(message, broker):
name = message.data["name"]
print(f"Hello {name}")
next_message = Message("quadrant:a", {"events": ["eagle"]})
broker.add_message(next_message)
def handle_quad... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | event_driven/sandbox.py | LuRsT/survivors |
from discord.ext import commands
import discord
class Plug:
def __init__(self, bot):
self.bot = bot
self.name = self.bot.config["plug"]["shilled_name"]
@commands.command(pass_context=True)
@commands.cooldown(1, 5.0, commands.BucketType.server)
async def twitter(self, ctx):
"""... | [
{
"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 | cogs/plug.py | mmmalk/saberbot |
import asyncio
import logging
import pytest
from p2p.peer import PeerSubscriber
from p2p.protocol import Command
from trinity.protocol.eth.peer import ETHPeer
from trinity.protocol.eth.commands import GetBlockHeaders
from trinity.protocol.eth.requests import (
HeaderRequest,
NodeDataRequest,
)
from tests.tr... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | tests/p2p/test_peer_subscriber.py | pipermerriam/py-evm |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free S... | [
{
"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 | ENV/lib/python3.5/site-packages/pyrogram/api/types/dh_gen_fail.py | block1o1/CryptoPredicted |
from Tkinter import *
import string
# This program shows how to use a simple type-in box
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.entrythingy = Entry()
self.entrythingy.pack()
# and here we get a callback when the u... | [
{
"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 | David and Pooja/++Validating Linked Mods/Python-3.0/Demo/tkinter/matt/bind-w-mult-calls-p-type.py | LinkedModernismProject/web_code |
# @Title: K 个一组翻转链表 (Reverse Nodes in k-Group)
# @Author: 18015528893
# @Date: 2021-02-19 22:23:56
# @Runtime: 48 ms
# @Memory: 15.6 MB
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverse... | [
{
"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 | Problemset/reverse-nodes-in-k-group/reverse-nodes-in-k-group.py | worldwonderer/algorithm |
"""Verbs ported from r-stats"""
from typing import Iterable
from pandas import DataFrame, isna
from pipda import register_verb
from ..core.defaults import NA_REPR
from ..core.grouped import DataFrameGroupBy
@register_verb(DataFrame)
def set_names(obj: DataFrame, names: Iterable[str]) -> DataFrame:
"""Set names ... | [
{
"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 | datar/stats/verbs.py | stjordanis/datar |
import discord
from discord.ext import commands
from arquivo import *
colour = 1015823
class Servers(commands.Cog):
'''Minecraft Servers commands'''
def __init__(self, bot):
self.bot = bot
@commands.command(name = 'servers', help = 'Mostra os servidores disponíveis. !servers')
async de... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | Minecraft Bot/commands/servers.py | KaueGuimaraes/Minecraft-Bot |
''' index '''
from flask import Flask, render_template, redirect, url_for
from .webwarrior import Webwarrior
import pprint
app = Flask(__name__)
app.config.update(dict(
Warrior = Webwarrior(),
DEBUG = True,
))
def format_date(date):
pass
def format_tags(tags):
pass
@app.route("/")
def 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | webwarrior/index.py | blastmaster/webwarrior-task |
from django.test import TestCase
from django.contrib.auth.models import User
from users.forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
class TestForms(TestCase):
def test_user_register_form_valid(self):
form = UserRegisterForm(
data = {
'username' :"user2",
'email' : "user2@email.com",
... | [
{
"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 | users/tests/test_forms.py | EaguaireSama/CodePanda |
from .base import BaseGroup
from .root import RootGroup
import inspect
class ContextManagerGroup(BaseGroup):
"""
A group that gathers tests with a context manager.
"""
def __enter__(self):
self.is_collecting = True
frame = inspect.currentframe(1)
self.spec = RootGroup.from_fram... | [
{
"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 | pspec/groups/contextmanager.py | bfirsh/pspec |
# -*- coding: utf-8 -*-
import sqlalchemy as sa
from sqlalchemy.orm import exc
from sqlalchemy.sql import expression
from h.db import Base
from h.i18n import TranslationString as _
class Blocklist(Base):
"""A list of URIs for which the badge API will always return 0.
This means that the Chrome extension wi... | [
{
"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 | h/badge/models.py | noscripter/h |
import numpy as np
import librosa
from tqdm import tqdm
from audiomisc import ks_key
from constants import VERTICALCUTOFF, FFT_SIZE, FFT_HOP
def stft(x, fft_size, hopsamp):
window = np.hanning(fft_size)
return np.array([np.fft.rfft(window*x[i:i+fft_size])
for i in range(0, len(x)-fft_siz... | [
{
"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 | audiospec.py | MountainRange/mobius_score |
# Copyright 2015 Huawei Technologies India Pvt Ltd.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | [
{
"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 | neutronclient/tests/unit/qos/test_cli20_rule.py | casual-lemon/python-neutronclient |
import simplejson as S
def test_encoding1():
encoder = S.JSONEncoder(encoding='utf-8')
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
s = u.encode('utf-8')
ju = encoder.encode(u)
js = encoder.encode(s)
assert ju == js
def test_encoding2():
u = u'\N{GREEK SMALL LETTER... | [
{
"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 | doc/tutorials/examples/gateways/appengine/demo/simplejson/tests/test_unicode.py | elmordo/Py3AMF |
import datetime
class Session():
def __init__(self, name, description, survey_url):
self.sessionJson = {
"createdTimezone" : "America/New_York",
"allowInSessionInvitees": 'true',
"guestRole": "presenter",
"openChair": 'true',
"sessionExitUrl": s... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | models/Session.py | DanielAlao/Collab-Panopto |
from fabric.api import lcd, local
from fabric.decorators import runs_once
import os
fabfile_dir = os.path.dirname(__file__)
def i18n():
with lcd('readthedocs'):
local('rm -rf rtd_tests/tests/builds/')
local('tx pull')
local('./manage.py makemessages --all')
#local('tx push -s')
... | [
{
"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 | fabfile.py | dbdaryl/readthedocs.org |
from abc import abstractmethod, ABC
from domain.failure_monitor import ControllerFailureMonitor
from utils.constants import UserAction
class IGeneiApp(ABC):
@abstractmethod
def run(self, **config):
pass
class GeneiAppSelenium(IGeneiApp):
def __init__(self, controller):
self.controller ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | app.py | gajoc/indexing-api |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.