source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""A test that publishes NumPy arrays.
Uses REQ/REP (on PUB/SUB socket + 1) to synchronize
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2010 Brian Granger
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, dis... | [
{
"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 | publisher.py | binwang-intel/ZeroMQ_test01 |
import discord
from discord.ext import commands
import utils
import requests
class Weather(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def weather(self, ctx, *, city: str):
city_name = city
url = f"http://api.openweathermap.org/data/2.5/weather?appid=64dfdf8642... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | Cogs/weather.py | Camto/Lad |
# coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | [
{
"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 | ask-sdk-model/ask_sdk_model/interfaces/audioplayer/clear_behavior.py | Signal-Kinetics/alexa-apis-for-python |
# test_core_common.py ---
#
# Filename: test_core_common.py
# Description:
#
# Author: Yu Lu
# Email: yulu@utexas.edu
# Github: https://github.com/SuperYuLu
#
# Created: Fri May 4 11:33:37 2018 (-0500)
# Version:
# Last-Updated: Sat Jul 28 15:00:42 2018 (-0500)
# By: yulu
# Update #: 24
... | [
{
"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 | scibeam/tests/test_common.py | SuperYuLu/SciBeam |
import importlib
from fhirbug.exceptions import ConfigurationError
from fhirbug.config.utils import LazySettings
settings = LazySettings()
def import_models():
"""
Dynamic import of the models module based on the backend selected in the configuration
"""
global settings
if not settings:
... | [
{
"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 | fhirbug/config/__init__.py | VerdantAI/fhirbug |
import pytest
def test_1():
...
@pytest.mark.slow
def test_2():
...
@pytest.mark.skip
def test_3():
...
| [
{
"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_markers.py | twotwo/python-pytest |
import numpy as np
def calculate_distance(rA, rB):
"""
This function calculates the distance between two points.
Parameters
----------
rA, rB : np.ndarray
The coordinates of each point.
Returns
-------
distance : float
The distance between two points.
Examples
... | [
{
"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 | molecool/measure.py | hienerd/molecool |
from dis_snek import InteractionContext, slash_command
from ElevatorBot.commands.base import BaseScale
from ElevatorBot.core.misc.calculator import Calculator
class CalculatorCommand(BaseScale):
@slash_command(name="calculator", description="Summons a handy calculator")
async def calculator(self, ctx: Intera... | [
{
"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 | ElevatorBot/commands/b_miscellaneous/calculator.py | TheDescend/elevatorbot |
"""
File: bouncing_ball.py
Name: Ruby
-------------------------
This file uses campy module to
simulate ball bouncing on a GWindow object
"""
from campy.graphics.gobjects import GOval
from campy.graphics.gwindow import GWindow
from campy.gui.events.timer import pause
from campy.gui.events.mouse import onmou... | [
{
"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 | stanCode Projects/campy_projects/bouncing_ball.py | ruby-pan/Stanford-Coding-Projects |
import glob
import cv2 as cv2
import numpy as np
import matplotlib.pyplot as plt
# import random
import math
from tqdm import tqdm
def load_images(path):
image_list = []
images = glob.glob(path)
for index in range(len(images)):
image = cv2.cvtColor(cv2.imread(images[index]), cv2.COLOR_BGR2RGB)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | SmallObjectAugmentation/Helpers.py | riciche/SimpleCVReproduction |
import pytest
import os
import sys
import time
from plumbum import local, NOHUP
try:
from plumbum.cmd import bash, echo
except ImportError:
bash = None
echo = None
from plumbum.path.utils import delete
from plumbum._testtools import skip_on_windows
@skip_on_windows
class TestNohupLocal:
def read_file(s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | tests/test_nohup.py | octarinesec/plumbum |
from model import GiverReceiverLink
from .AbstractDAO import AbstractDAO
class GiverReceiverLinkDAO(AbstractDAO):
def __init__(self, file_path, participant_dao):
super().__init__(file_path)
self.participant_dao = participant_dao
def get(self, giver):
raw_links = super().read... | [
{
"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 | api/dataaccess/GiverReceiverLinkDAO.py | domenic-corso/kris-kringle-python-web-app |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import u... | [
{
"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 | kubernetes_asyncio/test/test_v1beta1_non_resource_rule.py | hubo1016/kubernetes_asyncio |
class Mahasiswa:
def __init__(self, nama, nilai):
self.nama = nama
self.nilai = nilai
def hitung_nilai(self):
return sum(self.nilai)/len(self.nilai)
mahasiswa = Mahasiswa("Fazlur", (90,70,70,70))
print("Nama :", mahasiswa.nama)
print("Total Nilai :", mahasiswa.hitung_nilai()) | [
{
"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 | PBO_19188/Latihan_7.2.class2.py | Fazlur9/PBO |
import unittest
from test import test_support
import string
import StringIO
mimetools = test_support.import_module("mimetools", deprecated=True)
msgtext1 = mimetools.Message(StringIO.StringIO(
"""Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Foo!
"""))
c... | [
{
"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 | webStorm-APICloud/python_tools/Lib/test/test_mimetools.py | zzr925028429/androidyianyan |
# -*- coding: utf-8 -*-
# pylint: disable=no-member
"""
This file contains tests with base functionality.
"""
def test_merge(merged):
"""
Test that all values from settings are present.
"""
assert hasattr(merged, 'SECRET_KEY')
assert hasattr(merged, 'STATIC_ROOT')
def test_override(merged, mon... | [
{
"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 | tests/test_split_settings.py | abdulniyaspm/django-split-settings |
"""
Copyright 2019 Samsung SDS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | [
{
"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 | function/python/brightics/function/manipulation/test/timeseries_distance_test.py | parkjh80/studio |
from __future__ import annotations
from abc import ABC
from abc import abstractmethod
class FileState(ABC):
_context: File = None
@property
def context(self) -> File:
return self._context
@context.setter
def context(self, value: File) -> None:
self._context = value
@abstract... | [
{
"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 | state/file_states.py | rlelito/DesignPatterns |
class ObjectView(dict):
def __init__(self, *args, **kwargs):
super(ObjectView, self).__init__(**kwargs)
for arg in args:
if not arg:
continue
elif isinstance(arg, dict):
for key, val in arg.items():
self[key] = val
... | [
{
"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 | objectview.py | gpollatos/objectview |
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
import requests
from datetime import datetime, timedelta, timezone
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), "../../", '.env')
load_dotenv(dotenv_path)
RASPI_URL ... | [
{
"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 | sensor/src/get_metrics_test.py | tubone24/raspi_plant_checker |
import enum
from queue import Queue
class Animal(enum.Enum):
cat = 'cat'
dog = 'dog'
class AnimalShelter:
def __init__(self):
self.cats = Queue()
self.dogs = Queue()
self.pos = 0
# Time complexity: O(1)
# Space complexity: O(1)
def enqueue(self, animal: Animal):
... | [
{
"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 | chapter_3/3_6_animal_shelter.py | elishaking/CTCi |
import os
import shutil
import tempfile
import unittest
from django import conf
from django.test import TestCase
from django.test.utils import extend_sys_path
from django.utils import six
@unittest.skipIf(
six.PY2,
'Python 2 cannot import the project template because '
'django/conf/project_template doesn... | [
{
"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 | desktop/core/ext-py/Django-1.11.20/tests/project_template/test_settings.py | maulikjs/hue |
from jd.api.base import RestApi
class OrderJdOrderQueryRequest(RestApi):
def __init__(self,domain='gw.api.360buy.com',port=80):
RestApi.__init__(self,domain, port)
self.jdOrderId = None
def getapiname(self):
return 'biz.order.jdOrder.query'
| [
{
"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 | jd/api/rest/OrderJdOrderQueryRequest.py | fengjinqi/linjuanbang |
# -*- coding: utf-8 -*-
# author: @RShirohara
# TODO: #8
from time import sleep
from .detect import DetectArea
from .googleapis import DetectText, GetTTS
from .send import PlayMP3
from .util import VideoStream, QueueConnector
class Tegaki:
"""HandWriting Detection core class.
Attributes:
capture (... | [
{
"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 | tegaki/core.py | RShirohara/handwriting_detection |
import time
import socket
import re
import ctypes
import argparse
sender = ctypes.CDLL("/send.so")
sender.sendEncryptedAlert.argtype=[ctypes.POINTER(ctypes.c_char), ctypes.c_int]
sender.sendEncryptedAlert.restype=ctypes.c_int
#fileName='/var/log/nmap.log'
def getData(fileName):
data=''
with open(fileName, '... | [
{
"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 | docker_containers/demo_conts/dos_checker/sendAlert.py | slab14/IoT_Sec_Gateway |
from pal.transform.abstract_transform import AbstractTransform
class MakeWriteOnly(AbstractTransform):
@property
def description(self):
d = "removing readable access mechanisms"
return d
def do_transform(self, reg):
readable = [
"mrs_register",
"mrs_banked"... | [
{
"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 | pal/transform/make_write_only.py | mars-research/pal |
# Copyright 2021 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | cirq-google/cirq_google/engine/simulated_local_program.py | LLcat1217/Cirq |
"""Integration tests for DNSMadeEasy"""
from unittest import TestCase
import pytest
from lexicon.tests.providers.integration_tests import IntegrationTestsV2
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interface must
# pass, by inhe... | [
{
"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 | lexicon/tests/providers/test_dnsmadeeasy.py | wheatdog/lexicon |
"""
An implementation of the SMV image reader for ADSC images. Inherits from
FormatSMVADSC, customised for old detector on Diamond Light Source I03,
correctly accounting for the image pedestal & similar
"""
from __future__ import absolute_import, division, print_function
from dxtbx.format.FormatSMVADSCSN import Format... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
}... | 3 | modules/dxtbx/format/FormatSMVADSCSN920.py | jorgediazjr/dials-dev20191018 |
import re
from bs4 import BeautifulSoup
from ._schema import DefaultSchema
from ._utils import get_yields, normalize_string
class MyKitchen101en(DefaultSchema):
@classmethod
def host(cls):
return "mykitchen101en.com"
def author(self):
return self.soup.find("a", {"rel": "author"}).get_te... | [
{
"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 | recipe_parser/recipes/mykitchen101en.py | tyler-a-cox/recipe-parsing |
"""
Testing script to check edge cases for word_pattern.py
"""
import unittest
from word_pattern import Solution
class WordPatternTests(unittest.TestCase):
"""
Test suite to check edge cases for word patterns.
"""
def test_small_valid_word_pattern(self):
self.assertTrue(Solution().word_patt... | [
{
"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 | python/word-pattern/test_word_pattern.py | gurupratap-matharu/Exercism |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render_to_response
from django.views.generic.simple import direct_to_template
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from Aluno.models import Aluno
@login_required
def minhasAva... | [
{
"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 | AMAO/apps/Aluno/views/views.py | arruda/amao |
class User:
def __init__(self, id: str, name: str, color: str, studon: str):
self.id = id
self.name = name
self.color = color
self.studon = studon
class Role:
def __init__(self, id: str, name: str, color: str):
self.id = id
self.name = name
sel... | [
{
"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 | database/table_objects/ping_targets.py | Timo-Meinhof/friedrich-py |
import hug
import sub_api
@hug.cli()
def echo(text: hug.types.text):
return text
@hug.extend_api(sub_command="sub_api")
def extend_with():
return (sub_api,)
if __name__ == "__main__":
hug.API(__name__).cli()
| [
{
"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 | examples/multi_file_cli/api.py | pnijhara/hug |
from gae_handlers import RestHandler
from model import Email
class Emails(RestHandler):
requires_auth = True
model = Email
def get(self, **kwargs):
self.not_allowed()
def put(self):
self.not_allowed()
def delete(self):
self.not_allowed()
def not_allowed(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | app/handlers/emails.py | Stanford-PERTS/triton |
import pandas as pd
def read_csv_files(file_path):
return pd.read_csv(file_path)
def filter_films(dataframe):
pass
def join_categories_with_metadata(facts_df, categories_df):
# Hint: You can use lambda functions to change the id column in order to
# use join method in pandas.
pass
def categ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | Day2/pandas-exercises-python/python-exercises-02-questions/utils/transformation_functions.py | klimpie94/Python-training |
from scipy.spatial import cKDTree
from .base import Structure
class KDTree(cKDTree, Structure):
def __init__(self, *, points, leafsize=16, compact_nodes=False, balanced_tree=False):
Structure.__init__(self, points=points)
self._leafsize = leafsize
self._compact_nodes = compact_nodes
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | pyntcloud/structures/kdtree.py | bernssolg/pyntcloud-master |
from NN_model import *
import math
import numpy as np
coef,intercept = model.get_weights()
def sigmoid(X):
return 1/ (1+math.exp(-X))
def prediction_function(age,affordibility):
weighted_sum = coef[0]*age + coef[1]*affordibility + intercept
return sigmoid(weighted_sum)
#print(prediction_function(.28,... | [
{
"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 | ANN_From_Scratch/gradient_descent.py | rishusiva/InsurancePrediction_ANN |
from consul_kv import map_dictionary
from tests.testcase import TestCase
class TestMapDictionary(TestCase):
def setUp(self):
self.dictionary = {
'some': {'key': 'and', 'some': 'values'},
'with': {
'some': {'other': 'keys'},
'and': {'some': 'other', '... | [
{
"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 | vendor/consul-kv/tests/unit/serializer/test_map_dictionary.py | vdloo/raptiformica |
# These are notebooks that take too long to run so are not tested here
excluded_notebooks = ['Emukit-tutorial-multi-fidelity-bayesian-optimization.ipynb',
'Emukit-tutorial-select-neural-net-hyperparameters.ipynb']
import pytest
import os
from nbconvert.preprocessors import ExecutePreprocessor
im... | [
{
"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 | integration_tests/emukit/notebooks/test_notebooks.py | BrunoKM/emukit |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import StepLR
import sys, pickle
import numpy as np
from copy import deepcopy
from .blocks import Encoder1,Encoder2,Decoder,domainClf
# define the NN architecture
class ConvAutoencoder(nn.Module):
"""
"""
def __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 | models/autoencoder.py | gcramerb/TransferLearning-Sensors |
from model.contact import Contact
def test_modify_contact_first_name(app):
app.contact.modify_first_contact(Contact(first_name="second first name"))
def test_modify_contact_last_name(app):
app.contact.modify_first_contact(Contact(last_name="second last name"))
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | test/test_modify_contact.py | eugence/Python-Training |
def pre_save_test(instance, *args, **kwargs):
instance.pre_save_runned = True
def post_save_test(instance, created, *args, **kwargs):
instance.post_save_runned = True
| [
{
"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 | tests/signals.py | goalplan/django-model-utils |
import os
import shutil
import json
def check_true(option):
"""Check if option is true.
Account for user inputting "yes", "Yes", "True", "Y" ...
"""
option = option.lower()
if 'y' in option or 't' in option:
return True
else:
return False
def process_bibtex(bibtex, tex_root):
... | [
{
"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 | hooks/post_gen_project.py | TLouf/cookiecutter-latex-article |
import unittest
from ParserTest.TestUtil import *
class TestParserMethods(unittest.TestCase):
DIRECT_KOs_ID = 2
PASSIVE_KOs_ID = 3
DEATHS_ID = 4
def test_direct_KO(self):
pokemon_data = {
"Raichu-Alola": ["p1", "Stokin' Dude!"],
"Magikarp": ["p2", "A Karp"]
}
... | [
{
"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 | ParserTest/ParserTest.py | isaacrez/ShowdownParser |
import requests
import json
from briefmetrics.lib.http import assert_response
COLLECT_URL = 'https://heapanalytics.com/api/track'
COLLECT_SESSION = requests.Session()
def collect(app_id, identity=None, event=None, properties=None, http_session=COLLECT_SESSION):
"""
$ curl \
-X POST \
-H "Con... | [
{
"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 | briefmetrics/lib/service/heap.py | shazow/briefmetrics |
from tensorflow import keras
import tensorflow as tf
class BatchNormalization(keras.layers.BatchNormalization):
"""
Identical to keras.layers.BatchNormalization, but adds the option to freeze parameters.
"""
def __init__(self, freeze, *args, **kwargs):
self.freeze = freeze
super(BatchN... | [
{
"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 | net/layers.py | guoshuhong/Classification-networks |
# coding=utf-8
from app.api.base import base_name as names
from app.api.src.sales import *
from app.api.base.base_router import BaseRouter
class Sales(BaseRouter):
def __init__(self):
super().__init__()
self.args = [names.LOGIN, names.PASSWORD]
def get(self, id_user):
args = {
... | [
{
"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 | app/route/route_sales.py | LifeLaboratory/skb_sudo_su |
#
# @lc app=leetcode id=79 lang=python3
#
# [79] Word Search
#
# @lc code=start
class Solution:
def exist(self, board, word):
start = [None, None]
h = len(board)
l = len(board[0])
walked = [[0] * l for _ in range(h)]
for i in range(h):
for j in range(l):
... | [
{
"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 | Python3/79.word-search.py | 610yilingliu/leetcode |
from ContactsSafe import db
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from ContactsSafe import login
#creates table User
class User(db.Model, UserMixin):
#columns in the table
id = db.Column(db.Integer, primary_key = T... | [
{
"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": true
},
... | 3 | Multi User Flask Application/ContactsSafe/database.py | GarvBatra123/Contact-Safe |
'''Module tests'''
from hangman import check_letter, print_word, pick_a_new_word
def test_check_letter():
'''Module test by correct work function check_letter'''
assert check_letter('t',
'test',
1,
['e'],
['o']) ==... | [
{
"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 | tests/test_hangman.py | NPodlozhniy/HangMan |
# Copyright 2021, The TensorFlow Federated Authors.
#
# 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 o... | [
{
"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 | tensorflow_federated/python/learning/optimizers/optimizer_test.py | alessiomora/federated |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# Ported for Lord-Userbot By liualvinas/Alvin
from telethon import events
from userbot import CMD_HANDLER as cmd
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | userbot/modules/aeshtetic.py | Wiki28/WikixCilik |
from .. import NetQuery
import dns.resolver
import logging
import re
class DNSQuery(NetQuery):
"""Query configured or default DNS servers for a particular record."""
def __init__(self, cfg):
super(DNSQuery, self).__init__(cfg)
self.__logger = logging.getLogger('pircons.NetQuery.DNSQuery')
query, nameservers = ... | [
{
"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 | plugins/NetQuery/DNSQuery/__init__.py | madfordmac/pircons |
# 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": "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 | isi_sdk_8_2_0/test/test_auth_users_api.py | mohitjain97/isilon_sdk_python |
from ctypes import byref, Structure, c_char, c_buffer, string_at, windll, c_void_p, c_uint32, POINTER, c_wchar_p, WinError
LPWSTR = c_wchar_p
LPVOID = c_void_p
PVOID = LPVOID
PPVOID = POINTER(PVOID)
DWORD = c_uint32
def RaiseIfZero(result, func = None, arguments = ()):
"""
Error che... | [
{
"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 | pypykatz/dpapi/functiondefs/dpapi.py | wisdark/pypykatz |
import numpy as np
from scipy.stats import norm
from scipy.optimize import fminbound
__all__ = ["polyserial_correlation"]
def polyserial_correlation(continuous, ordinal):
"""Computes the polyserial correlation.
Estimates the correlation value based on a bivariate
normal distribution.
Args:... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer... | 3 | common/polyserial.py | eribean/GIRTH |
import time
import datetime
import json
import hashlib
from .env import Env
from .server import Server
from .hardware import Hardware
class Metric(object):
def __init__(self):
# format of report data
self._version = '0.1'
self._type = 'metric'
self.run_id = None
self.mode =... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | tests/benchmark/milvus_benchmark/metrics/models/metric.py | NotRyan/milvus |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from setuptools import setup, find_packages, Command
import os, sys, re
class RunTestsCommand(Command):
description = "Test command to run testr in virtualenv"
user_options = [
('coverage', 'c',
"Generate code coverage report... | [
{
"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 | src/config/schema-transformer/setup.py | kaweue/contrail-controller |
##########################################################################
##########################################################################
# tclean_base.py
#
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA.
#
# This script is free software; you can redistribute it and/or modify it
# u... | [
{
"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 | scripts/baseclass/stk_test_base.py | casangi/stakeholder |
import os
from alttprbot.tournament.core import TournamentConfig
from alttprbot_discord.bot import discordbot
from .sglcore import SGLCoreTournamentRace
class TWWR(SGLCoreTournamentRace):
async def configuration(self):
guild = discordbot.get_guild(590331405624410116)
return TournamentConfig(
... | [
{
"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 | alttprbot/tournament/sgl21/twwr.py | skyscooby/sahasrahbot |
# Digital OCEAN FLASK SERVER RECEIVES IMAGE
from flask import Flask, request, jsonify
import classify
import base64
import json
import firebase
import env
# Instantiate Flask
app = Flask(__name__)
# health check
@app.route("/status")
def health_check():
return "Running!"
# Performing image Recognition on Image... | [
{
"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 | app.py | flamanta/river-trash-detection |
from collections import defaultdict
import requests
from logger import logger
from perfrunner.helpers.misc import pretty_dict
from perfrunner.helpers.remote import RemoteHelper
from perfrunner.tests import PerfTest
class FIOTest(PerfTest):
TRACKER = 'fio.sc.couchbase.com'
TEMPLATE = {
'group': '{}... | [
{
"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 | perfrunner/tests/fio.py | bochun/perfrunner |
""" Class to count the inversion count using merge sort"""
class InversionCount:
def count(self, A: [int]) -> [int]:
""" Count and return the array containing the count of each element """
index_array = []
rc_arr = []
for ind in range(0, len(A)):
index_array.append(ind... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | InversionCount.py | vinayakasg18/algorithms |
from distributed.protocol import serialize, deserialize
import pickle
import pytest
cupy = pytest.importorskip("cupy")
@pytest.mark.parametrize("size", [0, 10])
@pytest.mark.parametrize("dtype", ["u1", "u4", "u8", "f4"])
def test_serialize_cupy(size, dtype):
x = cupy.arange(size, dtype=dtype)
header, frames ... | [
{
"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 | distributed/protocol/tests/test_cupy.py | mlhenderson/distributed |
# coding: utf-8
"""
Decision Lens API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | python/test/test_field_description_updated_event.py | dlens/dlxapi |
import tensorflow as tf
class Layer():
def __init__(self, output_dim, input_dim=0, activation=None):
# cache parameters
self.activation = activation
self.input_dim = input_dim
self.output_dim = output_dim
class Dense(Layer):
def __init__(self, output_dim, input_dim=0, activa... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | BesterTF/Layers.py | BesterRanX/BesterTF |
import logging
import os
import subprocess
logger = logging.getLogger(__name__)
class Combiner(object):
def __init__(self, options):
self.options = options
def combine(self, page_file_names):
output_file_name = self.options.output_file_name[0]
logger.info("combine %d pages into %s",... | [
{
"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/scan_pdf/combine.py | wuan/scan_pdf |
import mock
from fastapi import status
from fastapi.testclient import TestClient
from tests.conftest import root_token
from main import app
client = TestClient(app)
def test_welcome():
response = client.get("/")
assert response.status_code == status.HTTP_200_OK
assert response.json() == {"message": "M... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tests/test_main.py | ohandyya/python-rest-service |
# pylint: disable=missing-function-docstring, missing-module-docstring/
#==============================================================================
def allocatable_to_pointer():
from numpy import array
a = array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
c = a #pylint:disable=unused-variable
def pointer_to_po... | [
{
"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/codegen/ccode/scripts/arrays_pointers.py | dina-fouad/pyccel |
from flask import (render_template, url_for, flash,
redirect, request, abort, Blueprint)
from flask_login import current_user, login_required
from mpa_admin_app import db
from mpa_admin_app.models import Comment
from mpa_admin_app.comments.forms import CommentForm
comments = Blueprint('comments', __... | [
{
"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 | mpa_admin_app/comments/routes.py | norbertorok92/flask_MVC |
from django.db import models
class Estacionamiento(models.Model):
nombre_duenio = models.CharField(max_length=30)
nombre_est = models.CharField(max_length=30,unique=True)
direccion = models.CharField(max_length=30)
telefono1 = models.IntegerField(max_length=11)
telefono2 = models.IntegerField(max_l... | [
{
"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 | estacionamientos/models.py | ShadowManu/SAGE |
from timeit import timeit
from model.model_group import Group
def test_group_list(app2, db):
print(timeit(lambda: app2.group.get_group_list(), number=1))
def clean(group):
return Group(id=group.id, name=group.name.strip())
print(timeit(lambda: map(clean, db.get_group_list()), number=1000))
asse... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | test/test_db_matches_ui.py | anjel-ershova/python_training |
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from apps.users.models import User
class PermissionSerialzier(serializers.ModelSerializer):
"""
用户权限表序列化器
"""
class Meta:
model=Permission
... | [
{
"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 | E_business_project/apps/E_business_project_admin/serializers/permission.py | ambushonallsides1/E_business_project |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 08:10:35 2021
@author: RAGHAV ATREYA
"""
# -StartPython.py *- coding: utf-8 -*-
"""
Spyder Editor
#%% starts a new cell. Use second green triangle to run just the cell that
your mouse has last clicked in (or Ctrl-Enter on a PC or Command-Return on a
Macintosh or Menu>... | [
{
"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 | StartPython.py | rghvat/-TitlePython-Programming-A-Concise-Introduction |
from tkinter import *
def create_button(screen, text, action):
return Button(screen, text=text, command=action)
def create_label(screen, text):
return Label(screen, text=text, font=("arial", 16, "bold", "italic"), bg='red', width=15)
def create_listbox(screen, items):
list = Listbox(screen, bg='blue')
for ite... | [
{
"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 | code/python/utils.py | gyarab/2021-2e-holis-database_client |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2019 Antony Pavlov <antonynpavlov@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.altera import AlteraPlatform
from litex.build.altera.programmer import USBBlaster
# IOs ----------------------------... | [
{
"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 | litex_boards/platforms/de1soc.py | mhrtmnn/litex-boards |
class ConfigurationError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg | [
{
"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 | ddb/feature/docker/lib/compose/config/errors.py | gfi-centre-ouest/docker-devbox-ddb |
"""Company views."""
# Django REST Framework
from rest_framework import mixins, status, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
# Serializers
from paranuara.companies.serializers import CompanyModelSerializer
from paranuara.companies.serializers import Compan... | [
{
"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 | paranuara/companies/views/companies.py | SPLAYER-HD/Paranuara |
from nextcord.ext import commands
import json
import pymongo
import os
class AddBadWords(commands.Cog):
def __init__(self, client):
self.client = client
@commands.guild_only()
@commands.has_permissions(send_messages=True, manage_messages=True)
@commands.command(name="add-bad-words", aliases=... | [
{
"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 | commands/add-bad-words.py | IamSilentBot/Guardzilla |
import torch.nn
from torch import nn
class SegmentConsensus(torch.nn.Module):
def __init__(self, consensus_type, dim=1):
super().__init__()
self.consensus_type = consensus_type
self.dim = dim
def forward(self, input_tensor):
if self.consensus_type == "avg":
output ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | src/models/components/consensus.py | tomstark99/play-fair |
import os
import math
from numpy.testing import *
from numpy import array
import util
import textwrap
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestMixed(util.F2PyTest):
sources = [_path('src', 'mixed', 'foo.f'),
_path('src', 'mixed', 'foo_fixed.f90'),
... | [
{
"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 | numpy/f2py/tests/test_mixed.py | ewmoore/numpy |
import turtle
'''fix'''
def draw_rhombus(some_turtle):
for i in range(1,3):
some_turtle.forward(20)
some_turtle.right(315)
some_turtle.forward(20)
some_turtle.right(225)
def draw_ribbon(some_turtle):
some_turtle.forward(100)
some_turtle.right(150)
some_turtle.forward(30)... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | basic/draw_drawing.py | shmiko/big-fat-python-tests |
#!/usr/bin/env python
import os
import sys
import argparse
from data_tools.lib.files import findNumber,ParameterParser
from data_tools.lib.group import Group,run_grouping
class IntervalGroup(Group):
def __init__(self, tup):
super(IntervalGroup, self).__init__(tup)
self.last = None
self.chu... | [
{
"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 | data_tools/intervals.py | scoky/python-tools |
"""Common DB report tests."""
import datetime
from pycounter.constants import METRICS
def test_version(db_report):
assert db_report.report_version == 4
def test_year(db_report):
assert db_report.year == 2012
def test_publisher(db_report):
for publication in db_report:
assert publication.publi... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | pycounter/test/test_db_common.py | loadbrain/pycounter |
import pytest
from meijer import __version__
from meijer import Meijer
@pytest.fixture(scope="session")
def meijer():
with Meijer() as m:
m.login()
yield m
@pytest.fixture(scope="session")
def shopping_list(meijer):
shopping_list = meijer.list
shopping_list.clear()
yield shopping_li... | [
{
"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 | meijer/tests/test_meijer_list.py | sllawcj/python_Meijer |
#!/usr/bin/env python
"""Tooth.py: Public Tooth class representing tooth entities in the educational game Trusty Brusher."""
class Tooth:
"""
A Tooth in the Mouth of a Person.
self.location: int value indicating location of Tooth in the Mouth
self.has_cavity: bool value indicating whether or ... | [
{
"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 | tooth.py | jposchel/trusty-brusher-python |
# holds the data and methods for products
class Product:
__type: int = None # specifies P1 or P2
# Constructor:
# Inputs:
# p_type:int -> Product Type
def __init__(self, p_type):
if (p_type is not None) and (p_type >= 0) and (p_type <= 3):
self.__type = p_type
el... | [
{
"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/Product.py | AbdulMutakabbir/CCH-manufacturing-facility-simulator |
#!/usr/bin/env python
# Copyright 2015 Rackspace, 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
#... | [
{
"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 | onmetal_scripts/decom_port.py | jayofdoom/onmetal-scripts |
# Copyright (c) 2016 SUSE Linux LLC
# All Rights Reserved.
#
# Author: Bo Maryniuk <bo@suse.de>
import hashlib
import os
from yum import config
from yum.plugins import TYPE_CORE
CK_PATH = "/var/cache/salt/minion/rpmdb.cookie"
RPM_PATH = "/var/lib/rpm/Packages"
requires_api_version = "2.5"
plugin_type = TYPE_CORE
... | [
{
"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 | scripts/suse/yum/plugins/yumnotify.py | Noah-Huppert/salt |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Solution:
def insert(self, head, data):
p = Node(data)
if head is None:
head = p
elif head.next is None:
head.next = p
else:
start = head
... | [
{
"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 | 30 Days of Code/day24_more_linked_lists.py | quqixun/Hackerrank_Python |
import datetime
import uuid
from typing import Optional, Protocol
from pizza_store.db.models import RefreshToken
from sqlalchemy.ext.asyncio import AsyncSession
class IRefreshTokenCRUD(Protocol):
"""Has methods for getting, adding, deleting refresh tokens from db."""
@classmethod
async def get_refresh_t... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | pizza_store/db/crud/refresh_token/interface.py | astsu-dev/pizza-store-backend |
"""Add verified_at column
Revision ID: aa3517f1b1bd
Revises: 45973dacf7da
Create Date: 2020-09-12 02:34:11.722267
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'aa3517f1b1bd'
down_revision = '45973dacf7da'
branch_labels = None
depends_on = None
def upgrade(... | [
{
"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 | alembic/versions/aa3517f1b1bd_add_verified_at_column.py | vcokltfre/metricity |
import json
import requests
import pandas as pd
from typing import List
from haws.services.setup_helper import get_runtime_settings
from haws.main import logger
# Get the bearer token - see https://dev.leanix.net/v4.0/docs/authentication
def authenticate():
settings = get_runtime_settings()
api_token = setti... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | haws/services/lx_api_connector.py | vg-leanix/aws_sancheck |
from twocode.parser import Console as ConsoleBase
import sys
import twocode.utils.code
class Console(ConsoleBase):
def __init__(self, context=None):
super().__init__()
from twocode import Twocode
if context is None: context = Twocode()
self.twocode = context
self.c... | [
{
"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 | twocode/console.py | MrCoft/twocode |
import uuid
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class Profile(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.OneToOneField(User, on_delete=models.CASCADE)
profile_p... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | photo_app/models.py | newtonkiragu/photo_share |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | py/test/selenium/webdriver/remote/remote_firefox_profile_tests.py | Kunkgg/selenium |
"""Benchmark of optimized count-eq versus baseline."""
import os
import time
from cffi import FFI # type: ignore
import pytest
ffi = FFI()
ffi.cdef("""
size_t diablo_count_eq (uint8_t const * const src,
size_t const off,
size_t const len,
uint8_... | [
{
"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 | bench/count_eq_bench.py | haskell-text/diablo |
from cmdbus import cmdbus, Command
class AddCommand(Command):
def __init__(self, v1: int, v2: int):
self.v1 = v1
self.v2 = v2
def handle(self):
return self.v1 + self.v2
def test_dispatch():
cmd = AddCommand(3, 5)
result = cmdbus.dispatch(cmd)
assert result is 8
| [
{
"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_dispatch.py | jmwri/cmdbus |
from .manager import UserManager
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
objects = UserManager()
username = None
email = models.EmailField(
null=False,
unique=True,
)
nick = models.CharField(
max_length=30... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | user/models.py | LeonardoCruzx/ListaTarefasBackend |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.