source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import pyglet
class Resources:
# --- Player Parameters ---
player_animation_started = False
player_images = []
player_animation_time = 1. / 9.
player_animation_index = 0
# --- Obstacle Parameters ---
obstacle_images = []
# --- Player Methods ---
# loads the images neede... | [
{
"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 | src/dinosaur/game/resources.py | lukDev/dinosaur |
"""
pangocffi.ffi_instance_builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
generates an FFI for pangocffi
"""
from pathlib import Path
from cffi import FFI
from typing import Optional
class FFIInstanceBuilder:
def __init__(self, source: Optional[str] = None):
self.source = source
def generate(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | env/Lib/site-packages/pangocffi/ffi_instance_builder.py | kodelaben/manimce |
from django.contrib.auth.models import BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **kwargs):
"""
Creates and saves a User with the given email and password.
"""
if not email:
raise ValueError('Users must have an emai... | [
{
"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 | libdrf/login/managers.py | lumiqa/libdrf |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py | tasherif-msft/autorest.python |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copy... | [
{
"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 | pylith/topology/Field.py | cehanagan/pylith |
import random
from flask import ( Flask, render_template, jsonify )
app = Flask(__name__)
@app.get('/')
def index():
return render_template('index.html.j2')
@app.get('/api')
def api():
return jsonify({'lucky': random.randrange(1, 100)})
application = app | [
{
"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 | tests/hybrid/flaskapp/application.py | tdesposito/DevPail |
"""
Test for issue 51:
https://github.com/pandas-profiling/pandas-profiling/issues/51
"""
from pathlib import Path
import pandas as pd
import pandas_profiling
import requests
import numpy as np
def test_issue51(get_data_file):
# Categorical has empty ('') value
file_name = get_data_file(
"buggy1.pkl... | [
{
"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/issues/test_issue51.py | javiergodoy/pandas-profiling |
# -*- coding: utf-8 -*-
from pprint import pprint
from scrapy.spiders import SitemapSpider
class HuluSitemap(SitemapSpider):
name = 'hulu_sitemap'
allowed_domains = ['hulu.com']
sitemap_urls = ['https://www.hulu.com/sitemap_index.xml']
def sitemap_filter(self, entries):
for entry in entries:
... | [
{
"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 | tv_guide/tv_guide/spiders/hulu.py | bd/tv_tracker |
import pygame
def scale_image(img, factor):
size = round(img.get_width() * factor), round(img.get_height() * factor)
return pygame.transform.scale(img, size)
def blit_rotate_center(win, image, top_left, angle):
rotated_image = pygame.transform.rotate(image, angle)
new_rect = rotated_image.... | [
{
"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 | sakthiRaceGameFiles/utils.py | sakthiRathinam/sakthiRaceGame |
from django.test import Client, TestCase
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@danoscarmike.com',
... | [
{
"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 | app/core/tests/test_admin.py | danoscarmike/recipe-app-api |
def jeep(merk):
print("Jeep merk "+ merk +" telah terbeli")
def sedan():
print("Sedan telah terbeli") | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | 9 Modul dan Package/Beli/Mobil.py | Rakhid16/pibiti-himatifa-2020 |
from typing import List, Set
class ThroneInheritance:
def __init__(self, kingName: str):
self.names = [kingName]
self.index = {kingName: 0}
self.children: List[List[int]] = [[]]
self.died: Set[int] = set()
def birth(self, parentName: str, childName: str) -> None:
iC = 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 | Algorithms/1600/stack.py | M-Quadra/LeetCode-problems |
# init.py
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
# init SQLAlchemy so we can use it later in our models
db = SQLAlchemy()
def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = '9OLWxND4o83j4K4iuopO'
app.config['SQLALCHEMY_DATABA... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | __init__.py | Pratik2587/Medical-Cost-Predictor- |
from dusk.script import *
from dusk.transpile import callable_to_pyast, pyast_to_sir, validate
def test_math():
validate(pyast_to_sir(callable_to_pyast(math_stencil)))
@stencil
def math_stencil(a: Field[Cell], b: Field[Cell], c: Field[Cell], d: Field[Cell]):
with levels_upward:
a = sqrt(b)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | tests/stencils/test_math.py | Stagno/dusk |
import nesmdb.vgm
import nesmdb.score
def seprsco_to_vgm(seprsco):
exprsco = nesmdb.score.seprsco_to_exprsco(seprsco)
rawsco = nesmdb.score.exprsco_to_rawsco(exprsco)
ndf = nesmdb.score.rawsco_to_ndf(rawsco)
ndr = nesmdb.vgm.ndf_to_ndr(ndf)
vgm = nesmdb.vgm.ndr_to_vgm(ndr)
return vgm
def seprsco_to_wav(se... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | nesmdb/convert.py | youngmg1995/NES-Music-Maker |
import math
import torch
from . import Sampler
from torch.distributed import get_world_size, get_rank
class DistributedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`. In su... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/torch/utils/data/distributed.py | warcraft12321/Hyperfoods |
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@test.fr',
... | [
{
"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 | app/core/tests/test_admin.py | pshop/recipe-app-api |
import numpy as np
from model.indexer_v1 import Indexer
class QueryAnalizer:
def __init__(self, query, document_list, enable_stemming=True, filter_stopwords=True):
self.__query = Indexer([query], enable_stemming=enable_stemming, filter_stopwords=filter_stopwords)
self.__indexer = Indexer(document... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | IndexerQuery/model/QueryAnalizer.py | Llambi/Web_Semantica |
import random
from cereal import log
from selfdrive.hardware.base import HardwareBase
NetworkType = log.DeviceState.NetworkType
NetworkStrength = log.DeviceState.NetworkStrength
class Pc(HardwareBase):
def get_os_version(self):
return None
def get_device_type(self):
return "pc"
def get_sound_card_on... | [
{
"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 | selfdrive/hardware/pc/hardware.py | viraatdas/openpilot |
"""Useful Job for the task queue.
Include this file in the ``task_paths`` list if you need them
"""
import sys
import os
import tempfile
from pq.api import job
@job()
async def execute_python(self, code=None):
"""Execute arbitrary python code on a subprocess. For example:
tasks.queue_task('execute.pyth... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | pq/jobs.py | quantmind/pulsar-queue |
import numpy as np
from qaoa.operators import Kronecker, SumSigmaXOperator, Propagator
class SumSigmaXPropagator(Propagator):
def __init__(self,D,theta=0):
assert( isinstance(D,SumSigmaXOperator) )
self.kronecker = Kronecker(np.eye(2),D.num_qubits(),dtype=complex)
super().__init__(D,th... | [
{
"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 | qaoa/operators/sum_sigma_x_propagator.py | gregvw/pyQAOA |
#!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... | [
{
"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 | tests/test_download.py | iacopoff/climetlab |
from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor
from sklearn.model_selection import cross_val_score
import numpy as np
class GradientBoosting:
def __init__(self, x_train, y_train, problemtype = 'regression', cv = 5):
self.x_train = x_train
self.y_train = y_train
... | [
{
"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 | Algorithms/GradientBoosting/GradientBoosting.py | VireshDhawan/Data-Science-Templates |
# coding: utf-8
from __future__ import unicode_literals
from django.contrib import admin
from .models import ThumbnailOption
from django.contrib.admin.widgets import AdminFileWidget
@admin.register(ThumbnailOption)
class ThumbnailOptionAdmin(admin.ModelAdmin):
fields = ['source', 'alias', 'options']
class Thu... | [
{
"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 | easy_thumbnails_admin/admin.py | Apkawa/easy-thumbnails-admin |
import chainer
import numpy as np
from chainerrl.agents import a3c
from chainerrl import links
from chainerrl import misc
from chainerrl.optimizers import rmsprop_async
from chainerrl import policy
from chainerrl import v_function
from chainerrl.wrappers import atari_wrappers
from chainerrl_visualizer import launch_v... | [
{
"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 | examples/a3c_breakout/main.py | Ravie403/chainerrl-visualizer |
"""Route to all channels"""
import requests
from common.config import constants
from server import endpoints, errors
def get(handler, parameters, url_parameters, *ids_parameters):
"""GET method"""
headers = {"Authorization": "Bot " + constants.BOT_TOKEN}
try:
r = requests.get(endpoints.DISCORD_GU... | [
{
"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 | backend/server/routes/api/v1/discord/guilds/channels/all.py | NezzarClp/Tosurnament |
import re
from mail_app.mail import Mail
from mail_app.mail_processors.abstract_processor import AbstractProcessor
from mail_app.processed_mail import ProcessedMail
class PasswordProcessor(AbstractProcessor):
general_keywords = ["password (reset|request|update|updated)", "(new|reset|change|updated|changed your) ... | [
{
"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 | mail_app/mail_processors/password_processor.py | teamsaucisse/Data-Mailing |
import pytest
def pytest_addoption(parser):
parser.addoption(
"--hide-torch",
action='store_true',
default=False,
help="Run tests hiding torch."
)
def pytest_configure(config):
config.addinivalue_line("markers", "hide_torch: mark test as hiding torch")
def pytest_collec... | [
{
"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 | deepnog/utils/tests/conftest.py | alepfu/deepnog |
"""
FieldOverride that forces Show Answer values that use Past Due logic to
new Show Answer values that remove the Past Due check (keeping the rest intact)
"""
from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.cap... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/features/personalized_learner_schedules/show_answer/show_answer_field_override.py | osoco/better-ways-of-thinking-about-software |
from rcrs_core.commands.Command import Command
from rcrs_core.worldmodel.entityID import EntityID
from rcrs_core.connection import URN
from rcrs_core.connection import RCRSProto_pb2
class AKTell(Command):
def __init__(self, agent_id: EntityID, time: int, message: str) -> None:
super().__init__()
... | [
{
"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 | rcrs_core/commands/AKTell.py | roborescue/rcrs-core-python |
"""
With classes, we have a problem with heritage. Note that for standard functions
(like sum_arrays), we actually also have the problem with monkey patching.
We can just say that monkey patching of `sum_arrays` is not supported (so that
`sum_arrays` can be treated as a Pythran function, and potentially inlined) but
f... | [
{
"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 | doc/examples/not_implemented/pythran_class_with_calls.py | fluiddyn/fluidpythran |
from confd_gnmi_adapter import GnmiServerAdapter
class GnmiNetconfServerAdapter(GnmiServerAdapter):
@classmethod
def get_adapter(cls):
pass
def set(self, prefix, path, val):
pass
def get_subscription_handler(self, subscription_list):
pass
def capabilities(self):
... | [
{
"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 | confdgnmi/src/confd_gnmi_netconf_adapter.py | micnovak/ConfD-Demos |
import sqlite3
class DB:
def __init__(self, db, memory=False):
if not db.endswith('.db'):
db += '.db'
self.conn = sqlite3.connect(db)
if memory:
memory_db = sqlite3.connect(':memory:')
db_dump = "".join(line for line in self.conn.iterdump())
... | [
{
"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 | svdb/database.py | khurrammaqbool/SVDB |
import os
import sys
from csv import reader
class FileParser:
def __init__(self, file_path):
# Load file
filename, extension = os.path.splitext(file_path)
# Check for correct file format
if extension != '.txt':
print('Invalid file type, must be .txt with one query per l... | [
{
"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/file_parser.py | gldgrnt/twitter-search-scraper |
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
class Module(QtCore.QObject):
# User-readable name for this module
moduleDisplayName = None
# Override this class attribute to have this module appear
# under different category sections in the manager window's module list
moduleCategory = None
... | [
{
"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 | acq4/modules/Module.py | ablot/acq4 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Artem Glebov
import sys
import transmissionrpc
__settings__ = sys.modules[ "__main__" ].__settings__
def get_settings():
params = {
'address': __settings__.getSetting('rpc_host'),
'port': __settings__.getSetting('rpc_port'),
'user': __settings_... | [
{
"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 | resources/lib/common.py | torstehu/Transmission-XBMC |
# -*- coding: UTF-8 -*-
"""
Author:wistn
since:2020-06-11
LastEditors:Do not edit
LastEditTime:2020-10-06
Description:
"""
class DbApi:
@classmethod
def isFaved(cls, book):
return False
@classmethod
def logBID(cls, source, bookKey, bookUrl):
# if (
# db.existsSQL('SELECT *... | [
{
"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 | sited_py/lib/org_noear_siteder_dao_db_DbApi.py | wistn/sited_py |
#!/usr/bin/env python3
"""
classification type (books.py)
"""
from enum import Enum
from typing import Dict
class BookType(Enum):
"""
Enum to store nlp types
"""
dostoyevsky = "dostoyevsky"
doyle = "doyle"
austen = "austen"
class StartEnd:
"""
start and end lines for book
"""
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | assignment1/src/books.py | jschmidtnj/cs584 |
from datetime import datetime
from api import utils
from exchanges.exchange import Exchange
from strategies.strategy import Strategy
class Runner(Strategy):
def __init__(self, exchange: Exchange, timeout=60, *args, **kwargs):
super().__init__(exchange, timeout, *args, **kwargs)
self.buy_price = 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 | strategies/runner.py | Guillerbr/cryptobot |
import re
import smtplib
from email.message import EmailMessage
from email.mime.text import MIMEText
from typing import Union
from pywhatkit.core.exceptions import UnsupportedEmailProvider
def send_mail(
email_sender: str,
password: str,
subject: str,
message: Union[str, MIMEText],
email_receiver... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | pywhatkit/mail.py | Ankit404butfound/PyWhatK |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... | [
{
"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 | test/test_firmware_cifs_server_all_of.py | sdnit-se/intersight-python |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_cond_format06.py | eddiechapman/XlsxWriter |
"""An example of jinja2 templating"""
from bareasgi import Application, HttpRequest, HttpResponse
import jinja2
import pkg_resources
import uvicorn
from bareasgi_jinja2 import Jinja2TemplateProvider, add_jinja2
async def http_request_handler(request: HttpRequest) -> HttpResponse:
"""Handle the request"""
r... | [
{
"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 | examples/example1.py | rob-blackbourn/bareasgi-jinja2 |
# -*- coding: utf-8 -*-
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .models import OembedVideoPlugin, OembedRichPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class CMSOembedVideoPlugin(CMSPluginBase):
name = _('Video (emb... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | djangocms_oembed/cms_plugins.py | MatthewWilkes/djangocms-oembed |
import networkx as nx
import numpy as np
import torch
from torch.utils.data import Dataset
from dsloader.util import kron_graph, random_binary, make_fractional
class KroneckerDataset (Dataset):
def __init__(self, kron_iter=4, seed_size=4, fixed_seed=None, num_graphs=1, perms_per_graph=256, progress_bar=False):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | src/dsloader/kronecker.py | willshiao/brgan |
"""Services module."""
class ConfigService:
def __init__(self, config):
self._config = config
def build(self):
self._config.from_dict({"default": {"db_path": "~/test"}})
| [
{
"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 | examples/miniapps/application-multiple-containers-runtime-overriding/example/services.py | YelloFam/python-dependency-injector |
class AppTestAtexit:
def test_args(self):
import atexit
import io
import sys
stdout, stderr = sys.stdout, sys.stderr
try:
sys.stdout = sys.stderr = capture = io.StringIO()
def h1():
print("h1")
def h2():
pri... | [
{
"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 | pypy/module/atexit/test/test_atexit.py | yxzoro/pypy |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | kubernetes_asyncio/test/test_v1_persistent_volume_claim_list.py | aK0nshin/kubernetes_asyncio |
# -*- coding: utf-8 -*-
from mollusc.dist import Twine
class TestTwine(object):
def test_register_command(self):
twine = Twine(username='registrar', password='reg1strar')
assert twine.get_command('register', 'package.whl', {'-c': 'test register'}) == [
'twine',
'register',
... | [
{
"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 | test/test_dist.py | bachew/mollusc |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates and saves a new user"""
if not email:
raise ValueEr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | app/core/models.py | hm289/recipe-app-api |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from habitat.core.registry import registry
from habitat.core.simulator import Simulator
def _try_register_igibson_socia... | [
{
"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 | habitat/sims/igibson_challenge/__init__.py | qianLyu/habitat-lab |
class Graph:
def __init__(self, vertexes: int) -> None:
self.vertexes = vertexes
self.graph = []
def connect(self, u: int, v: int, w: int) -> None:
self.graph.append([u, v, w])
def show(self, distances: list) -> None:
print(distances)
def fordbellman(self, start: int) ... | [
{
"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 | 2 semester/DM/Practics/2022-03-09/FordBellman.py | kurpenok/Labs |
import celery
import logging
import prometheus_client
from .monitor import (
TaskThread,
WorkerMonitoringThread,
EnableEventsThread,
setup_metrics,
)
__all__ = ("CeleryExporter",)
class CeleryExporter:
def __init__(
self,
broker_url,
listen_address,
max_tasks=10000... | [
{
"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 | celery_exporter/core.py | itsx/celery-exporter-experiments |
import numpy as np
from lib.simulation import Simulation
from lib.rule_function import conway_rule
from Conway.lib.neighbourhood import moore_neighbourhood
SIMULATION_SIZE = (100,100)
NUMBER_OF_STEPS = 2
sim = Simulation( SIMULATION_SIZE, conway_rule)
def time_numpy ():
"""
... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | autumn_ca/benchmark.py | goshdarngames/Autumn-CA |
from . import *
class HelloWorldController(AppDevController):
def get_path(self):
return "/hello/"
def get_methods(self):
return ["GET"]
@authorize_user
def content(self, **kwargs):
return {"message": "Hello, world!"}
| [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/app/coursegrab/controllers/hello_world_controller.py | cuappdev/coursegrab-backend |
# Copyright 2019 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
{
"point_num": 1,
"id": "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 | ros2topic/ros2topic/verb/type.py | sunbo57123/ros2cli_common_extension |
from typing import *
import torch.nn as nn
import torch.optim as optim
from models.LitBase import LitBase
from .models import AlexNet
class LitAlexNet(LitBase):
def __init__(self, args: Dict[str, Any]):
super().__init__()
self.save_hyperparameters(args)
self.model = AlexNet(
... | [
{
"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 | models/AlexNet/lightning_model.py | zkdlfrlwl2/Classification-For-Everyone |
"""Symbolic quaterion operations, dynamics and rotations."""
import numpy as np
import sympy
def derivative(quat, omega, renorm_gain=0):
[q0, q1, q2, q3] = quat
[p, q, r] = omega
err = 1 - (q0**2 + q1**2 + q2**2 + q3**2)
q0dot = -0.5 * (p*q1 + q*q2 + r*q3) + renorm_gain*err*q0
q1dot = -0.5 * (-p... | [
{
"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 | ceacoest/modelling/symquat.py | dimasad/ceacoest |
import numpy as np
def train_ml_squarer() -> None:
print("Training!")
def square() -> int:
"""Square a number...maybe"""
return np.random.randint(1, 100)
if __name__ == '__main__':
train_ml_squarer() | [
{
"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 | packaging/squarer/ml_squarer.py | g-nightingale/tox_examples |
# Copyright 2016 Citrix Systems
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
{
"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 | os_xenapi/client/exception.py | mail2nsrajesh/os-xenapi |
import os
from time import gmtime, strftime
DEBUG=0
INFO=1
WARN=2
ERROR=3
LEVEL = DEBUG
_idx2str = ['D', 'I', 'W', 'E']
get_logger = lambda x:Logger(x)
class Logger():
def __init__(self, name='') -> None:
self.name = name
if self.name != '':
self.name = '[' + self.name + ']'
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | src/utils/logger.py | Frozenmad/MetaDelta |
'''
Created on 15 Sep 2017
@author: gavin
'''
from .basehandler import TcpHandler
class netbios(TcpHandler):
NAME = "NetBIOS Session"
DESCRIPTION = '''Responds to NetBIOS session requests. To be used along side SMB handler.'''
CONFIG = {}
def __init__(self, *args):
'''
Constructor... | [
{
"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 | src/catcher/handlers/netbios.py | gavin-anders/callback-catcher |
# Copyright 2019 Google LLC. 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 required by applicable law or a... | [
{
"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 | tfx/benchmarks/tft_benchmark_chicago_taxi.py | avelez93/tfx |
import requests
from ebooks.provider.ebook import Ebook
from ebooks.provider.ebook_provider import EbookProvider
class WereadEbookProvider(EbookProvider):
def __init__(self):
self.url = 'https://weread.qq.com/web/search/global?' \
'keyword={}&maxIdx={}&count=20'
def get_ebooks(self... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | ebooks/provider/weread.py | Frederick-S/ebooks-api |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
import asyncio
import pytest
import logging
import json
from utils import get_random_dict
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.INFO)... | [
{
"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 | device_e2e/aio/test_c2d.py | anthonyvercolano/azure-iot-sdk-python |
from typing import Match
import cv2 as cv
import numpy as np
from numpy.core.fromnumeric import ndim
'''
In this module, i will implement motion tracking with contour detection and contour drawing.
'''
def histOfObjects(objects = []) :
'''
Calculate the histograms of input objects.
'''
objHists = []
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (ex... | 3 | src_cam/track_object.py | Pecneb/RaspberryPI |
class Spam:
def eggs(self):
assert False
def eggs_and_ham(self):
assert False
| [
{
"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 | python/testData/create_tests/create_tst_class.expected_pytest_3k.py | tgodzik/intellij-community |
from discord.ext import commands
import discord
class EphemeralCounterBot(commands.Bot):
def __init__(self):
super().__init__()
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
# Define a simple View that gives us a counter button
clas... | [
{
"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 | examples/views/ephemeral.py | NextChai/discord.py |
from sys import stderr
from time import sleep
stderr.write("loading... ")
def test__stderr__1():
sleep(0.25)
stderr.write("Spoon!\n")
def test__stderr__2():
sleep(0.25)
stderr.write("Kilroy was here.\n")
assert False
stderr.write("done\n")
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | spikes/pytest/testdata/example/stderr_test.py | sjansen/mecha |
"""Add ON DELETE CASCADE to task parents and owners
Revision ID: d16c2ebe90cc
Revises: 52729177a07c
Create Date: 2017-05-21 14:11:15.173492
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd16c2ebe90cc'
down_revision = '52729177a07c'
branch_labels = None
depend... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | migrations/versions/d16c2ebe90cc_on_delete_cascade.py | toastwaffle/LiME |
from __future__ import absolute_import, unicode_literals
import os
from django.core.exceptions import ImproperlyConfigured
def get_env(name, default=None):
"""Get the environment variable or return exception"""
if name in os.environ:
return os.environ[name]
if default is not None:
retur... | [
{
"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 | {{cookiecutter.project_name}}/src/core/settings/__init__.py | techquila/Wagtail-Boilerplate |
from django.db import models
from django.contrib.auth import get_user_model
from django.urls import reverse
# Create your models here.
class Snack(models.Model):
title = models.CharField(max_length=64)
purchaser = models.ForeignKey(get_user_model(), on_delete=models.CASCADE)
description = models.TextField()
... | [
{
"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 | snacks/models.py | anas-abusaif/djangox |
# Copyright (c) 2018 PaddlePaddle Authors. 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 required by appli... | [
{
"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 | python/paddle/fluid/tests/unittests/test_dist_mnist_lars.py | L-Net-1992/Paddle |
from pathlib import Path
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pytest
import ctd
matplotlib.use("Agg")
data_path = Path(__file__).parent.joinpath("data")
def _assert_is_valid_plot_return_object(objs):
if isinstance(objs, np.ndarray):
for el in objs.flat:
... | [
{
"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 | tests/test_plotting.py | CoastalHydrodynamicsLab/python-ctd |
# -*- coding: utf-8 -*-
#import sys
import json
class CinToJson(object):
def __init__(self):
pass
def CinToJson(self):
return self
#def _file_get_contents(self,filename):
# return open(filename).read()
def _find_between(self, s, first, last ):
start = s.index( first ) + len( first )
e... | [
{
"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 | linux/cintojson.py | sqohapoe/CQOSJ_LIU |
from .lib.symengine_wrapper import (
have_mpfr, have_mpc, have_flint, have_piranha, have_llvm,
I, E, pi, oo, zoo, nan, Symbol, Dummy, S, sympify, SympifyError,
Integer, Rational, Float, Number, RealNumber, RealDouble, ComplexDouble,
add, Add, Mul, Pow, function_symbol,
Max, Min, DenseMatrix, Matrix,... | [
{
"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 | symengine/__init__.py | Meldanya/symengine.py |
from datetime import timedelta, date
def req_date(local_date):
if isinstance(local_date, str):
d, m, y = local_date.split('.')
return '{0}-{1}-{2}'.format(y, m, d)
elif isinstance(local_date, date):
return local_date.strftime('%Y-%m-%d')
else:
return local_date
def req_ti... | [
{
"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 | etools/apps/uptime/utils.py | Igelinmist/etools |
import pandas as pd
import os
from constants import LOCAL_PATH, APARTMENTS_FILENAME
def basic_write(df):
df.to_csv(os.path.join(LOCAL_PATH, APARTMENTS_FILENAME))
def basic_read():
return pd.read_csv(os.path.join(LOCAL_PATH, APARTMENTS_FILENAME))
| [
{
"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 | code/handlers/local_handler.py | hfiuza/ApartmentFinder |
import unittest
from .serializers import TweetSerializer
from tweeter.models import Tweet
from django.contrib.auth.models import User
from datetime import datetime
from rest_framework import serializers
class TestUsers(unittest.TestCase):
def test_user_creation(self):
user=User(username='���')
self... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tweeter/tests.py | luabud/tweeter3 |
#!/usr/bin/env python3
#
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Big number routines.
This file is copied from python-bitcoinlib.
"""
import struct
# generic big endian MPI format
def bn_bytes(v, have_ext=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 | test/functional/test_framework/bignum.py | nhoussay/groom |
from flask import render_template
from app import app
@app.errorhandler(404)
def page_not_found(e):
return render_template('http404.html'), 404
@app.errorhandler(403)
def page_not_found(e):
return render_template('http403.html'), 403
@app.errorhandler(500)
def page_not_found(e):
return render_template... | [
{
"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 | app/views/errorhandler_views.py | c1c1/network-config-generator |
import vaex
import vaex.ml
import tempfile
import vaex.ml.datasets
features = ['petal_length', 'petal_width', 'sepal_length', 'sepal_width']
def test_pca():
ds = vaex.ml.datasets.load_iris()
pca = vaex.ml.PCA(features=features, n_components=2)
pca.fit(ds)
ds1 = pca.transform(ds)
path = tempfile.m... | [
{
"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 | tests/ml/pipeline_test.py | cyrusradfar/vaex |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(name='hoursmins')
def hoursmins(value):
if value == None or value == "":
return ""
s = int(value) * 60
hours, remainder = divmod(s, 3600)
minutes, seconds = di... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | ft/templatetags/ft_tags.py | xurble/FeedThing |
import logging
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#The background is set with 40 plus the number of the color, and the foreground with 30
#These are the sequences need to get colored ouput
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
def formatter_message(message,... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/log/ColoredFormatter.py | ytyaru/Python.Tsv2HtmlTable.20201022074246 |
import yaml
import os
import pytest
from ..greeter import greet
def read_fixture():
with open(os.path.join(os.path.dirname(__file__),
'fixtures',
'samples.yaml')) as fixtures_file:
fixtures = yaml.load(fixtures_file)
return fixtures
@pytest.mark.pa... | [
{
"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 | ch04packaging/greetings/greetings/test/test_greeter.py | ashnair1/rsd-engineeringcourse |
"""
source - defines and describes a source
"""
from domain.base import Base
class RecursiveFragment(Base):
title = None
lead = None
text = None
fragments = None
def __init__(self, identifier, title, lead=None, text=None, fragments=[]):
super().__init__(identifier)
self.tit... | [
{
"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 | python/domain/document/model/recursive_fragment.py | ICTU/document-as-code |
import matplotlib.pyplot as plt
import numpy as np
light="#FFFCDC"
light_highlight="#FEF590"
mid="#FDED2A"
mid_highlight="#f0dc05"
dark="#EECA02"
dark_highlight="#BB9700"
green="#00FF00"
light_grey="#DDDDDD"
def is_sorted(a):
'''Check if numpy 1d-array is sorted
'''
return np.all(a[:-1] <= a[1:])
def ribb... | [
{
"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 | Data Analytics/Utilities/DA_tools.py | rafalmularczyk/public_lectures |
# -*- coding: utf-8 -*-
# @Time : 2019/3/19 0019 16:25
# @Author : __Yanfeng
# @Site :
# @File : search_indexes.py
# @Software: PyCharm
from haystack import indexes
from .models import Post
class PostIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=Tru... | [
{
"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 | blog/search_indexes.py | GITliyanfeng/blog-django |
def root(classes):
"""get all root classnames
"""
return [c for c in classes if c.startswith("h-")]
def properties(classes):
"""get all property (p-*, u-*, e-*, dt-*) classnames
"""
return [c.partition("-")[2] for c in classes if c.startswith("p-")
or c.startswith("u-") or c.starts... | [
{
"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 | mf2py/mf2_classes.py | kevinmarks/mentiontech |
from __future__ import unicode_literals
import datetime
from chatterbot.input import InputAdapter
from chatterbot.conversation import Statement
class Mailgun(InputAdapter):
"""
Get input from Mailgun.
"""
def __init__(self, **kwargs):
super(Mailgun, self).__init__(**kwargs)
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | venv/lib/python3.6/site-packages/chatterbot/input/mailgun.py | HackBots1111/flask-server-bot |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Copyright (c) Megvii, Inc. and its affiliates.
import os
import torch.nn as nn
from yolox.exp import Exp as MyExp
class Exp(MyExp):
def __init__(self):
super(Exp, self).__init__()
self.depth = 0.33
self.width = 0.25
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | exps/default/nano.py | itec-hust/MusicYOLO |
class mystr():
def get_string(self):
self.s=input("Enter the string")
def pr_string(abc):
val=abc.s
print(val.upper())
p=mystr()
p.get_string()
p.pr_string()
| [
{
"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 | pythonclass.py | bjoffficial/Python |
import os
import pickle
import json
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
def scatterplot(attribute_idx, table, epsilons, label, ax):
ys = []
xs = []
for eps in epsilons:
row = table[eps]
y = row[attribute_idx]
ys.append(y)
xs.ap... | [
{
"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 | vis/create_attributes_experiment_plot.py | johnmartinsson/adversarial-representation-learning |
from invoke import task
@task
def clean(ctx):
"""Remove virtual environement"""
ctx.run("pipenv --rm", warn=True)
@task
def init(ctx):
"""Install production dependencies"""
ctx.run("pipenv install --deploy")
@task
def init_dev(ctx):
"""Install development dependencies"""
ctx.run("pipenv in... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tasks/env.py | Lee-W/pycontw-postevent-report-generator |
import os
from subliminal import download_best_subtitles, save_subtitles
from subliminal.video import Episode
from subliminal.core import search_external_subtitles
from babelfish.language import Language
class Subtitler:
def __init__(self, languages, providers):
self.languages = languages
self.... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | back/fs/subtitler.py | rkohser/gustaf2 |
import unittest
"""
1.5 One Away
There are three types of edits that can be performed on
strings: insert a character, remove a character, or
replace a character. Given two strings, write a function
to check if they are one edit (or zero edits) away.
EXAMPLE
pale, ple -> true
pales, pale -> true
pa... | [
{
"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 | ch01_arrays_and_strings/1.5_one-away.py | appletreeisyellow/cracking-the-coding-interview |
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Concat(function.Function):
"""Concatenate multiple tensors towards specified axis."""
# concat along the channel dimension by default
def __init__(self, axis=1):
self.axis = axis
d... | [
{
"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 | chainer/functions/array/concat.py | ytoyama/yans_chainer_hackathon |
from NewDeclarationInQueue.processfiles.customprocess.text_with_special_ch import TextWithSpecialCharacters
class SearchTextLineParameter:
"""
Defines the parameters to search a line of text in the JSON returned by the Azure service
"""
start_with_text: TextWithSpecialCharacters
contains_wor... | [
{
"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 | NewDeclarationInQueue/processfiles/customprocess/search_text_line_parameter.py | it-pebune/ani-research-data-extraction |
from pymoo.model.problem import Problem
class MyProblem(Problem):
def __init__(self):
super().__init__(n_var=1, n_obj=2, n_constr=0, elementwise_evaluation=True)
def _evaluate(self, x, out, *args, **kwargs):
# print("Evaluation")
s = x[0]
s.eval_fitness()
# print(s.fi... | [
{
"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 | RQ3/Autonomous_robot/AmbieGen_ran/MyProblem.py | dgumenyuk/Environment_generation |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from authentication.socialaccount.tests import OAuth2TestsMixin
from authentication.tests import MockedResponse, TestCase
from .provider import MailRuProvider
class MailRuTests(OAuth2TestsMixin, TestCase):
provider_id = MailRuProvi... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | authentication/socialaccount/providers/mailru/tests.py | vo0doO/pydj-persweb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.