source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
try:
import librosa
except ImportError:
# No installation required if not using this function
pass
class AudioLoader:
@staticmethod
def load_audio(file_path):
try:
import librosa
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Missed ... | [
{
"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 | nlpaug/util/audio/loader.py | lucidworks/nlpaug |
from __future__ import absolute_import
import contextlib
from .compat import mock
@contextlib.contextmanager
def mock_signal_receiver(signal, wraps=None, **kwargs):
"""
Taken from mock_django as importing mock_django created issues with Django
1.9+
Temporarily attaches a receiver to the provided ``... | [
{
"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/mock.py | mikewolfd/django-gm2m |
import roman
from aiogram import types
from aiogram.dispatcher import FSMContext
from ..keyboards import QuestionKeyboardMarkupFactory
from ..states import QuestionnaireStates
from ...api import Question, QuestionsCategory
async def update_user_context(state: FSMContext,
category_index:... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | bot/bot/handlers/base.py | Doctorinna/telegram-bot |
from globconf import config
from globconf import verify_required_options
import unittest
import os
# let's test on a predefined file included in the unitteast
config.read(os.path.dirname(__file__)+'/config.ini')
class TestConf(unittest.TestCase):
def test_config_file_present(self):
self.assertTrue(os.pa... | [
{
"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 | test/test_verify_required_options.py | klang/globconf |
import pygame.font
class Button:
def __init__(self, screen, msg):
"""Initialize button size and position."""
self.screen = screen
self.screen_rect = screen.get_rect()
self.width, self.height = 200, 50
self.button_color = (0, 0, 0)
self.font_color = (200,... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | button.py | DamianS6/Jordan-Catch |
from pytest import warns
from strar.registration import Registrar
from strar.utils import Text, chain_functions
from strar.warnings import DuplicateRegistrantNameWarning
class TestWarnings:
def test_no_replace(self):
with warns(DuplicateRegistrantNameWarning):
class A(Registrar):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
}... | 3 | tests/registration/warnings_test.py | martvanrijthoven/creationism |
from flask import Flask # flask server
from flask import request # how the user requested a resource
from flask import render_template # to use templates/layouts
app = Flask(__name__)
# Something i can do in templates:
# {{ var_name }}
# {% """kind of python code on flask""" %}
# [@] signifies a decorator - way... | [
{
"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 | Python/flask/pr1/main.py | honchardev/Fun |
# qubit number=4
# total number=11
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | [
{
"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 | data/p4VQE/R4/benchmark/startPyquil237.py | UCLA-SEAL/QDiff |
class BaseHandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass
| [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | hallucinate/api.py | SySS-Research/hallucinate |
# -*- coding: utf-8 -*-
"""Utilities for calculation job resources."""
__all__ = (
'get_default_options',
'seconds_to_timelimit',
)
def get_default_options(max_num_machines: int = 1, max_wallclock_seconds: int = 1800, with_mpi: bool = False) -> dict:
"""Return an instance of the options dictionary with t... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstr... | 3 | aiida_abinit/utils/resources.py | azadoks/aiida-abinit |
class LibraryMetadata(object):
def __init__(self, section=None):
self.section = section
class LibrarySection(object):
def __init__(self, title=None):
self.title = title
class Session(object):
def __init__(self, **kwargs):
self.rating_key = None
self.state = None
... | [
{
"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 | Trakttv.bundle/Contents/Tests/plex_mock/models.py | disrupted/Trakttv.bundle |
import re
import sys
from typing import Dict
# https://github.com/pypa/twine/pull/551
if sys.version_info[:2] < (3, 9): # coverage: exclude
import importlib_resources
else: # coverage: exclude
import importlib.resources as importlib_resources
QUERIES_REGEX = re.compile(r"(?:\n|^)-- ([a-z0-9_]+) --\n(?:-- .+... | [
{
"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 | procrastinate/sql/__init__.py | michaszcz/procrastinate |
from unittest import TestCase
from pykotor.resource.formats.gff import load_gff
from pykotor.resource.generics.ute import construct_ute, dismantle_ute
TEST_FILE = "../../files/test.ute"
class TestUTE(TestCase):
def test_io(self):
gff = load_gff(TEST_FILE)
ute = construct_ute(gff)
self.va... | [
{
"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 | tests/resource/generics/test_ute.py | NickHugi/PyKotor |
from caffe_all import *
def parseProtoString(s):
from google.protobuf import text_format
proto_net = pb.NetParameter()
text_format.Merge(s, proto_net)
return proto_net
def get_param(l, exclude=set(['top', 'bottom', 'name', 'type'])):
if not hasattr(l,'ListFields'):
if hasattr(l,'__delitem... | [
{
"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 | src/load.py | philkr/voc-classification |
# TianTcl - Whisper game - generator
import random
subject=["ฉัน","คุณ","เขา","มัน","พวกเรา","พวกเขา","คน","ชาวบ้าน"]
expand_subject=[None,"ที่สูงๆ","ที่กวาดถนนอยู่","ตรงนั้น","ในห้องนั้น"]
verb=["กำลังวิ่ง","เดิน","คุยกัน","นอนอยู่"]
epand_verb=[None,"อย่างรวดเร็ว","ช้าๆ","เสียงดังมาก"]
object=[None,"ในลู่วิ่ง",... | [
{
"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 | generate.py | TianTcl/whisper-game |
from django.db import models
from django.db.models.fields import related
from django.utils.timezone import now
from django.urls import reverse
# Create your models here.
from pathlib import Path
from django.conf import settings
import os
from functools import partial
from datetime import datetime
def _update_filena... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | assignment/models.py | author31/HongsBlog |
class ProgressBarStyle(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the style that a System.Windows.Forms.ProgressBar uses to indicate the progress of an operation.
enum ProgressBarStyle,values: Blocks (0),Continuous (1),Marquee (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.... | [
{
"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 | stubs.min/System/Windows/Forms/__init___parts/ProgressBarStyle.py | ricardyn/ironpython-stubs |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..dcmstack import CopyMeta
def test_CopyMeta_inputs():
input_map = dict(
dest_file=dict(
extensions=None,
mandatory=True,
),
exclude_classes=dict(),
include_classes=dict(),
src_file=dict(
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | venv/Lib/site-packages/nipype/interfaces/tests/test_auto_CopyMeta.py | richung99/digitizePlots |
from PySide import QtGui, QtCore
from AttributeWidgetImpl import AttributeWidget
# By importing the ComboBoxWidget here, we ensure that the ComboBoxWidget is registered
# before the ListViewWidget, meaning the ListViewWidget will take precedence when displaying values with the 'Combo' option.
# The registered widgets... | [
{
"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 | Python/kraken/ui/DataTypeWidgets/ListViewWidgetImpl.py | FabricExile/Kraken |
from toga.platform import get_platform_factory
class Image(object):
"""
Args:
path (str): Path to the image.
factory (:obj:`module`): A python module that is capable to return a
implementation of this class with the same name. (optional & normally not needed)
"""
def __ini... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | src/core/toga/widgets/image.py | Donyme/toga |
'''Views for the device model.'''
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse_lazy
from django.shortcuts import get_object_or_404
from django.views import generic
from ..forms.device import DeviceForm
from ..m... | [
{
"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 | network/views/device.py | Atilla106/members.atilla.org |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "has_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 | aliyun-python-sdk-dbfs/aliyunsdkdbfs/request/v20200418/ListTagValuesRequest.py | yndu13/aliyun-openapi-python-sdk |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successful(self):
"""이메일로 유저 생성을 성공하는 테스트"""
email = 'test@testemail.com'
password = 'testpassword'
user = get_user_model().objects.create_use... | [
{
"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": true
},... | 3 | shoppingmall/core/tests/test_models.py | jacobjlee/simple-shopping |
"""
Test CSS loaders
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.conf import settings
from django.test import TestCase
from django.test import override_settings
from django_inlinecss.css_loaders im... | [
{
"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 | django_inlinecss/tests/test_css_loaders.py | EndevelCZ/django-inlinecss |
# (C) 2022 GoodData Corporation
from __future__ import annotations
from pathlib import Path
from typing import List, Optional, Type
import attr
from gooddata_metadata_client.model.declarative_user import DeclarativeUser
from gooddata_metadata_client.model.declarative_users import DeclarativeUsers
from gooddata_sdk.c... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | gooddata-sdk/gooddata_sdk/catalog/user/declarative_model/user.py | hkad98/gooddata-python-sdk |
# by Kami Bigdely
# Consolidate duplicate conditional fragments
def add(mix, ingrediants):
mix.append(ingrediants)
return mix
def mixer_ice_with_cream():
print('mixed ice with cream.')
return ['ice', 'cream']
def if_milkskake(drink):
return 'strawberry milkshake' in drink
def if_coffee(drink)... | [
{
"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 | exercises/simplify-conditionals/mix_ice_cream.py | xilaluna/ACS-4931-Testing-and-Architecture |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"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 | pipeline/tests/engine/core/data/test_mysql_backend.py | sdgdsffdsfff/bk-sops-tencent |
from functools import wraps
from starlette.requests import Request
from starlette.exceptions import HTTPException
import os
def guard(func):
@wraps(func)
async def check_permissions(*args, **kwargs):
request = args[1].context['request']
assert isinstance(request, Request)
... | [
{
"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 | gql_guard/guard.py | sostholm/GQL-Guard |
from django.contrib.auth.models import User
from django.test import TestCase
from .models import Conf, Site, SitePermission
class ConfTestCase(TestCase):
def test_conf_created(self):
site = Site.objects.create(domain='test.site', name='Test Site')
self.assertIsInstance(site.conf, Conf)
class S... | [
{
"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 | conf/tests.py | dyndeploy-test/timestrap |
from elasticsearch import Elasticsearch # type: ignore
from elasticsearch.client import IndicesClient # type: ignore
from elasticsearch.helpers import bulk # type: ignore
import logging
from config import CONFIG_DICT
LOGGER = logging.getLogger(__name__)
ELASTICSEARCH_NODES = [CONFIG_DICT['ELASTICS... | [
{
"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 | service/es_utils.py | LandRegistry/digital-register-elasticsearch-updater |
#12/24/2018
#Find the square which has the largest total power, the square can be anywhere from 1x1 to 300x300
#The package numpy has some tools that can help with the multidimensional arrays and creating the summed area table
#Note that numpy uses matrix indexing (i,j / row,col) vs cartesian indexing (x,y) --> if the... | [
{
"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 | 2018/day11/day11p2.py | davidpneal/adventofcode |
# coding: utf-8
"""
Peacemakr
This API describes the Peacemakr services, which enable seamless application layer encryption and verification. # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
i... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | test/test_login_response.py | peacemakr-io/peacemakr-python-sdk |
from functools import reduce
from base64 import b64encode, b64decode
from binascii import a2b_hex
from Crypto.Cipher import AES
from base import Component
class Crypto(Component):
KEY_SIZE = 32
def encrypt(self, key, data):
data = self.__pad(data)
key = self.__merge(key)
iv = a2b_hex... | [
{
"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 | api/source/components/crypto.py | 1pkg/ReRe |
from bs4 import BeautifulSoup
import re
from ..occurrences.occurrences import Occurrences
from ..occurrences.occurrence_interface import OccurrenceInterface
class Recommendation08:
"""
Recomendação 08: Separar links adjacentes
"""
def __init__(self, sourcecode):
self.rec = 8
self.sou... | [
{
"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 | crawling/recommendations/recommendation08.py | carlosbognar/TCC-WCGA-1 |
# -*- coding: utf-8 -*-
import scrapy
import re
import json
from locations.hourstudy import inputoutput
class AldiUKSpider(scrapy.Spider):
name = "aldiuk"
allowed_domains = ['www.aldi.co.uk']
start_urls = (
'https://www.aldi.co.uk/sitemap/store',
)
def parse(self, response):
respo... | [
{
"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 | locations/spiders/aldi_uk.py | bealbrown/allhours |
from django.test import TestCase, RequestFactory
from django.template import Context, Template
from django.contrib.auth import get_user_model
class InternalExternalTemplateTagTests(TestCase):
def setUp(self):
super(InternalExternalTemplateTagTests, self).setUp()
self.user = get_user_model().object... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | tests/test_templatetags.py | ortkin/django-internal-external-comments |
# -*- encoding: utf-8 -*-
'''
Created on 2012-3-23
@author: Neil
'''
from django.shortcuts import render_to_response
from grnglow.glow.views import people
from grnglow.glow.models.photo import Photo
def base(request):
return render_to_response('base.html')
def index(request):
if request.user.is_authenticat... | [
{
"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 | grnglow/glow/views/home.py | xiaokai111/green-glow |
import asyncio
import time
import pytest
from async_lru import alru_cache
pytestmark = pytest.mark.asyncio
async def test_expiration(check_lru, loop):
@alru_cache(maxsize=4, expiration_time=2, loop=loop)
async def coro(val):
return val
inputs = [1, 2, 3]
coros = [coro(v) for v in inputs]
... | [
{
"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 | tests/test_expiration.py | vera1118/async_lru |
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from libya_site.tests.factories import UserFactory
class StaffUserMixin(object):
model = None
username = "staff_user"
email = "staff@example.com"
password = "password"
permissions = []
... | [
{
"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 | staff/tests/base.py | SmartElect/SmartElect |
from django.shortcuts import render
from . import models
def index(request):
return render(request, 'blog/index.html')
def login(request):
return render(request, 'blog/login.html')
def register(request):
return render(request, 'blog/register.html')
def about(request):
return render(request, 'blog/a... | [
{
"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 | app/blog/views.py | gbr-mendes/tech-blog |
import random
from datetime import datetime
from typing import List
def calc_progressive_percentage(
percentage: int,
start_date: str,
end_date: str,
max_value: int,
date_format: str,
) -> int:
if datetime.today() < datetime.strptime(
start_date, date_format
) or datetime.today() >... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | air_flags/utils.py | devaway/air-flags-python |
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.187
Contact: support@ory.sh
Generated by: ht... | [
{
"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 | clients/client/python/test/test_self_service_settings_flow.py | ory/sdk-generator |
import random
from paho.mqtt import client as mqtt_client
broker = 'localhost'
port = 1883
topic = "python/mqtt"
# Generate client ID with pub prefix randomly.
client_id = f'python-mqtt-{random.randint(0, 100)}'
def connect_mqtt() -> mqtt_client:
def on_connect(client, userdata, flags, rc):
if rc == 0:
... | [
{
"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 | mqtt_comms_sub.py | Shest-Programmistov/Smart-Pots |
class FilterListQueryParams(object):
def __init__(self, offset=None, limit=None, name=None):
# type: (int, int, string_types) -> None
super(FilterListQueryParams, self).__init__()
self.offset = offset
self.limit = limit
self.name = name
@property
def openapi_types(s... | [
{
"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 | bitmovin_api_sdk/encoding/filters/filter_list_query_params.py | jaythecaesarean/bitmovin-api-sdk-python |
import argparse
def main():
args = parse_args()
args.func(args)
def parse_args():
parser = argparse.ArgumentParser()
commands = parser.add_subparsers(dest="command")
commands.required = True
init_parser = commands.add_parser("init")
init_parser.set_defaults(func=init)
return parse... | [
{
"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 | ugit/cli.py | Matheusqz/ugit |
"""A CSV annotation writer that writes the bbox in x, y, w, h format."""
from .types import CSVAnnotationWriter
class WidthHeightCSV(CSVAnnotationWriter):
"""Writes annotations to a CSV file in the following format.
image_name, x_min, y_min, width, height, label
"""
def get_csv_fieldnames(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | src/discolight/writers/annotation/widthheightcsv.py | denzel-datature/discolight |
import os
from jinja2 import lexer, nodes
from jinja2.ext import Extension
from jinja2.filters import do_mark_safe
__all__ = ['IncludeBlockExtension']
class IncludeBlockExtension(Extension):
tags = {'include_block'}
fields = {'template', 'block_name'} # block_name is optional
def template_contents(sel... | [
{
"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 | justengel_theme/extension.py | justengel/justengel_theme |
# -*- coding: utf-8 -*-
"""
indicator.py
Copyright (c) 2020 Nobuo Namura
This code is released under the MIT License.
"""
import numpy as np
from scipy.spatial import distance
#======================================================================
def rmse_history(x_rmse, problem, func, nfg=0):
rmse = 0.0
for... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | indicator.py | Nobuo-Namura/EPBII |
import numpy as np
def log_gaussian(x, mean, sigma):
"""
Computes the log-probability of X=x for a Gaussian of mean=mean and sigma=sigma
Parameters
----------
x
mean
sigma
Returns
-------
"""
log_pdf = -(x - mean) ** 2 / (2 * sigma ** 2)
log_pdf = log_pdf - np.log((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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | lstchain/image/pdf.py | calispac/cta-lstchain |
from flask_appbuilder import BaseView, expose
from config import APP_ICON, APP_NAME
from flask import g
def get_user():
return g.user
def custom_template():
app_name = "GEA"
app_version = "1.2"
return app_name, app_version
class someView(BaseView):
"""
A simple view that implemen... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | app/index.py | mcnigno/gea |
"""
Support for Tesla binary sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.tesla/
"""
import logging
from homeassistant.components.binary_sensor import (
BinarySensorDevice, ENTITY_ID_FORMAT)
from homeassistant.components.tesl... | [
{
"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 | homeassistant/components/binary_sensor/tesla.py | dauden1184/home-assistant |
import pandas as pd
customers = pd.read_csv('customers.csv', delimiter=",")
orders = pd.read_csv('orders.csv', delimiter=",")
# z1
print(orders.describe())
print(orders.info())
print(orders.head())
# a
orders['order_date'] = pd.to_datetime(orders['order_date'], format='%Y/%m/%d')
# b
print(orders['tshirt_category'].un... | [
{
"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 | cw05/z1_2_3.py | s19282/PAD |
class HT16K33:
def __init__(self, i2, a = 0x70):
self.i2 = i2
self.a = a
self.command(0x21) # Clock on
self.command(0x81) # Display on
self.bright(15)
self.load([0] * 16)
def bright(self, n):
assert 0 <= n < 16
self.command(0xe0 + n)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | python/samples/ht16k33.py | ramonbrugman/i2cdriver |
from algebra import WrappedFunction, Function, proven
from algebra.pretty import need_parens
from mlkernels import (
Kernel,
pairwise,
elwise,
)
from .. import _dispatch
__all__ = ["AmbiguousDimensionalityKernel"]
class AmbiguousDimensionalityKernel(Kernel, WrappedFunction):
"""A kernel whose dimens... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | stheno/mo/adk.py | vishalbelsare/stheno |
import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
#initializing cv2
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
#read the frames while the camera is on
ret,frame =... | [
{
"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 | capture_and_uploadImage.py | sagrawal1234/AUTOMATION-NEW |
from .NamedBO import NamedBO
class Einzelhaendler(NamedBO):
def __init__(self):
super().__init__()
self._benutzer_id = 0
def set_benutzer_id(self, benutzer_id):
"""Setzen der Benutzer_id"""
self._benutzer_id = benutzer_id
def get_benutzer_id(self):
"""Auslesen der... | [
{
"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/server/bo/Einzelhaendler.py | JanCwik/SoftwarePraktikum |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .budget import *
from .budget_by_resource_group_name import *
from .get_budget i... | [
{
"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 | sdk/python/pulumi_azure_nextgen/consumption/v20180131/__init__.py | pulumi/pulumi-azure-nextgen |
# -*- coding: utf-8 -*-
"""
pyvisa-sim.common
~~~~~~~~~~~~~~~~~
This code is currently taken from PyVISA-py.
Do not edit here.
:copyright: 2014 by PyVISA-sim Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import
import s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | pyvisa_sim/common.py | jpsecher/pyvisa-sim |
from aiohttp import web
from crawler.forms.config import config_trafaret
from crawler.models.configs import insert_new_config, remove_config
from webapp.helpers import login_required, flash
@login_required
async def save_config(request):
app = request.app
router = app.router
logger = app['logger']
en... | [
{
"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 | webapp/endpoints/config_endpoints.py | bmwant/chemister |
ROMAN_ONE = 'I'
ROMAN_FIVE = 'V'
ROMAN_TEN = 'X'
FIVE = 5
TEN = 10
VALUES = {'I': 1, 'V': 5, 'X': 10}
class Roman(object):
@classmethod
def translate(cls, number):
if number <= 3:
return ROMAN_ONE * number
left_part = cls._biggest_roman_symbol_in(number)
left_part_value ... | [
{
"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 | katas/roman-numerals/python-20-09-15/roman_numerals.py | alejandrodob/dojo |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | django_react_hybrid/contrib/sites/migrations/0003_set_site_domain_and_name.py | tylerhuntington222/django-react-pac |
def card_value(card):
if card[0] == "2":
return 2
elif card[0] == "3":
return 3
elif card[0] == "4":
return 4
elif card[0] == "5":
return 5
elif card[0] == "6":
return 6
elif card[0] == "7":
return 7
elif card[0] == "8":
return 8
el... | [
{
"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 | Introduction/Game - Card/UVa 10646 - What is the card.py | ServioTRC/Competitive-Programming |
from flask import Flask, render_template, request, redirect
from flask import render_template
app = Flask(__name__)
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)
from flask import Flask,request,render_template,redirect
# 绑定访问地址127.0.0.1... | [
{
"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 | demo_flask.py | archfool/nlp |
import os
import hashlib
def _update_sha256(filename, sha256):
"""
Updates a SHA-256 algorithm with the filename and the contents of a file.
"""
block_size = 64 * 1024 # 64 KB
with open(filename, 'rb') as input_file:
while True:
data = input_file.read(block_size)
i... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | hashing.py | bernardosulzbach/scripts |
# %% Packages
import os
import tensorflow as tf
from typing import Tuple
from tensorflow.keras.callbacks import TensorBoard, EarlyStopping
# %% Callbacks
# Loading callbacks
def load_callbacks(
name: str, monitor: str, patience: int
) -> Tuple[TensorBoard, EarlyStopping]:
tensorboard = load_tensorboard(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": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/utils/callbacks.py | data4help/shiny-bassoon |
from test.integration.base import DBTIntegrationTest
class RetryFailedTest(DBTIntegrationTest):
@property
def models(self):
return "test/integration/008_retry_failed_test/models"
def tests_retry_failed(self):
_, success = self.run_dbt(["run"])
self.assertFalse(success)
s... | [
{
"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 | test/integration/008_retry_failed_test/test_retry_failed.py | bastienboutonnet/dbt-helper |
from __future__ import absolute_import
from .implementations import ChildDiffingMixing, ImplementationBase
from .differ import make_differ
import xml.dom.minidom as dom
import re
class DiffXMLDocument(ChildDiffingMixing, ImplementationBase):
diffs_types = dom.Document
def path_and_child(self, doc):
yield "?xml@... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | treecompare/xml.py | sybitetechnologies/treecompare |
import pytest
from indy import IndyError
from indy import wallet
from indy.error import ErrorCode
@pytest.mark.asyncio
@pytest.mark.parametrize("wallet_config", [None, '{"freshness_time":1000}'])
async def test_open_wallet_works(wallet_config, wallet_handle):
pass
@pytest.mark.asyncio
async def test_open_walle... | [
{
"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 | wrappers/python/tests/wallet/test_open_wallet.py | Diiaablo95/indy-sdk |
"""SCons.Tool.fortran
Tool-specific initialization for a generic Posix f77/f90 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20... | [
{
"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 | cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/fortran.py | smartshowltd/zxing |
import psutil
import datetime
def main():
print("___________________________SYSTEM INFORMATION___________________________\n")
print("############ CPU ############")
cpu_percent()
cpu_count()
cpu_freq()
print("\n############ MEMORY ############")
memory()
print("\n############ DISK #####... | [
{
"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 | Sodalita/util.py | wakeupmh/pythonProjects |
import logging
import click
from clearly.server import start_server
logger = logging.getLogger('clearly.command_line')
@click.group()
@click.version_option()
def clearly():
"""Clearly command line tools."""
pass
@clearly.command()
@click.argument('broker')
@click.option('--backend', '-b',
h... | [
{
"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 | clearly/command_line.py | Colorless-Green-Ideas/clearly |
argv = None
byteorder = "little"
def exit():
pass
implementation = None
maxsize = 2147483647
modules = None
path = None
platform = "pyboard"
def print_exception():
pass
stderr = None
stdin = None
stdout = None
version = "3.4.0"
version_info = None
| [
{
"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 | thonny/plugins/micropython/api_stubs/sys.py | shreyas202/thonny |
from dagster.api.snapshot_execution_plan import sync_get_external_execution_plan
from dagster.core.snap.execution_plan_snapshot import ExecutionPlanSnapshot
from .utils import get_foo_pipeline_handle
def test_execution_plan_snapshot_api():
pipeline_handle = get_foo_pipeline_handle()
execution_plan_snapshot ... | [
{
"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 | python_modules/dagster/dagster_tests/api_tests/test_api_snapshot_execution_plan.py | JPeer264/dagster-fork |
#!/usr/bin/env python3
from shutil import copy2
from pathlib import Path
import sys
from .SourceFiles import SourceFiles
class SimpleCopy:
def __init__(self, source):
assert isinstance(source, SourceFiles), 'Not a SourceFiles object.'
self.source_object = source
self.source_parent = self.... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/SimpleCopy.py | sonbyj01/backup_module |
# 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 dataclasses import dataclass, field
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from fairseq.dataclass... | [
{
"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 | fairseq/data/encoders/fastbpe.py | fairseq-FT/fairseq |
import os
import json
import webapp2
import jinja2
from urllib import urlencode
from google.appengine.api import urlfetch
jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class MainPageHandler(webapp2.RequestH... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
... | 3 | main.py | nelson6400/ghibli |
"""Core definitions of MPT framework"""
class MptException(Exception):
pass
class BadCrcException(MptException):
pass
class CommandTooLongException(MptException):
def __init__(self):
MptException.__init__(self)
self.message = "Command is limited to 253 bytes!"
class NotConnectedExcep... | [
{
"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 | mlx90632/pympt/core.py | marcodesilva/SensoreTemperaturaMelexis90632 |
import re
from ..pattern.Pattern import Pattern
from .exceptions import (MemorySearchNotFoundException,
MemorySearchTooManyMatchException)
class MemorySearch:
def __init__(self, memory: bytes):
self.memory = memory
def find_pattern(self, pattern: Pattern) -> re.Match:
... | [
{
"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 | bravepatcher/patcher/MemorySearch.py | maxisoft/BravePatcher |
import os
from typing import Dict
from dbnd import as_task, band, task
from dbnd._core.commands import log_artifact, log_metric
from dbnd._core.current import get_databand_run
from dbnd._core.tracking.tracking_store_file import read_task_metrics
from dbnd.testing.helpers_pytest import assert_run_task
from test_dbnd.t... | [
{
"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 | modules/dbnd/test_dbnd/run/test_log_metrics_commands.py | turbaszek/dbnd |
from torch import nn
class posFFN1d(nn.Module):
def __init__(self, d_hid, d_inner_hid, window=1, dropout=0.1):
super().__init__()
self.w_1 = nn.Conv1d(d_hid, d_inner_hid, kernel_size=window)
self.relu = nn.ReLU()
self.w_2 = nn.Conv1d(d_inner_hid, d_hid, kernel_size=window)
... | [
{
"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 | src/pytorch_models/pos_ffn.py | chaitanya2334/lsm |
#!/usr/bin/python3
from html.parser import HTMLParser
import urllib.request
import webbrowser
import datetime
LANG = 'en'
TMPFILE = '/tmp/watdo.html'
class Parser(HTMLParser):
def __init__(self):
super(Parser, self).__init__()
self.handle_next_h2 = False
self.handle_until_h2 = False
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | watdo.py | KeyboardFire/watdo-today |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class HypervBackupEnvParams(object):
"""Implementation of the 'HyperVBackupEnvParams' model.
Message to capture any additional backup params for a HyperV environment.
Attributes:
allow_crash_consistent_snapshot (bool): Whether to fallback t... | [
{
"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 | cohesity_management_sdk/models/hyperv_backup_env_params.py | chandrashekar-cohesity/management-sdk-python |
# import necessary packages
from selenium import webdriver
import pyttsx3 as p
# class to see the information
class IMDBlatestBestMovies():
def __init__(self):
self.driver = webdriver.Chrome(executable_path=r"C:\Users\mtiwari33\Downloads\Softwares\chromedriver_win32\chromedriver")
def recommend(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 | Automation/Web/recommendation.py | ManojKumarTiwari/Tokio-TheVoiceAssistant |
from http.server import HTTPServer
from remotecontrol import RemoteControlHander
class TestHandler(RemoteControlHander):
"""testing handler"""
keystring = 'ab:cd'
def set_urls(self):
self.urls = [
('^/noget/andet/$', self.itester),
]
def itester(self):
print('runni... | [
{
"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 | example-server.py | Lynges/simple-python-web-remote |
# This isn't intended as an example, it's just here to simplify all the
# output formating the examples do.
from accelerator import colour
class Printer:
def __init__(self, indent=0):
self._indent = indent
self._last_indent = 0
self._unindent = []
def _prefix(self, txt):
for c in txt:
if not c.isspace()... | [
{
"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 | accelerator/examples/printer.py | eBay/accelerator |
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QTextEdit
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt
from settings import font
from functions import get_trans, get_data, get_history
class HistoryWin(QWidget):
def __init__(self):
super().__init__()
self.setWindowFlag(Qt... | [
{
"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 | code/historyWin.py | WaiZhong/WaiXCalc |
# -*- coding: utf-8 -*-
import csv
import numpy as np
class CSVHandle():
def __init__(self):
pass
def read(self, file):
data = []
data_title = []
with open(file, 'r') as csv_file:
rows = csv.reader(csv_file)
for row in rows:
coulmn =... | [
{
"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 | app/csv_handle.py | kaka-lin/csv-ptool |
#
# Copyright 2017 Alsanium, SAS. or its affiliates. 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 require... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | tests/sig_return_type/test.py | ujway/serverless-go |
"""Stopping criterion based on the relative change of the successive integral estimators."""
import numpy as np
from probnum.quad.solvers.bq_state import BQState
from probnum.quad.solvers.stopping_criteria import BQStoppingCriterion
from probnum.typing import FloatArgType
# pylint: disable=too-few-public-methods
c... | [
{
"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 | src/probnum/quad/solvers/stopping_criteria/_rel_mean_change.py | treid5/probnum |
from dataclasses import dataclass
@dataclass
class Lyric:
id_: str
track_id: str
common_track_id: str
content: list
@dataclass
class Track:
id_: str
common_id: str
name: str
instrumental: int
explicit: int
artist: str
album: str
@dataclass
class Song:
name: str
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | src/clients/musixmatch/models.py | juanitodread/gorrion |
import torch, einops
from ..builder import BACKBONES
from .resnet import ResNet
@BACKBONES.register_module()
class PositionalEncodingResNet(ResNet):
def __init__(self, num_frequencies, in_channels=3, **kwargs):
self.L = num_frequencies
in_channels += self.L * 4
super().__init__(in_channels=... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | mmdet/models/backbones/posenc_resnet.py | clintonjwang/mmdetection |
from typing import Callable, Tuple, cast, TypeVar
from ..model import Model
from ..config import registry
from ..types import Ragged, ArrayXd
OutT = TypeVar("OutT", bound=ArrayXd)
@registry.layers("reduce_first.v1")
def reduce_first() -> Model[Ragged, OutT]:
"""Reduce sequences to their first element."""
ret... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | thinc/layers/reduce_first.py | bratao/thinc |
class Curve_Parms():
def Curve_Parms_Paths(self):
return [str(self.a),str(self.b),str(self.c),str(self.NFrames)]
def Curve_Parms_Path(self):
return "/".join( self.Curve_Parms_Paths() )
def Curve_Parms_FileName(self,cname,fname,ext="svg"):
fnames=self.Curve_Parms_Paths()... | [
{
"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 | Curve/Parms.py | olesmith/SmtC |
from unittest import TestCase
from justmltools.config.bucket_data_path_config import BucketDataPathConfig
PREFIX = "my_bucket_key_prefix"
class TestBucketDataPathConfig(TestCase):
def setUp(self) -> None:
self.sut: BucketDataPathConfig = BucketDataPathConfig(prefix=PREFIX)
def test_get_prefix(self... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | tests/config/test_bucket_data_path_config.py | ranbb/justmltools |
# Copyright 2021 The TensorFlow 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... | [
{
"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 | official/vision/detection/modeling/optimizers.py | hjkim-haga/TF-OD-API |
import unittest
from ctypes import *
import _ctypes_test
lib = CDLL(_ctypes_test.__file__)
def three_way_cmp(x, y):
"""Return -1 if x < y, 0 if x == y and 1 if x > y"""
return (x > y) - (x < y)
class LibTest(unittest.TestCase):
def test_sqrt(self):
lib.my_sqrt.argtypes = c_double,
lib.m... | [
{
"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 | code/tmp_rtrip/ctypes/test/test_libc.py | emilyemorehouse/ast-and-me |
"""
Handling for the tags from calendar events.
"""
import pandas as pd
def explode(df, min_support_count=None):
"""
Given a dataframe with a tags column that contains an iterable of tags,
creates a new dataframe containing the (sparse) binary
columns for each tag. The index is the same.
Also, g... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | timefly/tags.py | vlad17/timedime |
from typing import Optional, Any
from .data_class import StaticData
from pathlib import Path
from ruamel.yaml import YAML
yaml = YAML(typ="safe")
class ConfigsManager(StaticData):
"""
插件配置 与 资源 管理器
"""
def __init__(self, file: Path):
self.file = file
super().__init__(file)
se... | [
{
"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 | nonebot_plugin_blackwhite_japanese/configs_manager.py | RainChain-Zero/Jasmine_Nonebot2_Plugins_Center |
import scrapy
from dateparser import parse
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class SpJundiaiSpider(BaseGazetteSpider):
TERRITORY_ID = "3525904"
name = "sp_jundiai"
allowed_domains = ["jundiai.sp.gov.br"]
start_urls = ["https://imprensaoficial.jundiai... | [
{
"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 | data_collection/gazette/spiders/sp_jundiai.py | kaiocp/querido-diario |
from sklearn import neural_network
import learners
class ANNLearner(learners.BaseLearner):
def __init__(self,
hidden_layer_sizes=(100,),
activation="relu",
solver='adam',
alpha=0.0001,
batch_size='auto',
learnin... | [
{
"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 | assignment1/learners/ANN.py | prestononeal/CS-7641-assignments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.