source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from rest_framework import status
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
from accounts import serializers
from rest_framework.serializers import ValidationError
# Create your views here.
from rest_framework.views import APIView
import logging
from accounts.models ... | [
{
"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 | accounts/views.py | Sahil624/insta_auto |
import pandas as pd
def read_csv(filename):
df = pd.read_csv(filename, header=[0, 1])
df.columns = rename_columns(df)
return df
def rename_columns(df):
new_cols = []
for col in df.columns:
if "Unnamed:" in col[0]:
new_cols.append(col[1])
else:
new_cols.app... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | ReadFBRefData.py | hellpoethero/FootballPython |
# coding: utf-8
"""
Senzing REST API
This is the Senzing REST API. It describes the REST interface to Senzing API functions available via REST. It leverages the Senzing native API which is documented at [https://docs.senzing.com](https://docs.senzing.com) # noqa: E501
OpenAPI spec version: 1.6.0
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | test/test_entity_data_api.py | docktermj/senzing-python-rest-client |
from sklearn.base import TransformerMixin
class BollingerBandTransform(TransformerMixin):
def __init__(self, smacolumn="",stdcolumn="",outputname="BBand",deviations=1):
self.smacolumn = smacolumn
self.stdcolumn = stdcolumn
self.cols = [smacolumn,stdcolumn]
self.outputname = outputna... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | mods/BollingerBandTransformer.py | mustyoshi/scikit-ta |
import unittest
import util
TEST_LINE = 'acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf'
class UtilTest(unittest.TestCase):
def test_part1(self):
self.assertEqual(26, util.part1('test_input.txt'))
def test_map_wires(self):
m = util.map_wires(TEST_LINE)
self.as... | [
{
"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 | 08/util_test.py | DylanSalisbury/advent-of-code-2021 |
#GUI con TKinter
#Autor: Javier Arturo Hernández Sosa
#Fecha: 20/Sep/2017
#Descripcion: Curso Python FES Acatlán
from tkinter import *
#Definición de funciones
def suma():
r.set(x.get() + y.get())
def multi():
r.set(x.get() * y.get())
def resta():
r.set(x.get() - y.get())
def dividir():
r.s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | Tkinter/tk5.pyw | Jav10/Python |
from flask import Flask, request, Response, jsonify
from .helpers.request_helper import read_audio
from .helpers.files_helper import clean_files
from .utils.wav_converter import convert_to_wav
from .utils.audio_recognizer import recognize_audio
app = Flask(__name__)
@app.route('/ping')
def ping():
return "I'm ali... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/main.py | doriandres/christine-bot-audio |
"""
Tests to make sure the pytest-repo-health plugin fixtures work correctly.
"""
import os
import pytest
from . import run_checks
GIT_REPO = """
def check_git_repo(git_repo):
assert git_repo.working_tree_dir
def check_git_origin_url(git_origin_url):
assert "/pytest-repo-health" in git_origin_url
"""
NOT_... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | tests/test_fixtures.py | jinder1s/pytest-opynions |
# Copyright 2020 Konstruktor, Inc. 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 la... | [
{
"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 | tethys/bin/cli.py | tethys-platform/tethys |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_button07.py | dthadi3/XlsxWriter |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..arithmetic import AddScalarVolumes
def test_AddScalarVolumes_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True... | [
{
"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 | nipype/interfaces/slicer/filtering/tests/test_auto_AddScalarVolumes.py | sebastientourbier/nipype |
import code
from pprint import pprint
from grouper import models
from grouper.ctl.util import make_session
from grouper.graph import GroupGraph
def shell_command(args):
session = make_session()
graph = GroupGraph.from_db(session)
m = models
pp = pprint
try:
from IPython import embed
... | [
{
"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 | grouper/ctl/shell.py | benjaminp/grouper |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the sy... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | app/user/views.py | akigugale/recipe-app-api |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kubernetes/test/test_v1_daemon_set_spec.py | L3T/python |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 7 12:21:28 2021
@author: user15
"""
from random import choice
counter = 0
def randomize():
jokenpo_value = ['gu', 'choki', 'pa']
machine = choice(jokenpo_value)
return machine
# get input from user
def init_game(counter):
if coun... | [
{
"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 | jokenpo/jokenpo.py | rhoenkelevra/python_simple_applications |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | src/oci/data_labeling_service_dataplane/models/text_dataset_format_details.py | ezequielramos/oci-python-sdk |
import io
import time
import datetime
import requests
import pandas as pd
__all__ =['rating', 'problem_platform']
def rating(date=None):
"""P2peye comprehensive rating and display results.
from https://www.p2peye.com
Args:
date: if None, download latest data, if like '201812', that down... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | tensordata/report/p2peye/_p2peye.py | Hourout/tensordata |
import pytest
from simpy.core import Environment
from common.collector import DataCollector
@pytest.fixture()
def env() -> Environment:
return Environment()
@pytest.fixture()
def dc() -> DataCollector:
return DataCollector()
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | tests/conftest.py | GiovanniZotta/kademlia |
from django.test import TestCase
from oscar.apps.dashboard.reports import forms
class TestReportsForm(TestCase):
def test_date_range_empty(self):
form = forms.ReportForm(data={})
self.assertFalse(form.is_valid())
def test_date_range_complete(self):
form = forms.ReportForm(data={
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | tests/integration/dashboard/test_reports_form.py | QueoLda/django-oscar |
"""create gc_data_file_staging
Revision ID: a2daa4fb5658
Revises: a2424db07997
Create Date: 2021-09-29 11:35:50.653184
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a2daa4fb5658'
down_revision = 'a2424db07997'
branch_labels = None
depends_on = None
def upgr... | [
{
"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 | rdr_service/alembic/versions/a2daa4fb5658_create_gc_data_file_staging.py | all-of-us/raw-data-repository |
"""
Module with SQLite helpers, see http://flask.pocoo.org/docs/0.12/patterns/sqlite3/
"""
import logging
import threading
from contextlib import contextmanager
from psycopg2 import pool, extras
from constants import SCHEMA_PATH, POSTGRES_DSN
logger = logging.getLogger(__name__)
class DBPool:
_lock = threadin... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | server/app/database.py | jalaka/S4DFarm |
# coding: utf-8
"""
Onfido API
The Onfido API is used to submit check requests. # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import onfido
from onfido.models.report_option import ReportOption # n... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | test/test_report_option.py | roverdotcom/onfido-api-python-client |
from __future__ import division, absolute_import, print_function
from numpy.testing import *
import numpy.distutils.fcompiler
g77_version_strings = [
('GNU Fortran 0.5.25 20010319 (prerelease)', '0.5.25'),
('GNU Fortran (GCC 3.2) 3.2 20020814 (release)', '3.2'),
('GNU Fortran (GCC) 3.3.3 20040110 (prerel... | [
{
"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 | numpy/distutils/tests/test_fcompiler_gnu.py | RittaNarita/numpy |
import json
import os
from tempfile import mkstemp
import pytest
from guillotina import testing
from guillotina.commands import get_settings
from guillotina.commands.run import RunCommand
DATABASE = os.environ.get('DATABASE', 'DUMMY')
def test_run_command(command_arguments):
_, filepath = mkstemp(suffix='.py')... | [
{
"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 | guillotina/tests/test_commands.py | diefenbach/guillotina |
import hashlib
from apps.mood_groups.models import MoodGroup, UserMoodGroup
from apps.users.models import User
class InitTestData(object):
def __init__(self):
self.OAUTH2_CLIENT_KEY = None
def create_user(self,
username: str = 'test_user',
name: str = 'test_n... | [
{
"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 | today_mood/tests/init_data.py | 5boon/backend |
from django.core.exceptions import ObjectDoesNotExist
from django.http import JsonResponse
from rest_framework import status, permissions
from rest_framework.decorators import api_view, permission_classes
from task.models import TaskModel, Status
from worker import WORKER_LIST
from worker.settings import NEW_TASK_EVEN... | [
{
"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 | task/views.py | soltanoff/dj_task_queue |
from django import forms
from django.forms.models import inlineformset_factory
from cruditor.forms import CruditorFormsetFormMixin, CruditorFormsetMixin
from examples.store.models import Person, RelatedPerson
class DummyForm(CruditorFormsetFormMixin, forms.ModelForm):
class Meta:
model = RelatedPerson
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | tests/test_forms.py | fpoulain/django-cruditor |
# Copyright (c) 2018 Dow Jones & Company, Inc.
#
# 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... | [
{
"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 | sast_controller/drivers/connect_utils.py | dovbiyi/reapsaw |
# coding=utf-8
import logging
from werkzeug import exceptions as exc
from flask import g
from app.extends.flask import (
Namespace,
MethodView
)
from app import schemas
from app.services import PetService
pet_ns = Namespace('pet', __name__)
@pet_ns.route('/pet', methods=['POST'])
class PetCreator(MethodVie... | [
{
"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 | app/routes/pet.py | nkthanh98/flask-seed |
from django.contrib.auth import authenticate, login
from rest_framework import serializers
from .models import User
# LOGIN------------------------------------------------------------------------
def get_and_authenticate_user(email,password):
user = authenticate(username=email, password=password)
if user is 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | smart_shop/user/utils.py | hammott/django-shop-practice |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 26/10/2014
@author: Vagner Clementino
@summary: Classe que gerencia o lançamento de exceção para todo o software
@version: 0.9
'''
from control_asfbugscaper.LogManager import LogManager
class ASFBugScraperError(Exception):
'''
Classe para gere... | [
{
"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 | asf_bug_scraper/src/control_asfbugscaper/ASFBugScraperError.py | vagnerclementino/projeto_sqm |
# Let there be a binary operation for 3 symbols a, b, c and result of these binary operation given in a table.
# Given an expression of these 3 symbols and a final result, tell if this expression can be parenthesize in certain
# way to produce the final result.
class Holder(object):
def __init__(self):
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 | python/dynamic/symbolexpressionevaluation.py | slaveuser/interview20160430 |
import sys
sys.path.append('.')
import app.models
def suite_setup():
app.models.destroy_db()
app.models.setup_db()
def suite_teardown():
app.models.destroy_db()
| [
{
"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/test_setup.py | anjali-92/tuesday |
from menpodetect.ffld2 import load_ffld2_frontal_face_detector
import menpo.io as mio
takeo = mio.import_builtin_asset.takeo_ppm()
def test_frontal_face_detector():
takeo_copy = takeo.copy()
ffld2_detector = load_ffld2_frontal_face_detector()
pcs = ffld2_detector(takeo_copy, threshold=2)
assert len(p... | [
{
"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 | menpodetect/tests/ffld2_test.py | jabooth/menpodetect |
# 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | test/test_x509_certificate_all_of.py | sdnit-se/intersight-python |
# Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import typing
from typing import TYPE_CHECKING, Callable, Type
import pytest
from composer.datasets.dataset_hparams import DataLoaderHparams
from composer.trainer import Trainer
from composer.trainer.... | [
{
"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/trainer/test_trainer_hparams.py | moinnadeem/composer |
# coding=utf-8
# Copyright (c) DIRECT Contributors
import argparse
import pathlib
import sys
from direct.types import FileOrUrl, PathOrString
from direct.utils.io import check_is_valid_url
def is_file(path):
path = pathlib.Path(path)
if path.is_file():
return path
raise argparse.ArgumentTypeErro... | [
{
"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 | direct/cli/utils.py | NKI-AI/direct |
#
# 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 writing, software
# distributed under t... | [
{
"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 | neutron/extensions/router_availability_zone.py | mrwukang/neutron |
from tests.package.test_lua import TestLuaBase
class TestLuaLuaGD(TestLuaBase):
config = TestLuaBase.config + \
"""
BR2_PACKAGE_LUA=y
BR2_PACKAGE_LUA_GD=y
BR2_PACKAGE_FONTCONFIG=y
BR2_PACKAGE_JPEG=y
BR2_PACKAGE_LIBPNG=y
"""
def test_run(self):
s... | [
{
"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 | buildroot/support/testing/tests/package/test_lua_gd.py | bramkragten/operating-system |
from . import Entity
class Meet(Entity):
"""A meet represents a collection of races occurring at a given track on a given date"""
def __str__(self):
return '{track} on {date:%Y-%m-%d}'.format(track=self['track'], date=self['date'].astimezone(self.provider.local_timezone))
@property
def has_... | [
{
"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 | racing_data/meet.py | predictive-punter/racing_data |
"""
Support for ISY994 lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/isy994/
"""
import logging
from homeassistant.components.isy994 import (
HIDDEN_STRING, ISY, SENSOR_STRING, ISYDeviceABC)
from homeassistant.components.light import ATTR_B... | [
{
"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 | homeassistant/components/light/isy994.py | beschouten/home-assistant |
import nose
import itertools
import numpy as np
from climin import Sbfgs
from losses import Quadratic, LogisticRegression, Rosenbrock
@nose.tools.nottest
def test_sbfgs_quadratic():
obj = Quadratic()
opt = Sbfgs(obj.pars, obj.f, obj.fprime)
for i, info in enumerate(opt):
if i > 50:
... | [
{
"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_sbfgs.py | tjsongzw/climin |
# -*- coding: utf-8 -*-
# dict_conv.py (Python3 script)
import sys
ENC_UTF16_BE = 1
ENC_UTF16_LE = 2
def add_char(enc, s, c):
if enc == ENC_UTF16_BE:
s += "\\x00"
s += c
if enc == ENC_UTF16_LE:
s += "\\x00"
return s
def conv(enc, s):
n = len(s)
r = ""
i = 0
while i < n:
c = s[i]
i... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | harnesses/dict_conv.py | ujjwalsh/oniguruma |
# Copyright 2015 PerfKitBenchmarker 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": "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 | perfkitbenchmarker/linux_packages/libpng.py | xiaolihope/PerfKitBenchmarker-1.7.0 |
# Python3
def diffOne(a, b):
count = 0
for i in range(len(a)):
if a[i] != b[i]:
count += 1
if count == 2:
return False
return bool(count)
def func(inputArray, curr):
if len(inputArray) == 1:
return diffOne(inputArray[0], curr)
for i in range(len(inpu... | [
{
"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 | Codefights/arcade/intro/level-7/33.stringsRearrangement/Python/solution1.py | RevansChen/online-judge |
# This is not actually my code
# You can check https://www.youtube.com/playlist?list=PLgCYzUzKIBE_dil025VAJnDjNZHHHR9mW
# I used this course to build my account app
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import authenticate
from account.models import A... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | account/forms.py | AngeloZan/CodeZone |
from typing import List
from tmtrader.entity.order import BasicOrder, FilledBasicOrder
from tmtrader.entity.trade import Trade
class OrderManager:
def __init__(self):
self.__open_orders: List[BasicOrder] = list()
self.__filled_orders: List[FilledBasicOrder] = list()
# TODO: refactor and ... | [
{
"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 | tmtrader/exchange_for_backtest/order_manager.py | reouno/tomatorader |
"""Tests the module that parses and executes commands."""
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [
{
"point_num": 1,
"id": "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 | tool/tests/clusterfuzz/main_test.py | vngkv123/clusterfuzz-tools |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the sy... | [
{
"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": true
},
{
... | 3 | app/user/views.py | OsamaDaghestani/recipe-app-api |
import pytest
import numpy as np
import torch
from openunmix import transforms
@pytest.fixture(params=[4096, 44100])
def nb_timesteps(request):
return int(request.param)
@pytest.fixture(params=[1, 2])
def nb_channels(request):
return request.param
@pytest.fixture(params=[1, 2])
def nb_sam... | [
{
"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 | tests/test_transforms.py | ParhamYZ/MusicSourceSeparation |
from test.BaseCase import BaseCase
class TestAddSetting(BaseCase):
@BaseCase.login
@BaseCase.grant_access("/setting/add_setting")
def test_ok(self, token):
payload = {
"property": "PROP",
"value": "VALUE",
}
response = self.application.post('/setting/add_... | [
{
"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 | oxe-api/test/resource/setting/test_add_setting.py | CybersecurityLuxembourg/openxeco |
#
# ImageViewCanvasMock.py -- A Ginga image widget with canvas drawing in mock
# widget set
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return ... | 3 | ginga/mockw/ImageViewCanvasMock.py | Cadair/ginga |
import datetime
from .. import db
tags = db.Table(
'post_tags',
db.Column('post_id', db.Integer, db.ForeignKey('post.id')),
db.Column('tag_id', db.Integer, db.ForeignKey('tag.id'))
)
class Post(db.Model):
id = db.Column(db.Integer(), primary_key=True)
title = db.Column(db.String(255), nullable=Fa... | [
{
"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 | Chapter11/webapp/blog/models.py | jayakumardhananjayan/pythonwebtut |
"""
Data Structures shared by both the detectors and the server
"""
import datetime
import sys
import traceback
from typing import *
from dataclasses import dataclass, field
from dataclasses_jsonschema import JsonSchemaMixin
@dataclass
class ConfigMessage(JsonSchemaMixin):
cat_identifiers: Dict[str, str] # servi... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | src/kitbit/protocol.py | jsexauer/kitbit |
import logging
from .property_base import Property_Base
logger = logging.getLogger(__name__)
class Property_Enum(Property_Base):
def __init__(self, node, id, name, settable=True, retained=True, qos=1, unit=None, data_type='enum', data_format=None, value=None, set_value=None):
assert(data_format)
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than cl... | 3 | homie/node/property/property_enum.py | dresber/HomieV3 |
import torch
import torch.nn as nn
import torch.autograd as autograd
import torch.nn.functional as F
class DDQNCnn(nn.Module):
def __init__(self, input_shape, num_actions):
super(DDQNCnn, self).__init__()
self.input_shape = input_shape
self.num_actions = num_actions
self.... | [
{
"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 | algos/models/ddqn_cnn.py | BeylierMPG/Reinforcement-Learning |
# -*- coding: utf-8 -*-
"""Tests for NullTask plugin."""
import unittest
from pomito.plugins.task import nulltask, TaskPlugin
class NullTaskTests(unittest.TestCase):
"""Tests for NullTask."""
def setUp(self):
self.task = nulltask.NullTask(None)
def test_nulltask_is_a_task_plugin(self):
... | [
{
"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 | tests/plugins/task/test_nulltask.py | codito/pomito |
import discord
from discord.commands import CommandPermission, SlashCommandGroup
from discord.ext import commands
bot = discord.Bot(debug_guilds=[...], owner_id=...) # main file
class Example(commands.Cog):
def __init__(self, bot):
self.bot = bot
greetings = SlashCommandGroup("greetings", "Various ... | [
{
"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 | examples/app_commands/slash_cog_groups.py | Vioshim/pycord |
import simpy
from core.cluster import Cluster
from core.scheduler import Scheduler
from core.broker import Broker
from core.simulation import Simulation
class Episode(object):
def __init__(self, machine_configs, task_configs, algorithm, event_file):
self.env = simpy.Environment()
cluster = Cluster... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | playground/Non_DAG_with_Energy_rllib/utils/episode.py | kangyifei/CloudSimPy |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file '_options.ui'
##
## Created by: Qt User Interface Compiler version 6.3.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##################... | [
{
"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 | ui/raw/_options.py | yiguanxianyu/PiGIS |
from test.integration.base import DBTIntegrationTest, use_profile
class TestAliases(DBTIntegrationTest):
@property
def schema(self):
return "custom_aliases_043"
@property
def models(self):
return "models"
@property
def project_config(self):
return {
"macro... | [
{
"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 | test/integration/043_custom_aliases_test/test_custom_aliases.py | tjengel/dbt |
from .base_file import BaseFilePlugin
from ..xnodes import create_xnode, XNode, XDict, XFileError
import yaml
class PluginYaml(BaseFilePlugin):
def def_extensions(self) -> set:
return {'yaml'}
def load(self, content) -> XNode:
if content.strip() == '':
result = XDic... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | xjson/plugins/plugin_yaml.py | mikegribov/filedjson |
# Input: number of iterations L
# number of labels k
# matrix X of features, with n rows (samples), d columns (features)
# X[i,j] is the j-th feature of the i-th sample
# vector y of labels, with n rows (samples), 1 column
# y[i] is the label (1 or 2 ... or k) of the i-th samp... | [
{
"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 | HW3/ratingprank.py | miguel-mzbi/MachineLearning-DataMining |
import insightconnect_plugin_runtime
from .schema import AddAttributeInput, AddAttributeOutput
# Custom imports below
class AddAttribute(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="add_attribute",
description="Add an attri... | [
{
"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 | plugins/misp/komand_misp/actions/add_attribute/action.py | JaredAllen13/insightconnect-plugins |
def encoded_from_base10(number, base, digit_map):
'''
This function returns a string encoding in the "base" for the the "number" using the "digit_map"
Conditions that this function must satisfy:
- 2 <= base <= 36 else raise ValueError
- invalid base ValueError must have relevant information
- di... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | Session03_Numeric Types - I/session3_assignment.py | abdksyed/EPAi |
class Settings():
"""存储《外星人入侵》的所有设置"""
def __init__(self):
"""初始化静态设置"""
# 屏幕设置
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
# 飞船的设置
self.ship_limit = 3
# 子弹设置
self.bullet_width = 500
self.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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | settings.py | GalileoL/GalileoL-Alien__Invasion |
from .scrape_objects_MVP import get_attributes, get_id
from pymongo import MongoClient
import os
DB_URL = os.environ['DB_URL']
CLIENT = MongoClient(DB_URL)
DB = CLIENT.compurator
PRODUCTS_COLLECTION = DB["products"]
def check_product_exists(url):
'''
:param url: url of amazon product
:return: false if pr... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | backend/scrape_amazon/update_product_db_amazon.py | jayleenli/the-legend-of-compurator |
# LEGB rule: Local Enclosing Global Built-in
name = 'global'
def enclosing():
name = 'enclosing'
def local():
global name # bring name from global namespace into local
#nonlocal name # bring name from enclosing namespace into local
name = 'local'
print(f'enclosing name: ... | [
{
"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 | general/scoping.py | bpuderer/python-snippets |
def can_build(env, platform):
# Thirdparty dependency OpenImage Denoise includes oneDNN library
# and the version we use only supports x86_64.
# It's also only relevant for tools build and desktop platforms,
# as doing lightmap generation and denoising on Android or HTML5
# would be a bit far-fetche... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | modules/denoise/config.py | gw2cc/godot |
from . import db
from flask_login import UserMixin
class User(db.Model, UserMixin):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(150), nullable=False)
email = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(15... | [
{
"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 | website/models.py | Fbossio/Contacts |
import pyperclip #for copying and pasting to our clipboard
class User:
'''
Create class that generates new instances of users.
'''
user_list = []
def __init__(self, username, password):
'''
Method that defines the properties of a user.
'''
... | [
{
"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 | user.py | SophieO1970/Password-Locker |
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def static_fullpath(request, path):
protocol = 'https://' if request.is_secure() else 'http://'
host = request.get_host()
static_url = settings.STATIC_URL
return protocol + host + static_ur... | [
{
"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 | workflows/templatetags/fullpath.py | xflows/clowdflows-backend |
"""
pygments.filter
~~~~~~~~~~~~~~~
Module that implements the default filter.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
def apply_filters(stream, filters, lexer=None):
"""
Use this method to apply an itera... | [
{
"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 | TimeWrapper_JE/venv/Lib/site-packages/pygments/filter.py | JE-Chen/je_old_repo |
"""reindex_outcomes
Revision ID: 61a1763b9c8d
Revises: 340d5cc7e806
Create Date: 2019-08-09 12:47:22.165013
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "61a1763b9c8d"
down_revision = "340d5cc7e806"
branch_labels = ()
depends_on = None
def upgrade():
#... | [
{
"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 | zeus/migrations/61a1763b9c8d_reindex_outcomes.py | conrad-kronos/zeus |
# coding: utf-8
"""
Healthbot APIs
API interface for Healthbot application # noqa: E501
OpenAPI spec version: 1.0.0
Contact: healthbot-hackers@juniper.net
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagge... | [
{
"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 | docs/jnpr_healthbot_swagger/test/test_rule_schema_sensor.py | dmontagner/healthbot-py-client |
# coding: utf-8
"""
Pythonの数学演算子についてのサンプルです。
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
# ---------------------------------------
# 加算
# ---------------------------------------
pr('add',... | [
{
"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 | trypython/basic/others/mathoperators01.py | devlights/try-python |
"""This module contains the HelpCommandHandler class."""
from telegram import Update
from telegram.ext import CommandHandler, CallbackContext
import utils.helper as helper
class HelpCommandHandler(CommandHandler):
"""Handler for /help command"""
def __init__(self):
CommandHandler.__init__(self, "hel... | [
{
"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 | ongabot/handler/helpcommand.py | walkerjens/telegram.ongabot |
"""Shows some basic dispatch examples."""
# Local package imports
from lhrhost.messaging.dispatch import Dispatcher
from lhrhost.messaging.presentation import Message, MessagePrinter
def print_dispatcher(dispatcher):
"""Print some deserializations."""
messages = [
Message('e', 123),
Message('... | [
{
"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 | lhrhost/tests/messaging/dispatch/dispatch.py | ethanjli/liquid-handling-robotics |
# 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 writing, software
# distributed under th... | [
{
"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 | clients/python/marquez_client/models.py | aridwiprayogo/marquez |
from kopf.structs.credentials import VaultKey, ConnectionInfo
def test_key_as_string():
key = VaultKey('some-key')
assert isinstance(key, str)
assert key == 'some-key'
def test_creation_with_minimal_fields():
info = ConnectionInfo(
server='https://localhost',
)
assert info.server == ... | [
{
"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 | tests/authentication/test_connectioninfo.py | pawelkopka/kopf |
from typing import List
from aiogram.types import Message, BotCommand
from app.misc.command_description import CommandDescription
def register_main_group_start(storage: List[CommandDescription]):
async def cmd_help(message: Message):
help_message = "".join(f"/{command.command} - {command.description}\n" f... | [
{
"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 | app/handlers/main_group_start.py | TheBoysCoding/sandworm-bot |
from tools import *
import torch
import numpy as np
import sys
charcnn = torch.load('/var/www/html/flaskapp/charcnn.pth')
charcnn.train(False)
def predict(name):
from torch.autograd import Variable
name = encode_input(name)
name = Variable(torch.from_numpy(name).float())
name = name.view(1,-1,max_na... | [
{
"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 | flaskapp/namecnn.py | csgwon/dl-pipeline |
import click
from flask.cli import FlaskGroup
from app import app, db
@click.group(cls=FlaskGroup, create_app=lambda: app)
def cli():
"""Management script for the flask application."""
@cli.command()
def init_db():
"""Creates database tables"""
db.create_all()
@cli.command()
def delete_db():
"""De... | [
{
"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 | script.py | baluyotraf/flask-basic |
# -*- coding: utf-8 -*-
# Copyright (c) 2021-2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
{
"point_num": 1,
"id": "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 | neural_compressor/ux/utils/yaml_utils.py | intel/neural-compressor |
import importlib
import logging
from zygoat.constants import Phases, Projects
from zygoat.components import Component
from zygoat.config import yaml
from . import resources
log = logging.getLogger()
file_name = 'docker-compose.yml'
class DockerCompose(Component):
def _dump_config(self, data):
with open(... | [
{
"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 | zygoat/components/backend/docker_compose.py | Ian-MacLeod/zygoat |
import unittest
from vi_cleaner.vi_cleaner import ViCleaner
class Test_Intergration(unittest.TestCase):
def setUp(self) -> None:
self.cleaner = ViCleaner("")
self.letter_cases = [
("đồng - kim lại quý", "đồng - kim lại quý"),
("đồng-kim lại quý", "đồng kim lại quý"),
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_intergration.py | CodeLinkIO/Vietnamese-text-normalization |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import u... | [
{
"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 | kubernetes_asyncio/test/test_v1beta1_role_list.py | olitheolix/kubernetes_asyncio |
from abc import ABC,abstractmethod
class A(ABC):
def sides(self):
pass
class B (A):
def sides(self):
print(("Triangle have three sides"))
obj1 = B()
obj1.sides() | [
{
"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 | Python/AnujGupta/abstraction.py | lakhan098/Technocrats-HacktoberFest |
from overrides import overrides
import numpy as np
from transformers import BertTokenizer
from stog.data.vocabulary import DEFAULT_PADDING_TOKEN, DEFAULT_OOV_TOKEN
class AMRBertTokenizer(BertTokenizer):
def __init__(self, *args, **kwargs):
super(AMRBertTokenizer, self).__init__(*args, **kwargs)
@o... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | stog/data/tokenizers/bert_tokenizer.py | KiroSummer/AMR |
import subprocess
def du(path):
du = subprocess.run(["du", "-sb", path], stdout=subprocess.PIPE)
# Decode binary string, split return and fetch first entry
# in array which is the size in bytes
size = du.stdout.decode().split()[0]
return size
def du_remote(host, path):
du = subprocess.run(["... | [
{
"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 | loft/helpers.py | dotKom/loft |
#CONSTRUINDO UMA CLASSE ITERATOR
class GenItem(object):
def __init__(self, first, last):
self.first = first
self.last = last
def __iter__(self):
return self
def __next__(self):
if self.first > self.last:
raise StopIteration
else:
self.first +... | [
{
"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 | 05/iterator_example.py | alissonit/pythontrap |
import functools
import mimetypes
import os
from platypush.utils import get_mime_type
from . import MediaHandler
class FileHandler(MediaHandler):
prefix_handlers = ['file://']
def __init__(self, source, *args, **kwargs):
super().__init__(source, *args, **kwargs)
self.path = os.path.abspath... | [
{
"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 | platypush/backend/http/media/handlers/file.py | BlackLight/platypush |
import numpy as np
from sigman.analyzer import InvalidArgumentError
procedure_type = 'points'
description = (
"""Procedure calculate time of B point from equation:
RB = 1.233RZ-0.0032RZ^2-31.59
where RZ - time between R and dz/dt max [ms]
RB - time between R and B
Equation was proposed by D.L. Lozano in pa... | [
{
"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 | procedures/points_B_ICG_Lozaano_Equation.py | k-cybulski/sigman-project |
import tkinter as tk
class MyEntry:
def __init__(self, root, **kwargs):
self.root = root
self.value = None
self.frame = tk.Frame(self.root)
self.frame.pack(anchor="nw")
self.kwargs = kwargs
self.title_label = tk.Label(self.frame, text=self.parse_title(), anchor='w... | [
{
"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 | src/GUI_Elements/Entries.py | cedric-romain/lins |
from os.path import join as pjoin
from scrapy.spiders import (
Rule,
CrawlSpider,
)
from scrapy import exceptions
from scrapy.linkextractors import LinkExtractor
from django.conf import settings
from django.core.cache import caches
import tldextract
from core.extractors import ck0tp
from crawler import ite... | [
{
"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 | scrape/crawler/crawler/spiders/ck0tp.py | ikeikeikeike/scrape-django-app |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | test/test_settings_reporting_eula_item.py | Atomicology/isilon_sdk_python |
from mltrace import Task
from sklearn.metrics import mean_squared_error
import random
import string
task = Task("testing")
def inference_component(output_id):
task.logOutput(random.randint(0, 1), output_id)
def feedback_component(output_id):
task.logFeedback(random.randint(0, 1), output_id)
if __name__ ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | examples/metric_logging.py | vishwanath1306/mltrace |
"""py.test configuration"""
import os
from sys import version_info
from pathlib import Path
import numpy as np
import nibabel as nb
import pandas as pd
import pytest
import tempfile
import pkg_resources
from .utils.bids import collect_data
test_data_env = os.getenv(
"TEST_DATA_HOME", str(Path.home() / ".cache" / ... | [
{
"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 | aslprep/niworkflows/conftest.py | krmurtha/aslprep |
import dpm.lib as lib
import tempfile
import os
import random
import string
import dpm
import dpm.index.ckan
import dpm.package
from nose.tools import raises
# A package in CKAN index for testing. It has three resources: two in CKAN storage, one on task3.cc
CKAN_SPEC = 'ckan://'
PACKAGE_NAME = 'datapkg-gui-test'
PACKA... | [
{
"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 | dpm/tests/test_lib_internet.py | okfn/dpm-old |
# -*- coding: utf-8 -*-
"""
meraki_sdk
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
class SwitchProfilePortModel(object):
"""Implementation of the 'SwitchProfilePort' model.
TODO: type model description here.
Attributes:
... | [
{
"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 | meraki_sdk/models/switch_profile_port_model.py | meraki/meraki-python-sdk |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.