source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from matplotlib.axes import Axes
from ml_matrics import precision_recall_curve, roc_curve
from . import y_binary, y_proba
def test_roc_curve():
roc_auc, ax = roc_curve(y_binary, y_proba)
assert isinstance(roc_auc, float)
assert isinstance(ax, Axes)
def test_precision_recall_curve():
precision, ax ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | tests/test_relevance.py | sgbaird/ml-matrics |
from typing import Union, Tuple
from charset_normalizer import from_bytes
from charset_normalizer.constant import TOO_SMALL_SEQUENCE
UTF8 = 'utf-8'
ContentBytes = Union[bytearray, bytes]
def detect_encoding(content: ContentBytes) -> str:
"""
We default to UTF-8 if text too short, because the detection
... | [
{
"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 | httpie/encoding.py | 10088/httpie |
#criando uma classe "Pessoa", que posteriormente será importada ,no
#arquivo "main"
#aonde tem o if deve ser usado soemnte o retun e msg que está escrita
#pois deve haver um método #get para os outros métoods que vão conter ações ou valores
class Pessoa:
#cridndo método connstrutor,e passando parametros para ele ... | [
{
"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 | estudo_poo/pessoa.py | gabriel-correia0408/Sala_Green_GabrielCorreia |
from tkinter import Frame,Label,Button,Menu
class Application(Frame):
def __init__(self, master=None,):
Frame.__init__(self, master)
#窗口大小位置
self.pack()
self.createWidgets()
menu = self.creatMenu()
self.master.config(menu=menu)
def creatMenu(self):
... | [
{
"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 | 人机交互/GUI/src/menu_othercommand.py | TutorialForPython/python-io |
from django.db import models
from django.db.models import Q, F
# Create your models here.
from treeckle.common.models import TimestampedModel
from organizations.models import Organization
from users.models import User
from venues.models import Venue
class BookingStatus(models.TextChoices):
PENDING = "PENDING"
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | backend/treeckle/bookings/models.py | CAPTxTreeckle/Treeckle-3.0 |
import os
import psutil
COEFFICIENT = 2 ** 20
def get_other_ram() -> int:
"""Ram used by other processes"""
return get_ram_used() - get_process_ram()
def get_total_ram() -> int:
mem = psutil.virtual_memory()
return mem[0] / COEFFICIENT
def get_process_ram() -> int:
process = psutil.Process(os.getpid())
re... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | website/system.py | timlyo/timlyo.github.io |
# -*- coding: utf-8 -*-
import sys
import unittest
from requests import Response
from yookassa.domain.common.user_agent import Version
if sys.version_info >= (3, 3):
from unittest.mock import patch
else:
from mock import patch
from yookassa.client import ApiClient
from yookassa.configuration import Configur... | [
{
"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 | test/unit/test_client.py | tonchik-tm/yookassa-sdk-python |
"""
Created on May 21, 2014
@author: StarlitGhost
"""
from twisted.plugin import IPlugin
from desertbot.moduleinterface import IModule, BotModule
from zope.interface import implementer
from desertbot.response import IRCResponse
from desertbot.utils import string
@implementer(IPlugin, IModule)
class AutoPasteEE(Bot... | [
{
"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 | desertbot/modules/postprocess/AutoPasteEE.py | MasterGunner/DesertBot |
import time
def long_running_task(time_to_sleep: int) -> None:
print(f"Begin sleep for {time_to_sleep}")
time.sleep(time_to_sleep)
print(f"Awake from {time_to_sleep}")
def main() -> None:
long_running_task(2)
long_running_task(10)
long_running_task(5)
if __name__ == "__main__":
s = tim... | [
{
"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 | code/01-intro-asyncio/sync_demo.py | mfonism/us-pycon-2019-tutorial |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free S... | [
{
"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 | ENV/lib/python3.5/site-packages/pyrogram/api/types/channel_admin_log_event_action_toggle_pre_history_hidden.py | block1o1/CryptoPredicted |
from app import models
from app.config import sqla
from app.lib.duplication_check.reply_database import ReplyDatabase
from sqlalchemy import func
from app.lib.duplication_check.reply_model import Reply
def pull_data_from_database(db: ReplyDatabase, start_time):
start_rpid = get_min_start_rpid(start_time)
ses... | [
{
"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 | app/lib/duplication_check/pull_data.py | WHUT-XGP/ASoulCnki |
from Crypto.Util.number import getPrime
from random import randint
from math import gcd
with open("flag.txt",'r') as f:
flag = f.read()
p = getPrime(1024)
g = 3
MASK = 2**1024 - 1
def gen_keys():
x = randint(1, p-2)
y = pow(g, x, p)
return (x, y)
def sign(answer: str, x: int):
while True:
m = int(asnwer, 16)... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | assets/ctfFiles/2021/csaw2021/forgery/forgery.py | Angmar2722/Angmar2722.github.io |
# Faça um Programa que mostre a mensagem "Alo mundo" na tela.
def oi(s):
"""Função que imprime a mensagem 'Alo Mundo' com um str especifico
:param s:
:return:
"""
if s == 'oi':
print('Alo Mundo')
elif s != 'oi':
print('tente novamente')
def cumprimento():
return 'Alo Mund... | [
{
"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 | 1.Estrutura_Sequencia_wiki.Python/estrutura_sequencial_1.py | renankemiya/exercicios |
from numbers import Real
from typing import Tuple
def _to_epsilon_and_splitter() -> Tuple[Real, Real]:
every_other = True
epsilon, splitter = 1, 1
check = 1
while True:
last_check = check
epsilon /= 2
if every_other:
splitter *= 2
every_other = not every_oth... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | robust/bounds.py | lycantropos/robust |
import os
import numpy as np
import PIL.Image as Image
import matplotlib.pylab as plt
import time
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras import layers
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def image_analysis(classifier, image_shape, img_array):
result = classifier.predict(... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | inference_exploration/cpu/main.py | nbortolotti/tflite-tpu-experiences |
import io
import os
import sys
import json
import tokenize
from pyswahili.sw_to_en import dictionary
class PySwahili(object):
def __init__(self, filename=""):
if filename:
self.swahili_code = filename
self.sw_to_en = dictionary
def load_python_code(self) -> str:
try:
... | [
{
"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 | pyswahili/swahili_node.py | HawkUs-Git/pyswahili |
import pytest
from nutshell_api.users.models import User
from nutshell_api.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"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 | nutshell_api/conftest.py | garguelles/nutshell-api |
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''Geddy before v13.0.8 LFI''',
"description": '''Directory traversal vulnerability in lib/app/index.js in Geddy before 13.0.8 for Node.js allows remote attackers to read arbitrary files via a ..%2f (dot ... | [
{
"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 | 2015/CVE-2015-5688/poc/pocsploit/CVE-2015-5688.py | hjyuan/reapoc |
# -------------------------------------------------------------------
# @author DobeChen
# @copyright (C) 2018
# @doc
# 数据转换模块
# @end
# Created : 01. 一月 2018 下午5:28
# -------------------------------------------------------------------
import json
def trans_comic_data(comic_data):
return json.loads(comic_data)
d... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | transdata/transdatatool.py | DobeChen/Comic |
from sklearn import linear_model
from ml.regression.base import Regression
class LogisticRegression(Regression):
def __init__(self):
Regression.__init__(self)
self._name = "Logistic"
self._model = linear_model.LogisticRegression(C=1e5)
def predict_proba(self, data):
return se... | [
{
"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 | package/ml/regression/logistic.py | xenron/coco |
from rest_framework import serializers
from .models import Currency
class CurrencyMiniSerializer(serializers.ModelSerializer):
name = serializers.SerializerMethodField(read_only=True)
class Meta:
model = Currency
fields = ['id', 'name']
def get_name(self, obj):
return f'{obj.desc... | [
{
"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 | backend/apps/currency/serializers.py | jorgejimenez98/backend-evaluacion-desempenno |
class Student:
def __init__(self, name, school):
self.name = name
self.school = school
self.marks = []
def average(self):
return sum(marks) / len(marks)
def friend(self, friend_name):
return Student(friend_name, self.school)
anna = Student("Anna", "Oxford")
frien... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | Original Content/section2/9_inheritance.py | alokkshukla/RESTWithFlask |
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from django.views import generic
import json
# import db models
from ..models import ChartAnnotation, Assessment, TaskType
#Crud
def create(reques... | [
{
"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 | pixelwalker/engine/webgui/views_chart_annotation.py | thomMar/pixelwalker |
# -*- coding: utf-8 -*-
"""FamilySearch Parents and Children submodule"""
# Python imports
# Magic
class ParentsAndChildren:
"""https://familysearch.org/developers/docs/api/resources#parents-and-children"""
def __init__(self):
"""https://familysearch.org/developers/docs/api/examples#p... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | familysearch/parentsAndChildren.py | teoliphant/familysearch-python-sdk-opensource |
import numpy as np
from sklearn.pipeline import Pipeline
from models.model import Model, ArrayLike
from preprocess.report_data import ReportData
from preprocess.report_data_d import ColName
from training.description_classification.utils import load_svm, SVMPipeline
class SVMDescriptionClf(Model[SVMPipeline]):
"... | [
{
"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 | models/svm_model.py | Code-the-Change-YYC/YW-NLP |
"""Tests for the dianna.my_module module.
"""
import pytest
from dianna.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(excinfo.va... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/test_my_module.py | cwmeijer/dianna |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1_persistent_volume_claim_volume_source.py | iguazio/python |
"""Shared utilities for unit test cases."""
from unittest import TestCase
from bcrypt import hashpw, gensalt
from app.create import create_app
from app.extensions import db
from app.models.db import Role, User
# Global testing parameters
USR = "usr@usr.com"
ADM = "adm@adm.com"
class SetupTest(TestCase):
"""Pr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | test/setup_tests.py | CraigCiccone/crc_site |
from unittest import mock
class AsyncMock(mock.MagicMock):
async def __call__(self, *args, **kwargs):
return super(AsyncMock, self).__call__(*args, **kwargs)
def async_mock(method_to_mock, **kwargs):
return mock.patch(method_to_mock, new_callable=AsyncMock, **kwargs)
| [
{
"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 | tests/__init__.py | dbluhm/aries-sdk-python |
"""add_mood
Revision ID: b8bfbb8170b6
Revises: d459222e4af3
Create Date: 2020-07-19 11:11:16.102951
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "b8bfbb8170b6"
down_revision = "d459222e4af3"
branch_labels = None
depends_on = None
def upgrade():
# ### co... | [
{
"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 | migrations/versions/b8bfbb8170b6_add_mood.py | edementyev/wakeupbot |
# decorators/time.measure.arguments.py
from time import sleep, time
def f(sleep_time=0.1):
sleep(sleep_time)
def measure(func, *args, **kwargs):
t = time()
func(*args, **kwargs)
print(func.__name__, 'took:', time() - t)
measure(f, sleep_time=0.3) # f took: 0.30056095123291016
measure(f, 0.2) # f t... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | ch06/decorators/time.measure.arguments.py | kxen42/Learn-Python-Programming-Third-Edition |
import aioredis
from aioredis import Redis
class RedisWrapper:
"""A Redis wrapper class for usage in FastAPI endpoints."""
def __init__(self):
self.conn: Redis = None
async def create_redis(self):
"""Close the connection. Use at server startup."""
self.conn = aioredis.from_url(
... | [
{
"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 | core/api/api/redis.py | lkk7/blackjack |
from app.config import settings
from app.db import db
from app.db.init_db import init_db
from app.routers import documents, links, taxons
from fastapi import FastAPI
tags_metadata = [
{
"name": "documents",
"description": "Operations with documents",
"externalDocs": {
... | [
{
"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 | fastapi-api/src/app/main.py | dataforgoodfr/batch8_ceebios |
from nanome._internal._network._serialization import _ContextDeserialization, _ContextSerialization
from nanome._internal._util._serializers import _DictionarySerializer, _LongSerializer
from nanome._internal._structure._serialization import _WorkspaceSerializer, _AtomSerializer
from nanome._internal._util._serializers... | [
{
"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 | nanome/_internal/_network/_commands/_serialization/_send_notification.py | rramji/nanome-lib |
from .actor import Actor
from ..world.camera import Camera, Frame
from .. import event
class CameraCaptureSimulation(Actor):
interval: float = 1
def __init__(self) -> None:
super().__init__()
async def step(self):
await super().step()
while len(self.world.cameras) < 2:
... | [
{
"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 | rosys/actors/camera_capture_simulation.py | zauberzeug/rosys |
from __future__ import print_function
import sys
from robot.api import logger
class InitLogging:
called = 0
def __init__(self):
InitLogging.called += 1
print('*WARN* Warning via stdout in init', self.called)
print('Info via stderr in init', self.called, file=sys.stderr)
logger... | [
{
"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 | atest/testdata/test_libraries/InitLogging.py | userzimmermann/robotframework |
import pytest
import pathlib
import os
import subprocess
import tempfile
from kopf.testing import KopfRunner
from dask_kubernetes.common.utils import check_dependency
DIR = pathlib.Path(__file__).parent.absolute()
check_dependency("helm")
check_dependency("kubectl")
check_dependency("docker")
@pytest.fixture()
a... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | dask_kubernetes/conftest.py | ddelange/dask-kubernetes |
import unittest
from survey import AnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
"""Tests for the class AnonymousSurvey"""
def setUp(self):
"""
Create a survey and a set of responses for use in all test methods.
"""
question = "What language did you first le... | [
{
"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 | ehmatthes-pcc_2e-078318e/chapter_11/test_survey.py | charliechocho/py-crash-course |
from pykeepass import PyKeePass, create_database
def load_db(path, pas):
"""
:param path: путь к файлу
:param pas: пароль
:return: объект PyKeePass по указанным параметрам
"""
kp = PyKeePass(path, password=pas)
return kp
def load_group(kp, name='Root'):
"""
:param kp: объект PyK... | [
{
"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 | backend/crypto_and_keePass_interaction/keys.py | AkaMelk/TelegramBot_NoteForPasswords |
from keras.saving.save import load_model
from board import GameState, Player
from encoder import Encoder
from agent import Agent
import scoring
from board import Move, Point
from tiaocan import bot_name
class My():
def select_move(self, game_state):
print("请输入点坐标和方向(或弃权):")
x, y, d = input().split(... | [
{
"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 | game.py | zty111/tonghua |
# Python
# Django
# Rest Framework
from django.contrib.auth.models import User
from rest_framework.serializers import ModelSerializer
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
# Local
class LoginSerializer(TokenObtainPairSerializer):
@classmethod
def get_token(cls, user):
... | [
{
"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 | ftd_auth/serializers/userSerializer.py | Shanaka11/ftd_auth |
""" This is a dummy file used only to avoid errors in ReadTheDocs. The real BF.py is created during the setup once swig is run. """
def CP():
pass
def LeP():
pass
def LaP():
pass
def HoPpro():
pass
def HoPphy():
pass
def FS():
pass
def ELMReLU():
pass
def ELMSigmoid():
pa... | [
{
"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 | src/tfc/utils/BF/BF.py | leakec/tfc |
"""Create and save random price data"""
from random import random
import os
from datetime import datetime, timedelta
import pandas as pd # type: ignore
def random_walker(data_length: int):
"""Create a random walk data list"""
# seed(1)
random_walk = list()
random_walk.append(-1 if random() < 0.5 else... | [
{
"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 | backtest/simulator.py | geisten/bot |
import os
import flask
import joblib
PATH = os.path.dirname(os.path.abspath(__file__))
app = flask.Flask(__name__)
model_fname = "constant.joblib"
app.my_model = joblib.load(os.path.join(PATH, f"models/{model_fname}"))
@app.route("/")
def info():
return flask.jsonify({"model_instance": model_fname})
@app.ro... | [
{
"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 | ML_deployment/Google_cloud_platform/App_engine/main.py | kaisahling/Machine-Learning |
from .models import User
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import (
RedirectView,
UpdateView,
DetailView,
CreateView,
ListView,
)
User = get_user_model()
class UserDeta... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | backend/users/views.py | crowdbotics-apps/secretariado-28865 |
n = 8
grid = [[['.' for _ in range(n)] for _ in range(n)] for _ in range(n)]
grid[n // 2] = [list(l.strip()) for l in open('input_v2.txt', 'r').readlines()]
dirs = [(x, y, z) for x in [-1, 0, 1] for y in [-1, 0, 1] for z in [-1, 0, 1]]
dirs.remove((0, 0, 0))
def cycle(i, n_new, new_grid):
active_count = 0
for x in... | [
{
"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 | Problem 17/advent17a_v2.py | mankybansal/advent-of-code-2020 |
#!/usr/bin/env python3
# imports go here
#
# Free Coding session for 2015-04-18
# Written by Matt Warren
#
class Foo(object):
nice_level = "HI THERE"
def __init__(self, name):
self.name = name
def p(self):
return self.nice_level
def q(self):
return Foo.nice_level
def foo(... | [
{
"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 | 2015/04/fc_2015_04_18.py | mfwarren/FreeCoding |
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def compute_lr(target_lr, n_epochs, train_set_size, batch_size, warmup):
total = (n_epochs - 1) * int(np.ceil(train_set_size / batch_size))
progress = [float(t) / total for t in range(0, total)]
factor = [p / warmup if p < w... | [
{
"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 | qurator/sbb_ned/models/evaluation.py | qurator-spk/sbb_ned |
UPDATE_EVENTS = {
'ChangePassword', 'CreateAccessKey', 'CreateLoginProfile', 'CreateUser'
}
def rule(event):
return event.get(
'eventName') in UPDATE_EVENTS and not event.get('errorCode')
def dedup(event):
return event.get('userIdentity', {}).get('userName', '<UNKNOWN_USER>')
def title(event):... | [
{
"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 | aws_cloudtrail_rules/aws_update_credentials.py | designing-penguin/panther-analysis |
"""
Modified state columns in executions table
Revision ID: a472b5ad50b7
Revises: e1a50dae1ac9
Create Date: 2021-01-21 13:25:45.815775
"""
import sqlalchemy as sa
from alembic import op
# TODO: import DEFAULT EXECUTION CODE HERE
# revision identifiers, used by Alembic.
revision = "a472b5ad50b7"
down_revision = "e1a... | [
{
"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 | cornflow-server/migrations/versions/a472b5ad50b7_.py | ggsdc/corn |
# echogood.py
#
# A another attempt at an echo server. This one works because
# of the I/O waiting operations that suspend the tasks when there
# is no data available. Compare to echobad.py
from socket import *
from pyos7 import *
def handle_client(client,addr):
print("Connection from", addr)
while True:
... | [
{
"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 | coroutines/echogood.py | alick97/python_train |
# coding: utf-8
"""
AVACloud API 1.17.3
AVACloud API specification # noqa: E501
OpenAPI spec version: 1.17.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import avacloud_client_python
from avacloud_client_python.... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | test/test_gross_price_component_dto.py | Dangl-IT/avacloud-client-python |
import pytest
from s3contents import S3ContentsManager
from s3contents.ipycompat import TestContentsManager
@pytest.mark.minio
class S3ContentsManagerTestCase(TestContentsManager):
def setUp(self):
"""
This setup is a hardcoded to the use a minio server running in localhost
"""
se... | [
{
"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 | s3contents/tests/test_s3manager.py | ericdill/s3contents |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
from ppmessage.db.models import PredefinedScript
import json
import logging
class PPMovePr... | [
{
"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 | ppmessage/api/handlers/ppmovepredefinedscriptintogroup.py | augustand/ppmessage |
def add(x, y):
return x + y
def crunchNumbers():
print("How do you want me to crunch two numbers? ")
crunchFunction = input("Type add or something else: ")
num1 = input('First number: ')
num2 = input('Second number: ')
if crunchFunction == "add":
answer = add(num1, num2)
... | [
{
"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 | curriculum/03_functions_02_numbers/03_02_02_number_cruncher.py | google/teknowledge |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.contrib.auth import logout
from dogowner.models import DogOwner
from daycare.models import DayCare
from dogowner.views import dog_owner_home
from daycare.views import daycare_... | [
{
"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 | main/views.py | tamirmatok/Beyond-07-team-1 |
# qubit number=4
# total number=28
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 += X(3) # number=1
prog ... | [
{
"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 | benchmark/startPyquil2211.py | UCLA-SEAL/QDiff |
from django.shortcuts import render
from wiki.models import Page
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
# Create your views here.
class PageList(ListView):
"""
CHALLENGES:
1. On GET, display a homepage that shows all Pages in your wiki.
2.... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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/cls)?... | 3 | wiki/views.py | javiermms/makewiki |
from flask import Flask, render_template, jsonify, request, json
from modules import extract
from modules import ABREVIACIONES as abr
app = Flask(__name__,
static_folder='./templates/static',
template_folder='./templates')
@app.route('/api', methods=['POST'])
def api():
text = json.load... | [
{
"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 | web.py | javi20gu/frases_io |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 5 09:05:19 2019
@author: Rajiv Sambasivan
"""
class ManagedServiceConnParam:
@property
def DB_SERVICE_HOST(self):
return "DB_service_host"
@property
def DB_SERVICE_END_POINT(self):
return "DB_end_point"
@prop... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | src/arangomlFeatureStore/managed_service_conn_parameters.py | rajivsam/arangomlFeatureStore |
import torch
import torch.nn as nn
from torch.distributions import Bernoulli
from src.modules.attn import MAB, PMA, SAB, ISAB, ISABStack
from src.utils import *
from src.modules.mlp import *
class EdgePredictor(nn.Module):
def __init__(self, embedding_dim, device):
super().__init__()
self.pairwi... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | src/models/ep.py | tonyduan/ge-vae |
import discord
async def run(ctx, latency):
await ctx.send(ping_message(latency))
def ping_message(latency):
return f':ping_pong: `{calculate_latency(latency)} ms `'
def calculate_latency(latency):
return round(latency * 1000) | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | commands/ping_cmd.py | cygnus-dev/le-hamster |
class DynamicMenuMiddleware:
"""
Adds a cookie to track user when navigating our website, so we can
know which part of the web did he/she came from.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response... | [
{
"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 | dynamic_menu/middleware.py | lessss4/oil-and-rope |
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the BSD 3-Clause or the CeCILL-B License
# (see codraft/__init__.py for details)
"""
CodraFT launcher module
"""
from guidata.configtools import get_image_file_path
from qtpy import QtCore as QC
from qtpy import QtGui as QG
from qtpy import QtWidgets as QW
from... | [
{
"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 | codraft/app.py | CODRA-Software/CodraFT |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ray(CMakePackage):
"""Parallel genome assemblies for parallel DNA sequencing"""
homep... | [
{
"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 | var/spack/repos/builtin/packages/ray/package.py | xiki-tempula/spack |
class SubrectangleQueries:
def __init__(self, rectangle: List[List[int]]):
self.rectangle=rectangle
self.pos=[]
def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
self.pos.append([row1,col1,row2,col2,newValue])
... | [
{
"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 | P1476.py | Muntaha-Islam0019/Leetcode-Solutions |
'''
URL: https://leetcode.com/problems/day-of-the-week/
Difficulty: Easy
Description: Day of the Week
Given a date, return the corresponding day of the week for that date.
The input is given as three integers representing the day, month and year respectively.
Return the answer as one of the following values {"Sund... | [
{
"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 | 1185 Day of the Week.py | AtharvRedij/leetcode-solutions |
import numpy as np
# from scipy.misc import imread, imresize
from scipy import misc
def preprocess_input(x, v2=True):
x = x.astype('float32')
x = x / 255.0
if v2:
x = x - 0.5
x = x * 2.0
return x
def _imread(image_name):
return misc.imread(image_name)
def _imresize(image_array,... | [
{
"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/utils/preprocessor.py | EternalImmortal/Real-time-emotion-classifier-mini-Xception |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_data_labels06.py | edparcell/XlsxWriter |
""" Full assembly of the parts to form the complete network """
import torch.nn.functional as F
from .unet_parts import *
from .channels import C
class UNet3D(nn.Module):
def __init__(self, n_channels, n_classes, bilinear=True, apply_sigmoid_to_output=False):
super(UNet3D, self).__init__()
self.... | [
{
"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 | pytorch/unet_3d/unet_model.py | mistermoutan/ModelsGenesis |
#LordLynx
#Part of PygameLord
import pygame,os
from pygame.locals import*
pygame.init()
#Loading Objects
'''
Parse_Locations(file)
file: Your text file, use a .txt
# Like in Python will be ingored thusly follow this example
#Coment
./File/File
./File/Other File
...
'''
def Parse_Locations(file):
file = open(file,... | [
{
"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 | venv/Lib/site-packages/PygameLord/Loads.py | apoorv-x12/SpaceInvadersClassicGame-Myfirst-game |
# Условие:
# Написать простую функцию, которая будет возвращать век, на основе года.
# Пример:
# get_century(2021) -> 21
# get_century(1999) -> 20
# get_century(2000) -> 20
# get_century(101) -> 2
import unittest
def get_century(n: int) -> int:
a, b = divmod(n, 100)
return a + 1 if b > 0 else a
class Tes... | [
{
"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 | from_python_community/get_century.py | ZaytsevNS/python_practice |
# Copyright 2015 - Alcatel-Lucent
#
# 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 agree... | [
{
"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 | vitrage_dashboard/api/vitrage.py | mail2nsrajesh/vitrage-dashboard |
#!/usr/bin/env python3
# encoding: utf-8
"""
@version: 0.1
@author: lyrichu
@license: Apache Licence
@contact: 919987476@qq.com
@site: http://www.github.com/Lyrichu
@file: test_PSO.py
@time: 2018/06/08 23:31
@description:
test for PSO
"""
import sys
sys.path.append("..")
from time import time
from sopt.util.functions ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | sopt/test/test_PSO.py | Lyrichu/sopt |
"""empty message
Revision ID: f30cc5d13b95
Revises: 6df98408ed48
Create Date: 2021-08-01 00:26:06.428653
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f30cc5d13b95'
down_revision = '6df98408ed48'
branch_labels = None
depends_on = None
def upgrade():
op... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | migrations/versions/f30cc5d13b95_.py | gregziegan/eviction-tracker |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations... | [
{
"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 | crewbank/contrib/sites/migrations/0003_set_site_domain_and_name.py | mfwarren/CrewBank |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Beast2(Package):
"""BEAST is a cross-platform program for Bayesian inference using MCMC
... | [
{
"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 | var/spack/repos/builtin/packages/beast2/package.py | xiki-tempula/spack |
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
# 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... | [
{
"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": true... | 3 | neutron/plugins/ofagent/agent/tables.py | gampel/neutron |
from pynput import mouse, keyboard
import win32api
import win32con
def on_move(x, y):
print('Pointer moved to {0}'.format((x, y)))
def on_click(x, y, button, pressed):
print('{0} at {1}'.format('Pressed' if pressed else 'Released', (x, y)))
win32api.LoadCursor(None, win32con.IDC_NO)
if not pressed:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | bug_free_code.py | 96imranahmed/clickyclicky |
#
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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 requ... | [
{
"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 | src/aria/aria/loading/literal.py | tliron/aria-ng |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.common.replacement import FrontReplacementPattern
from openvino.tools.mo.front.tf.loader import variables_to_constants
from openvino.tools.mo.graph.graph import Graph
class VariablesToConstants(FrontReplace... | [
{
"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 | tools/mo/openvino/tools/mo/front/tf/variables_values_freezing.py | pazamelin/openvino |
"""Zoom.us REST API Python Client -- Chat Messages component"""
from zoomapi.util import require_keys, Throttled
from zoomapi.components import base
class ChatMessagesComponentV2(base.BaseComponent):
"""Component dealing with all chat messages related matters"""
@Throttled
def list(self, **kwargs):
... | [
{
"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 | zoomapi/components/chat_messages.py | zihuaweng/zoomapi |
#!/usr/bin/env python3
"""
Author: Ted Bracht <ted@bracht.uk>
Purpose: Shout hello to the world
"""
import argparse
def get_args():
parser = argparse.ArgumentParser(description="Say hello")
parser.add_argument("-n", "--name", metavar="name",
default="World", help="Name to greet")
r... | [
{
"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 | 01_hello/hello.py | flyingdutch20/tiny_python_projects |
# Author: Simon Blanke
# Email: simon.blanke@yahoo.com
# License: MIT License
import numpy as np
import pandas as pd
class Memory:
def __init__(self, warm_start, conv):
self.memory_dict = {}
self.memory_dict_new = {}
self.conv = conv
if warm_start is None:
return
... | [
{
"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 | gradient_free_optimizers/memory.py | gtr8/Gradient-Free-Optimizers |
from spinnman.messages.scp.abstract_messages.abstract_scp_request\
import AbstractSCPRequest
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.scp.scp_request_header import SCPRequestHeader
from spinnman.messages.scp.scp_command import 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 | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_dpri_get_status_request.py | Roboy/LSM_SpiNNaker_MyoArm |
import mdtraj as md
import MDAnalysis as mda
import numpy as np
import factory
from interface import TrajectoryAdapter
# We made an abstract class,that both packages can be handled in the same way. Each package exported information from pdb files in different ways so we will have those be private variables.
class M... | [
{
"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 | oop_playground/adapters.py | jaclark5/design_patterns |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.conf import settings
from django.shortcuts import render, get_object_or_404
from django.utils.decorators import method_decorator
from django.views.generic.list import ListView
from uw_saml.decorators import group_requi... | [
{
"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 | interview_db/views.py | jcivjan/interview-db |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-04-27 21:41:14
# Description:
import os
import sys
class Solution(object):
def subsets(self, nums):
ret = []
self.dfs(nums, [], ret)
return ret
def dfs(self, nums, path, ret):
ret.append(path)
... | [
{
"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 | leetcode/0078_Subsets/result.py | theck17/notes |
# Copyright 2020-present, Netherlands Institute for Sound and Vision (Nanne van Noord)
#
# 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": "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 | dane/utils.py | CLARIAH/DANE-util |
from inferno.io.volumetric import TIFVolumeLoader, HDF5VolumeLoader
from inferno.io.transform import Compose
from inferno.io.transform.generic import Cast, Normalize
from inferno.io.transform.image import AdditiveGaussianNoise
class RawVolume(TIFVolumeLoader):
def __init__(self, path, dtype='float32', **slicing_c... | [
{
"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 | neurofire/datasets/isbi2012/loaders/raw.py | nasimrahaman/neurofire |
from pathlib import Path
import moonleap.resource.props as P
from moonleap import (
MemFun,
Prop,
StoreOutputPaths,
StoreTemplateDirs,
create,
extend,
feeds,
receives,
register_add,
)
from moonleap.verbs import has, runs
from titan.project_pkg.project import Project
from titan.proje... | [
{
"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 | titan/project_pkg/vscodeproject/__init__.py | mnieber/gen |
from core.model.meta_column import MetaColumn
from core.service.column_generator.base import SingleColumnGenerator, RegisteredGenerator
from core.service.column_generator.decorator import parameter
from core.service.data_source.data_provider import DataProvider
from core.service.generation_procedure.database import Gen... | [
{
"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 | backend/core/service/column_generator/basic_generator/boolean.py | pecimuth/synthia |
from p2ner.base.ControlMessage import ControlMessage,trap_sent
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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": "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 | p2ner/components/plugin/chatclient/chatclient/messages/messages.py | schristakidis/p2ner |
import numpy as np
import cv2
import onnxruntime
import time
def test_conv2d(img, filter_size):
start = time.time()
# Load the model
model_path = f'conv_{filter_size}x{filter_size}.onnx'
ort_session = onnxruntime.InferenceSession(model_path)
# Run inference
ort_inputs = {ort_session.get_inputs()[0].name: i... | [
{
"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 | examples/ConvOpt/comparison/onnxruntime-conv2d.py | LeiWang1999/buddy-mlir |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_navi_widget.ipynb (unless otherwise specified).
__all__ = ['NaviGUI', 'NaviLogic', 'Navi']
# Cell
from ipywidgets import (AppLayout, Button, IntSlider,
HBox, Output,
Layout, Label)
from traitlets import Int, observe, li... | [
{
"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 | ipyannotator/navi_widget.py | AlexJoz/ipyannotator |
"""
Given the root of a binary tree, return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two nodes in a tree.
This path may or may not pass through the root.
The length of a path between two nodes is represented by the number of edges between th... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | scripts/practice/FB/DiameterofBinaryTree.py | bhimeshchauhan/competitive_programming |
import unittest
from pyravendb.commands.raven_commands import PutDocumentCommand, PatchCommand
from pyravendb.custom_exceptions.exceptions import DocumentDoesNotExistsException
from pyravendb.data.patches import PatchRequest
from pyravendb.tests.test_base import TestBase
class TestPatch(TestBase):
def setUp(self)... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | pyravendb/tests/raven_commands_tests/test_patch.py | CDuPlooy/ravendb-python-client |
# 打家劫舍
# DP
# 法一:一维数组
class Solution:
def rob(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
if len(nums) == 1:
return nums[0]
# 创建数组
dp = [0] * len(nums)
# 初始化数组
dp[0] = nums[0]
dp[1] = max(nums[0],nums[1])
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | Week 08/id_475/LeetCode_198_475.py | sekishi/algorithm004-05 |
# -*- coding: utf-8 -*-
import unittest
from unittest.mock import MagicMock, patch
from dashboard.exceptions import PageOutOfRange
from dashboard.history import BuildSetsPaginated
class TestBuildSets(unittest.TestCase):
@patch('dashboard.model.ZuulBuildSet.get_for_pipeline')
def test_create_buildsets_history... | [
{
"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 | tests/test_buildsets.py | MichalMilewicz/tungsten-ci-dashboard |
# -*- coding: utf-8 -*-
from bdea.client import BDEAStatusResponse
class TestBDEAStatusResponse(object):
RESPONSE = {
'apikeystatus': 'active',
'commercial_credit_status': 'exhausted',
'commercial_credit_status_percent': 0,
'credits': '0',
'credits_time': '2015-10-24 13:15... | [
{
"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/test_api_status.py | max-arnold/python-block-disposable-email |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.