source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
from h import models, storage
from h.celery import celery, get_task_logger
from h.search.index import BatchIndexer, delete, index
log = get_task_logger(__name__)
@celery.task
def add_annotation(id_):
annotation = storage.fetch_annotation(celery.request.db, id_)
if annotation:
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | h/tasks/indexer.py | kevinjalbert/h |
'''
Problem 017
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in
words, how many letters would be used?
NOTE: Do not count spaces or hyphens. ... | [
{
"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 | project_euler/017.letter_counts.py | davemungo/various |
from torch import nn
from transformers import T5ForConditionalGeneration
from config import config
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.t5_model = T5ForConditionalGeneration.from_pretrained(config.MODEL_PATH)
def forward(
self,
input_... | [
{
"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 | t5-base/model.py | shanayghag/AV-Janatahack-Independence-Day-2020-ML-Hackathon |
import pytest
from werkzeug.datastructures import MultiDict
from wtforms import Form, validators
from wtforms import BooleanField, StringField
from app.model.components.helpers import form_fields_dict
def _form_factory(form_class):
def _create_form(**kwargs):
form = form_class(MultiDict(kwargs))
... | [
{
"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 | webapp/tests/model/components/test_helpers.py | digitalservice4germany/steuerlotse |
from django.utils.text import slugify
import string
import random
def generate_random_string(N):
res = ''.join(random.choices(string.ascii_uppercase +
string.digits, k = N))
return res
def generate_slug(text):
new_slug = slugify(text)
from home.models import BlogMod... | [
{
"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 | home/helpers.py | suyogojha/Blog-Django |
# # Python Week-7 Day-42
# Python Classes and Objects 2
print(" -- Let us create a method in the Person class --")
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def myfunc(self):
print("Hello my name is " + self.name )
p1 = Person("John", "36")
p1.myfunc(... | [
{
"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 | Week-7/Day-42.py | abusamrah2005/Python |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.j... | [
{
"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/python/pants/backend/jvm/tasks/ivy_imports.py | arloherrine/pants |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
s3gis = s3gis_tests.s3gis
def test_KMLLayer():
current.session.s3.debug = True
current.request.utcnow = datetime.datetime.now()
s3gis_tests.layer_test(
db,
db.gis_layer_kml,
dict(
name = "Test KML",
... | [
{
"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 | tests/unit_tests/modules/s3/s3gis/KMLLayer.py | PeterDaveHello/eden |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test a node with the -disablewallet option.
- Test that validateaddress RPC works when running with -d... | [
{
"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 | test/functional/wallet_disable.py | Afrigonblockchain/Afrigon-Core |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.db.models import ConversationUserData
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
import json
import logging
class PPOpe... | [
{
"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 | ppmessage/api/handlers/ppopenconversationhandler.py | gamert/ppmessage |
from django import template
import filters.forest as forest
import json
register = template.Library()
@register.simple_tag(takes_context=False)
def render_full(src, inp):
# load some json
obj = json.loads(inp)
# parse the source code
tree = forest.parse(src)
# make a layout with the given objec... | [
{
"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 | filters/templatetags/filter.py | kuboschek/jay |
from dsa_queue import DSAQueue
class DSAShufflingQueue(DSAQueue):
def enqueue(self, obj: object) -> None:
if self.is_full():
raise ValueError("Queue is full.")
self._array[self._size] = obj
self._size += 1
def dequeue(self) -> object:
tmp = self.peek()
for ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | P2/dsa_shuffling_queue.py | MC-DeltaT/DSA-Practicals |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayUserElectronicidOutermerchantbarcodeCreateResponse(AlipayResponse):
def __init__(self):
super(AlipayUserElectronicidOutermerchantbarcodeCreateResponse, self).__init__()... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | alipay/aop/api/response/AlipayUserElectronicidOutermerchantbarcodeCreateResponse.py | snowxmas/alipay-sdk-python-all |
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot
def window():
app = QApplication(sys.argv)
win = QWidget()
button1 = QPushButton(win)
button1.setText("Show dialog!")
button1.move(50, 50)
butt... | [
{
"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 | speed_reader.py | nickmalleson/SpeedReader |
import argparse
import random
parser = argparse.ArgumentParser(prog='xkcdpwgen', description='Generate a secure, memorable password using the XKCD method')
parser.add_argument("-w", "--words", type=int, default=4, help='include WORDS words in the password (default=4)')
parser.add_argument("-c", "--caps", type=int, def... | [
{
"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 | Secure-Password-Generator/password-gen.py | allenwest24/Ethical-Hacking-Toolbox |
import unittest
import sccf
import cvxpy as cp
import numpy as np
class TestMinExpression(unittest.TestCase):
def test(self):
x = cp.Variable(10)
x.value = np.zeros(10)
expr = cp.sum_squares(x)
with self.assertRaises(AssertionError):
sccf.minimum(-expr, 1.0)
mi... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | test.py | cvxgrp/sccf |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 21:09:10 2018
@author: Dimitris Loukrezis
Univariate Lagrange and hierarchical polynomials.
"""
import numpy as np
class Lagrange1d:
"""Univariate Lagrange nodal basis polynomial"""
def __init__(self, current_knot, knots):
self.current_knot = curren... | [
{
"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 | dali/lagrange1d.py | dlouk/DALI |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..preprocess import FWHMx
def test_FWHMx_inputs():
input_map = dict(acf=dict(argstr='-acf',
usedefault=True,
),
args=dict(argstr='%s',
),
arith=dict(argstr='-arith',
xor=['geom'],
),
aut... | [
{
"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 | nipype/interfaces/afni/tests/test_auto_FWHMx.py | effigies/nipype |
# FARIS : Factual Arrangement and Representation of Ideas in Sentences
# FAris : Farabi & Aristotle
# Faris : A knight (in Arabic)
# --------------------------------------------------------------------
# Copyright (C) 2015, 2021 Abdelkrime Aries (kariminfo0@gmail.com)
#
# Autors:
# - 2021 Abdelkrime Aries (kar... | [
{
"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 | faris/philosophical/quantity.py | kariminf/faris_py |
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
#直方图反向投影
def bitwise_and():
small = cv.imread("C:/1/image/small.jpg")
big = cv.imread("C:/1/image/big.jpg")
small_hsv = cv.cvtColor(small, cv.COLOR_BGR2HSV)
big_hsv = cv.cvtColor(big, cv.COLOR_BGR2HSV)
"""
h,s,v = cv.spl... | [
{
"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 | 11_ Histogram3.py | Sanduoo/OpenCV-Python |
# Copyright (c) 2019/7/13 Hu Zhiming jimmyhu@pku.edu.cn All Rights Reserved.
# process files and directories.
#################### Libs ####################
import os
import shutil
import time
# remove a directory
def RemoveDir(dirName):
if os.path.exists(dirName):
shutil.rmtree(dirName)
else:
print("Invalid... | [
{
"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 | EHTask/utils/FileSystem.py | CraneHzm/EHTask |
import reader
class DeviceStub(object):
def __init__(self, text):
self.__text = text
def read(self):
return self.__text
def __enter__(self, *args):
return self
def __exit__(self, *args):
pass
class ReaderStub(object):
def __init__(self, values):
self.__va... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/test_reader.py | vladfolts/rpi-web-temperature-monitor-with-google-drive-upload |
"""Unify local and remote int8
Revision ID: 5bc9e9b6c3ff
Revises: 7f3c818591e1
Create Date: 2021-03-29 15:28:58.945918
"""
"""
OpenVINO DL Workbench
Migration: Unify local and remote int8
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this ... | [
{
"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/5bc9e9b6c3ff_unify_local_and_remote_int8.py | apaniukov/workbench |
# 使用yield 实现单线程的异步并发效果
import time
def consumer(name):
print("%s 准备吃包子啦!" %name)
while True:
baozi = yield #接收值
print("包子[%s]来了,被[%s]吃了!" %(baozi,name))
def producer(name):
c = consumer("A")
c2 = consumer("B")
c.__next__()
c2.__next__()
print("老子开始做包子了")
for i in ran... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | async.py | Ethan-Xie/python_study |
from sqlalchemy.orm import sessionmaker
from models import Forecasts, db_connect, create_forecast_table
import logging
class PollenScraperPipeline(object):
def __init__(self):
engine = db_connect()
create_forecast_table(engine)
self.Session = sessionmaker(bind=engine)
def process_item... | [
{
"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 | scraper_app/pipelines.py | brian-yang/pollen-scraper |
"""SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
#
# Permission is hereb... | [
{
"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 | scons-local-0.96.90/SCons/Tool/sgic++.py | luaman/twilight |
import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.integer import (
Int8Dtype,
Int16Dtype,
Int32Dtype,
Int64Dtype,
UInt8Dtype,
UInt16Dtype,
UInt32Dtype,
UInt64Dtype,
)
@pytest.fixture(
params=[
Int8Dtype,
Int16Dtype,
Int32Dtype,
... | [
{
"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 | pandas/tests/arrays/integer/conftest.py | AdrianMastronardi/pandas |
import time
import pytest
@pytest.mark.parametrize("partition", ["normal", "debug"])
def test_partitions_are_up(host, partition):
partition_status = host.check_output(f"scontrol -o show partition {partition}")
assert "State=UP" in partition_status
def test_job_can_run(host):
host.run('sbatch --wrap="hos... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | tests/test_slurm.py | drewsilcock/docker-centos7-slurm |
"""Stand-alone utility functions."""
from inspect import Parameter, Signature
from typing import Any, Dict, Optional, Tuple
def convert_docblock(doc: Optional[str]) -> Optional[str]:
"""Strip the comment syntax out of a docblock."""
if not isinstance(doc, str):
return doc
doc = doc.strip('/*')
... | [
{
"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 | phpbridge/utils.py | Louzet/Python-PHP-Bridge |
"""
Collection of functions to assist PyDoof modules.
"""
from collections import Iterable
from datetime import date
from enum import Enum
def parse_query_params(params):
"""
Parses a query-parameters dictionary into their proper parameters schema.
Each key value of the dictionary represents a parameter ... | [
{
"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 | pydoof/helpers.py | doofinder/pydoof |
"""
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | model-optimizer/extensions/back/RNNSequenceTypeRename.py | calvinfeng/openvino |
from conans import ConanFile
class libxbitset_conan(ConanFile):
name = "libxbitset"
version = "0.0.1"
license = "Apache License Version 2.0"
author = "Khalil Estell"
url = "https://github.com/SJSU-Dev2/libxbitset"
description = "Extension of std::bitset that includes multi-bit insertion and ex... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | conanfile.py | SJSU-Dev2/libxbitset |
import pytest
import torch
from torchts.nn.loss import masked_mae_loss, mis_loss, quantile_loss
@pytest.fixture
def y_true():
data = [1, 2, 3]
return torch.tensor(data)
@pytest.fixture
def y_pred():
data = [1.1, 1.9, 3.1]
return torch.tensor(data)
def test_masked_mae_loss(y_true, y_pred):
"""... | [
{
"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 | tests/nn/test_loss.py | JudyJin/torchTS |
import graphene
from graphene_django.types import DjangoObjectType
from .models import Category, Ingredient
class CategoryType(DjangoObjectType):
class Meta:
model = Category
class IngredientType(DjangoObjectType):
class Meta:
model = Ingredient
class Query(object):
category = graphene.Fi... | [
{
"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 | ingredients/schema.py | gtg7784/Graphene-Django |
# 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": "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 | aliyun-python-sdk-reid/aliyunsdkreid/request/v20190928/DescribeHeatMapRequest.py | yndu13/aliyun-openapi-python-sdk |
import math
import sys
sys.path.append("chapter3")
sys.path.append("chapter4")
from drawable import Drawable
from robot import Robot
class Particle(Drawable):
def __init__(self, init_pose):
self._pose = init_pose
def draw(self, ax):
xs = self._pose[0]
ys = self._pose[1]
vxs = ... | [
{
"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 | chapter5/particle.py | yuishihara/probabilistic_robotics_implementations |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.15.6
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer... | 3 | kubernetes/test/test_authorization_v1_api.py | fooka03/python |
import requests
import json
import time
ACCESS_TOKEN = ''
class Commit(object):
def __init__(self):
self.sha = None
self.url = None
self.repository = None
self.message = None
self.nn = None
self.rf = None
self.languages_url = None
def populate_la... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | toolkits/cm_class.py | GiorgosNikitopoulos/Mine_Vulnerable_Code |
from http_stubs.models import AbstractHTTPStub, AbstractLogEntry
class TestAbstractHTTPStub:
"""Tests for AbstractHTTPStub class."""
model = AbstractHTTPStub(
method='test_method',
path='test_path',
)
def test_str(self):
"""Test magic method __str__."""
assert str(sel... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
... | 3 | http_stubs/tests/test_models.py | PetrS12/Kesha |
import asyncio
import concurrent.futures
import threading
import click
def safe_run_async(async_fn, *argv):
loop = asyncio.get_event_loop()
try:
ret = loop.run_until_complete(async_fn(*argv))
loop.run_until_complete(loop.shutdown_asyncgens())
finally:
loop.close()
return 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | async_utils.py | tejashah88/devpost-profile-exporter |
# -*- coding: utf-8 -*-
# spróbój czegos takiego jak
def index(): return dict(message="hello from moje.py")
def aaa(a):
if not request.vars.a:
request.vars.a=123
session.id=request.vars.a
return session.id
| [
{
"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 | applications/bestbukpl/controllers/moje.py | lechu87/bbuk |
#sum = 10
def func1():
#sum = 20
print('Local1:', sum)
def func2():
#sum = 30
print('Local 2:', sum)
func2()
func1()
print("Global:", sum([1, 2, 3]))
| [
{
"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 | Course/functions/example_12.py | zevgenia/Python_shultais |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Batch"
prefix = "batch"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
super().... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | awacs/batch.py | michael-k/awacs |
from spytest import st
def init(dut):
st.create_init_config_db(dut)
def extend(dut):
st.log("Extend base config if needed", dut=dut)
st.config(dut, "config feature state nat enabled")
st.config(dut, "config feature state sflow enabled")
| [
{
"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 | spytest/apis/common/base_config.py | macikgozwa/sonic-mgmt |
try:
from BytesIO import BytesIO
except ImportError:
from io import BytesIO
from pyecore.resources import URI
class BytesURI(URI):
def __init__(self, uri, text=None):
super(BytesURI, self).__init__(uri)
if text is not None:
self.__stream = BytesIO(text)
def getvalue(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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | pygeppetto/model/utils/bytesuri.py | openworm/pygeppetto |
# -*- coding: utf-8 -*-
def create_entry(date, description, change):
return (list(map(int, date.split("-"))), description, change)
def format_entries(currency, locale, entries):
if currency == "USD":
symbol = "$"
elif currency == "EUR":
symbol = u"€"
if locale == "en_US":
he... | [
{
"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 | python/ledger/ledger.py | fruit-in/exercism-solution |
from os import listdir, system
from os.path import isfile, join
def iterate_dir(path):
for f in listdir(path):
if isfile(join(path, f)):
if f.endswith('.wav'):
system('sox ' + path + '/' + f + ' out.wav remix 1')
system('rm ' + path + '/' + f)
sy... | [
{
"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 | fix_audios.py | faboyds/deepspeech.pytorch |
import torch
from torch import nn
from torch.distributions import Categorical
class SoftmaxCategoricalHead(nn.Module):
def forward(self, logits):
return torch.distributions.Categorical(logits=logits)
# class MultiSoftmaxCategoricalHead(nn.Module):
# def forward(self, logits):
# return Indepe... | [
{
"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 | pfrl/policies/softmax_policy.py | tkelestemur/pfrl |
from pytest import mark
from myia.ir import manage
from myia.pipeline import scalar_debug_pipeline
cconv_pipeline = scalar_debug_pipeline \
.select('resources', 'parse', 'resolve', 'cconv', 'export')
def check_no_free_variables(root):
mng = manage(root)
for g, nodes in mng.nodes.items():
if not ... | [
{
"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 | tests/test_cconv.py | fosterrath-mila/myia |
import asyncio
import pytest
from liualgotrader.common.database import create_db_connection
from liualgotrader.trading.alpaca import AlpacaTrader
alpaca_trader: AlpacaTrader
@pytest.fixture
def event_loop():
global alpaca_trader
loop = asyncio.get_event_loop()
loop.run_until_complete(create_db_connecti... | [
{
"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 | tests/test_alpaca_trader.py | ksilo/LiuAlgoTrader |
import fire
from scripts import plot_results
from scripts import run_experiments
from scripts import tabular_test
class Experiments:
def test(self):
tabular_test.main()
def plot_experiments(self):
plot_results.main()
def run_experiments(self):
run_experiments.main()
... | [
{
"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 | bandits/__main__.py | probml/bandits |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import pytest
from windtalker.cipher import BaseCipher
from windtalker.tests import BaseTestCipher
class MyCipher(BaseCipher):
def encrypt(self, binary, *args, **kwargs):
return (base64.b64encode(binary... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_cipher.py | MacHu-GWU/windtalker-project |
from paz.core import Processor
from paz.core import SequentialProcessor
import numpy as np
class ProcessorA(Processor):
def __init__(self):
super(ProcessorA, self).__init__()
def call(self, image, boxes):
boxes = boxes - 1.0
return image, boxes
class ProcessorB(Processor):
def _... | [
{
"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 | tests/paz/backend/processor.py | niqbal996/paz |
prev = 0
balance = 0
day = 0
longest_dep1 = 0
longest_dep2 = 0
longest_day = 0
wins = 0
def start_game(deposit_1, deposit_2):
global day, balance, prev
day = 2
prev = deposit_1
balance = deposit_1 + deposit_2
day_loop()
def day_loop():
global day, balance, prev
day += 1
prev_tmp = pr... | [
{
"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 | mpmp/million/million.py | themaskedcrusader/hodgepodge |
import chainer
import chainer.functions as F
import chainer.links as L
"""
Based on chainer official example
https://github.com/pfnet/chainer/tree/master/examples/ptb
Modified by shi3z March 28,2016
"""
class RNNLM(chainer.Chain):
"""Recurrent neural net languabe model for penn tree bank corpus.
This is... | [
{
"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 | deel/model/lstm.py | ghelia/deel |
# pigeonhole
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
return len(set(zip(s, t))) == len(set(s)) == len(set(t))
# two dict
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
dx, dy = {}, {}
for x, y in zip(s, t):
if (x in dx and dx[x] != y)... | [
{
"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 | python/0205. isIsomorphic.py | whtahy/leetcode |
from io import BytesIO
from gtts import gTTS
from PIL import Image
from vkbottle import AudioUploader, Bot, DocUploader, Message, PhotoUploader
bot = Bot("token")
photo_uploader = PhotoUploader(bot.api, generate_attachment_strings=True)
doc_uploader = DocUploader(bot.api, generate_attachment_strings=True)
audio_uplo... | [
{
"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 | examples/uploaders.py | MooFreak/vkbottle |
from flask import Flask, jsonify
import data4app
app = Flask(__name__)
@app.route("/")
def home():
return "Lets goooo!!!"
@app.route("/<var>")
def jsonified(var):
data = data4app.get_data(var)
return jsonify(data)
if __name__ == "__main__":
app.run(debug=True)
| [
{
"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 | app.py | IIVIIIII/2020_Weathering |
from abjad import attach
from abjad import inspect
from abjad import iterate
from abjad.tools import abctools
from abjad.tools import scoretools
class ClefSpannerExpression(abctools.AbjadValueObject):
r'''A clef spanner expression.
'''
### CLASS VARIABLES ###
__slots__ = ()
### INITIALIZER ###
... | [
{
"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 | consort/tools/ClefSpannerExpression.py | josiah-wolf-oberholtzer/consort |
import sys, os
sys.path.append(os.path.abspath(os.path.join('..', 'linked_list')))
from LinkedList import linked_list
from node import Node
class queue_linked_list():
def __init__(self):
self.head = None
self.tail = None
def enqueue(self, value):
tempNode = Node(value)
if (se... | [
{
"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 | python_practice/data_structure/queue/queue_link_list.py | jeremykid/FunAlgorithm |
import click
import logging
from os.path import basename, exists
from shutil import rmtree
from helper.aws import AwsApiHelper
logging.getLogger().setLevel(logging.DEBUG)
class Helper(AwsApiHelper):
def __init__(self, sql_file):
super().__init__()
self._sql_file = sql_file
with open(sql_f... | [
{
"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 | Config/query_configservice.py | kyhau/arki |
from django.utils.translation import ugettext as _
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from .serializers import PaymentInputSerializer, PaymentPatchSerializer, PaymentResponseSerializer
from .services import PaymentService
class PaymentView(GenericAPIView):... | [
{
"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 | payment/views.py | caioaraujo/bakery_payments_api_v2 |
'''
Given the root of a binary tree, return the level order traversal of its nodes' values.
(i.e., from left to right, level by level).
Example 1:
Input: root = [3,9,20,null,null,15,7]
Output: [[3],[9,20],[15,7]]
Example 2:
Input: root = [1]
Output: [[1]]
Example 3:
Input: root = []
Output: []
'''
# Definition... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | medium/binary-tree-level-order-traversal.py | therealabdi2/LeetcodeQuestions |
'''
Created on Dec 30, 2010
@author: patnaik
'''
from collections import deque
class Queue(object):
def __init__(self, data = None):
if data:
self.internal_queue = deque(data)
else:
self.internal_queue = deque()
def enqueue(self, value):
self... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | emr_mine_python_scipts/pq_tree/Queue.py | debprakash/emr-view |
def make_subject(sector: str, year: str, q: str):
return f'[업종: {sector}] {year}년도 {q}분기'
def make_strong_tag(value: str):
return f'<strong>{value}</strong>'
def make_p_tag(value: str):
return f'<p>{value}</p>'
def make_img_tag(name: str, src: str):
return f'<img src="{src}" alt="{name}">'
def 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | fdap/app/autopost/template.py | miniyus/finance-data-auto-posting |
from typing import Sequence
from urllib.parse import urlparse
import eventualpy.datatypes
from eventualpy import messages, exceptions
class Publisher:
def __init__(
self,
connection,
stream: str,
new_events: Sequence[messages.NewEvent],
expected_version: int = eventualpy.d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | src/eventualpy/publisher.py | madedotcom/eventualpy |
from fabric.api import task, local
@task
def down():
local('docker-compose down')
local('rm -rf /tmp/manager_run')
@task
def up():
local('docker-compose up -d manager1 manager2 worker1 worker2')
local('docker-compose exec -T manager1 docker swarm init')
token_worker = local('docker-compose exec -T... | [
{
"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 | fabfile.py | chainidio/chainid-dash |
from .analysis import polyfit
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
def plot_water_levels(station, dates, levels):
#plot the dates and water levels
plt.plot(dates, levels, label = 'Water level')
# Add axis labels, rotate date labels and add plot title
plt.xlabel('date')... | [
{
"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 | floodsystem/plot.py | rok20/flood-warning-rok20 |
# -*- coding: utf-8 -*-
#
# 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
#... | [
{
"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 | tests/gcp/operators/test_spanner_system.py | suensummit/airflow |
# coding=utf-8
from __future__ import print_function
import json
from data_packer import err, DataPacker, container
g_src = {
'a': 1,
'b': 'hello',
'c': ['a', 'b', 'c'],
'd': {
'1': 1,
'2': 2,
},
'e': {
'1': ['a', 'b'],
'2': {
'a': '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_has_docstring",
"question": "Does every function in this file have a docst... | 3 | example/demo/common.py | ideascf/data-packer |
import requests
import logging
logging.basicConfig(format='[PYTHON] %(levelname)s:%(message)s', level=logging.DEBUG)
class JSonTest:
def __init__(self):
self.status_code = 0
def getip(self):
resp = requests.get("http://ip.jsontest.com/")
self.status_code = resp.status_code
i... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | python_embedded/jsontest.py | wgodefro/birl |
from sys import maxsize
class Project:
def __init__(self, id=None, name=None):
self.id = id
self.name = name
def __repr__(self):
return "%s:%s" % (self.id, self.name)
def __eq__(self, other):
return (self.id is None or other.id is None or self.id == other.id) and self.na... | [
{
"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 | model/project.py | OIGurev/python_training_mantis |
import collections.abc
import typing
def is_generic37(as_class: typing.Type):
return isinstance(as_class, typing._GenericAlias) and as_class.__origin__ not in (
typing.Union, typing.ClassVar, collections.abc.Callable
)
_collection_types = [
collections.abc.Collection,
]
def is_collection37(as_... | [
{
"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 | src/pyjackson/_typing_utils37.py | mike0sv/pyjackson |
import electrum.crypto
import electrum.util
from electrum_gui.common.basic.functional.require import require
from electrum_gui.common.secret import exceptions
def encrypt_data(password: str, data: str) -> str:
require(bool(password))
return electrum.crypto.pw_encode(data, password, version=1)
def decrypt_da... | [
{
"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 | electrum_gui/common/secret/encrypt.py | BixinKey/electrum |
from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... | [
{
"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 | az_ykan_v1.0.1/Arduino-master/tests/device/test_WiFiServer/test_WiFiServer.py | angelbarusta/ind-matageyco |
import subprocess
import json
import os
class ExifTool:
sentinel = "{ready}\n"
def __init__(self, executable="/usr/bin/exiftool"):
self.executable = executable
def __enter__(self):
self.process = subprocess.Popen(
[self.executable, "-stay_open", "True", "-@", "-"],
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | picymcsortpy/exif_tool.py | patrjon/PicyMcSortpy |
"""Offer time listening automation rules."""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import CONF_PLATFORM
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import async_track_time_change
# mypy: allow-untyped-d... | [
{
"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 | homeassistant/components/automation/time_pattern.py | kayr7/home-assistant |
import functools
import simplejson as json
def _assert_status_code(code, response):
assert response['statusCode'] == code
assert_200 = functools.partial(_assert_status_code, 200)
assert_404 = functools.partial(_assert_status_code, 404)
assert_500 = functools.partial(_assert_status_code, 500)
def get_body_from_... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/helpers.py | verypossible/pychain |
from ColorPair_get_data import get_color_from_pair_number
from ColorPair_get_data import get_pair_number_from_color
def test_functionalities():
test_number_to_pair(4, 'White', 'Brown')
test_number_to_pair(5, 'White', 'Slate')
test_pair_to_number('Black', 'Orange', 12)
test_pair_to_number('Violet', 'Slate', 25)... | [
{
"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 | ColorPair_test_data.py | clean-code-craft-tcq-1/modular-python-Anjana-MU |
from django.db import models
from django.conf import settings
import os
from django.core.validators import FileExtensionValidator
User = settings.AUTH_USER_MODEL
def smarket_directory_path(instance, filename):
banner_pic_name="smarket/products/{0}/{1}".format(instance.name, filename)
full_path = os.path.join(... | [
{
"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 | smarket/models.py | fedeuhr/smartket |
"""Test component helpers."""
# pylint: disable=protected-access
from collections import OrderedDict
import unittest
from homeassistant import helpers
from tests.common import get_test_home_assistant
class TestHelpers(unittest.TestCase):
"""Tests homeassistant.helpers module."""
# pylint: disable=invalid-n... | [
{
"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": true
},... | 3 | tests/helpers/test_init.py | dauden1184/home-assistant |
"""Added watchlist table
Revision ID: 573029c13b1a
Revises: 67e97402fd6b
Create Date: 2021-01-12 01:01:34.967150
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '573029c13b1a'
down_revision = '67e97402fd6b'
branch_labels = None
depends_on = None
def upgrade()... | [
{
"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 | alembic/versions/573029c13b1a_added_watchlist_table.py | FlorianSW/hll_rcon_tool |
import unittest, os, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(3)
@classmethod
def tearDownClass(cls):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | py/testdir_multi_jvm/test_rf_stedo_fvec.py | gigliovale/h2o |
import datetime
import logging
import random
import time
from dbnd._core.task_build.dbnd_decorator import task
from dbnd._core.tracking.metrics import log_metric
logger = logging.getLogger(__name__)
@task
def dbnd_sanity_check(check_time=datetime.datetime.now(), fail_chance=0.0):
# type: (datetime.datetime, fl... | [
{
"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 | modules/dbnd/src/dbnd/tasks/basics/sanity.py | dmytrostriletskyi/dbnd |
import kivy
from functools import partial
kivy.require('2.0.0')
from kivymd.uix.imagelist import SmartTile
from constants import Screen
class CustomSmartTile(SmartTile):
def __init__(self, **kwargs):
super(CustomSmartTile, self).__init__(**kwargs)
self.height = '240dp'
self.size_hint_y = No... | [
{
"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 | src/libs/components/customsmarttile.py | loghinalexandru/blackboard-greenboard |
from abc import ABC, abstractmethod
from typing import Any, Dict, Tuple
import numpy as np
class BaseSplitter(ABC):
"""Base class for performing splits."""
@abstractmethod
def _split(self,
dataset: np.ndarray,
frac_train: float = 0.75,
frac_valid: float = 0.1... | [
{
"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 | profit/dataset/splitters/base_splitter.py | ayushkarnawat/profit |
import os.path
from pythoscope.astbuilder import EmptyCode
from pythoscope.execution import Execution
from pythoscope.store import Project
from .helper import MemoryCodeTreesManager
class TestingProject(Project):
"""Project subclass useful during testing.
It contains handy creation methods, which can all b... | [
{
"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/testing_project.py | jmikedupont2/pythoscope |
# 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": "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 | aliyun-python-sdk-ess/aliyunsdkess/request/v20140828/DescribeNotificationConfigurationsRequest.py | LittleJober/aliyun-openapi-python-sdk |
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
@receiver(post_save, sender=User)
def create_profile(sender,instance,created,**kwargs):
if created:
Profile.objects.create(user=instance)
@receiver... | [
{
"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 | users/signals.py | cookie-shruti/IPL-fanstation |
"""empty message
Revision ID: 6bfa0312ba62
Revises: 5a782369bf8a
Create Date: 2021-05-10 14:49:32.300588
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '6bfa0312ba62'
down_revision = '5a782369bf8a'
branch_labels = None... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | backend/migrations/versions/6bfa0312ba62_.py | sartography/star-drive |
"""The Logitech Squeezebox integration."""
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .const import DISCOVERY_TASK, DOMAIN, PLAYER_DISCOVERY_UNSUB
_LOGGER = logging.getLogger(__name__)
PLATFORMS = [P... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | homeassistant/components/squeezebox/__init__.py | learn-home-automation/core |
#!/usr/bin/python
################################################################################
# 23145ca0-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"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 | pcat2py/class/23145ca0-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
import pandas as pd
import joblib
class Utils:
def load_from_csv(self, path):
return pd.read_csv(path)
def load_from_mysql(self):
pass
def features_target(self, df, drop_columns, target):
x = df.drop(drop_columns, axis=1)
y = df[target]
return x, y
def m... | [
{
"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 | production_project/utils.py | JLCaraveo/sklearn-projects-Platzi |
# Copyright 2014-2015 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
{
"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 | f5/bigip/ltm/rule.py | yuanfm/f5-common-python |
from mltemplate.ci.core import Stage
from mltemplate.ci.jobs import BumpVersionJob, PypiDeployJob, RunTestsJob, StyleCheckJob
class BumpVersionStage(Stage):
def __init__(self, name="bump-version", **kwargs):
super(BumpVersionStage, self).__init__(
name=name, jobs=[BumpVersionJob(stage=name, **... | [
{
"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 | mltemplate/ci/stages.py | vmarkovtsev/ml-repo-template |
'''
Quadcopter class for Nengo adaptive controller
Copyright (C) 2021 Xuan Choo, Simon D. Levy
MIT License
'''
import nengo
import gym
import numpy as np
from adaptive import run
class Copter:
def __init__(self, seed=None):
self.env = gym.make('gym_copter:Hover1D-v0')
self.reset(seed)
d... | [
{
"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 | nengo/copter.py | simondlevy/gym-copter |
import json
from pathlib import Path
def expand_dest_dir(dest):
return Path(dest).expanduser() if dest else Path.cwd()
def stringify_metadata(metadata):
return json.dumps(metadata, indent=2, sort_keys=True, ensure_ascii=False)
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | locdown/action/common.py | SpencerMichaels/locdown |
import re
from dataclasses import dataclass
from logging import getLogger
from typing import List
logger = getLogger('M3U')
@dataclass
class M3UMedia:
title: str
tvg_name: str
tvg_ID: str
tvg_logo: str
tvg_group: str
link: str
class M3UParser:
"""Mod from https://github.com/Timmy93/M3uP... | [
{
"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 | api/utils/m3u.py | StoneMoe/Anime-API |
# -*- coding: utf-8 -*-
import pytest
@pytest.fixture
def solution():
from leetcode.letter_combinations_of_a_phone_number import Solution
return Solution()
@pytest.mark.parametrize(
'x,expected',
[
('23', ['ad', 'ae', 'af', 'bd', 'be', 'bf', 'cd', 'ce', 'cf']),
('', []),
('2'... | [
{
"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 | tests/test_letter_combinations_of_a_phone_number.py | dantin/leetcode-py |
from __future__ import print_function
import numpy as np
class BaseModel(object):
"""
base dictionary learning model for classification
"""
# def __init__(self)
def predict(self, data):
raise NotImplementedError
def evaluate(self, data, label):
pred = self.predict(data)
... | [
{
"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 | dictol/base.py | ksasi/DICTOL_python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.