source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright (C) 2020, 2021 Satoru SATOH <satoru.satoh@gmail.com>
# SPDX-License-Identifier: MIT
#
# pylint: disable=invalid-name
# pylint: disable=too-few-public-methods,missing-class-docstring
# pylint: disable=missing-function-docstring
"""Test cases for the rule, DebugRule.
"""
import os
import unittest.mock
import... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | tests/TestDebugRule.py | ssato/ansibl-lint-custom-rules |
class Layer:
def forward(self, x):
'''
forward propagation
Parameters
---
x: matrix
input from last layer
Returns
---
out: matrix
output of current layer
'''
raise NotImplementedError
def backprop(self, d):
'''
backward propagation
Parameters
-... | [
{
"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 | blog-record/record-4/cnn-py/layer.py | MaxXSoft/Deeplearning-Notes |
import logging
from typing import TYPE_CHECKING, Dict, Optional, Tuple
import settings
from .mappers import FoliumMapBuilder
if TYPE_CHECKING:
from pandas.core.frame import DataFrame
logger = logging.getLogger(__name__)
class MapPlotter:
def __init__(
self,
data: "DataFrame",
colu... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | map_generator/app.py | Plazas87/map_generator |
import unittest
import unittest.mock
import os
from programy.clients.restful.client import RestBotClient
from programy.clients.restful.config import RestConfiguration
from programytest.clients.arguments import MockArgumentParser
class RestBotClientTests(unittest.TestCase):
def test_init(self):
arguments... | [
{
"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 | test/programytest/clients/restful/test_client.py | whackur/chatbot |
import os
import shutil
from pathlib import Path
from test.convert_worker.unit.convert_test import ConvertTest
from workers.convert.convert_pdf import convert_pdf_to_tif
class PdfToTifTest(ConvertTest):
def setUp(self):
super().setUp()
self.pdf_src = os.path.join(f'{self.resource_dir}', 'files'... | [
{
"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 | test/convert_worker/unit/test_pdf_to_tif.py | dainst/cilantro |
import discord
import subprocess
import os, random, re, requests, json
import asyncio
from datetime import datetime
from discord.ext import commands
class Economy(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('[+] Shop Code ACTIVE!'... | [
{
"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 | GT-ECONOMY-BOT/economy/shop.py | iFanID/e.Koenomi-DBot |
'''
This example demonstrates creating and using an AdvancedEffectBase. In
this case, we use it to efficiently pass the touch coordinates into the shader.
'''
from kivy.base import runTouchApp
from kivy.properties import ListProperty
from kivy.lang import Builder
from kivy.uix.effectwidget import EffectWidget, Advance... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | examples/widgets/effectwidget3_advanced.py | yunus-ceyhan/kivy |
'''
This is a sample class that you can use to control the mouse pointer.
It uses the pyautogui library. You can set the precision for mouse movement
(how much the mouse moves) and the speed (how fast it moves) by changing
precision_dict and speed_dict.
Calling the move function with the x and y output of the gaze est... | [
{
"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/mouse_controller.py | NAITTOU/computer_pointer_controller |
# Determine whether or not one string is a permutation of another.
def is_permutation(str1, str2):
counter = Counter()
for letter in str1:
counter[letter] += 1
for letter in str2:
if not letter in counter:
return False
counter[letter] -= 1
if counter[letter] == 0:
del counter[letter]
... | [
{
"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 | Cracking the Coding Interview/ctci-solutions-master/ch-01-arrays-and-strings/02-is-permutation.py | nikku1234/Code-Practise |
from libsaas import http, parsers
from libsaas.services import base
from . import resource, labels
class MilestonesBase(resource.GitHubResource):
path = 'milestones'
def get_url(self):
if self.object_id is None:
return '{0}/{1}'.format(self.parent.get_url(), self.path)
return '... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | libsaas/services/github/milestones.py | MidtownFellowship/libsaas |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | python/oneflow/test/modules/test_consistent_dot.py | L-Net-1992/oneflow |
import torch
import pandas as pd
from io import BytesIO
from subprocess import check_output
from . import writing
import time
def memory(device=0):
total_mem = torch.cuda.get_device_properties(f'cuda:{device}').total_memory
writing.max(f'gpu-memory/cache/{device}', torch.cuda.max_memory_cached(device)/total_m... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | rebar/stats/gpu.py | JulianKu/megastep |
from django.db import models
from django.conf import settings
class EducationalInstitution(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
@classmethod
def get_institutions_with_enrolled_students(cls):
"""
For recruiters to use, so 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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | student/models.py | yaelerdr/SJMaster |
from nxt.sensor import *
class ColorControl(object):
def __init__(self, brick):
self.brick = brick
self.colorSensor = Color20(brick, PORT_1)
def get_color(self):
return self.colorSensor.get_color()
def get_light_color(self):
return self.colorSensor.get_light_color()
def set_light_color(self, color):
... | [
{
"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 | brick_control/colorControl.py | GambuzX/Pixy-SIW |
from ...shared.utils.restApi import RestResource
from ...shared.utils.api_utils import build_req_parser
from ..models.statistics import Statistic
from ..models.quota import ProjectQuota
class StatisticAPI(RestResource):
result_rules = (
dict(name="ts", type=int, location="json"),
dict(name="resul... | [
{
"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 | api/statistics.py | nikitosboroda/projects |
import os, sys, requests
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
#curl -H "Content-Type: application/json" -X POST -d '{"job_id":"ac97682c-c81e-4170-bb46-8301df317587"}' http://localhost:9000/scheduled-bod
class UIHRecurrence(Resource):
def p... | [
{
"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 | main.py | elcolie/scheduled-bod |
def dev_cors_middleware(get_response):
"""
Adds CORS headers for local testing only to allow the frontend, which is served on
localhost:3000, to access the API, which is served on localhost:8000.
"""
def middleware(request):
response = get_response(request)
if request.META['HTTP_HOS... | [
{
"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 | myblog/myblog/middleware.py | daxia07/fancyBlog |
from autosklearn.pipeline.constants import DENSE, UNSIGNED_DATA, INPUT, SPARSE
from autosklearn.pipeline.components.data_preprocessing.rescaling.abstract_rescaling \
import Rescaling
from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
class NoRescalingComponent(Rescaling, AutoSklear... | [
{
"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 | autosklearn/pipeline/components/data_preprocessing/rescaling/none.py | ihounie/auto-sklearn |
from conans import ConanFile, CMake
class LibB(ConanFile):
name = "libB"
version = "0.0"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "cmake"
scm = {"type": "git",
"url": "auto",
... | [
{
"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 | conanfile.py | demo-ci-conan/libB |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime # for checking renewal date range.
from django import forms
class RenewBookForm(forms.Form):
"""Form for a librarian to renew books."""
renewal_date = forms.DateField(
help_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | catalog/forms.py | PMPL-Arieken/django-locallibrary-tutorial |
import pytest
from astropy.io import fits
import numpy as np
from numpy.testing import assert_array_equal
from lightkurve.io.k2sff import read_k2sff_lightcurve
from lightkurve import search_lightcurve
@pytest.mark.remote_data
def test_read_k2sff():
"""Can we read K2SFF files?"""
url = "http://archive.stsci.... | [
{
"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 | tests/io/test_k2sff.py | jorgemarpa/lightkurve |
import discord
from discord.ext import commands
from Systems.levelsys import levelling
import os
from Systems.gettext_init import GettextInit
# Set up environment variables:
PREFIX = os.environ["BOT_PREFIX"]
# Set up gettext
_ = GettextInit(__file__).generate()
# Spam system class
class xpcolour(commands.Cog):
... | [
{
"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 | Commands/xpcolour/xpcolour.py | Chromeilion/kyoshi |
# Thomas (Desnord)
# O objetivo desta tarefa é fazer um programa
# que use recursividade e que, dada a matriz
# que descreve a hierarquia de uma empresa,
# encontre a cadeia hierárquica relativa a
# um determinado funcionário.
#entrada:
# A primeira linha contém dois inteiros: n,
# o número de funcionários entre 3 ... | [
{
"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 | lab19/thomas.py | Desnord/lab-mc102 |
from django_unicorn.components import QuerySetType, UnicornView
from example.coffee.models import Flavor, Taste
class AddFlavorView(UnicornView):
is_adding = False
flavors = None
flavor_qty = 1
flavor_id = None
def __init__(self, *args, **kwargs):
super().__init__(**kwargs) # calling supe... | [
{
"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 | example/unicorn/components/add_flavor.py | Franziskhan/django-unicorn |
"""
Upwork OAuth1 backend
"""
from .oauth import BaseOAuth1
class UpworkOAuth(BaseOAuth1):
"""Upwork OAuth authentication backend"""
name = 'upwork'
ID_KEY = 'id'
AUTHORIZATION_URL = 'https://www.upwork.com/services/api/auth'
REQUEST_TOKEN_URL = 'https://www.upwork.com/api/auth/v1/oauth/token/requ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | social_core/backends/upwork.py | astofsel/package_2 |
import random
from itertools import chain
def split_train_test_without_chaining(proteins, asas, train_ratio):
indices = list(range(len(proteins)))
random.shuffle(indices)
train_indices = indices[:int(train_ratio * len(indices))]
test_indices = indices[int(train_ratio * len(indices)):]
train_protei... | [
{
"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/split_train_test.py | ibraheem-moosa/protein-asa-prediction |
# /usr/bin/env python
# coding=utf-8
from pylinux.common.file_config.rc_local_file_config import RcLocalFileConfig
from pylinux.common.modifier.rc_local_modifier import RcLocalModifier
from pylinux.common.acessor.rc_local_accessor import RcLocalAccessor
from pylinux.system_file.base_system_file import BaseSystemFile
f... | [
{
"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 | pylinux/system_file/rc_local.py | ruiruige/pylinux |
# -*- coding: utf-8 -*-
"""Import exampledata"""
from os import path as osp
import pandas as pd
DATADIR = osp.join(osp.dirname(osp.realpath(__file__)), 'exampledata')
def getOECD():
return pd.read_table(osp.join(DATADIR, 'Cancer_men_perc.txt'), index_col=0)
def getA():
return pd.read_table(osp.join(DATADIR... | [
{
"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 | hoggormplot/data.py | olivertomic/hoggormPlot |
"""Patient Model
Revision ID: 64fb26819d4f
Revises: 1f3baa1921c7
Create Date: 2018-07-27 00:50:36.593722
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '64fb26819d4f'
down_revision = '1f3baa1921c7'
branch_labels = None
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_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | migrations/versions/64fb26819d4f_patient_model.py | owenabrams/greyapp |
from __future__ import print_function
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators
import sys
import socket
import struct
@Configuration()
class IPDecodeCommand(StreamingCommand):
def stream(self, records):
self.logger.debug('IPDecodeCommand: %s', sel... | [
{
"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 | bin/ipdecode.py | onura/Splunk-IPEncoder |
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from django.utils.text import slugify
from django_md_editor.models import EditorMdField
from core.cooggerapp.choices import ISSUE_CHOICES, make_choices
from ...threaded_comment.models import AbstractThreadedCommen... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | core/cooggerapp/models/issue.py | bisguzar/coogger |
from collections import defaultdict
from aoc.util import load_example, load_input
def part1(lines):
"""
>>> part1(load_example(__file__, '6'))
11
"""
answers = []
a = {}
for line in lines:
if not line.strip():
answers.append(len(a.keys()))
a = {}
els... | [
{
"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 | python/src/aoc/year2020/day6.py | ocirne/adventofcode |
from ..script import tools
from ...serialize import b2h
from .ScriptType import ScriptType
class ScriptNulldata(ScriptType):
TEMPLATE = tools.compile("OP_RETURN OP_NULLDATA")
def __init__(self, nulldata):
self.nulldata = nulldata
self._script = None
@classmethod
def from_script(cls... | [
{
"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 | lib/pycoin/pycoin/tx/pay_to/ScriptNulldata.py | AYCHDO/Dominus |
# Copyright 2014 Google 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 law or a... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | adb/sign_cryptography.py | 4oo4/python-adb |
import collections
import pytest # noqa: F401
from pudb.py3compat import builtins
from pudb.settings import load_breakpoints, save_breakpoints
def test_load_breakpoints(mocker):
fake_data = ["b /home/user/test.py:41"], ["b /home/user/test.py:50"]
mock_open = mocker.mock_open()
mock_open.return_value.re... | [
{
"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_settings.py | mm40/pudb |
from collections import namedtuple
from dataclasses import dataclass, field
from datetime import datetime
from typing import List
from .base import MangadexBase
from .exceptions import MangadexException
from .group import Group
from .language import Language
@dataclass(frozen=True)
class PartialChapter(MangadexBase):... | [
{
"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 | aiomangadex/partialchapter.py | lukesaltweather/aiomangadex |
# -*- coding: utf-8 -*-
'''
【简介】
PyQt5中 QCheckBox 例子
'''
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
class CheckBoxDemo(QWidget):
def __init__(self, parent=None):
super(CheckBoxDemo , self).__init__(parent)
groupBox = ... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | PyQt5-master/PyQt5-master/Chapter04/qt0410_QCheckbox.py | chaiwenda/Qt-mind |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import gettext_lazy as _
from . import managers
class CustomUser(AbstractUser):
username = models.CharField(
max_length=150, help_text=_("The username of the user."), unique=True
)
email... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | example_project/example_app/models.py | IgnisDa/django-tokens |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class SpacebattlesSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scr... | [
{
"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 | scrapers/Spacebattles/Spacebattles/middlewares.py | NovelTorpedo/noveltorpedo |
import os, sys
import typing
import discord
class TestPlugin:
async def ping_func(message, discord_client: object) -> str:
await discord_client.send_message(message.channel, "WE WUZ KINGS N SHIET")
async def echo_func( message, discord_client: object) -> str:
await discord_client.send_message(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | plugin/test_plugin/__main__.py | Joule4247532/CS-Army-World-Destroying-Discord-Bot |
#!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.address import *
from test_framework.qtum import *
class QtumEVMConstantinopleActivationTest(BitcoinTest... | [
{
"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 | test/functional/qtum_evm_constantinople_activation.py | TopoX84/newlux |
from myimageboard_1.models.MainModel import MainModel
from myimageboard_1.models.UsersModel import UsersModel
class MainController:
def __init__(self, request = None):
self.main = MainModel()
self.users = UsersModel()
if request != None:
self.request = reques... | [
{
"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 | src-python/myimageboard_1/controllers/MainController.py | yuriysydor1991/repository-4-imageboard1 |
class MessageId:
"""The CAN MessageId of an PDU.
The MessageId consists of three parts:
* Priority
* Parameter Group Number
* Source Address
"""
def __init__(self, **kwargs): #priority=0, parameter_group_number=0, source_address=0):
"""
:param priority:
... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | j1939/message_id.py | rliebscher/python-can-j1939 |
import disnake as discord
import random
from disnake.ext import commands
from api.check import utils, block
from api.server import base, main
class Gay(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
@block.block()
async def gay(self, ctx, user: discord.Me... | [
{
"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 | commands/gay.py | DiscordHackers/BetterBot-1.0.2.2 |
from rest_framework_jwt.views import JSONWebTokenAPIView
from rest_framework_jwt.serializers import JSONWebTokenSerializer
from django.contrib.auth import authenticate
from rest_framework import serializers
from django.utils.translation import ugettext as _
from rest_framework_jwt.settings import api_settings
jwt_paylo... | [
{
"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 | meiduo_mall/apps/meiduo_admin/login.py | zhengcongreal/meiduo_project- |
""""""
from screws.freeze.main import FrozenOnly
from objects.CSCG._3d.forms.standard.base.dofs.visualize.matplot._0sf import _3dCSCG_S0F_DOFs_Matplot
from objects.CSCG._3d.forms.standard.base.dofs.visualize.matplot._1sf import _3dCSCG_S1F_DOFs_Matplot
from objects.CSCG._3d.forms.standard.base.dofs.visualize.matplot... | [
{
"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 | objects/CSCG/_3d/forms/standard/base/dofs/visualize/main.py | mathischeap/mifem |
"""Preprocess the Vivi Ornitier model
The model is available for download from
https://sketchfab.com/models/be1e505ef3304343bf00736644730c70
The Python Imaging Library is required
pip install pillow
"""
from __future__ import print_function
import json
import os
import zipfile
from PIL import Image
from .... | [
{
"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 | scripts/vivi.py | FTD2012/software-renderer |
from rlcard.agents.nfsp_agent import NFSPAgent
from rlcard.agents.dqn_agent import DQNAgent
from rlcard.agents.random_agent import RandomAgent
from rlcard.utils.pettingzoo_utils import wrap_state
class NFSPAgentPettingZoo(NFSPAgent):
def step(self, state):
return super().step(wrap_state(state))
def e... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | rlcard/agents/pettingzoo_agents.py | xiviu123/rlcard |
from .layer_norm import LayerNorm
from . import dy_model
@dy_model
class SublayerConnection:
"""
A residual connection followed by a layer norm.
Note for code simplicity the norm is first as opposed to last.
"""
def __init__(self, model, size, p):
pc = model.add_subcollection()
s... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | antu/nn/dynet/modules/sublayer.py | AntNLP/pyAnt |
from unittest import TestCase
from maki.color import Color
class ColorTest(TestCase):
def test_is_light(self):
self.assertTrue(Color.from_hex("#ffffff").is_light)
self.assertTrue(Color.from_hex("#fff").is_light)
self.assertFalse(Color.from_hex("#000").is_light)
def test_invalid_hex(s... | [
{
"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_color.py | zostera/python-makiwich |
def generateMatrice(data, K_mer, k):
# Variables
X = []
# Generate K-mer dictionnary
X_dict = {}
for i, e in enumerate(K_mer): X_dict[e] = 0;
# Generates X (matrix attributes)
for d in data:
x = []
x_dict = X_dict.copy()
# Count K-mer occurences (with overlaping)
for i in range(0, len(d[1]) - k + 1... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | castor_krfe/matrices.py | maremita/CASTOR_KRFE |
import os
import unittest
import json
from spaceone.core.unittest.runner import RichTestRunner
from spaceone.tester import TestCase, print_json
GOOGLE_APPLICATION_CREDENTIALS_PATH = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', None)
if GOOGLE_APPLICATION_CREDENTIALS_PATH is None:
print("""
##########... | [
{
"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 | test/api/test_collector.py | choonho/plugin-google-cloud-compute-inven-collector |
def half(i, n):
return "".join(str(d%10) for d in range(1, n-i+1))
def line(i, n):
h = half(i, n)
return " " * i + h + h[-2::-1]
def get_a_down_arrow_of(n):
return "\n".join(line(i, n) for i in range(n)) | [
{
"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 | CodeWars/7 Kyu/Down Arrow With Numbers.py | anubhab-code/Competitive-Programming |
from unittest.mock import patch
from pydragonfly.sdk.const import ANALYZED, MALICIOUS
from tests.mock_utils import MockAPIResponse
from tests.resources import APIResourceBaseTestCase
from tests.resources.test_analysis import AnalysisResultTestCase
class DragonflyTestCase(APIResourceBaseTestCase):
@property
d... | [
{
"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 | tests/test_dragonfly.py | certego/pydragonfly |
"""Wrapper to integrate with Arcanist's .arcconfig file."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_arcconfig
#
# Public Functions:
# find_arcconfig
# load
# get_arcconfig
#
... | [
{
"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 | py/phl/phlsys_arcconfig.py | aevri/phabricator-tools |
from sqlalchemy.orm import Session
from models import sql
from models.api import SubscriptionDB, Subscription
from models.covid_data.school_cases_by_district import SchoolDistricts
def add_(db: Session, subscription: SubscriptionDB):
sub_dict = subscription.dict()
sub_dict["district"] = subscription.district... | [
{
"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 | utils/database/db_subscriptions.py | peterHoburg/utah_covid_alerting |
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from lists.views import home_page
class HomePageTest(TestCase):
def test_root_url_resolves_to_home_page_view(self):
found = resolve('/')
... | [
{
"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 | superlists/lists/tests.py | kentaro0919/obeythetestinggoat |
import json, os
from planutils import manifest_converter
# This should eventually be changed once the prefix is customizable
PLANUTILS_PREFIX = os.path.join(os.path.expanduser('~'), '.planutils')
SETTINGS_FILE = os.path.join(PLANUTILS_PREFIX, 'settings.json')
PAAS_SERVER = 'http://45.113.232.43:5001'
PAAS_SERVER_L... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | planutils/settings.py | AI-Planning/planning-utils |
import unittest
import mock
from pythonwarrior.abilities.base import AbilityBase
class TestAbilityBase(unittest.TestCase):
def setUp(self):
unit = mock.Mock()
self.ability = AbilityBase(unit)
def test_should_have_offset_for_directions(self):
self.assertEqual(self.ability.offset('forwa... | [
{
"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 | pythonwarrior/tests/abilities/test_base.py | kuvaszkah/python_warrior |
from Block import Block
class Blockchain:
def __init__(self):
self.difficulty = 4 # number of leading 0's needed for proofed hash
genesis_block = Block(["Genesis Block"], "0", self.difficulty)
self.chain = [genesis_block]
print(f"Genesis Block created!\nHash: {genesis_block.genera... | [
{
"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 | Blockchain.py | sgongidi/Local-Blockchain |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | isi_sdk_8_2_0/test/test_event_settings_settings_maintenance.py | mohitjain97/isilon_sdk_python |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_page_breaks05.py | timgates42/XlsxWriter |
def create_new(numbers):
n = len(numbers)
keys = [None for i in range(2 * n)]
for num in numbers:
idx = num % len(keys)
while keys[idx] is not None:
idx = (idx + 1) % len(keys)
keys[idx] = num
return keys
def create_new_broken(numbers):
n = len(numbers)
... | [
{
"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 | python_code/hash_chapter1_impl.py | possnfiffer/inside_python_dict |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_utils.models import FeedForward
class EIIEFeedForwarad(nn.Module):
def __init__(self, model_params, cash_bias):
super(EIIEFeedForwarad, self).__init__()
self.lower_model = FeedForward(model_params['lower_params'])
... | [
{
"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 | rl_traders/models.py | jjakimoto/rl_traders.py |
from .bases import DotloopObject
from .document import Document
class Folder(DotloopObject, id_field='folder_id'):
@property
def document(self):
return Document(parent=self)
def get(self, **kwargs):
return self.fetch('get', params=kwargs)
def patch(self, **kwargs):
return sel... | [
{
"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 | dotloop/folder.py | spentaur/dotloop-python |
from model.group import Group
def test_group_list(app, db):
ui_list = app.group.get_group_list()
def clean(group):
return Group(id=group.id, name=group.name.strip())
db_list = map(clean, db.get_group_list())
assert sorted(ui_list, key=Group.id_or_max) == sorted (db_list, key=Group.id_or_max)
| [
{
"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 | test/test_db_matches_ui.py | ntomczyk/python_training |
from django.conf.urls import url
from rest_framework import fields, generics, versioning
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer
from testproj.urls import SchemaView, required_urlpatterns
class SnippetSerializerV2(SnippetSerializer):
v2field = fields.IntegerField(he... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/urlconfs/url_versioning.py | johnny-prnd/drf-yasg |
import random
import torch
import torch.nn as nn
from models.cnn_layer import CNNLayer
from utility.model_parameter import ModelParameter, Configuration
class SiameseNeuralNetwork(nn.Module):
def __init__(self, config: Configuration, label_count=64, device=torch.device('cpu'), *args, **kwargs):
super(Si... | [
{
"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 | models/siamese_neural_network.py | RobinRojowiec/intent-recognition-in-doctor-patient-interviews |
from typing import Callable
import pytest
from hannah import HannahException
from hannah import UnsupportedOperation
def dummy_func(exc: Callable[..., None], msg: str, valid: bool) -> None:
raise exc(msg=msg, valid=valid) # type: ignore
@pytest.mark.parametrize(
("exc", "msg", "valid", "match"),
(
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | tests/test_exceptions.py | xames3/hannah |
# Undirected Graph from demo represented as Adjacency List
graph = {
"a": [("b", 7), ("c", 9), ("f", 14)],
"b": [("a", 7), ("c", 10), ("d", 15)],
"c": [("a", 9), ("b", 10), ("d", 11), ("f", 2)],
"d": [("b", 15), ("c", 11), ("e", 6)],
"e": [("d", 6), ("f", 9)],
"f": [("a", 14), ("c", 2), ("e", 9... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python-dsa/Section4/graph_adj_list.py | vermuz/mani-professional-notes |
def stripQuotes(string):
"""Strip leading and trailing quotes from a string.
Does nothing unless starting and ending quotes are present and
the same type (single or double).
"""
single = string.startswith("'") and string.endswith("'")
double = string.startswith('"') and string.endswith('"'... | [
{
"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 | jsinclude/templatetags/pkg/utils.py | cobbdb/jsinclude |
class Pessoa:
def __init__(self, nome, idade):
self._nome = nome
self._idade = idade
@property
def nome(self):
return self._nome
@property
def idade(self):
return self._idade
class Cliente(Pessoa):
def __init__(self, nome, idade):
super().__init__(no... | [
{
"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 | aprendizado/udemy/03_desafio_POO/cliente.py | renatodev95/Python |
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
"""
Run a job from hdf5.
"""
from pyiron.base.job.wrapper import job_wrapper_function
def register(parser):
parser.add_argument(
... | [
{
"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 | pyiron/cli/wrapper.py | srmnitc/pyiron |
import pickle
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import (
QWidget, QToolTip, QPushButton, QApplication, QMessageBox, QTableWidget)
from .RadioWindow import RadioWindow
class WrappedRadioWindow(RadioWindow, QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | SmartMedApp/GUI/apps/PredictionApp/WrappedRadioWindow.py | vovochkab/SmartMed |
# by Kami Bigdely
# Docstrings and blank lines
class OnBoardTemperatureSensor:
VOLTAGE_TO_TEMP_FACTOR = 5.6
def __init__(self):
pass
def read_voltage(self):
return 2.7
def get_temperature(self):
return self.read_voltage() * OnBoardTemperatureSensor.VOLTAGE_TO_TEMP_FACTOR ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | lab/refactoring-pep8/docstrings_blank_lines.py | stark276/SPD-2.31-Testing-and-Architecture1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class ContentPrizeInfoModel(object):
def __init__(self):
self._prize_id = None
self._prize_logo = None
self._prize_name = None
@property
def prize_id(self... | [
{
"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 | alipay/aop/api/domain/ContentPrizeInfoModel.py | articuly/alipay-sdk-python-all |
import click
from . import __version__
from .cli_commands import create_cluster, upload, upload_and_update
from .configure import configure
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo('Version {}'.format(__version__))
ctx.exit()
@click.group()
... | [
{
"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 | stork/cli.py | ShopRunner/apparate |
# Copyright 2016 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 applica... | [
{
"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 | tensorflow/contrib/distributions/python/ops/chi2.py | breandan/tensorflow |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import logging
from .lr_scheduler import WarmupMultiStepLR
def make_optimizer(cfg, model):
logger = logging.getLogger("fcos_core.trainer")
params = []
for key, value in model.named_parameters():
if not value.requi... | [
{
"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 | fcos_core/solver/build.py | CityU-AIM-Group/SFPolypDA |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipaySocialGiftOrderRefundResponse(AlipayResponse):
def __init__(self):
super(AlipaySocialGiftOrderRefundResponse, self).__init__()
self._order_id = None
@prope... | [
{
"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 | alipay/aop/api/response/AlipaySocialGiftOrderRefundResponse.py | snowxmas/alipay-sdk-python-all |
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, session
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from flask_wtf.csrf import generate_csrf
from redis import StrictRedis
from config import config
# 初始化db
from in... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | info/__init__.py | Alison67/NewsWebsite |
# B. Сбалансированное дерево
# ID успешной посылки 66593272
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.right = right
self.left = left
def height(root):
if root is None:
return 0
return max(height(root.left), height(root.right)) ... | [
{
"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 | tree/b_my_solution.py | master-cim/algorithm |
import sys
import os
import argparse
import json
import numpy as np
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'lib'))
import inputparser
import clustermaker
def write_ssms(variants, outfn):
_stringify = lambda A: ','.join([str(V) for V in A])
mu_r = 0.999
cols = ('id', 'gene', 'a', 'd'... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | comparison/pwgs/convert_inputs.py | J-Moravec/pairtree |
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class PointLikeMixer(nn.Module):
def __init__(self, args):
super(PointLikeMixer, self).__init__()
self.args = args
self.n_agents = args.n_agents
self.n_groups = args.mixing_group_dim
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/modules/mixers/point_like.py | wjh720/pymarl |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.31
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _sequencer_osx
import new
new_instancemethod = new.instancemethod
try:
_swig_property = p... | [
{
"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 | src/sequencer_osx/sequencer_osx.py | NFJones/python-midi |
import pandas as pd
def cols_choice (df, include):
return df.select_dtypes(include=include).columns.to_list()
def cols_header (data_records):
if (len(data_records) == 0):
return []
return [{'name': v, 'id': v} for v in data_records[0].keys()]
| [
{
"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 | helpers/cols.py | ijlyttle/reactivity-demo-dash |
"""Status bar widget on the viewer MainWindow"""
from typing import TYPE_CHECKING
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QLabel, QStatusBar
from ...utils.translations import trans
from ..dialogs.activity_dialog import ActivityToggleItem
if TYPE_CHECKING:
from ..qt_main_window import _QtMainWindow
... | [
{
"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 | napari/_qt/widgets/qt_viewer_status_bar.py | kolibril13/napari |
from .exceptions import WrongInputException
class S3Trigger():
"""Get information from a S3 trigger record.
Args:
record (dic): trigger record.
Exceptions:
WrongInputException
"""
def __init__(self, record):
self.__record = record
try:
self.__buck... | [
{
"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 | awstriggers/s3triggers.py | JevyanJ/awstriggers |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.9.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | kubernetes/test/test_v1_node_config_source.py | kevingessner/python |
class TokenBox(object):
def __init__(self, url, username, password, margin = 10, request_now = False):
self.URL = url
self.Username = username
self.Password = password
self.Token = None
self.Expiration = 0
self.Encoded = None
self.Margin = margin
if re... | [
{
"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 | auth/token_box.py | ivmfnal/dm_common |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2020 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | [
{
"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 | venv/Lib/site-packages/pyrogram/raw/functions/messages/get_dialog_unread_marks.py | iamgeorgiy/heroku-userbot |
from js_analyzer import JsMethod
import logging
log = logging.getLogger('JsClass')
class JsClass:
def __init__(self, data: object):
self.name = data.id.name
log.info('Found class %s' % self.name)
self.methods = []
log.debug('Searching for methods...')
self.find... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/js_analyzer/js_class.py | cmw278/BCDE321_uml_generator |
from typing import Awaitable, Callable
from fastapi.exceptions import HTTPException
from fastapi.param_functions import Depends
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from fastapi_integration.current_user_resolvers import CurrentUserResolverFactory
from fastapi_integration.users.models import Use... | [
{
"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 | examples/fastapi_integration/src/fastapi_integration/current_user_resolvers/basic_auth.py | maximsakhno/galo-ioc |
from typing import Union
import math
AbstractText = Union[int, bytes]
def byte_length(i: int) -> int:
"""Returns the minimal amount of bytes needed to represent unsigned integer `i`."""
# we need to add 1 to correct the fact that a byte can only go up to 255, instead of 256:
# i.e math.log(0x100, 0x1... | [
{
"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 | pws/asymmetric/rsa/helpers.py | pqlx/pws-crypto |
"""
Functions providing access to file data for unit tests and tutorials.
Preferred way to import the module is via the import syntax:
import pseudo_dojo.data as pdj_data
"""
from __future__ import print_function, division, unicode_literals, absolute_import
import os
from pseudo_dojo.core.pseudos import dojopseudo_f... | [
{
"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 | pseudo_dojo/data/__init__.py | henriquemiranda/pseudo_dojo |
import time
from Data.parameters import Data
from reuse_func import GetData
class District_names():
def __init__(self,driver):
self.driver = driver
def test_districtlist(self):
self.p = GetData()
self.driver.find_element_by_xpath(Data.hyper_link).click()
self.p.page_loading(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 | tests/src/SI/MAP/check_with_districts_from_select_box.py | JalajaTR/cQube |
import torch
import torch.nn as nn
import torch.nn.functional as F
from layers import ImplicitGraph
from torch.nn import Parameter
from utils import get_spectral_rad, SparseDropout
import torch.sparse as sparse
from torch_geometric.nn import global_add_pool
class IGNN(nn.Module):
def __init__(self, nfeat, nhid, n... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | graphclassification/models.py | makinarocks/IGNN |
# Time: O(n^2)
# Space: O(1)
class Solution(object):
def triangleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = 0
nums.sort()
for i in reversed(xrange(2, len(nums))):
left, right = 0, i-1
while left < right:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | Algo and DSA/LeetCode-Solutions-master/Python/valid-triangle-number.py | Sourav692/FAANG-Interview-Preparation |
import unittest
import os
from parsons import CivisClient, Table
# from . import scratch_creds
@unittest.skipIf(not os.environ.get('LIVE_TEST'), 'Skipping because not running live test')
class TestCivisClient(unittest.TestCase):
def setUp(self):
self.civis = CivisClient()
# Create a schema, cr... | [
{
"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 | test/test_civis.py | Tomiiwa/parsons |
# License: BSD Style.
from ...utils import verbose
from ..utils import _data_path, _get_version, _version_doc
@verbose
def data_path(path=None, force_update=False, update_path=True, download=True,
verbose=None):
"""
Get path to local copy of the kiloword dataset.
This is the dataset from [... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | mne/datasets/kiloword/kiloword.py | DraganaMana/mne-python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.