source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.contrib.syndication.views import Feed
from blogg.models import Post
class LatestPosts(Feed):
title = "Blog"
link = "/rss/"
description = "Latest Posts"
def items(self):
return Post.objects.published()[:5]
def item_title(self, item):
return item.title
def item_des... | [
{
"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 | source/blogg/feed.py | ishahid/django-blogg |
import os
DEFAULT_ROOT = '/space1/zhaoqing/dataset/fsl'
datasets = {}
def dataset_register(name):
def decorator(cls):
datasets[name] = cls
return cls
return decorator
def make(dataset_name, dataset_args):
if dataset_args.get('root_path') is None:
dataset_args['root_path'] = os.... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | data/datasets/datasets.py | CharleyZhao123/graceful-few-shot |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 14:12:06 2021
@author: robertclay
This file is for parsing the understanding societies data over all waves into
a persistent data frame containing immutable person attributes for all
agents over all times and variable frames containing values t... | [
{
"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 | minos/data_generation/US_full_data_parser.py | RobertClay/Paper1 |
load(":repositories.bzl", "closure_repos")
# NOTE: THE RULES IN THIS FILE ARE KEPT FOR BACKWARDS COMPATIBILITY ONLY.
# Please use the rules in repositories.bzl
def closure_proto_compile(**kwargs):
print("Import of rules in deps.bzl is deprecated, please use repositories.bzl")
closure_repos(**kwargs)
de... | [
{
"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 | closure/deps.bzl | kalbasit/rules_proto_grpc |
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
from typing import Dict
import re
import string
from jina.hub.crafters.nlp.Sentencizer import Sentencizer
import pickle
# class Splitter(Sentencizer):
# count = 0
# separator = "|"
#
# def __init__(self,... | [
{
"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 | search_engine/pods/splitter.py | Alea4jacta6est/transformers-for-lawyers |
import igibson
from igibson.envs.igibson_env import iGibsonEnv
from time import time
import os
from igibson.utils.assets_utils import download_assets, download_demo_data
from igibson.utils.motion_planning_wrapper import MotionPlanningWrapper
import numpy as np
import matplotlib.pyplot as plt
def test_occupancy_grid():... | [
{
"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 | igibson/test/test_motion_planning.py | fxia22/gibson_demos |
from flask import Flask, render_template, request, session
from db import *
from otp_mail import *
app = Flask(__name__)
app.secret_key = 'a really secret super key has been set'
app.config['SESSION_TYPE'] = 'memcache'
# homepage
@app.route('/')
def site():
return render_template("site.html")
# login page
@app... | [
{
"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 | app.py | ArragonElessar/devsoc-hack |
from .message_type import MessageType
class BaseMessage(object):
def __init__(self, message_type):
self.type = MessageType(message_type)
class BaseHeadersMessage(BaseMessage):
"""
All messages expct ping can carry aditional headers
"""
def __init__(self, message_type, headers):
... | [
{
"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 | signalrcore/messages/base_message.py | smiddle/signalrcore |
"""
EVE tests
"""
from __future__ import absolute_import
#pylint: disable=C0103,R0904,W0201,W0232,E1103
import sunpy
from sunpy.data.test import (EVE_AVERAGES_CSV)
class TestEve:
"""Tests the EVE class"""
def setup_class(self):
pass
def teardown_class(self):
pass
def test_csv... | [
{
"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 | sunpy/tests/lightcurve/test_eve.py | astrofrog/sunpy |
import unittest
from glob import glob
import pycodestyle
from pylint import epylint as lint
class LintError(Exception):
pass
class TestCodeLinting(unittest.TestCase):
# pylint: disable=no-self-use
def test_pylint(self):
(stdout, _) = lint.py_run('megaphone', return_std=True)
errors = 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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | megaphone/test/test_linting.py | theatlantic/megaphone |
from twisted.logger import Logger
from autobahn.twisted.wamp import ApplicationSession
class MySession(ApplicationSession):
log = Logger()
def __init__(self, config):
a = 1 / 0
self.log.info("MySession.__init__()")
ApplicationSession.__init__(self, config)
def onJoin(self, detail... | [
{
"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 | containers/failures/router/failure3/myapp.py | haizaar/crossbar-examples |
import numpy as np
from .config import cfg
pure_python_nms = False
try:
from lib.utils.gpu_nms import gpu_nms
from ..utils.cython_nms import nms as cython_nms
except ImportError:
pure_python_nms = True
def nms(dets, thresh):
if dets.shape[0] == 0:
return []
if pure_python_nms:... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | api/lib/fast_rcnn/nms_wrapper.py | Praneet9/Docify |
#!/usr/bin/env python3
# Copyright (C) Alibaba Group Holding Limited.
""" Timer class. """
from time import perf_counter
from typing import Optional
class Timer:
"""
A timer which computes the time elapsed since the start/reset of the timer.
"""
def __init__(self) -> None:
s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | papers/pytorch-video-understanding/utils/timer.py | jiangzeyinzi/EssentialMC2 |
from .base import BaseManipulator
from . import ByUserManipulator, ByDateManipulator, ByExtensionManipulator, ByDirectoryManipulator, BySizeManipulator
class ManipulatorCollection:
"""
This class is used to instantiate all the manipulators
"""
def __init__(self, **kwargs):
# Forbid passing ... | [
{
"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 | files_to_dataframe/ftd/manipulators/collection.py | LilianBoulard/utils |
from __future__ import unicode_literals
from moto.core.exceptions import RESTError
class RepositoryNotFoundException(RESTError):
code = 400
def __init__(self, repository_name, registry_id):
super(RepositoryNotFoundException, self).__init__(
error_type="RepositoryNotFoundException",
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | moto/ecr/exceptions.py | alexsult/moto |
#!/usr/bin/env python
import explorerhat
from time import sleep
from random import randint
#the explorer hat has already some motor functions build in
#invert() - Reverses the direction of forwards for this motor
#forwards( speed ) - Turns the motor "forwards" at speed ( default 100% )
#backwards( speed ) - Turns 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 | test.py | omardude/therover |
'''
Author: Liu Xin
Date: 2021-11-21 18:10:58
LastEditors: Liu Xin
LastEditTime: 2021-11-21 21:38:30
Description: file content
FilePath: /CVMI_Sementic_Segmentation/utils/runner/optimizer/builder.py
'''
import copy
import inspect
import torch
from utils.registry import Registry, build
OPTIMIZERS = Registry('optimizer'... | [
{
"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 | utils/runner/optimizer/builder.py | UESTC-Liuxin/CVMI_Sementic_Segmentation |
def get(mist_session, org_id):
uri = "/api/v1/orgs/%s" % org_id
resp = mist_session.mist_get(uri, org_id=org_id)
return resp
def create(mist_session, org_id, org_settings):
uri = "/api/v1/orgs/%s" % org_id
body = org_settings
resp = mist_session.mist_post(uri, org_id=org_id, body=body)
retu... | [
{
"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 | mlib/requests/orgs/info.py | tmunzer/Mist_library |
"""
this script was designed to initialize the graph G
and the rest of the demo is in an interactive ipython stint
ie i just
%run example.py
this also loads some functions for manipulating G
as well as the coloring of G returned by networkx
so that I wouldn't have to come up with these routines on the spot
"""
impo... | [
{
"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 | assets/codes/dsatur/example.py | kkly1995/algorithms |
def iter_ngram(seq, max_order, min_order=None, sent_start=None, sent_end=None):
if min_order > max_order:
raise ValueError("min_order > max_order (%d > %d)" % (min_order, max_order))
if min_order is None:
min_order = max_order
orders = range(min_order, max_order+1)
it = iter(seq)
... | [
{
"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": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 l... | 3 | kitchen/utils.py | honzas83/kitchen |
import time as t
def MainLoop(func):
def wrapper():
while True:
t.sleep(0.01)
func()
return wrapper | [
{
"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 | engine/mainloop.py | LBartolini/MazeSolver |
def powe(base, exp):
if exp == 0:
return 1
else:
return base ** exp
print(powe(10, 2))
# now recursive:
def pow(base, exp):
if exp == 0:
return 1
else:
return base * pow(base, exp - 1)
print(pow(10, 3))
| [
{
"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 | simple_exercises/lanesexercises/py_recursions/rec_ex_from_slides/sli14.py | ilante/programming_immanuela_englander |
from django.core.management.base import BaseCommand
from django.contrib.admin.models import LogEntry
def clear_old_admin_logs():
logs = LogEntry.objects.all()
for i in range(2000, len(logs)):
logs[i].delete()
class Command(BaseCommand):
def handle(self, *args, **options):
clear_old_admi... | [
{
"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 | courier/management/commands/clear_old_admin_logs.py | HelloMelanieC/FiveUp |
from machinetranslation import translator
from flask import Flask, render_template, request
import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def englishToFrench():
textToTranslate = request.args.get('textToTranslate')
return translator.englishToFrench(textToTranslate)
@app.route("/fre... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | final_project/server.py | jalsop24/xzceb-flask_eng_fr |
from typing import Tuple
from hypothesis import given
from robust.linear import (Segment,
SegmentsRelationship,
segments_relationship)
from tests.utils import (reflect_segment,
reverse_segment)
from . import strategies
@given(strategies.... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | tests/linear_tests/test_segments_relationship.py | lycantropos/robust |
# -*- coding: utf-8 -*-
"""
tests.test_model
~~~~~~~~~~~~~~~~
Tests the models provided by the updown rating app
:copyright: 2016, weluse (https://weluse.de)
:author: 2016, Daniel Banck <dbanck@weluse.de>
:license: BSD, see LICENSE for more details.
"""
from __future__ import unicode_literals
import random
from djan... | [
{
"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 | tests/test_model.py | agusmakmun/django-updown-ratings |
import praw
class RedditRelevancyChecker:
""" Class containing all reddit related methods."""
def __init__(self, system, time='month', client_id='JWw9vCj6-fEBfQ'):
self.reddit = praw.Reddit(client_id=client_id,
client_secret=None,
us... | [
{
"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 | reddit_functions.py | rishooty/vrec-dat-filter |
from __future__ import print_function
import datetime
import hashlib
import logging
from abc import ABCMeta
from halo_flask.classes import AbsBaseClass
from halo_flask.logs import log_json
from halo_flask.const import SYSTEMChoice,LOGChoice
from .settingsx import settingsx
settings = settingsx()
logger = logging.... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | halo_flask/models.py | yoramk2/halo_flask |
"""
Copyright (2018) Chris Scuderi
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 writing, softwar... | [
{
"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 | alarm_central_station_receiver/singleton.py | alexp789/alarm-central-station-receiver |
from api.interests.models import Interest
from api.projects.models import Project, ProjectApplication
from api.users.models import User
def test_user(email="test@example.com", is_supervisor=False, interests=None):
user, created = User.objects.get_or_create(
email=email,
first_name="Test",
... | [
{
"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 | api/tests/conftest.py | sorinburghiu2323/Supervisio |
"""Main file tests"""
from typing import Final
from unittest.mock import patch, MagicMock, call
class TestHello:
"""hello function Tests"""
class TestNominalCase:
@patch('hellopymsdl.service.MessageService.MessageService')
@patch('builtins.print')
def test_call_hello__should__print_m... | [
{
"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 | src/test/python/hellopymsdl_test/test__main__.py | St4rG00se/pymsdl_template |
import os
from flask import Flask, request, jsonify
app = Flask(__name__)
FLASK_PORT = int(os.environ.get('FLASK_PORT', 8080))
@app.route("/healthz", methods=['GET'])
def health():
return jsonify({"status": True, "success": True, "msg": "I am Alive!", "cloud": None})
@app.route('/', defaults={'path': ''})
@app... | [
{
"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 | pkg/api.py | christus02/citrix-cloud-controller |
from .element_set import BaseElementSet
from .feature import Feature
class FeatureSet(BaseElementSet):
'''
A `FeatureSet` is a collection of unique `Feature` instances
and is typically used as a metadata data structure attached to some "real"
data. For instance, given a matrix of gene expressions, the... | [
{
"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 | mev/api/data_structures/feature_set.py | hsph-qbrc/mev-backend |
import tensorflow as tf
class BaseTrain:
def __init__(self, sess, model, data, config, logger):
self.model = model
self.logger = logger
self.config = config
self.sess = sess
self.data = data
self.init = tf.group(tf.global_variables_initializer(), tf.local_variables_... | [
{
"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 | base/base_train.py | AndersDHenriksen/Tensorflow-Project-Template |
#
# Copyright (c) European Synchrotron Radiation Facility (ESRF)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy,... | [
{
"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 | edna2/tasks/test/DozorTask/ControlDozor_plot_exec_test.py | gsantoni/edna2 |
class Error(Exception):
'''Base Error.'''
def __init__(self):
self.error = 'Fatal error occured.'
super().__init__(self.error)
class ArgError(Error):
'''Argument Error.'''
def __init__(self):
self.error = 'Incorrect argument passed.'
super().__init__(self.error)
class MissingArg(ArgError):
'''Argument ... | [
{
"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 | cocasync/errors.py | cree-py/cocasync |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
fig, ax = plt.subplots()
plt.subplots_adjust(left=0.25, bottom=0.25)
t = np.arange(0.0, 1.0, 0.001)
a0 = 5
f0 = 3
delta_f = 5.0
s = a0 * np.sin(2 * np.pi * f0 * t)
l, = plt.plot(t, s, lw=2)
ax.margins(x=0)
a... | [
{
"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 | ctsutils/mpl_slider.py | 534ttl3/ctsutils |
from time import sleep
from picamera import PiCamera
class CameraService:
__instance = None
@staticmethod
def getInstance():
if CameraService.__instance == None:
CameraService()
return CameraService.__instance
def __init__(self):
self.camera = PiCamera()
C... | [
{
"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 | camera_service.py | viorelspinu/teddy-vision |
import yaml
import numpy as np
import tensorflow as tf
from absl import logging
def set_memory_growth():
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.conf... | [
{
"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 | modules/utils.py | 2005606/arcface-tf2-new |
from time import sleep
import csv
import re
import sys
import requests
from bs4 import BeautifulSoup
def scrape(num_players):
url = "https://osu.ppy.sh/p/pp/"
players = {}
# Handle invalid input
if num_players%50 != 0:
print("num_players must be divisible by 50")
return None
max... | [
{
"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 | scrape_players.py | N-lson/osu-top-modstats |
import pytest
import linearmodels
def test_runner():
status = linearmodels.test(
location="tests/shared/test_typed_getters.py", exit=False
)
assert status == 0
def test_runner_exception():
with pytest.raises(RuntimeError):
linearmodels.test(location="tests/shared/unknown_test_file.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 | linearmodels/tests/test_tester.py | clarityai-eng/linearmodels |
import torch.nn as nn
class VfExtractor(nn.Module):
def __init__(self, in_channels=1):
super(VfExtractor, self).__init__()
self.conv1 = nn.Conv2d(in_channels, 120, kernel_size=(3, 3), padding=(1, 1))
self.relu1 = nn.ReLU(inplace=True)
self.conv2 = nn.Conv2d(120, 120, kernel_size=(... | [
{
"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 | src/lib/extractor/vf_extractor.py | dpsong/test |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from yoti_python_sdk.doc_scan.constants import ID_DOCUMENT_COMPARISON
from yoti_python_sdk.utils import YotiSerializable
from .requested_check import RequestedCheck
class RequestedIDDocumentComparisonCheckConfig(YotiSerializable):
"""
The config... | [
{
"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 | yoti_python_sdk/doc_scan/session/create/check/document_comparison.py | getyoti/python |
from archivekit.collection import Collection # noqa
from archivekit.archive import Archive # noqa
from archivekit.resource import Resource # noqa
from archivekit.types.source import Source # noqa
from archivekit.ext import get_stores
def _open_store(store_type, **kwargs):
store_cls = get_stores().get(store_type)... | [
{
"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 | archivekit/__init__.py | rlugojr/archivekit |
# modify : print input
# get square sum
def square_sum(a,b):
print('input:',a,b)
return a**2+b**2
# get square diff
def square_diff(a,b):
print('input:',a,b)
return a**2-b**2
print(square_sum(3,4))
print(square_diff(3,4))
| [
{
"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 | Vamei/decorator/decorator2.py | YangPhy/learnPython |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/openapi3/client/petstore/python-experimental/test/test_composed_bool.py | LeComptoirDesPharmacies/openapi-generator |
from django.shortcuts import render, redirect
from .form import UserRegister, UserUpdate, ProfileUpdate
from django.contrib import messages
from django.contrib.auth.views import LoginView
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
# Create your views here.
d... | [
{
"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 | users/views.py | NiteshBabu/Buzz-Feed |
import unittest
from tests import TestClient
from procountor.client import Client
class TestClientClient(TestClient):
def __init__(self, *args, **kwargs):
super(TestClientClient, self).__init__(*args, **kwargs)
def test_0001_init(self):
""" Testing that client has required params """
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_000_client_core.py | vilkasgroup/Procountor |
from flask import request
from flask_restful import Resource
from helpers.decorator import validate_schema, permission_required
from managers.auth import auth
from managers.document_managers import DocumentManaagers
from models import UserType
from schemas.request.doc_request import DocRequest
class DocumentResourse... | [
{
"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 | resources/document_resourse.py | borko81/parking_system_with_flask |
from datetime import timedelta
from feaflow.airflow_config import AirflowSchedulerConfig, OperatorDefaultArgs
from feaflow.compute.sql import SqlCompute
from feaflow.job import Job
from feaflow.sink.table import TableSink
from feaflow.source.query import QuerySource
from feaflow.utils import deep_merge_models
def te... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | tests/test_job.py | baineng/feaflow |
from .valueType import ValueType, ValueSubType
class State:
def __init__(self, name, ise_id, datapoints):
self.name = name
self.ise_id = ise_id
self.datapoints = datapoints
def __str__(self):
return self.tostring()
def get_name(self):
return self.name
def get... | [
{
"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 | hm/state.py | debauer/HomematicToInflux |
"""APIs for working with Kubernetes deployments."""
from datetime import datetime, timezone
from kubernetes_asyncio import client
from kubernetes_asyncio.client.api_client import ApiClient
from kubernetes_asyncio.client.models import V1DeploymentList
async def restart_deployment(deployment: str, namespace: str) -> N... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | arthur/apis/kubernetes/deployments.py | doublevcodes/king-arthur |
#!/usr/bin/python3
class Evaluator:
def __init__(self, lexer):
self.__lexer = lexer
def evaluate(self, line):
return int(next(self.__lexer.tokenize(line)).raw_value)
class REPL:
def __init__(self, read, print, evaluate):
self.__read = read
self.__eval = evaluate
sel... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/repl.py | PolyglotSymposium/mm-i |
import time
def measure_target():
time.sleep(5)
return
def measure_elapsed_time(f, *args):
time1 = time.perf_counter()
obj_return = f(*args)
time2 = time.perf_counter()
print('{:s} took {:.9f} ms to run'.format(f.__name__, (time2-time1)*1e3 ))
# print( obj_return )
return obj_return... | [
{
"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 | library/measure_time_performance.py | brianchiang-tw/Python |
#!/usr/bin/env python3
"""
Author : Me <me@foo.com>
Date : today
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Rock the Casbah',
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | template/template.py | frank-gear/tiny_python_projects |
from akhet.urlgenerator import URLGenerator
import pyramid.threadlocal as threadlocal
from pyramid.exceptions import ConfigurationError
from .lib import helpers
def includeme(config):
"""Configure all application-specific subscribers."""
config.add_subscriber(create_url_generator, "pyramid.events.ContextFound... | [
{
"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 | akhet/demo/subscribers.py | Pylons/akhet |
import os
import molgrid
import pytest
import torch
def pytest_addoption(parser):
# Allows user to force tests to run on the CPU (useful to get performance on CI)
parser.addoption(
"--nogpu",
action="store_false",
help="Force tests to run on CPU",
)
@pytest.fixture(scope="sessio... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/conftest.py | RMeli/gnina-torch |
#!/usr/bin/env python
import dateutils
def quartiles(values):
"""
Returns the (rough) quintlines of a series of values. This is not intended
to be statistically correct - it's not a quick 'n' dirty measure.
"""
return [i * max(values) / 4 for i in range(5)]
def longest_streak(dates):
"""
... | [
{
"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 | contributions/statistics.py | t170815518/contributions-graph |
import time
class Loggable:
def log(self, msg):
print(str(time.ctime()) + ": " + str(msg))
class LoggableList(list, Loggable):
def append(self, x):
self.log(x)
list.append(self, x)
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},... | 3 | python basics and applications/1/1-6/1-6-3.py | DzmitrySakalenka/stepik_courses |
# -*- encoding: utf-8 -*-
from .. import db
class EMI_Information(db.Model):
__tablename__ = "EMI_Information"
EMI_Identifier = db.Column(db.String(45),primary_key = True, nullable = False)
ItemName = db.Column(db.String(45), nullable = False)
ProductPrice = db.Column(db.Float, nullable = False)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | app/main/models/EMI.py | pOrgz-dev/financial-api |
# Copyright 2019 The Blueqat Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_toqasm.py | minatoyuichiro/Blueqat |
from pyopteryx.factories.loop_action_factories.abstract_loop_action_factory import AbstractLoopActionFactory
from pyopteryx.utils.builder_utils import add_activity_to_task, add_reply_entry
class StopLoopActionFactory(AbstractLoopActionFactory):
def __init__(self, action, xml_cache, input_data, processor, mapping_... | [
{
"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 | pyopteryx/factories/loop_action_factories/stop_action_factory.py | DanielZim/PyOpteryx |
from theseus.registry import Registry
def get_instance(config, registry: Registry, **kwargs):
# ref https://github.com/vltanh/torchan/blob/master/torchan/utils/getter.py
assert "name" in config
config.setdefault("args", {})
if config.get("args", None) is None:
config["args"] = {}
return r... | [
{
"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 | theseus/utilities/getter.py | lannguyen0910/food-recognition-baseline |
def average_above_zero(tab):
"""
brief: computes the average of the lists
Args:
tab: a list of numeric values, expects at least one positive values
Return:
the computed average
Raises:
ValueError if no positive value is found
"""
if not(isinstance(tab, list)):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | s1_algotools.py | parafeu/USMB-Public |
from enum import Enum
EVENT_KEY_UP=0
EVENT_BUTTON_PLAY=0
EVENT_KEY_DOWN=1
## no down button equivalent on speaker
EVENT_KEY_LEFT=2
EVENT_BUTTON_PREV=2
EVENT_KEY_RIGHT=3
EVENT_BUTTON_NEXT=3
EVENT_KEY_Q = 4
class EventEnum(Enum):
"""different events"""
NO_EVENT = 0
ALARM_INTERRUPT = 1
CONTINUE = 2
E... | [
{
"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 | client/src/event.py | tommccallum/smartbot |
import torch
###### BIAS GELU FUSION/ NO AUTOGRAD ################
# 1/sqrt(2*pi)-> 0.3989423
# 1/sqrt(2) -> 0.70710678
# sqrt(2/pi) -> 0.79788456
# this function is tanh approximation of gelu
# actual gelu is:
# x * 0.5 * (1.0 + torch.erf(x * 0.70710678))
@torch.jit.script
def bias_gelu(bias, y):
x = bias + ... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | colossalai/kernel/jit/bias_gelu.py | RichardoLuo/ColossalAI |
import sys
import os
import click
from subprocess import call
PROJECT_PATH = click.Path(exists=True, file_okay=False, dir_okay=True, resolve_path=True)
COOKIECUTTER_DIR = 'mesa/cookiecutter-mesa'
SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
COOKIECUTTER_PATH = os.path.join(os.path.dirname(SCRIPTS_DIR),
... | [
{
"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 | mesa/main.py | fire-suppression-abm/mesa |
import numpy as np
from PyQt5.QtCore import (QAbstractTableModel, QModelIndex, QObject, Qt,
QVariant, pyqtProperty, pyqtSignal, pyqtSlot)
from ..hub import Hub, Message
class PlotDataModel(QAbstractTableModel):
# DataRole = Qt.UserRole + 1
def __init__(self, *args, **kwargs):
... | [
{
"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 | qt_client/components/plot_data_model.py | cosmoscope/qt-client |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.4
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_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 | kubernetes/test/test_v1beta2_rolling_update_daemon_set.py | Prahladk09/python-1 |
# Copyright 2019 Wilhelm Putz
# 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 writing, s... | [
{
"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 | jinjamator/plugins/content/json.py | jinjamator/jinjamator |
import multiprocessing
import time
import pytest
from jina import Client, Document, Executor, Flow, requests
class SlowExecutor(Executor):
@requests
def foo(self, *args, **kwargs):
time.sleep(0.2)
def _test_error(flow_kwargs, add_kwargs, error_port=None):
f = Flow(**flow_kwargs).add(**add_kwar... | [
{
"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 | tests/integration/gateway_clients/test_executor_timeout_failures.py | sthagen/jina-ai-jina |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Mayo Clinic
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list... | [
{
"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 | examples/simple_example.py | hsolbrig/dirlistproc |
#
# Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
{
"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 | CodeAnalysis/SourceMeter_Interface/SourceMeter-8.2.0-x64-linux/Python/Demo/ceilometer/ceilometer/tests/network/statistics/test_table.py | ishtjot/susereumutep |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_dj-prosftpd
------------
Tests for `dj-prosftpd` models module.
"""
from django.test import TestCase
from dj_prosftpd import models
class TestDj_prosftpd(TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDo... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | tests/test_models.py | devopsmakers/dj-prosftpd |
from .queue import get_dowonload_queue
from cone.tools import get_md5
class Request(dict):
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36'}
def __init__(self, url=None, callback=None, method='GET', headers=No... | [
{
"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 | cone/spider_ex/request.py | cone387/cone |
#-*- coding:utf-8 -*-
#所有encoder的基类
import copy
class Base(object):
def __init__(self, **kwargs):
pass
def embed_fun(self, text_id, name = 'base_embedding', **kwargs):
input_dict = {}
input_dict[name] = text_id
return input_dict
| [
{
"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 | embedding/embedding_base.py | zhufz/nlp_research |
from contextlib import ExitStack
import pytest
from plenum.test.helper import create_new_test_node
@pytest.fixture(scope="module")
def create_node_and_not_start(testNodeClass,
node_config_helper_class,
tconf,
tdir,
... | [
{
"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": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | plenum/test/view_change/test_start_view_change_ts_set.py | andkononykhin/indy-plenum-copy |
import numpy as np
import cv2
def rodrigues2matrix_cv(params):
rvec = np.array(params,dtype=np.float64)
rvec.shape = (1,3)
Rmat, jacobian = cv2.Rodrigues(rvec)
return Rmat
def rodrigues2matrix(params):
# Written after the docs at
# http://opencv.itseez.com/modules/calib3d/doc/camera_calibratio... | [
{
"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 | src/freemovr_engine/cvnumpy.py | strawlab/flyvr |
"""
Various utility functions.
"""
import numpy as np
import re
import subprocess
__all__ = ['rstate', 'SubprocessQuery', 'InteractiveQuery']
def rstate(rng=None):
"""
Return a RandomState object. This is just a simple wrapper such that if rng
is already an instance of RandomState it will be passed ... | [
{
"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 | pybo/utils.py | dreamflasher/pybo-python3 |
import random
import string
import grpc
import numpy as np
from pkg.api.python import api_pb2
from pkg.api.python import api_pb2_grpc
import logging
from logging import getLogger, StreamHandler, INFO, DEBUG
class NasrlService(api_pb2_grpc.SuggestionServicer):
def __init__(self, logger=None):
self.manage... | [
{
"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 | pkg/suggestion/nasrl_service.py | jayunit100/katib |
import os
import json
from redis import Redis
from normality import stringify
class Cache(object):
def get(self, key):
return None
def has(self, key):
return self.get(key) is not None
def store(self, key, value):
pass
class RedisCache(Cache):
EXPIRE = 84600 * 90
URL = o... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | enrich/followthemoney_enrich/cache.py | achievement008/followthemoney |
from flask import Flask, g
from proxypool.storages.redis import RedisClient
from proxypool.setting import API_HOST, API_PORT, API_THREADED, IS_DEV
__all__ = ['app']
app = Flask(__name__)
if IS_DEV:
app.debug = True
def get_conn():
"""
get redis client object
:return:
"""
if not hasattr(g, '... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | proxypool/processors/server.py | staugur/ProxyPool |
import timeit
mapx = 512
mapy = 512
# Good seeds:
# 772855 Spaced out continents
# 15213 Tight continents
# 1238 What I've been working with, for the most part
# 374539 Sparse continents
# 99999
seed = 773202
sea_level = 0.6
DEBUG = 0
GFXDEBUG = 0
setup_time = timeit.default_timer()
tiles = [[None] * mapx for _ in ... | [
{
"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 | ginit.py | ghlmtz/airline-sim |
from unittest import TestCase
from lf3py.api.errors import ApiError
from lf3py.api.render import ApiRender
from lf3py.api.response import Response
from lf3py.test.helper import data_provider
class TestRender(TestCase):
@data_provider([
(200, {'statusCode': 200, 'headers': {'Content-Type': 'application/js... | [
{
"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 | tests/unit/lf3py/api/test_render.py | rog-works/lambda-fw |
import kivy
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
# Size and position for testing
Window.size = (360, 640) # Size of Samsung s5
Window.left = 1500 # Right side of screen
Window.clearcolor = (.94, 1, 1, 1)
import changecolor # Change colo... | [
{
"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 | app.py | VSanteriH/Python-Kivy-template |
import subprocess
def test_run(app_connection, composition):
composition.run('run_test', 'true')
def test_run_timeout(app_connection, composition):
try:
composition.run('run_test', 'sleep', '5', timeout=1)
assert False
except subprocess.TimeoutExpired:
pass # Expected
| [
{
"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 | acceptance_tests/tests/tests/test_composition.py | arnaud-morvan/c2cwsgiutils |
from random import shuffle
from src.implementations.sorting.basic_sorts import insertion_sort
from src.implementations.helpers.partition import three_way_partition
def quicksort(arr: list) -> list:
"""Sorts arr in-place
by implementing https://en.wikipedia.org/wiki/Quicksort
"""
shuffle(arr) # shuff... | [
{
"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 | src/implementations/sorting/quicksort.py | wobedi/array-sort-and-search |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | [
{
"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 | python3/koans/about_decorating_with_functions.py | brianpaff1992/python_koans |
'''
Leetcode problem No 110 Balanced Binary Tree
'''
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def height(self, root):
if not root:
return 0
else:
return 1 + max(self.height(root.left), self.height(root.right))
def isBala... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | py/leetcode/BalanceTree.py | danyfang/SourceCode |
"""Podcast registration tests."""
from httplib import OK
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
class RegistrationTestCase(TestCase):
def setUp(self):
self.account_login_url = reverse('account_login')
self.regist... | [
{
"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 | fanscribed/apps/podcasts/tests/test_register.py | fanscribed/fanscribed |
class Text:
""" The Plot Text Text Template
"""
def __init__(self, text=""):
"""
Initializes the plot text Text
:param text: plot text text
:type text: str
"""
self.text = text
self.template = '\ttext = "{text}";\n'
def to_str(self):
"""
... | [
{
"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 | zmodulo/plot/text/text.py | aaruff/Z-Modulo |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def data_augmentation(image, is_training=None):
if is_training:
return preprocess_for_train(image)
else:
return preprocess_for_eval(image)
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | nets/preprocessing.py | zhyhan/spine-reports-gene |
import torch
import torch.nn as nn
import torchvision
__all__ = ["linear"]
class LinearHead(nn.Module):
def __init__(self, width, roi_spatial=7, num_classes=60, dropout=0.0, bias=False):
super().__init__()
self.roi_spatial = roi_spatial
self.roi_maxpool = nn.MaxPool2d(roi_spatial)
... | [
{
"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 | models/heads/linear.py | lucasmtz/ACAR-Net |
from rpython.rlib import jit
from . import pretty
class ImmutableEnv(object):
_immutable_fields_ = ['_w_slots[*]', '_prev']
def __init__(self, w_values, prev):
self._w_slots = w_values
self._prev = prev
@jit.unroll_safe
def at_depth(self, depth):
#depth = jit.promote(depth)
... | [
{
"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 | yasir/rt.py | overminder/YASIR |
"""
Module: 'json' on micropython-maixpy-0.6.2-66
"""
# MCU: {'ver': '0.6.2-66', 'build': '66', 'sysname': 'MaixPy', 'platform': 'MaixPy', 'version': '0.6.2', 'release': '0.6.2', 'port': 'MaixPy', 'family': 'micropython', 'name': 'micropython', 'machine': 'Sipeed_M1 with kendryte-k210', 'nodename': 'MaixPy'}
# Stubber:... | [
{
"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 | micropython-maixpy-0_6_2-66/stubs/json.py | mongonta0716/stub_for_maixpy |
# 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | kubernetes/test/test_v1_horizontal_pod_autoscaler.py | iguazio/python |
DIRECT = 'direct'
FANOUT = 'fanout'
TOPIC = 'topic'
HEADERS = 'headers'
class Blocking:
@staticmethod
def queue(queue_name, callback=None, exchange_name=None, routing_key=None, exchange_type=DIRECT, host='localhost',
port=None, prefetch_count=0, durable=False):
import pika
from p... | [
{
"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 | neurograph/utils/python/pika_utils.py | sleep3r/pyneurograph |
"""
Min Stack
-----
A LIFO abstract data type that serves as a collection of elements.
Supports retrieving the min from the stack in constant time.
"""
class MinStack(object):
def __init__(self):
"""
Attributes:
data (arr): data stored in the stack
minimum (arr): minimum values of data stored
"""
self... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | libalgs-py/data_structures/min_stack.py | tdudz/libalgs-py |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ...testing import assert_equal
from ..io import DataGrabber
def test_DataGrabber_inputs():
input_map = dict(base_directory=dict(),
ignore_exception=dict(nohash=True,
usedefault=True,
),
raise_on_empty=dict(usedefault=True,
),
sort_... | [
{
"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 | nipype/interfaces/tests/test_auto_DataGrabber.py | Conxz/nipype |
"""
Module: 'urandom' on esp32_LoBo 3.2.24
"""
# MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.24', version='ESP32_LoBo_v3.2.24 on 2018-09-06', machine='ESP32 board with ESP32')
# Stubber: 1.2.0
def choice():
pass
def getrandbits():
pass
def randint():
pass
def random():
pass
def r... | [
{
"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 | packages/esp32_LoBo/master/esp32_LoBo/stubs/urandom.py | TheVinhLuong102/micropy-stubs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.