source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import numpy as np
import pylab as plt
import mahotas as mh
class GaussianFilter:
def __init__(self,img,sigma = 1,windsize = 3):
self.img = mh.imread(img)
self.M,self.N = self.img.shape
self.windsize = windsize
self.sigma = sigma
self.gaussian_kernel = self.kernel()
... | [
{
"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 | CVlib/GaussianFilter.py | ShiKaiWi/python-practice |
import logging
from .. import Component
from zygoat.utils.files import use_dir
from zygoat.utils.shell import run
import virtualenv
log = logging.getLogger()
class Backend(Component):
def create(self):
log.info('Installing django at a user level to generate the project')
run(['pip', 'install', ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | zygoat/components/backend/__init__.py | kborer/zygoat |
# some exception classes for the Smalltalk VM
class SmalltalkException(Exception):
"""Base class for Smalltalk exception hierarchy"""
class PrimitiveFailedError(SmalltalkException):
pass
class PrimitiveNotYetWrittenError(PrimitiveFailedError):
pass
class UnwrappingError(PrimitiveFailedError):
pass
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | pypy/lang/smalltalk/error.py | woodrow/pyoac |
import numpy as np
from Tensor import Tensor
class Operation:
result = None
def forward(self):
raise NotImplementedError
def backward(self, gradOutput: Tensor):
raise NotImplementedError
class Negative(Operation):
def __init__(self, A: Tensor,B:Tensor):
self.A = A
def forward(self):
self.result = ... | [
{
"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 | solutions/python/Lesson02-03/Operation.py | 0xLiso/DeepLearningFromScratch |
import time
import unittest
import upytester
# ------------ Bench Environment ------------
class Switch(object):
def __init__(self, device):
self.device = device
@property
def value(self):
return self.device.get_switch()()['value']
class BenchTest(unittest.TestCase):
@classmethod
... | [
{
"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 | examples/01-basic/03-switch-evaluation/test_switch.py | fragmuffin/upytester |
from functools import wraps
from flask_sample_test.sample_test import SampleEnvironment
def with_env(env: SampleEnvironment):
def decorate(func):
@wraps(func)
def wrapper(*args, **kwargs):
with env:
func(*args, **kwargs)
return wrapper
return decorate
| [
{
"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 | flask_sample_test/utils.py | December1208/sample_test |
# -*- coding: utf-8 -*-
"""The GraphQL Schema."""
import datetime as dt
import graphene as gql
from graphene.types.datetime import DateTime
class About(gql.ObjectType):
first_name = gql.String()
last_name = gql.String()
birthday = DateTime()
full_name = gql.String()
age = gql.Int()
def res... | [
{
"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 | api/schema.py | myles/api.mylesb.ca |
from machine import Pin
from time import sleep
analog_switch = Pin(16,Pin.OUT, Pin.PULL_DOWN)
led_status1 = Pin(15,Pin.IN,Pin.PULL_UP)
led_status2 = Pin(14,Pin.IN,Pin.PULL_UP)
led_status3 = Pin(13,Pin.IN,Pin.PULL_UP)
def button_sim():
analog_switch.value(1)
sleep(0.1)
analog_switch.value(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | HDMI_splitter_mod/hdmi_funcs.py | LiamHowell/SmartCube |
from bos_consensus.util import LoggingMixin
class NoFurtherBlockchainMiddlewares(Exception):
pass
class StopReceiveBallot(Exception):
pass
class BaseBlockchainMiddleware(LoggingMixin):
blockchain = None
def __init__(self, blockchain):
self.blockchain = blockchain
super(BaseBlockc... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | src/bos_consensus/middlewares/blockchain/base.py | LuffyEMonkey/isaac-consensus-protocol |
import math
import sys
def example_1():
"""
THIS IS A LONG COMMENT AND should be wrapped to fit within a 72
character limit
"""
long_1 = """LONG CODE LINES should be wrapped within 79 character to
prevent page cutoff stuff"""
long_2 = """This IS a long string that looks gross and... | [
{
"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 | lambdata/code_review.py | DevinJMantz/lambdata-25 |
from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse
from django.urls import reverse
from .models import Post, Comment
from .forms import CommentForm
def index(request):
posts = Post.objects.all()
return render(request, 'weblog/index.html', {'posts': posts})
... | [
{
"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 | django_framework/blog/weblog/views.py | geordi/skj-course |
def shellSort(collection):
lenght = len(collection)
middle, counter = lenght // 2, 0
while middle > 0:
for i in range(0, lenght - middle):
j = i
while (j >= 0) and (collection[j] > collection[j + middle]):
temp = collection[j]
collection[j] = collection[j + middle]
collection[j + middle] = temp
... | [
{
"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 | SortingAlgorithms/ShellSort.py | Sai-nook73/TheAlgorithms |
from csrv.model import actions
from csrv.model.actions import play_run_event
from csrv.model import cost
from csrv.model import events
from csrv.model import timing_phases
from csrv.model.cards import card_info
from csrv.model.cards import event
class TrashForFree(actions.TrashOnAccess):
COST_CLASS = cost.NullCost
... | [
{
"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 | csrv/model/cards/runner/card01003.py | mrroach/CentralServer |
import pprint
class ApiResponse:
"""
Api Response
Wrapper around all responses from the API.
Examples:
literal blocks::
response = Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
print(response.payload) # original response dat... | [
{
"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 | sp_api/base/ApiResponse.py | hrausch/python-amazon-sp-api |
import random
import string
# Generating characters for password
def generate_password_characters():
alphabets = string.ascii_letters
alphabets = [alphabet for alphabet in alphabets]
numbers = string.digits
numbers = [number for number in numbers]
special_characters = string.punctuation
spec... | [
{
"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 | password-generator.py | AkashSDas/Mini-Projects |
from vkbottle.rule import FromMe
from vkbottle.user import Blueprint, Message
from idm_lp.logger import logger_decorator
from idm_lp.database import Database
from idm_lp.utils import edit_message
user = Blueprint(
name='disable_notifications_blueprint'
)
@user.on.message_handler(FromMe(), text="<prefix:service... | [
{
"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 | idm_lp/commands/disable_notifications.py | lper1/dgm-. |
'''
This problem was recently asked by Google:
Given a singly-linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions?
Example:
Input: 4 -> 3 -> 2 -> 1 -> 0 -> NULL
Output: 0 -> 1 -> 2 -> 3 -> 4 -> NULL
'''
class ListNode(object):
def __init__(self, x):
self.... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | algorithms/LinkedList/reverseLinkedList.py | gadodia/Algorithms |
from rest_framework import status
from rest_framework.response import Response
from rest_auth.registration.views import RegisterView as RestAuthRegisterView
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from allauth.account.models import EmailConfirmation, EmailConfirmationHMA... | [
{
"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 | dj_starter/users/registration/views.py | zeenfaizpy/dj_starter |
import unittest
class TestPython(unittest.TestCase):
def test_float_to_int_coercion(self):
self.assertEqual(1, int(1.0))
def test_get_empty_dict(self):
self.assertIsNone({}.get('key'))
def test_trueness(self):
self.assertTrue(bool(10))
| [
{
"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 | 4/tests/test_python.py | microcoder/course-python-mipt |
# qubit number=4
# total number=7
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pro... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | data/p4VQE/R1/benchmark/startPyquil5.py | UCLA-SEAL/QDiff |
# Coded By Gowtham on 30/05/2020
# Coded Using Vim Text Editor
from flask import Flask, request, jsonify
from DailyHunt import getNews
from flask_cors import CORS
app = Flask(__name__)
app.secret_key = "I_am_Marvelous (^_^)"
CORS(app)
@app.route('/')
def home():
return 'News API is UP!<br><br>A part of <a href=... | [
{
"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 | techraz-rishi/DailyHunt-NewsAPI |
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
from __future__ import absolute_import
import hashlib
import logging
import sys
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR
from pip._internal.... | [
{
"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 | ml_python/env/Lib/site-packages/pip/_internal/commands/hash.py | ArchibaldChain/python-workspace |
import codecs
import csv
# запись списка словарей в CSV-таблицу
def write_list(file, list, mode='a', header=None):
with codecs.open(file, mode, 'utf-8') as f:
if header:
fieldnames = header
else:
# список ключей словаря записывается в качестве заголовка таблицы
f... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | csvdict.py | slabstone/python-experiments |
# encoding: utf-8
"""Step implementations for document settings-related features"""
from __future__ import absolute_import, division, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.settings import Settings
from helpers import test_docx
# given ==========... | [
{
"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 | features/steps/settings.py | revvsales/python-docx-1 |
from conans import ConanFile, CMake
class JWTUtilsTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_find_package"
options = {"gtest": ["1.7.0", "1.8.1", "1.10.0"], "openssl": ["1.0.2n", "1.0.2s", "1.1.1g", "1.1.1k"]}
default_options = {"gtest":"1.10.0", "opens... | [
{
"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_package/conanfile.py | systelab/cpp-jwt-utils |
import mama
class libjpeg(mama.BuildTarget):
def dependencies(self):
pass
def configure(self):
self.add_cmake_options('BUILD_STATIC=ON', 'BUILD_EXECUTABLES=OFF', 'BUILD_TESTS=OFF')
def package(self):
self.export_libs('lib', ['.lib', '.a'])
self.export_include('include', bui... | [
{
"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 | mama/libjpeg.py | wolfprint3d/AlphaGL |
"""A module to keep track of a plaintext."""
class Plaintext:
"""An instance of a plaintext.
This is a wrapper class for a plaintext, which consists
of one polynomial.
Attributes:
poly (Polynomial): Plaintext polynomial.
scaling_factor (float): Scaling factor.
"""
def __init... | [
{
"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 | util/plaintext.py | seounghwan-oh/homomorphic_encryption |
from .adaptor import Adaptor, SleapObjectType
from .filehandle import FileHandle
class TextAdaptor(Adaptor):
@property
def handles(self):
return SleapObjectType.misc
@property
def default_ext(self):
return "txt"
@property
def all_exts(self):
return ["txt", "log"]
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | sleap/io/format/text.py | jens-k/sleap |
# _*_coding : UTF_8 _*_
# Author : Xueshan Zhang
# Date : 2022/1/22 2:59 PM
# File : Status.py
# Tool : PyCharm
# Reference : __repr__ << Thread << threading.py
import threading
import time, os
def Subthread(n):
for i in range(n):
print('is going to sleep', i, 's.')
time.sleep(i)... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | Multithreading/Status.py | mangomangomango0820/multi-processing-threading |
from django.db import models
from datetime import datetime
from django.conf import settings
from django.template.defaultfilters import slugify
# Create your models here.
class Category(models.Model):
""" Model representation for blog post categpries."""
id = models.AutoField(primary_key=True)
name = model... | [
{
"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 | blog/models.py | bodealamu/django_blog_application |
from spark_auto_mapper_fhir.extensions.extension_base import ExtensionBase
from spark_auto_mapper_fhir.classproperty import genericclassproperty
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
class ProviderSearchSystemExtensionItem(ExtensionBase):
# noinspection PyPep8Naming
def __init__(self, val... | [
{
"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 | spark_auto_mapper_fhir/extensions/custom/provider_search_system.py | imranq2/SparkAutoMapper.FHIR |
from supabase.lib.storage.storage_bucket_api import StorageBucketAPI
from supabase.lib.storage.storage_file_api import StorageFileAPI
class SupabaseStorageClient(StorageBucketAPI):
"""
Manage the storage bucket and files
Examples
--------
>>> url = storage_file.create_signed_url("something/test2.t... | [
{
"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 | supabase/lib/storage_client.py | discdiver/supabase-py |
from touchingperimeter import Rect
def test_tl_inside():
assert sorted(Rect(2, 5, 12, 8).substracted(Rect(7, 6, 12, 8))) == [
Rect(2, 5, 12, 1),
Rect(2, 5, 5, 8),
]
def test_tr_inside():
assert sorted(Rect(5, 7, 13, 8).substracted(Rect(3, 9, 6, 18))) == [
Rect(5, 7, 13, 2),
... | [
{
"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_substract.py | tasptz/py-touchingperimeter |
from torch.utils.data import Dataset
class PandasDataset(Dataset):
def __init__(self, df):
self.df = df
def __len__(self):
return len(self.df)
def __getitem__(self, idx):
return self.df.iloc[idx]
| [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | src/my_lib/torch/dataset.py | akirasosa/BCAI_kaggle_CHAMPS |
import copy
from typing import List, Optional, Tuple
from . import boards, enums, moves
JournalEntry = Tuple[Optional[moves.Move], boards.Board]
class Journal:
"""A journal of all previous Move and Board states."""
def __init__(self, board: boards.Board):
"""
Create a journal.
:par... | [
{
"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 | supercheckers/journals.py | mikegoodspeed/supercheckers-python |
class Hero:
def __init__(self,name,health,attackPower):
self.__name = name
self.__health = health
self.__attPower = attackPower
# getter
def getName(self):
return self.__name
def getHealth(self):
return self.__health
# setter
def diserang(self,serangPower):
self.__health -= serangPower
def setA... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | Python OOP/test.py | zharmedia386/Data-Science-Stuff |
import unittest
from rx import Observable
from rx.testing import ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscribed
disposed = ReactiveTest.disposed
created = ReactiveTest.created... | [
{
"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 | tests/test_observable/test_fromcallback.py | Affirm/RxPY |
"""
test_group_wb
----------------------------------
Tests for the `kifield.group_wb` function
"""
import unittest
import openpyxl as pyxl
import hypothesis
import hypothesis.strategies as st
from kifield import kifield
class TestGroupWb(unittest.TestCase):
def test_groups(self):
wb = pyxl.Workbook()
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | tests/unit/test_group_wb.py | Machine-Hum/KiField |
import random
from pyschieber.player.base_player import BasePlayer
from pyschieber.trumpf import Trumpf
class RandomPlayer(BasePlayer):
def choose_trumpf(self, geschoben):
return move(choices=list(Trumpf))
def choose_card(self, state=None):
cards = self.allowed_cards(state=state)
ret... | [
{
"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 | pyschieber/player/random_player.py | Murthy10/pyschieber |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | [
{
"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 | ooobuild/lo/awt/x_file_dialog.py | Amourspirit/ooo_uno_tmpl |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import random as rm
def V(dp, L, R, x):
v = (dp * (R * R - x * x)) / (4 * 0.001 * L)
return v
def Re(v, D):
return (1000 * v * D) / 0.001
# Rmax=5[m]
# Lmax=100[m]
# dpmax=3.68*10**-6
# vmax=2.4*10**-4
R = 5 # радиус трубы [м]
dp =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | Project_37/Test.py | YaKashubo/NeuralNetworksKeras |
import sys
import click
import json
from urllib.request import urlopen
from urllib.parse import quote
RESPONSES_CODE = {
200 : "SMS sent",
400 : "One parameter is missing (identifier, password or message).",
402 : "Too many SMS sent.",
403 : "Service not activated or false login/key.",
500 : "Serv... | [
{
"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 | sms.py | Lyokolux/smsNotificationFree |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.files.storage import default_storage as storage
from ..utils.compatibility import PILExifTags, PILImage
def get_exif(im):
try:
exif_raw = im._getexif() or {}
except: # noqa
return {}
ret = {}
for tag, va... | [
{
"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 | filer/utils/pil_exif.py | ArtistsTechGuy/django-filer |
from collections import Counter
from dataclasses import dataclass, field
from typing import Optional, List
@dataclass
class Paper:
title: str
abstract: Optional[str] = None
keywords: Optional[str] = None
_text: Optional[str] = None
text_attr = ('title', 'abstract', 'keywords')
@property
d... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | cset/model.py | jamesdunham/cso-classifier |
class B(object):
c1 = 0
def f(self, x):
self.i1 = x
l1 = self.i1
self.i2 = l1
def __init__(self, x, y):
self.i2 = x
self.i3 = y
@classmethod
def g(cls, x):
cls.c2 = cls.c1
g1 = "foo"
class C(B):
c2 = -1
def __init__(self, x, y):
s... | [
{
"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 | python/testData/structureView/attributes.py | truthiswill/intellij-community |
#!usr/bin/env python3
import collections
def main():
print(map.__doc__, end="\n=====\n")
print(collections.__doc__, end="\n=====\n")
print(my_function.__doc__)
def my_function(arg1, arg2=None):
"""my_function(arg1, arg2=None) --> Doesn't really do anything special.
:param arg1: the first argume... | [
{
"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 | advanced/documentation.py | ariannasg/python3-essential-training |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""Cleanup build artifacts."""
import argparse
import logging
import os
import shutil
import sys
from glob import iglob
logger = logging.getLogger()
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('toplevel')
parser.add_argument('--all... | [
{
"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 | scripts/build_cleanup.py | objectrocket/python-client |
#!/usr/bin/python3
"""
Given an n-ary tree, return the postorder traversal of its nodes' values.
For example, given a 3-ary tree:
Return its postorder traversal as: [5,6,3,2,4,1].
Note:
Recursive solution is trivial, could you do it iteratively?
"""
# Definition for a Node.
class Node:
def __init__(self, val, ... | [
{
"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 | 590 N-ary Tree Postorder Traversal.py | krishna13052001/LeetCode |
from ._anvil_designer import query_viewerTemplate
from anvil import *
import anvil.server
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
class query_viewer(query_viewerTemplate):
def __init__(self, title_label, **properties):
# Set Form properties and Data Bindin... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
... | 3 | client_code/query_viewer.py | Alcampopiano/graphical_query_app |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class TrafficWeight:
def __init__(self):
self.request = 0
self.response = 0
class PacketInterval:
def __init__(self):
self.firstPacket = 0
self.lastPacket = 0
| [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | src/utils.py | AntoineRondelet/SideChannelLeaksOverHTTPS |
import unittest
from binary_search_leetcode_704.binary_search import Solution
class TestSearch(unittest.TestCase):
def setUp(self) -> None:
self.solution = Solution()
self.data_1 = [-1, 0, 3, 5, 9, 12]
self.data_2 = [-1, 0, 3, 5, 9, 12]
def test_search(self):
self.assertEqua... | [
{
"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 | leetcode/binary_search_leetcode_704/test_binary_search.py | Williano/Interview-Prep |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from polymorphic_tree.models import PolymorphicMPTTModel, PolymorphicTreeForeignKey
# A base model for the tree:
@python_2_unicode_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | example/tree/models.py | avaddon/django-polymorphic-tree |
from sympy.core.numbers import I
from sympy.core.symbol import symbols
from sympy.physics.paulialgebra import Pauli
from sympy.testing.pytest import XFAIL
from sympy.physics.quantum import TensorProduct
sigma1 = Pauli(1)
sigma2 = Pauli(2)
sigma3 = Pauli(3)
tau1 = symbols("tau1", commutative = False)
def test_Pauli(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | sympy/physics/tests/test_paulialgebra.py | utkarshdeorah/sympy |
#!/usr/bin/env python
from multiprocessing import cpu_count
from multiprocessing import Pool
def func(temp):
while True:
temp = (temp ** temp )
if(temp > 5000):
temp = 2
def main():
number_of_cores = cpu_count()
print("Number of cores availabe is {}".format(number_of_cores))
use_cpu = 2
pool = Pool(use_... | [
{
"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 | cpu_intensive.py | rahulguptakota/thermal_eavesdropping |
"""PruneUsers module."""
import asyncio
class PruneUsers(object):
"""PruneUsers class."""
def __init__(self, bot):
"""Init method for PruneUsers."""
self.bot = bot
server_id = self.bot.config['general']['server_id']
inactive_days = int(self.bot.config['prune_users']['inactive... | [
{
"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 | bot/cogs/prune_users.py | diegorusso/discordbot |
import sqlite3
import sys
from . import colorbrewer
try:
from datasette import hookimpl
has_datasette = True
except ImportError:
has_datasette = False
if has_datasette:
@hookimpl
def prepare_connection(conn):
register(conn)
def register(conn):
if sys.version_info >= (3, 8):
... | [
{
"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 | sqlite_colorbrewer/__init__.py | eyeseast/sqlite-colorbrewer |
#!/usr/bin/env python3 -W all
"""
ner-frog.py: perform named entity recognition for Dutch
usage: ner-frog.py < text
notes:
* adapted from: https://www.tutorialspoint.com/python/python_networking.htm
* requires frog running and listening on localhost port 8080
* output lines with format: token SP... | [
{
"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 | ner-frog.py | PabloMosUU/data-processing |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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.... | [
{
"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 | tests/jpypetest/serial.py | karpierz/jtypes.jpype |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020- IBM Inc. All rights reserved
# SPDX-License-Identifier: Apache2.0
#
"""
"""
from abc import ABC, abstractproperty, abstractmethod
class AbstractType(ABC):
@abstractproperty
def length(self):
pass
@abstractmethod
def __call__... | [
{
"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 | cbexplorer/types/AbstractType.py | ambitus/cbexplorer |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
{
"point_num": 1,
"id": "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 | tensorflow/python/data/experimental/kernel_tests/serialization/unique_dataset_serialization_test.py | uve/tensorflow |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CloudbusTransitResultItem import CloudbusTransitResultItem
class AlipayDataAiserviceCloudbusTransitorridorQueryResponse(AlipayResponse):
def __init__(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | alipay/aop/api/response/AlipayDataAiserviceCloudbusTransitorridorQueryResponse.py | antopen/alipay-sdk-python-all |
import scrapy
import pandas as pd
import time
import os
category_name = "LGBT"
category_num = 4
class QuotesSpider(scrapy.Spider):
name = category_name.lower() + str(category_num) + "spider"
def start_requests(self):
list_of_urls = []
parent_dir = "./reviewpages"
link_file = parent_di... | [
{
"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 | scraping_2/com-4/reviewsprofiles/reviewsprofiles/spiders/lgbt4scraper.py | hvarS/AmazonPrivacy |
"""SQL alchemy models for tweettweet"""
from flask_sqlalchemy import SQLAlchemy
DB = SQLAlchemy()
class Tweeter(DB.Model):
"""Twitter users that we pull and analyze tweets for"""
id = DB.Column(DB.BigInteger, primary_key=True)
handle = DB.Column(DB.String(15), nullable=False)
newest_tweet_id = DB.Colu... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | twitoff/models.py | BrianThomasRoss/TwitOff |
from __future__ import unicode_literals
import vmraid
from vmraid.chat.util import filter_dict, safe_json_loads
from vmraid.sessions import get_geo_ip_country
@vmraid.whitelist(allow_guest = True)
def settings(fields = None):
fields = safe_json_loads(fields)
dsettings = vmraid.get_single('Website Set... | [
{
"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 | vmraid/chat/website/__init__.py | sowrisurya/vmraid |
# -*- coding: utf-8 -*-
"""
Created on 12/21/2018
@author: BioinfoTongLI
"""
import numpy as np
import read_roi
from imagepy.core.engine import Free
from imagepy import IPy
from skimage.draw import polygon
class Plugin(Free):
"""load_ij_roi: use read_roi and th pass to shapely objects"""
title = 'Import Rois f... | [
{
"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 | imagepy/menus/File/Import/roi_plg.py | adines/imagepy |
from injector import inject, singleton
from typing import List
from domain.model.track import Track
from interface.repository.track_repository import TrackRepository
from interface.usecase.track_usecase import TrackUsecase
@singleton
class TrackInteractor(TrackUsecase):
@inject
def __init__(
self,
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | interactor/track_interactor.py | ooyamatakehisa/bpm-searcher |
import subprocess
import uuid
from dcos_test_utils.dcos_api import DcosApiSession
__maintainer__ = 'orsenthil'
__contact__ = 'tools-infra-team@mesosphere.io'
def test_if_default_systctls_are_set(dcos_api_session: DcosApiSession) -> None:
"""This test verifies that default sysctls are set for tasks.
We use ... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | packages/dcos-integration-test/extra/test_sysctl.py | timgates42/dcos |
# Copyright 2015 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
#
# https://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | [
{
"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 | tests/functional/test_resource.py | dtrimm/boto3 |
INPUTPATH = "input.txt"
#INPUTPATH = "input-test.txt"
with open(INPUTPATH) as ifile:
raw = ifile.read()
from typing import Tuple
def line_to_pos(line: str) -> Tuple[int, ...]:
filtered = "".join(c for c in line if c.isdigit() or c in {"-", ","})
return tuple(map(int, filtered.split(",")))
starts = tuple(zip(*map(lin... | [
{
"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 | day12/main.py | Floozutter/aoc-2019-speedrun |
#!/usr/bin/env python
from nipype import config
config.enable_debug_mode()
from arcana.data import InputFilesets # @IgnorePep8
from banana.file_format import nifti_gz_format, text_matrix_format # @IgnorePep8
from banana.study.mri.coregistered import ( # @IgnorePep8
CoregisteredStudy, CoregisteredToMatrixStudy)
f... | [
{
"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 | test/unittests/study/mri/test_coregistered.py | szho42/banana |
from commplax import xop
import numpy as np
from jax import random, numpy as jnp
def conv_input_complex(n, m):
key1 = random.PRNGKey(0)
key2 = random.PRNGKey(1)
k1, k2 = random.split(key1)
k3, k4 = random.split(key2)
x = random.normal(k1, (n,)) + 1j * random.normal(k2, (n,))
h = random.normal(... | [
{
"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 | tests/xop_test.py | remifan/commplax |
import os
from PIL import Image
import urllib.request as ur
import urllib.request
from io import BytesIO
import requests
import csv
import h5py
import numpy as np
import argparse
def retrieve_patch( rec ):
response = requests.get( rec[1], timeout=10 )
file = BytesIO( response.content )
img = Image.open( fi... | [
{
"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 | DownloadVGG_Faces.py | jfrancis71/TensorFlowApps |
import base64
import hashlib
import json
import datetime
from zcash.cryptographic_basics import *
class Wallet():
def __init__(self):
self._sk, self._pk = K_sig(1)
@property
def address(self):
"""
generate address by pk
"""
h = hashlib.sha256(self._pk)
ret... | [
{
"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 | blockchain/wallet.py | gwynethallwright/cs291d_project |
from aoc2019.shared.solution import Solution
from aoc2019.shared.intcode import getProgramFromFile
from aoc2019.helpers.day17 import VacuumRobot, sumAlignmentParametersOfIntersections
class Day17(Solution):
def part1(self):
program = getProgramFromFile(self._dirPath + "/../input/day17.txt")
bot = ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | aoc2019/solutions/day17.py | mdalzell/advent-of-code-2019 |
from reconbf.modules import test_kernel
from reconbf.lib.result import Result
from reconbf.lib import utils
import unittest
from mock import patch
class PtraceScope(unittest.TestCase):
def test_no_yama(self):
with patch.object(utils, 'kconfig_option', return_value=None):
res = test_kernel.tes... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_kernel.py | fallenpegasus/reconbf |
#
# 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 os
from .agent import Agent, TAgent
from .workspace import Workspace
trace_workspace = False
trace = []
trace_maximum_size = 1000... | [
{
"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 | salina/__init__.py | bpiwowar/salina |
import pulumi
import pulumi.runtime
from ... import tables
class PersistentVolumeClaimList(pulumi.CustomResource):
"""
PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
"""
def __init__(self, __name__, __opts__=None, items=None, metadata=None):
if not __name__:
ra... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | sdk/python/pulumi_kubernetes/core/v1/PersistentVolumeClaimList.py | rosskevin/pulumi-kubernetes |
import sys
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gtk, GObject
import numpy as np
from plotter.gtk3_plotter import PlotSelector
def create_to_plot():
mat = np.random.random((100, 100))
trace = np.random.random(100)
to_plot = [
{"title": "Matrix", "type": "mat... | [
{
"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 | examples/gtk3_example.py | davidelbaze/plotter |
import uvicorn
from fastapi import Depends, FastAPI, HTTPException
from sqlalchemy.orm import Session
from src.crud import crud
from src.models import models
from src.schemas import schemas
from src.database.database import SessionLocal, engine
models.Base.metadata.create_all(bind=engine)
app = FastAPI()
# Depende... | [
{
"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 | main.py | DileepEverestek/Testsite |
import json
from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import permission_required
from wagtail.wagtailadmin.modal_workflow import render_modal_workflow
from wagtail.wagtailsnippets.views.snippets import get_content_type_from_url_params, get_snippet_type_name
@permission_requ... | [
{
"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 | wagtail/wagtailsnippets/views/chooser.py | digitalmarmalade/wagtail |
#!/usr/bin/python
################################################################################
# 22f7e138-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"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 | pcat2py/class/22f7e138-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
from threading import Thread
from flask import current_app
from flask_mail import Message
from flask_app import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body, attachments=None, sync=False):
msg = Message(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | flask_app/email_sender.py | julien-bonnefoy/website |
"""
shared functions
"""
#!/usr/bin/env python
#coding=utf-8
def cmp_str(element1, element2):
"""
compare number in str format correctley
"""
try:
return cmp(float(element1), float(element2))
except ValueError:
return cmp(element1, element2)
def list_to_str(value_list, cmpfun=cm... | [
{
"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 | utils/utility.py | qiyuangong/Relational_Transaction_Anon |
from django.db import models
from django.contrib import admin
class SingletonModel(models.Model):
"""This is the abstract ancestor for all models
that should have a strictly single record in the database"""
class Meta:
abstract = True
def save(self, *args, **kwargs):
self.__class__.o... | [
{
"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 | amokryshev/utils/singleton_model.py | amokryshev/amokryshev-com |
# Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
#
# Note:
#
# The solution set must not contain duplicate quadruplets.
#
# Example:
#
# Given array nums = [1, 0,... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | 1-50/18.py | yshshadow/Leetcode |
# coding=utf-8
# *** WARNING: this file was generated by test. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = [
'Foo',
]... | [
{
"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 | pkg/codegen/testing/test/testdata/plain-schema-gh6957/python/pulumi_xyz/_inputs.py | BearerPipelineTest/pulumi |
class SupervisedModel:
def train(self, x, y):
raise NotImplementedError
def predict(self, x):
raise NotImplementedError
def predict_classes(self, x):
raise NotImplementedError
def save(self, path):
raise NotImplementedError
def load(self, path):
raise ... | [
{
"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 | src/supervised_model.py | gdex1/irl-maxent |
import numpy as np
import pytest
from scipy.spatial import Delaunay
from locan.data.hulls.alpha_shape_2d import _circumcircle, _half_distance
def test__circumcircle_2d(locdata_2d):
points = np.array([(0, 0), (1, 1 + np.sqrt(2)), (1 + np.sqrt(2), 1)])
center, radius = _circumcircle(points, [2, 1, 0])
asse... | [
{
"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 | locan/tests/data/test_alpha_shape_2d.py | super-resolution/Locan |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_image02.py | hugovk/XlsxWriter |
class Handle(dict):
def __init__(self, api, handle, callback):
# derive from dict so instances get auto serialized to JSON when passed as a parameter to an API call
super().__init__(handle=handle, callback=callback)
# however, api is a client-side instance and should not get serialized, s... | [
{
"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 | fdrtd/handle.py | UNakade/server |
import os
import logging as log
from xml.etree import ElementTree
class AndroidManifest:
XMLNS = {
'android': 'http://schemas.android.com/apk/res/android'
}
ElementTree.register_namespace('android', XMLNS['android'])
def __init__(self, path):
if not os.path.exists(path):
r... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | bootstrap/android.py | lagner/academ-weather |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | aliyun-python-sdk-ens/aliyunsdkens/request/v20171110/DescribeEpnInstancesRequest.py | jorsonzen/aliyun-openapi-python-sdk |
from datetime import datetime
def create_game_mock(
name="Dungeons & Dragons",
sumary="Medieval fantasy adventures on D20 based systems",
):
return {
'name': name,
'sumary': sumary,
}
def create_item_mock(
name="Vorpal Sword",
description="Pierces anything",... | [
{
"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 | rpg/mocks.py | juanmagalhaes/rpg-manager |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class Sub(Base):
@staticmethod
def export():
node = onnx.h... | [
{
"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 | onnx/backend/test/case/node/sub.py | sridhar551/ONNX |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...worksheet import Worksheet
class TestWriteSheetFormatPr(unittest.TestCase):
"""... | [
{
"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 | xlsxwriter/test/worksheet/test_write_sheet_format_pr.py | eddiechapman/XlsxWriter |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name
"""
Pauli X (bit-flip) gate.
"""
from qiskit.circuit import CompositeGate
from qiskit.circuit... | [
{
"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 | qiskit/extensions/standard/x.py | jagunnels/qiskit-sdk-py |
from django.utils import timezone
from beehive.models import BeeHive
class BeeHiveService():
"""Sets service date for BeeHive"""
@staticmethod
def set_beehive_service_date(beehive_id):
beehive = BeeHive.objects.get(id=beehive_id)
beehive.service_date = timezone.now()
beehive.save... | [
{
"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 | beehive/service/bee_hive_service.py | BartekStok/beehive-apiary-sim |
from django.views.generic import TemplateView, DetailView
from .models import Page
class HomeView(TemplateView):
template_name = 'main/home.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page'] = Page.objects.get_home_page()
return co... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | apps/main/views.py | assigdev/django-project-alt-template |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | libcloud/test/common/test_openstack.py | Jc2k/libcloud |
from flask_ember.util.string import dasherize
class ResourceGenerator:
def __init__(self, ember, resource_class):
self.ember = ember
self.resource_class = resource_class
def generate(self, app):
# TODO generation of api endpoints etc
resource = self.resource_class
nam... | [
{
"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 | flask_ember/generator/resource_generator.py | fr3akout/flask_ember |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.