source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""This module implements a simple replay buffer."""
import numpy as np
from garage.misc.overrides import overrides
from garage.replay_buffer.base import ReplayBuffer
class SimpleReplayBuffer(ReplayBuffer):
"""
This class implements SimpleReplayBuffer.
It uses random batch sample to minimize correlation... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | garage/replay_buffer/simple_replay_buffer.py | shadiakiki1986/garage |
#!/usr/bin/env python
"""Test suite for aospy.utils module."""
import sys
import unittest
import numpy as np
import aospy.utils.vertcoord as vertcoord
class AospyUtilsTestCase(unittest.TestCase):
def setUp(self):
self.p_in_hpa = np.array([1000, 925, 850, 775, 700, 600, 500, 400, 300,
... | [
{
"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 | aospy/test/test_utils_vertcoord.py | spencerahill/aospy |
import pathlib
from cldfbench import Dataset as BaseDataset
class Dataset(BaseDataset):
dir = pathlib.Path(__file__).parent
id = "test_bench"
def cldf_specs(self): # A dataset must declare all CLDF sets it creates.
return super().cldf_specs()
def cmd_download(self, args):
"""
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_bench/cldfbench_test_bench.py | dictionaria/cldf2lift |
class Basic:
def __init__(self, identifier):
self._identifier = identifier
def __eq__(self, other):
return isinstance(other, Basic) and self.identifier == other.identifier
def __str__(self):
return self.identifier
@property
def identifier(self):
return self._identi... | [
{
"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 | nbe/type_syntax.py | decb/stlc-py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_mqtt_videocap
----------------------------------
Tests for `mqtt_videocap` module.
"""
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from mqtt_videocap import mqtt_videocap
from mqtt_videocap import cli
@pytest.fixtu... | [
{
"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 | tests/test_mqtt_videocap.py | flyte/mqtt-videocap |
import tensorflow as tf
import nature
LAYER = nature.Layer
MIN_LAYERS, MAX_LAYERS = 2, 4
UNITS_OPTIONS = [64, 128, 256, 512]
class MLP(tf.keras.layers.Layer):
"""
units_list: list of int for units
fns_list: list of strings for activations (default None)
"""
def __init__(self, AI, units=None, la... | [
{
"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 | nature/bricks/mlp.py | bionicles/neuromax |
import pulumi
import pulumi.runtime
from ... import tables
class ClusterRoleList(pulumi.CustomResource):
"""
ClusterRoleList is a collection of ClusterRoles
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
if not __name__:
raise TypeError('Missing resourc... | [
{
"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 | sdk/python/pulumi_kubernetes/rbac/v1/ClusterRoleList.py | rosskevin/pulumi-kubernetes |
import os
import mock
import six
import tempfile
from specter import Spec, expect
from aumbry.errors import LoadError, SaveError
from aumbry.utils.file import load_file, save_file
class VerifyFileUtils(Spec):
def before_each(self):
self.cfg_file = tempfile.NamedTemporaryFile(delete=False)
with s... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | spec/utils/file.py | jimbobhickville/aumbry |
import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer
class MyBot(sc2.BotAI):
async def on_step(self, iteration):
for structure in self.structures:
self._client.debug_text_world(
"\n".join([
f"{structure.type_id.name... | [
{
"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 | examples/show_debug.py | Matuiss2/python-sc2 |
from django.shortcuts import render, redirect
from django.contrib import messages
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
from django.contrib.auth.decorators import login_required
def register(request):
if request.method == "POST":
form = UserRegisterForm(request.POST)
... | [
{
"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 | users/views.py | DanielG-H/todo_app |
# Java locale differences from JDK 9 onwards, and locale variation on
# developer machines, break test_strptime tests. This manifests more on Windows.
# Rather than diverge from the Python source, this overrides with extra locale
# setup.
# Merging back into CPython is desirable, but is a bigger discussion around
# lib... | [
{
"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 | Lib/test/test_strptime_jy.py | jeff5/jython-whinchat |
"""
Hydrothermal Venture
https://adventofcode.com/2021/day/5
"""
import re
from collections import defaultdict
from aoc import parse_numbers
class Vent:
def __init__(self, x1, y1, x2, y2):
assert x1 != x2 or y1 != y2
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
... | [
{
"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 | 2021/day_05/solution.py | krother/advent_of_code |
import unittest
from unittest.mock import Mock
from guet.commands.command import Command
from guet.executor import Executor
from guet.factory import CommandFactory
class TestExecutor(unittest.TestCase):
def test_init_loads_command_factory_by_default(self):
executor = Executor()
self.assertIsNo... | [
{
"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/test_executor.py | sapphon/guet |
# -*- coding:utf-8 -*-
"""
统一config调配
"""
__author__ = 'zcj'
import www.config_default
class Dict(dict):
'''
Simple dict but support access as x.y style.
'''
def __init__(self, names=(), values=(), **kw):
super(Dict, self).__init__(**kw)
for k, v in zip(names, values):
... | [
{
"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 | www/config.py | zuocaijian/HiPythonWeb |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.utils import ImageMeants
def test_ImageMeants_inputs():
input_map = dict(args=dict(argstr='%s',
),
eig=dict(argstr='--eig',
),
environ=dict(nohash=True,
usedefault=True,
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"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 | nipype/interfaces/fsl/tests/test_auto_ImageMeants.py | grlee77/nipype |
import pygame as pg
import random
class Starfield(object):
def __init__(self, rect):
self.stars = []
self.pos = (0,0)
self.size = rect.size
self.speed = 1
self.color = (255,255,255, 255)
self.backgroundcolor = pg.Color(0,0,0)
for loop in range(100):
... | [
{
"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 | examples/common/starfield.py | slode/triton |
from redbot.core import data_manager
from .json_utils import *
class CogSettings(object):
SETTINGS_FILE_NAME = "legacy_settings.json"
def __init__(self, cog_name, bot=None):
self.folder = str(data_manager.cog_data_path(raw_name=cog_name))
self.file_path = os.path.join(self.folder, CogSetting... | [
{
"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 | tsutils/cog_settings.py | kary5678/tsutils |
import os
import numpy as np
import pandas as pd
from sklearn.model_selection import ShuffleSplit
from sklearn.preprocessing import Imputer, StandardScaler
from sklearn.utils import check_random_state
from csrank.constants import LABEL_RANKING
from csrank.util import ranking_ordering_conversion
from ..dataset_reader ... | [
{
"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 | csrank/dataset_reader/labelranking/survey_dataset_reader.py | hytsang/cs-ranking |
import matplotlib
matplotlib.use("Agg")
import matplotlib.pylab as plt
from math import ceil
import numpy as np
import argparse
from functools import partial
import os
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Reshape, Flatten
from keras.layers.merge import _Merge
from keras.laye... | [
{
"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 | Chapter05/utils.py | Kushalshingote/Hands-On-Generative-Adversarial-Networks-with-Keras |
def pow(n,r):
if r == 1:
return n
elif r == 0:
return 1
elif r < 0:
res = 0
n1 = n
i = -1
while i > r:
res = n*n1
n1 = res
i -= 1
return (1/res)
else:
res = 0
n1 = n
for i in range(r):
res = n*n1
n1 = res
return res
def sigmoid(w_sum):
e = 2.71828183
output = 1/(1+(pow(e,-... | [
{
"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 | SimplePrediction.py | PrakamyaKhare/Machine-Learning |
# coding: utf-8
"""
Thola
REST API for Thola. For more information look at our Github : https://github.com/inexio/thola # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
impor... | [
{
"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 | test/test_check_device_request.py | inexio/thola-client-python |
# coding: utf-8
# 2021/6/19 @ tongshiwei
from EduCDM.IRR import IRT
def test_irr_irt(train_data, test_data, params, tmp_path):
cdm = IRT(params.user_num, params.item_num, params.knowledge_num)
cdm.train(train_data, test_data=test_data, epoch=2)
filepath = tmp_path / "irr.params"
cdm.save(filepath)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | tests/irr/test_irt.py | ViviHong200709/EduCDM |
#!/usr/bin/env python3
from flask import abort, jsonify, request
from flask_classful import FlaskView
from marshmallow import ValidationError
from utils import ponytoken_required, this_player, anyadmin_required, json_required
from model import db, Pony, Hug
from schemas import PonySchema
class PoniesView(FlaskView... | [
{
"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 | ponyhug/views/ponies_view.py | marcsello/ponyhug-backend |
import pytest
from inventory_control import storage
def get_config():
"""
Create my simple localhost config
:return:
"""
config = {'host': 'localhost', 'user': 'wce',
'password': 'thispasswordisobjectivelyterrible',
'db': 'inventory_control'}
return config
def te... | [
{
"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 | tests/test_storage.py | worldcomputerxchange/inventory-control |
import unittest
class TestClassBase(unittest.TestCase):
"""Test Data"""
def setUp(self):
pass
class TestClassName(TestClassBase):
"""Test block hash"""
def test_func_name(self):
result = ""
expected = "-0.00001234"
self.assertEqual(expected, result)
if __name__ == '_... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | Uwallet/tests/test_demo.py | monotone/Ulord-platform |
"""product_migration_for_vs
Revision ID: 31ec16d4f1e9
Revises: a37f90e6802d
Create Date: 2021-04-30 10:01:10.794355
"""
import sqlalchemy as sa
from alembic import op
from flask import current_app
from auth_api.models import db
from auth_api.services.products import Product
from auth_api.services.rest_service import... | [
{
"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 | auth-api/migrations/versions/31ec16d4f1e9_product_migration_for_vs.py | karthik-aot/sbc-auth |
from functools import reduce
from operator import sub, mul
from typing import Tuple, Union
Scalar = Union[int, float]
Vector = Tuple[Scalar, ...]
Matrix = Tuple[Vector, ...]
vector = tuple
def mult_vs(u: Vector, s: Scalar) -> Vector:
return vector(map(lambda x: s * x, u))
def mult_v(u: Vector) -> Scalar:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | utils/algebra.py | pmikolajczyk41/Discriminative-vs-Generative-classifiers |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class KoubeiCateringOrderPayApplyResponse(AlipayResponse):
def __init__(self):
super(KoubeiCateringOrderPayApplyResponse, self).__init__()
self._out_pay_no = None
s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | alipay/aop/api/response/KoubeiCateringOrderPayApplyResponse.py | snowxmas/alipay-sdk-python-all |
import random
import string
from cache import Cache
from client_factory import ClientFactory
class CommonMethods():
def __init__(self, cache):
self.cache = cache
self.client_factory = ClientFactory(self.cache)
def get_unused(self, name, resource):
if self.cache[name][resource]['used'... | [
{
"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 | spamostack/common.py | ivanovmi/spam-o-stack |
import numpy as np
from keras import backend as K
#
# Tuning these will adjust the output of your network
# class_weights[0] = penalty for misclassifying background
# class_weights[1] = penalty for misclassifying unknown
# class_weights[2] = penalty for misclassifying foreground
# Setting class_weights = [.25,0,1] ... | [
{
"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 | losses.py | williamdjones/cv_assignment_5 |
from xml.etree.ElementTree import Element, SubElement
from .door import Door
class DoubleSwingDoor(Door):
def __init__(self, door_edge, level_elevation):
super().__init__(door_edge, level_elevation)
motion_degrees = door_edge.params['motion_degrees'].value
self.motion_radians = 3.14 * moti... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | building_map_tools/building_map/doors/double_swing_door.py | marcoag/traffic_editor |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | deep-rl/lib/python2.7/site-packages/OpenGL/raw/EGL/VERSION/EGL_1_1.py | ShujaKhalid/deep-rl |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"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 | profiles_api/permissions.py | rijalalfariz/profiles-rest-api |
#clothes by weather
import random
def pickTop(clothesList):
return random.choice(clothesList[0])
def pickBottoms(clothesList):
return random.choice(clothesList[1])
#sorts clothes into weather type and returns a list of clothes of the correct weather
def sortWeather(clothesList, weather):
#eventually com... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | sortByWeather.py | LeahGabrielle/Clothes |
"""
Dummy layout. Used when somebody creates an `Application` without specifying a
`Layout`.
"""
from quo.text import HTML
from quo.keys import KeyBinder
from quo.keys.key_binding.key_processor import KeyPressEvent
from .containers import Window
from .controls import FormattedTextControl
from .dimension import D
from ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?"... | 3 | src/quo/layout/dummy.py | chouette254/quo |
from tests.testcase import TestCase
from edmunds.validation.validator import Validator
from wtforms import Form, BooleanField, StringField, PasswordField, validators
from werkzeug.datastructures import MultiDict
class TestValidator(TestCase):
"""
Test the validator
"""
def test_validates(self):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | tests/validation/testvalidator.py | LowieHuyghe/edmunds-python |
from Crypto.Hash import SHA256
import struct
# import sig
from proto import request_pb2
from fastchain import ecdsa_sig as sig
from fastchain.config import _logger
def add_sig(key, id, seq, view, type, message, timestamp=None):
"""
@key
@id
@seq
@view
@type
@message
@... | [
{
"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 | trueconsensus/proto/proto_message.py | truechain/py-trueconsensus |
__copyright__ = """
Copyright 2016 Lukasz Tracewski
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 applic... | [
{
"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 | gee_asset_manager/batch_remover.py | dh-conciani/gee_asset_manager |
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from model import Todo
app = FastAPI()
from database import (
fetch_one_todo,
fetch_all_todos,
create_todo,
update_todo,
remove_todo
)
origins = ['https://localhost:3000']
app.add_midd... | [
{
"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 | backend/main.py | le-kag/Fast-API-backend |
# Time: O(m * n)
# Space: O(m + n)
class Solution(object):
def findLonelyPixel(self, picture):
"""
:type picture: List[List[str]]
:rtype: int
"""
rows, cols = [0] * len(picture), [0] * len(picture[0])
for i in range(len(picture)):
for j in range(len(pic... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | Python/lonely-pixel-i.py | sm2774us/leetcode_interview_prep_2021 |
from django.db import models
from apps.home.models import Profil,Session
from django.db.models.fields.related import OneToOneField,ManyToManyField
from django.db.models.deletion import CASCADE
from django.db.models.fields import CharField, DateField, IntegerField, TextField
# Create your models here.
class ClassLevels... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | core/apps/classes/models.py | yavuzbektas/StudentAnalayze |
# -*- coding: utf-8 -*-
class C:
a = 'abc'
def __getattribute__(self, args):
print('__getattribute_ is called')
#import pdb; pdb.set_trace()
#return object.__getattribute__(self, args)
return super().__getattribute__(args)
def __getattr__(self, name):
print('__getattr()__ is called')
return name+ 'from ... | [
{
"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 | app/getattrtest.py | asuraswrath/pysample |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import namedtuple
from collections import deque
from collections import defaultdict
from collections import OrderedDict
from collections import Counter
def test_namedtuple():
Point = namedtuple('Point', ['x', 'y'])
p = Point(1, 2)
print('p:',... | [
{
"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 | draft/use_collections.py | gorgeousbubble/Nightmare |
from importlib import import_module
def dynamic_callable(name):
module_name, function_name = name.rsplit('.', 1)
def wrapped(*args, **kwargs):
module = import_module(module_name)
function = getattr(module, function_name)
return function(*args, **kwargs)
wrapped.__name__ == function... | [
{
"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 | shark/utils/dynamic_callable.py | bikeshedder/shark |
import pytest
import factory
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from bazar.models import Entity, Note
from bazar.forms.entity import EntityForm
from bazar.forms.note import NoteForm
import factories
@pytest.mark.django_db
def test_form_entity(admin_client):
... | [
{
"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 | project_test/tests/test_002_forms.py | emencia/emencia-django-bazar |
"""
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | plaid_project/contrib/sites/migrations/0003_set_site_domain_and_name.py | reetikaSR/PlaidProject |
def c_to_f(Jimmy):
# Forumla = (c * 9/5) +32
# I took this formula from this link: http://contractor quote
f = (c * 9/5) + 32
return f
def c_to_k(Jimmy):
#Forumla = (c + 273.15 )
# I took this formula from this link: //contractor quote
k = (c + 273.15)
return k
def f_to_c(Jimmy):
#... | [
{
"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 | library/temperature.py | Jimmyjtc001/assignment2 |
import aiohttp
DOMAIN = 'hikvision'
class Hikvision(object):
def __init__(self, token, communityId):
"""Initialize device."""
self.name = '云眸社区'
self.token = token
self.communityId = communityId
@property
def device_info(self):
return {
"identifiers": ... | [
{
"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 | custom_components/hikvision/hikvision.py | shaonianzhentan/hikvision |
from pathlib import Path, PurePath
class Directory:
def __init__(self, path_in_image, path_out_image, path_out_file):
self.__path_in_image = path_in_image
self.__path_out_image = path_out_image
self.__path_out_file = path_out_file
self.__allowed_image_extension = ['.jpg', '.jpeg',... | [
{
"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 | tax_receipt/directory.py | paaarx/tax_receipt |
import numpy as np
def make_exp_kernel(L0):
def exp_kernel(x1, x2):
x1 = np.expand_dims(x1, 2) # Append a singleton dimension
x2 = x2.T
return np.exp(-np.mean(np.abs(x1 - x2), axis=1) / L0)
return exp_kernel
def make_sq_exp_kernel(L0):
def sq_exp_kernel(x1, x2):
x1 = np.exp... | [
{
"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 | cpu_ver/hypergrad/kernel_methods.py | bigaidream-projects/drmad |
"""
decorator for functions that take a unique model attribute as
url parameter (or other string argument), and convert that
into an actual instance of that model as argument for the function
e.g. django url sees this function:
my_view(request, example_pk)
which is defined as
@instantiate(Example)
def my_vi... | [
{
"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 | misc/decorators/instantiate.py | mverleg/django_misc |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2015 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | [
{
"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 | helix/common/exceptions.py | phantomii/helix |
class UnionFind:
"""A collection of distjoint sets."""
def __init__(self, size: int) -> None:
"""Creates a collection of size disjoint unit sets."""
self._parent = [-1] * size
def find(self, idx: int) -> int:
"""Return the identifier of a representative element for the set
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | permuta/misc/union_find.py | quintant/Permuta |
import unittest
from openprocurement.framework.cfaua.tests.base import BaseAgreementContentWebTest
from openprocurement.framework.cfaua.tests.data import TEST_AGREEMENT
class AgreementContractsResourceTest(BaseAgreementContentWebTest):
initial_data = TEST_AGREEMENT
def test_get_agreement_contracts(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | src/openprocurement/framework/cfaua/tests/contract.py | ProzorroUKR/openprocurement.api |
import numpy
class SegmentationResult:
"""
Object that stores the results of the segmentation algorithm.
"""
def __init__(self,
segmented_image: numpy.ndarray,
segmented_classes: numpy.ndarray,
elapsed_time: float):
self.segmented_image = seg... | [
{
"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 | colour_segmentation/base/segmentation_result.py | mmunar97/colour-segmentation |
import tensorflow as tf
class Masker(object):
def __init__(self):
"""
This class holds a collection of masking functions that are used across the entire package.
"""
@staticmethod
def create_padding_mask(seq):
"""
:param seq: the sequence to mask
:return: ... | [
{
"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 | transformer_model/masker.py | zbloss/TransformerModel |
from identifyPropositions import config
def test_config_get_existing():
assert config.get("model_name") == "en_core_web_sm"
def test_config_get_missing():
assert config.get("i_do_not_exist") is 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 | tests/test_config.py | syllogio/syllogio-identifyPropositions |
import pytest
from sqlalchemy.orm import Session
from itunesdb.web import crud
from itunesdb.web import database
from itunesdb.web import models
from itunesdb.web import schemas
@pytest.fixture
def album_ambient_1(db: Session, genre_ambient: models.Genre) -> models.Album:
return crud.create_album(
schema... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | itunesdb/test/web/conftest.py | paul-ko/itunes-to-sqlite |
from ....twitter.twitter_user import TwitterUser
from ....genius.match import Match
from .. import utils
user = TwitterUser("MontellFish")
matcher = Match()
def test_basic_match():
query = ""
top_words = user.get_top_words()
word_limit = 1
for index, word_freq in enumerate(top_words):
query ... | [
{
"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 | tweetbrain/backend/app/api_v1/songs/tests/test_song_matches.py | ShraxO1/you |
# 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.
import numpy as np
import torch.utils.data
class FairseqDataset(torch.utils.data.Dataset):
"""A dataset that provides helpers for batchi... | [
{
"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 | fairseq/data/fairseq_dataset.py | nadongguri/fairseq |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/cmdline/commands/test_status.py | pranavmodx/aiida-core |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayTradeAppMergePayModel(object):
def __init__(self):
self._pre_order_no = None
@property
def pre_order_no(self):
return self._pre_order_no
@pre_order_no.setter
... | [
{
"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 | alipay/aop/api/domain/AlipayTradeAppMergePayModel.py | snowxmas/alipay-sdk-python-all |
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from django.conf import settings
def dumps(json,expires):
"""
加密
:param json:字典
:param expires:加密数据的过期时间
:return: 字符串
"""
# 1 创建工具对象
serializer = Serializer(settings.SECRET_KEY,expires)
# 2加密
s1 = serializer.... | [
{
"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 | meido_mall/meido_mall/utils/meiduo_signature.py | zhangbin9597/py22_django |
from datetime import date, timedelta
from django.db import models
class Plant(models.Model):
name = models.CharField(max_length=100)
image_url = models.URLField(max_length=200)
description = models.TextField()
def __str__(self):
return self.name
class WateringLog(models.Model):
plant = ... | [
{
"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 | houseplants/houseplants_api/models.py | galihmelon/houseplants-server |
from math import dist
import requests, json, time
import tkinter as tk
root=tk.Tk()
root.geometry("425x300")
root.title('Tamil Nadu COVID-19 Tracker App')
root['bg']='yellow'
day = str(time.localtime().tm_mday) + '.' + str(time.localtime().tm_mon) + '.' + str(time.localtime().tm_year)
district = tk.StringVar()... | [
{
"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 | TNcovidapp.py | Yedhubooshan/Covid-TN-app |
import argparse
def add_common_args(parser: argparse.ArgumentParser):
parser.add_argument(
'--dry-run',
action='store_true',
default=False,
help='If true, will not actually do any changes to i3 workspaces.')
parser.add_argument(
'--log-level',
choices=('debug', ... | [
{
"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 | i3wsgroups/cli.py | damani42/i3-workspace-groups |
from scapy.all import *
conf.verb = 0
class HostPR:
def __init__(self, dst_ips):
self._dst_ips = dst_ips
self._hosts = []
def discover(self):
for dst_ip in self._dst_ips:
packet = arping(dst_ip)
if packet[0]:
self._hosts.append(dst_ip)
... | [
{
"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 | server_django/apps/api/modules/nmap_folder/hostPR.py | notclement/botnet-enumeration-network |
from . import *
class TestHttpManager(TestCase):
def test_standalone_c(self):
pkg = MockPackage('test_standalone_c', 'c_configure_make_install', {'NAME': 'foo'})
pkg.render_commit()
vee(['install', mock_url('packages/test_standalone_c.tgz'),
'--install-name', 'foo/1.0.0',
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_http_package.py | immersionroom/vee |
import pytest
import uqbar.strings
import supriya.patterns
pattern_01 = supriya.patterns.Pn(
supriya.patterns.Pbind(foo=supriya.patterns.Pseq(["A", "B", "C"])), repetitions=2
)
pattern_02 = supriya.patterns.Pn(
supriya.patterns.Pbind(foo=supriya.patterns.Pseq(["A", "B", "C"])),
key="repeat",
repetit... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},... | 3 | tests/patterns/test_patterns_Pn.py | butayama/supriya |
import numpy as np
from .PCASmallestEig import pca_smallest_eig, pca_smallest_eig_powermethod
from .Withness import withness
from .CalculateAngle import get_angle
#RP1D clustering from
#Han, Sangchun, and Mireille Boutin. "The hidden structure of image datasets." 2015 IEEE International Conference on Image Processing ... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | src/AngleMeasurement/RP1DClustering.py | paigeco/VirtualGoniometer |
import sys
from typing import Tuple, List
import pytest
from clizy import run
from tests.utils import stdoutify, cli_print_dict
@pytest.mark.parametrize("type_hint, value, expected_output", [
(Tuple[int, int], ['1', '2'], stdoutify(values=[1, 2])),
(Tuple[str, str], ['a', 'b'], stdoutify(values=['a', 'b']))... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | tests/tests_cli/test_positional_containers.py | prokopst/clizy |
#
# Copyright 2017 National Renewable Energy Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
{
"point_num": 1,
"id": "every_function_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 | reg_tests/lib/rtestlib.py | abhineet-gupta/openfast |
import nextcord
from nextcord.ext import commands, menus
bot = commands.Bot(command_prefix="$")
class ButtonConfirm(menus.ButtonMenu):
def __init__(self, text):
super().__init__(timeout=15.0, delete_message_after=True)
self.text = text
self.result = None
async def send_initial_messa... | [
{
"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/confirm.py | Skelmis/nextcord-ext-menus |
import unittest
from programy.services.lookups.countrycodes import CountryCodes
class CountryCodesTests(unittest.TestCase):
def test_names(self):
self.assertEqual(['Ukraine', 'UA', 'UKR', '804'], CountryCodes.NAMES['Ukraine'])
def test_two_digits(self):
self.assertEqual(['Ukraine', 'UA', 'UK... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | test/programytest/services/lookups/test_countrycodes.py | RonKhondji/program-y |
import socket
import time
from xmlrpclib_to import ServerProxy
import httpretty
import pytest
XML_RESPONSE = """<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><string>Test</string></value>
</param>
</params>
</methodResponse>"""
def timeout(request, url, headers)... | [
{
"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 | tests/tests_timeout.py | gisce/xmlrpclib-to |
from dataclasses import dataclass
from boltons.cacheutils import cachedproperty
from boltons.strutils import split_punct_ws
from cltkv1.core.data_types import Process
from cltkv1.stops.words import Stops
@dataclass
class StopsProcess(Process):
"""
>>> from cltkv1.core.data_types import Doc, Word
>>> fr... | [
{
"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 | src/cltkv1/stops/processes.py | todd-cook/cltkv1 |
import threading, atexit, sys
try:
from thread import start_new_thread
except:
from _thread import start_new_thread
def _atexit():
print('TEST SUCEEDED')
sys.stderr.write('TEST SUCEEDED\n')
sys.stderr.flush()
sys.stdout.flush()
# Register the TEST SUCEEDED msg to the exit of the process... | [
{
"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 | python/helpers/pydev/pydev_tests_python/resources/_debugger_case_unhandled_exceptions.py | tgodzik/intellij-community |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: Niccolò Bonacchi
# @Date: Friday, October 30th 2020, 10:42:49 am
import unittest
import ibllib.io.extractors.ephys_passive as passive
import numpy as np
class TestsPassiveExtractor(unittest.TestCase):
def setUp(self):
pass
def test_load_passive... | [
{
"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 | ibllib/tests/extractors/test_ephys_passive.py | nbonacchi/ibllib |
from . import model
from . import gate_type as gtype
def cx(control, target) :
g = model.Gate(gtype.X())
g.set_ctrllist([control])
g.set_qreg(target)
return g
def ci(control, target) :
g = model.Gate(gtype.ID())
g.set_ctrllist([control])
g.set_qreg(target)
return g
# def swap(qreg0, q... | [
{
"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 | qgate/model/gate_factory.py | rickyHong/Gate-Quantum-gpu-repl |
from decimal import Decimal
from django.db.models import Sum
from django.shortcuts import get_object_or_404
from datetime import date, timedelta
from .models import Task
class TaskRepository:
"""Repository for tasks."""
def list(self):
return Task.objects.all()
def create(self, title: str, descr... | [
{
"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 | todo/task/repository.py | matiasjavierlucero/todo-challenge |
#coding:utf-8
from flask import *
import db,modules
def User_Statistic(username):
submissions = db.Read_Submissions({'username':username})
status_cnt = [ 0 for i in range(13) ]
for submission in submissions:
status_cnt[submission['status']] += 1
return status_cnt
def Run(username):
user = db.Read_User_Byname(u... | [
{
"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 | web/sites/userhome.py | intoj/intoj-legacy |
from core.plant import Plant
from core.schedule import Schedule
class Simulator(object):
def __init__(self, plant):
assert type(plant) == Plant
self.plant = plant
def run(self, schedule):
assert type(schedule) == Schedule
pass # TODO
| [
{
"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 | Projects/PyPlantSIM/evaluation/simulative.py | fredmorcos/attic |
class Options:
def __init__(self, output_formats):
self.output_formats = output_formats
def get_output_formats(self):
return self.output_formats
def __add__(self, other):
return Options(output_formats=self.output_formats + other.output_formats)
| [
{
"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 | conversion_service/converters/converter.py | das-g/osmaxx-postgis-conversion |
import graphene
from django.db.models import Min, Q, QuerySet
from ..core.types import SortInputObjectType
class CommentSortField(graphene.Enum):
NUMBER = ["pk"]
CREATION_DATE = ["created", "status", "pk"]
STATUS = ["status", "pk"]
@property
def description(self):
if self.name in Comment... | [
{
"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 | saleor/graphql/comment/sorters.py | wuchujiecode/saleor |
import unittest
from tests.utils import TestHarness, tasks
_final_state = None
@tasks.bind()
def state_passing_workflow():
return _create_workflow_state.send(initial_state=123) \
.continue_with(_add_two_numbers, 3, 5) \
.continue_with(_update_workflow_state) \
.continue_with(_noop) \
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | tests/test_state_passing.py | LaudateCorpus1/flink-statefun-tasks |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import luigi
from servicecatalog_puppet.workflow.codebuild_runs import code_build_run_for_task
class CodeBuildRunTask(code_build_run_for_task.CodeBuildRunForTask):
code_build_run_name = luigi.Parame... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | servicecatalog_puppet/workflow/codebuild_runs/code_build_run_task.py | richardmilnerwatts/aws-service-catalog-puppet |
# -*- coding: future_fstrings -*-
from xml.dom import minidom
import xpath
import os
import base64
import mimetypes
class TemplateSVG:
def __init__(self, templateFile):
with open(templateFile, 'r') as arquivo:
self.template = minidom.parse(arquivo)
self.svg = self.template.cloneNod... | [
{
"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 | gerador.py | pmarkun/guess_who |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyqt_example.ui'
#
# Created: Sun May 18 03:45:55 2014
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except A... | [
{
"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 | pyqt_ui.py | hacker-h/pyusb-keyboard-alike |
from django import template
from base.forms import MaterialsDonationForm
from django.template.context_processors import csrf
register = template.Library()
@register.inclusion_tag('base/donate.html')
def money_donation_instructions():
return {}
@register.inclusion_tag('base/material_donation.html', takes_context=... | [
{
"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 | base/templatetags/materials_donation.py | imagreenplant/beacon-food-forest |
from conans import ConanFile, CMake
class LibtcodSamplesConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = (
"libtcod/[~=1.15]@hexdecimal/stable",
"sdl2/[~=2.0.5]@bincrafters/stable",
)
default_options = {"*:shared": True}
def b... | [
{
"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 | samples/conanfile.py | SiennaSaito/libtcod |
"""
Setuptools script for pwatch
"""
from setuptools import setup, find_packages
def readme():
"""
Extracts readme contents
"""
with open('README.md') as f:
return f.read()
def requirements():
"""
Extacts requirements.txt contents
"""
with open('requirements.txt') as f:
... | [
{
"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 | setup.py | quanta-computing/hapapi |
#!/usr/bin/env python
# Copyright 2012 Yummy Melon Software LLC
#
# 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 appl... | [
{
"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 | sequenceplot/__init__.py | kickingvegas/SequencePlot |
# coding=utf-8
__author__ = 'renkse'
from forms import FeedbackForm
from django.template import RequestContext, loader
from django.http import HttpResponse, HttpResponseRedirect
from models import Contact, FeedbackMessage
from collections import OrderedDict
import json
def contacts_view(request):
fbform = Feedba... | [
{
"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 | contacts/views.py | renkse/django-simple-contacts |
from flask import Flask, render_template, redirect, request, jsonify, Markup
from flask_pymongo import PyMongo
import scrape_mars
import json
import pandas as pd
import time
app = Flask(__name__)
# Use PyMongo to establish Mongo connection
mongo = PyMongo(app, uri="mongodb://localhost:27017/mars_db")
@app.route("/"... | [
{
"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 | Missions_to_Mars/app.py | navistar792/web-scraping-challenge |
from typing import Type, Tuple
from ....core.component import ProcessorComponent
from ....core.domain import DomainSpecifier
from ....core.specifier import ProcessorStageSpecifier
class PolygonDiscarderISPSpecifier(ProcessorStageSpecifier):
"""
Specifies the dimension-discarder.
"""
@classmethod
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | src/wai/annotations/isp/polygon_discarder/specifier/_PolygonDiscarderISPSpecifier.py | waikato-ufdl/wai-annotations-core |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_json_schema_props_or_string_array.py | jashandeep-sohi/kubernetes-python |
import networkx as nx
import helpers.DataLoader as dataLoader
import matplotlib.pyplot as plt
import helpers.DataLoader as data
class Question2_3:
def main(self):
"""
Caclulate the indegree and outdegree distribution of the given graph
"""
# Load the data
data = dataLoader... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | Questions/Question2_3.py | sevmardi/Social_network_analysis |
import re
from typing import Any, Dict
from django.http import HttpRequest
from django.views.debug import SafeExceptionReporterFilter
class ZulipExceptionReporterFilter(SafeExceptionReporterFilter):
def get_post_parameters(self, request: HttpRequest) -> Dict[str, Any]:
filtered_post = SafeExceptionReporte... | [
{
"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 | zerver/filters.py | alexandraciobica/zulip |
from __future__ import absolute_import
import scrapy
from collections import defaultdict
from scrapy.loader.processors import Join, MapCompose, Identity
from w3lib.html import remove_tags
from .utils.processors import Text, Number, Price, Date, Url, Image
class PortiaItem(scrapy.Item):
fields = defaultdict(
... | [
{
"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 | scrapper/scrapper/items.py | mpetyx/london-event-scraper |
import os
from pathlib import Path
import pytest
@pytest.fixture
def test_files(nb_file):
pytest.importorskip("nbconvert")
pytest.importorskip("nbformat")
import nbconvert
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
if not Path(nb_file).exists():
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | thinc/tests/test_examples.py | TheVinhLuong102/thinc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.