source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import time
# decorator to time the function
def timer(func):
def wrapper(*args, **kwargs):
start = time.perf_counter()
result = func(*args, **kwargs)
end = time.perf_counter()
print(f'{func.__name__} took {end - start} seconds')
return result
return wrapper | [
{
"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 | timer.py | codePerfectPlus/Awesome-Coding-Problems |
import numpy as np
from sklearn.base import BaseEstimator
class MinMaxScaleCapper(object):
"""Min max scaler of a one dimensional array
This class min-max normalizes the scores returned from
Anomaly Detection algorithms. Please note sklearn's
MinMaxScaler does not wotk on 1D arrays
"""
def __... | [
{
"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 | task_templates/pipelines/python3_calibrated_anomaly_detection/anomaly_helpers.py | andreakropp/datarobot-user-models |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | hseng/contrib/sites/migrations/0003_set_site_domain_and_name.py | dark-codr/henroposki |
# Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Bio.SearchIO base classes for HMMER-related code."""
from anarci.Bio._py3k import _as_... | [
{
"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 | lib/python/anarci/Bio/SearchIO/HmmerIO/_base.py | Discngine/anarci |
# -*- coding: utf-8 -*-
'''
:file: app.py
:author: -Farmer
:url: https://blog.farmer233.top
:date: 2021/09/21 12:44:37
'''
import os
import click
from apiflask import APIFlask, abort
from app.config import config
from app.models import TodoList
from app.extensions import db, cors
from app.api.todo impor... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | app/app.py | Farmer-chong/todo-list |
from abc import abstractmethod
from abc import ABCMeta
import prettytensor as pt
import tensorflow as tf
class Model(metaclass=ABCMeta):
def __init__(self, inputs, labels):
self.inputs = inputs
self.labels = labels
self.model = self._make(inputs, labels)
self.softmax = self.model.softmax
self.lo... | [
{
"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 | common.py | jeffdshen/oneshotNN |
from __future__ import print_function
import click
from openelex.base.cache import StateCache
from .utils import default_state_options, print_files
@click.command(name="cache.files", help="List files in state cache diretory")
@default_state_options
def files(state, datefilter=''):
"""List files in state cache di... | [
{
"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 | openelex/tasks/cache.py | Mpopoma/oe-core |
from django.contrib import admin
from import_export.admin import ImportExportMixin
from post.models import Post, PostImage, PostLike
@admin.register(Post)
class PostAdmin(ImportExportMixin, admin.ModelAdmin):
filter_horizontal = ('showed_locates',)
@admin.register(PostImage, PostLike)
class PostImageAdmin(admi... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | app/post/admin.py | FinalProject-Team4/Server_DaangnMarket |
import argparse
import os
import subprocess
import sys
CGO1_SUFFIX='.cgo1.go'
def call(cmd, cwd, env=None):
# sys.stderr.write('{}\n'.format(' '.join(cmd)))
return subprocess.call(cmd, stdin=None, stderr=sys.stderr, stdout=sys.stdout, cwd=cwd, env=env)
def process_cgo1_go(source_root, prefix, src_path, ds... | [
{
"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 | build/scripts/cgo1_wrapper.py | blatr/catboost |
import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class EpisodeHopperEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
self.t = 0
self.r = 0
mujoco_env.MujocoEnv.__init__(self, 'hopper.xml', 4)
utils.EzPickle.__init__(self)
def step(se... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | rapid/mujoco_envs/episode_hopper.py | daochenzha/rapid |
def length_of_longest_substringi(string):
if not string:
return 0
char_map = {}
start = 0
max_sub = 0
for i, c in enumerate(string):
if c in char_map:
start = max(start, char_map[c] + 1)
else:
start = max(start, 0)
# start = max(start, char_... | [
{
"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 | leetcode/length_of_longest_substring.py | vrshah90/interview |
from Comparison import Comparison
from Action import Action
from TransitionCodegen import TransitionCodegen
from TransitionGraphic import TransitionGraphic
import xml.etree.ElementTree as ET
class Transition:
def __init__(self, id):
self.id = id
self.fromStateID = None
s... | [
{
"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 | Transition.py | gerth2/FSMMaker |
class Car:
def needFuel(self):
pass
def getEngineTemperature(self):
pass
def driveTo(self, destination):
pass | [
{
"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 | src/car.py | TestowanieAutomatyczneUG/laboratorium-9-Sienkowski99 |
from flask import Flask, jsonify, request
from pathlib import Path
app = Flask(__name__, static_url_path='')
@app.route('/')
def index():
return app.send_static_file("index.html")
@app.route('/api/experiments')
def get_experiments():
all_exps = (Path(__file__).parent / "static").glob("[0-9]*_*_1shot_*")
... | [
{
"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 | http/backend.py | Jarvis73/PEMP |
"""empty message
Revision ID: 34531bfd7cab
Revises: bb91fb332c36
Create Date: 2018-03-19 16:59:42.235474
"""
from alembic import op
import sqlalchemy as sa
from GeoHealthCheck.migrations import alembic_helpers
# revision identifiers, used by Alembic.
revision = '34531bfd7cab'
down_revision = 'bb91fb332c36'
branch_la... | [
{
"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 | GeoHealthCheck/migrations/versions/34531bfd7cab_.py | dersteppenwolf/GeoHealthCheck |
#!/usr/bin/env python
import numpy as np
import os
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
def load_date_series():
dirname = os.path.dirname(os.path.realpath(__file__))
return pd.read_csv(dirname + '/data/shampoo.csv', header=0, parse_dates=[0], index_col=0, squeeze=True)
def split... | [
{
"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 | python/shampoo_sales/dataset.py | JBris/time_series_anomaly_detection_examples |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
{
"point_num": 1,
"id": "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 | tempest/api/compute/limits/test_absolute_limits_negative.py | pcaruana/tempest |
from django.contrib.auth.models import User
from django import forms
import re
class RegistrationForm(forms.Form):
first_name = forms.CharField(
label='Enter Your First Name',
widget=forms.TextInput(
attrs={
'class': 'form-control',
'placeholder': 'Your ... | [
{
"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 | Registration/signup application/forms.py | sivanagarajumolabanti/RegistrationApp |
import os
import sys
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../")))
import traceback
import v2.utils.utils as utils
SSL_CERT_PATH = "/etc/ceph/"
PEM_FILE_NAME = "server.pem"
PEM_FILE_PATH = os.path.join(SSL_CERT_PATH, PEM_FILE_NAME)
import logging
log = logging.getLogger()
def create_pem()... | [
{
"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 | rgw/v2/lib/pem.py | viduship/ceph-qe-scripts |
import json
from flask import Blueprint, request, session
from google.appengine.api import search
from car.model import Car
cars = Blueprint('cars', __name__)
@cars.route('/', methods=['GET'])
def get_all():
cars = [u.to_dict() for u in Car.query().fetch()]
return json.dumps(cars)
@cars.route('/<int:car_id>... | [
{
"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/car/controller.py | jeffersonvenancio/therightpark |
num1 = input('Ingrese el numero 1 ')
num2 = input('Ingrese el numero 2 ')
num3 = input('Ingrese el numero 3 ')
def multiplicacion(num1,num2,num3):
resultado = num1 * num2
if(num3 > num1):
print('El numero %s es mayor a %s' %(num3,num1))
elif(num3 < num1):
print('El numero %s es men... | [
{
"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 | trabajos_entregas/parcial/pablo_b.py | AgustinParmisano/tecnicatura_analisis_sistemas |
# Adding parent directory to the PYTHONPATH
import sys
sys.path.insert(0,'..')
import numpy as np
from utils.GlobalVariables import *
class EMA_FT(object):
# Base class for all of the feature transformers
def __init__(self):
super(EMA_FT, self).__init__()
def transform(self, df, features):
# it construct a set... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | indicators_transformer/EMA_FT.py | vd1371/gram |
import unittest
from User import User
class TestUser(unittest.TestCase):
def setUp(self):
self.new_user = User("John","Paul")
def tearDown(self):
'''
clean up after each test to prevent errors
'''
User.userList = []
#2nd test
def test__init(self):
... | [
{
"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 | user-test.py | obewas/PasswordLocker |
# 10001st prime
# Problem 7
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
# we can see that the 6th prime is 13.
# What is the 10 001st prime number?
# as of solving this challenge the largest prime number known is 24,862,048
def is_prime(n):
i = 2
while i*i <= n:
if n % i == 0:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | p007.py | pbgnz/project-euler |
#!/usr/bin/python3
def lowestPositiveInt(A):
A.sort()
index = -1
try:
index = A.index(1)
except ValueError:
return 1
# Remove all negatives and zero if 1 is found
# if index >= 0:
A = A[index:]
length = len(A)
i = 1
found = 0
while i ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | codingTestIterative.py | gustavoromerobenitez/python-playground |
# -*- coding: utf-8 -*-
# Copyright (C)2014 DKRZ GmbH
"""Recipe r"""
import os
from mako.template import Template
from birdhousebuilder.recipe import conda
r_install_script = Template(
"""
% for pkg in pkg_list:
install.packages("${pkg}", dependencies = TRUE, repo="${repo}")
% endfor
"""
)
def install_pkgs(pkgs, r... | [
{
"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 | birdhousebuilder/recipe/r/__init__.py | bird-house/birdhousebuilder.recipe.r |
from threading import Thread
from flask import render_template
from flask_mail import Message
from app import mail, app
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, re... | [
{
"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 | src/flask_mega_tutorial/microblog/app/email.py | sfortson/random-scripts |
from datetime import datetime
import sys
import os
import re
from pathlib import Path
import urllib.request
SHUTDOWN_EVENT = "Shutdown initiated"
this_file = Path(__file__).resolve()
app_path = this_file.parent
sys.path.insert(0, str(app_path))
# prep: read in the logfile
logfile = app_path / "tmp" / "log.txt"
urll... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | days/01-03-datetimes/Bite_7_Day_2/logtimes.py | edotgilmore/100-days-of-code-course |
import discord
client = discord.Client()
@client.event
async def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
if message.content.startswith('!hello'):
msg = 'Hello {0.author.mention}'.format(message)
await cl... | [
{
"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 | examples/reply.py | AllenPlayz/discord.py |
from typing import Sequence, Union
import numpy as np
from scipy.ndimage.interpolation import rotate as np_rotate
from PIL.Image import Image
from torch import Tensor, tensor
from torchvision.transforms.functional import rotate
class ImageRotation(object):
def __init__(self, degree):
self.degree = degree... | [
{
"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 | continual_learning/scenarios/utils.py | jaryP/ContinualAI |
class SpacingRenderMixin:
def render(self, context, instance, placeholder):
if not instance.space_device or instance.space_device == "xs":
instance.add_classes(
f"{instance.space_property}{instance.space_sides}-{instance.space_size}"
)
else:
instan... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | djangocms_frontend/contrib/utilities/frameworks/bootstrap5.py | fsbraun/djangocms-bootstrap5 |
import numpy as np
#############################################
# variable #
#############################################
val = False
x = 0
y = 0
#############################################
# function #
############################################... | [
{
"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 | util/my_util.py | RegentLee/master_research |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from aluno_app import facade
from routes.alunos import adm... | [
{
"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 | backend/appengine/routes/alunos/admin/new.py | SamaraCardoso27/eMakeup |
import json
import flask
import datetime
from ruddock.resources import Permissions
from ruddock.decorators import login_required
from ruddock.modules.birthdays import blueprint, helpers
@blueprint.route('/')
@login_required(Permissions.BIRTHDAYS)
def show_bdays():
"""Displays a list of birthdays for current studen... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | ruddock/modules/birthdays/routes.py | calebsander/RuddockWebsite |
class Person:
def __init__(self,fname,lname):
self.fname=fname
self.lname=lname
self.name=self.fname+self.lname
class Student(Person):
def __init__(self,fname,lname,RollNO):#We can add properties in child class like this.
#Using __init__ inside child will disable the inheri... | [
{
"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 | inheritance3.py | Nischal47/Python-basics |
# Diophantine equation
import numpy as np
from fractions import Fraction
LIMIT = 1000
def solve():
def minimal_solution(D):
if np.sqrt(D) % 1 == 0:
return 0
a0 = int(np.floor(np.sqrt(D)))
a = a0
m = 0
d = 1
n = Fraction(0, 1)
denominators = [... | [
{
"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 | python/p066.py | wephy/project-euler |
from django.test import TestCase
from .models import Profile
import datetime as dt
from django.contrib.auth.models import User
# Create your tests here.
class ProfileTestClass(TestCase):
# Set up method
def setUp(self):
# Creating a new location and saving it
self.new_user= User(username='den... | [
{
"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 | users/tests.py | D-Kamunya/instagram-clone |
import math
class Robo:
def __init__(self,nome):
self.__nome = nome
self.__posicao = [0.0,0.0]
self.__em_op = False
@property
def nome(self):
return self.__nome
@nome.setter
def nome(self, alterar_nome):
self.__nome = alterar_nome
@property
def... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | prova1/prova1.py | samcost/POO |
import pytest
from flask import g, session
from flaskr.db import get_db
def test_register(client, app):
assert client.get('/auth/register').status_code == 200
response = client.post(
'/auth/register', data = {'username': 'a', 'password': 'a'}
)
assert 'http://localhost/auth/login' == response.h... | [
{
"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 | tests/test_auth.py | XelK/blog |
"""Provide file operator functions."""
# Import built-in modules
import codecs
import json
# Import third-party modules
import yaml
def read_yaml(file_path):
"""Read a YAML file by the given path.
Args:
file_path (str): The absolute path of the YAML file.
Returns:
dict: The data spec_r... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | rayvision_api/file_operator.py | renderbus/rayvision_api |
"""Test the Pip version."""
from pathlib import Path
import pytest
from universions import Version
from universions.pip import get_pip_version
from .mock_popen import BasicMockedPopen
PIP_19_3_1 = b"pip 19.3.1 from /path/python3.7/site-packages/pip (python 3.7)"
PIP_10_0_0B2 = b"pip 10.0.0b2 from /path/lib/python2... | [
{
"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 | test/test_pip_version.py | Kineolyan/universions |
"""
Component logic
"""
from bluecat.util import get_password_from_file
from ..cmdb_configuration import cmdb_config
import requests
def raw_table_data(*args, **kwargs):
# pylint: disable=redefined-outer-name
data = {'columns': [{'title': 'Name'},
{'title': 'IP Address'},
... | [
{
"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 | Community/ServiceNow CMDB/cmdb_switches/cmdb_switches_logic.py | spenney-bc/gateway-workflows |
import telebot
from telebot.apihelper import ApiTelegramException
from blackbox.handlers.notifiers._base import BlackboxNotifier
from blackbox.utils.logger import log
STRING_LIMIT = 2000 # Limit output
CHECKMARK_EMOJI = "\U00002705" # ✔
FAIL_EMOJI = "\U0000274C" # ❌
WARNING_EMOJI = "\U000026A0" # ⚠
clas... | [
{
"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 | blackbox/handlers/notifiers/telegram.py | rabibh/blackbox |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | kubernetes/test/test_apps_v1beta1_deployment_list.py | dix000p/kubernetes-client-python |
class Gender:
NEUTRAL = 1
FEMALE = 2
MALE = 3
GENDER_STRINGS = {NEUTRAL: "neutral",
FEMALE: "female",
MALE: "male"
}
def __init__(self, gender: int = 1):
self.gender: int = gender
def __str__(self):
return self.... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | src/models/gender.py | evdhout/learn_students |
from pylabber.views.defaults import DefaultsMixin
from research.filters.procedure_filter import ProcedureFilter
from research.models.procedure import Procedure
from research.serializers.procedure import (
ProcedureSerializer,
ProcedureItemsSerializer,
)
from rest_framework import viewsets
from rest_framework.de... | [
{
"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": true
}... | 3 | research/views/procedure.py | ZviBaratz/pylabber |
from pathlib import Path, PurePath
from .types import ProjectConfig, StaticAsset, FileId
from .page import Page
def test_project() -> None:
path = Path("test_data/bad_project")
project_config, project_diagnostics = ProjectConfig.open(path)
assert len(project_diagnostics) == 1
assert project_config.con... | [
{
"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 | snooty/test_types.py | nlarew/snooty-parser |
import autograd.numpy as np
class signalGenerator:
'''
This class inherits the Signal class. It is used to organize
1 or more signals of different types: square_wave,
sawtooth_wave, triangle_wave, random_wave.
'''
def __init__(self, amplitude=1, frequency=1, y_offset=0):
'''... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | signalGenerator.py | drinkdhmo/optimal_pid |
import asyncio
import subprocess
import pulsectl
class Pulse(pulsectl.Pulse):
async def __aenter__(self):
await asyncio.to_thread(self.__enter__)
return self
async def __aexit__(self, *exc_info):
await asyncio.to_thread(self.__exit__, *exc_info)
async def upload_sample(self, fil... | [
{
"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 | polundra/audio/pulse.py | smgd/polundra |
import threading
class MultiThreadCounter(object):
def __init__(self):
self.value = 0
self._lock = threading.Lock()
def increment(self):
with self._lock:
self.value += 1
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | test/atomic/multi_thread_counter.py | mad-center/mad-bilibili-crawler |
from unittest import TestCase
from scrapy.http import Response, Request
from scrapy.spider import BaseSpider
from scrapy.contrib.spidermiddleware.offsite import OffsiteMiddleware
class TestOffsiteMiddleware(TestCase):
def setUp(self):
self.spider = self._get_spider()
self.mw = OffsiteMiddleware(... | [
{
"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 | scrapy/tests/test_spidermiddleware_offsite.py | ghrhomeDist/scrapy |
"""empty message
Revision ID: 87daec43f7f5
Revises: 53299b87b12d
Create Date: 2017-05-14 21:12:33.971017
"""
# revision identifiers, used by Alembic.
revision = '87daec43f7f5'
down_revision = '53299b87b12d'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | [
{
"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 | migrations/versions/87daec43f7f5_.py | tferreira/piggydime |
class Buffer:
def __init__(self):
self.lst = list()
def add(self, *a):
for value in a:
self.lst.append(value)
while len(self.lst) >= 5:
s = 0
for i in range(5):
s += self.lst.pop(0)
print(s)
def get_current_part(self)... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | week1/1.05 classes/step09 buffer.py | TheNovel/stepik-python-fundamentals-and-application |
"""empty message
Revision ID: cae5e85415c2
Revises: 34632e9e90f3
Create Date: 2020-08-06 13:31:19.185791
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cae5e85415c2'
down_revision = '34632e9e90f3'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/cae5e85415c2_.py | ppruchnicki/flask_web_app |
import unittest
from unittest import TestCase
import pandas as pd
from mynlpwrangler.cleaner import ArticleCleaner
import pandas.testing as pd_testing
class TestCleaner(TestCase):
def setUp(self) -> None:
self.data = {"id": ["10001", "11375", "23423"], "text": [
"Hello, https://www.google.com... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | tests/test_cleaner.py | jjudy60334/my-nlp-wrangler |
from libs.Screen import *
class App_tpl(object):
@staticmethod
def hello():
print(" _ _ _ _ _ ")
print(" | |__(_) | | |_ ___ _ _ _ __ ")
print(" | '_ \ | | | _/ -_) '_| ' \ ")
print("__|_.__/_|_|_|\__\___|_| |_|_|_|_... | [
{
"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 | components/app/App_tpl.py | bitbuit/billterm |
#!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass
from datetime import datetime
from gql.gql.datetime_utils import DATETIME_FIELD
from gql.gql.graphql_client import GraphqlClient
from functools import partial
from numbers import Number
from typing import Any, Call... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | symphony/cli/pyinventory/graphql/move_location_mutation.py | marosmars/magma |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015 Yann Lanthony
# Copyright (c) 2017-2018 Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (See LICENSE.txt for details)
# ---------------------------------------------... | [
{
"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 | tests/test_functions.py | matsjoyce/qtsass |
import pytest
from django.urls import resolve, reverse
from django_crypto_trading_bot.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resol... | [
{
"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 | django_crypto_trading_bot/users/tests/test_urls.py | chiragmatkar/django-crypto-trading-bot |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
import sys
import unittest
import fundamental_tester_base
class tester_t(fundamental_tester_base.fundamental_tester_... | [
{
"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 | unittests/casting_tester.py | electronicvisions/pyplusplus |
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check
from checkov.common.util.type_forcers import force_list
class NginxIngressCVE202125742Alias(BaseK8Check):
def __init__(self):
name = "Prevent NGINX Ingress annot... | [
{
"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 | checkov/kubernetes/checks/resource/k8s/NginxIngressCVE202125742Alias.py | pmalkki/checkov |
from aoc2015.core import dispatch
def test_dispatch_fail(capsys):
'''Dispatch fails properly when passed a bad day'''
# capsys is a pytest fixture that allows asserts agains stdout/stderr
# https://docs.pytest.org/en/stable/capture.html
dispatch(['204'])
captured = capsys.readouterr()
assert '... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tests/test_core.py | emauton/aoc2015 |
import keras
from keras.models import Sequential
from keras.models import load_model
from keras.layers import Dense, LSTM, Dropout
from keras.optimizers import Adam
import numpy as np
import random
from collections import deque
class Agent:
def __init__(self, state_size, is_eval=False, model_name=""):
sel... | [
{
"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 | Reinforcement-Learning-Trader/Agent.py | krisbuote/Reinforcement-Learning-Trader |
def zigzagTraversal(root):
queue = [root] # initialize queue to root node
result = []
while queue: # iterate through loop while queue is not empty
arr = []
# levelSize prevents us from looping pasts current level in queue
levelSize = len(queue)
for _ in range(levelSize):
# these two lines ... | [
{
"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 | educative/TreesBFS/zigzagTraversal.py | j-dags/Algos |
from crom.project import Project
def with_directory(file, dir):
if dir is None:
return file
else:
return'/'.join([dir, file])
def list_files(files, dir):
return map(lambda f: with_directory(f, dir), files)
def get_files(files, dir):
return dict(map(lambda p: (with_directory(p[0], d... | [
{
"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 | crom/bootstrap/bootstrap.py | mropert/crom |
"""
Forces method classes.
The dynamic model should inherit from these classes in order to get the proper forces.
"""
import opensim as osim
class ResidualForces:
def __init__(self, residual_actuator_xml=None):
if residual_actuator_xml:
res_force_set = osim.ForceSet(residual_actuator_xml, Tru... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | static_optim/forces.py | pariterre/opensim_static_optimization_python |
from kivy.app import App
from kivy.factory import Factory
from kivy.lang import Builder
Factory.register('QRScanner', module='electroncash_gui.kivy.qr_scanner')
class QrScannerDialog(Factory.AnimatedPopup):
__events__ = ('on_complete', )
def on_symbols(self, instance, value):
instance.stop()
... | [
{
"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 | gui/kivy/uix/dialogs/qr_scanner.py | awemany/Electron-Cash |
# -*- coding: utf-8 -*-
"""
Translate docutils node important formatting.
each important start will processed with visit() and finished with depart()
"""
from docutils.nodes import Node
from sphinxpapyrus.docxbuilder.translator import DocxTranslator
node_name = "important"
def visit(visitor: DocxTranslator, node: N... | [
{
"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 | sphinxpapyrus/docxbuilder/nodes/important.py | amarin/sphinxpapyrus-docxbuilder |
from collections import Counter
def part1(lines):
gamma = ''
epsilon = ''
num_bits = len(lines[0])
for i in range(num_bits):
most_common = Counter(map(lambda x: x[i], lines)).most_common(1)[0][0]
gamma += most_common
epsilon += '0' if most_common == '1' else '1'
return 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | day03/binary_diagnostic.py | SimeonHristov99/aoc_2021 |
import numpy as np
from allvar import *
def _distance(r1, r2):
"""Return Euclidean _distance between positions"""
return np.sqrt(np.sum((r1 - r2)**2.))
def drdt(r, v):
"""Return position derivative
:param r: shape: (x_earth, y_earth, x_jupiter, y_jupiter))
:param v: shape: (vx_earth, vy_earth,... | [
{
"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 | source/force.py | swyang50066/sun-jupiter-earth-orbit |
# -*- coding: utf-8 -*-
"""
Created on Thu May 18 05:18:02 2017
@author: Siobhan
"""
import webbrowser
class Movie():
"""
A class which provides a way to store movie data.
Attributes:
title(str): value is the movie title given as the first argument.
storyline (str): value is the mov... | [
{
"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 | media.py | skehokin/gross-tomatoes |
from typing import Any, Sequence, Tuple, cast, TypeVar, Dict
from scipy.stats import mode
from numpy.typing import NDArray
def windowed_mean(
array: NDArray[Any], window_size: Tuple[int, ...], **kwargs: Dict[Any, Any]
) -> NDArray[Any]:
"""
Compute the windowed mean of an array.
"""
reshaped = res... | [
{
"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 | src/xarray_multiscale/reducers.py | jhnnsrs/xarray-multiscale |
import torch.nn as nn
import torch.nn.functional as F
class DQNLinear(nn.Module):
"""
A feedforward, non-convolutional network.
There is nothing about this architecture which is specific to Deep-q-learning - in fact,
the algorithm's performance should be fairly robust to the number and sizes of layers... | [
{
"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 | src/models/dqn_linear.py | CCS-Lab/pytorch_car_caring |
import re
# Allow underscore in host name
_label_valid = re.compile(b"(?!-)[A-Z\d\-_]{1,63}(?<!-)$", re.IGNORECASE)
def is_valid_host(host: bytes) -> bool:
"""
Checks if a hostname is valid.
"""
try:
host.decode("idna")
except ValueError:
return False
if len(host) > 255:
... | [
{
"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 | mitmproxy/net/check.py | caputomarcos/mitmproxy |
import dropbox
class TransferData:
def __init__(self, access_token):
self.access_token = access_token
def upload_file(self, file_from, file_to):
dbx = dropbox.Dropbox(self.access_token)
f = open(file_from, 'rb')
dbx.files_upload(f.read(), file_to)
def main():
access_toke... | [
{
"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 | cloud_storage.py | RakshithBharadwaj24/CLOUD-STORAGE |
from typing import NoReturn
from Recorder.BaseRecorder import BaseRecorder
from Config.const import BillStatus
from Models.AlipayBill import AlipayBill
class AlipayRecorder(BaseRecorder):
def __init__(self, rows):
super(AlipayRecorder, self).__init__(rows, AlipayBill)
@classmethod
def update_sa... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | Recorder/AlipayRecorder.py | Sijiu/Xbill |
# Copyright: (c) 2021, Edwin G. W. Peters
from demodulator.demodulator_base import Demodulator as Demodulator_base
class Demodulator(Demodulator_base):
def uploadAndFindCarrier(self,samples):
"""
Performs:
thresholding -- remove large spikes of interference
uploadToGPU --... | [
{
"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 | pyCuSDR/demodulator/UHF.py | mugpahug/pycu-sdr |
#!/usr/bin/python3
import subprocess as sb
import os
SSH_KEY_GEN = "ssh-keygen -t rsa -b 4096 -C "
# USER_EMAIL = '"test2@example.com"'
def create_key(email_id,password):
global SSH_KEY_GEN
rsa_file_path = os.path.expanduser('~/.ssh/id_rsa')
SSH_KEY_GEN = SSH_KEY_GEN + email_id
command = SSH_KEY_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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | package/sshHandler.py | kartik-karz/auto-ssh |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = ('... | [
{
"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 | app/user/serializers.py | quangnhatdao/recipe-app-api |
#!/usr/bin/env python
import numpy as np
from parameters import *
from snn import TargetFollowingSNN, ObstacleAvoidanceSNN, nest_simulate
class Model:
def __init__(self):
self.snn_tf = TargetFollowingSNN()
self.snn_oa = ObstacleAvoidanceSNN()
self.turn_pre = 0.0
self.angle_pre = 0.0
self.weights_tf = []
... | [
{
"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 | controller/model.py | romenr/bachelorthesis |
# Copyright 2018 Sergio Oller
#
# 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, modify, merge, publish, distribut... | [
{
"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 | __init__.py | zeehio/enclosure-text-skill |
###############################################################################
# Copyright Maciej Patro (maciej.patro@gmail.com)
# MIT License
###############################################################################
from cmake_tidy.formatting.utils.single_indent import get_single_indent
class FormatSpaces:
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | cmake_tidy/formatting/utils/format_spaces.py | MaciejPatro/cmake-tidy |
import datetime
from django.utils import timezone
from .base import BlockObjectsTests
class ObjectTimeStampMethodsTests(BlockObjectsTests):
def test_old_object_was_not_published_recently(self):
time = timezone.now() - datetime.timedelta(days = 30)
old_object = self.create_object()
setat... | [
{
"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 | demoslogic/blockobjects/tests/test_timestamps.py | amstart/demoslogic |
from trainers.basic import BasicTrainer
class SupervisedTrainer(BasicTrainer):
def calculate_logits(self, images, labels):
images = images.to(self.args.device)
labels = labels.to(self.args.device)
logits = self.model(images) / self.args.temperature
return logits, labels
def pr... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | trainers/supervised.py | isadrtdinov/SimCLR |
import math
def is_prime_power(n):
#even number divisible
factors = set()
while n % 2 == 0:
factors.add(2)
n = n / 2
#n became odd
for i in range(3,int(math.sqrt(n))+1,2):
while (n % i == 0):
factors.add(i)
n = n / i
if n > 2:
factors.add(n)
ret... | [
{
"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 | Prime Powers/prime_powers.py | philippossfrn/Integer-Sequences |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# © arkoz 2021
import os
import sys
import requests
import logging
from logging import handlers
botnick = "satfinder"
def logprepare():
path = "logi/"
if not os.path.exists(path):
os.makedirs(path)
with open(path + botnick + '.log', 'a'):
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 | TLEdownloader.py | 4rk0z/satfinder |
import pytest
import mfr
import mfr_rst
def test_detect(fakefile):
# set filename to have .rst extension
fakefile.name = 'mydoc.rst'
handler = mfr_rst.Handler()
assert handler.detect(fakefile) is True
@pytest.mark.parametrize('filename', [
'other.rs',
'otherrst',
'other',
'other.',
]... | [
{
"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 | mfr_rst/tests/test_rst.py | erinspace/modular-file-renderer |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import wiringpi
# 定数宣言
LED_PIN = 4 # LEDのGPIO番号
BUTTON_PIN = 13 # スイッチのGPIO番号
BUTTON_DELAY = 0.5 # チャタリング防止用の遅延時間
INTERVAL = 0.1 # スイッチチェック間隔
def get_button_value(pin):
"""指定したpinのスイッチ入力状態を取得"""
v = wiringpi.digitalRead(pin)
if v == wiringpi.H... | [
{
"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 | 05-07-a2/sample_05_button.py | hiro345g/raspi_magazine_201610_toku1 |
# -*- coding: utf-8 -*-
import numpy as np
from .timestamp import Timestamp
from .movement_model_base import MovementModelBase
class LinearMovementModel(MovementModelBase):
"""Продвигает автомобиль вперед с его текущей скоростью"""
def __init__(self, *args, **kwargs):
super(LinearMovementModel, self).... | [
{
"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 | road situation analysis/research/road/state estimation/sdc/linear_movement_model.py | MikhailKitikov/DrivingMonitor |
# -*- coding: utf-8 -*-
"""
har2lilua Tests
"""
from __future__ import unicode_literals
from io import open
import unittest
from har2lilua import har2lilua
def _read_testfiles():
with open("test.har", "r", encoding="utf-8") as fil:
harstring = fil.read()
with open("test.lua", "r", encoding="utf-8") 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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | har2lilua/tests/tests.py | Griatch/har2lilua |
# -*- coding: utf-8 -*-
# @Time : 2021/8/25 4:25
# @Author : pixb
# @Email : tpxsky@163.com
# @File : main_view.py.py
# @Software: PyCharm
# @Description:
import time
from view import click
from constants.constants import *
class main_view(object):
def click_enter(self):
click.left_click(int(WI... | [
{
"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 | view/main_view.py | pixb/great-hero-beard-robot |
#!/usr/bin/env python
import urllib2
from threading import Thread
URL = 'http://localhost:8001'
class SiteRequest:
def __init__(self, x=10, suffixName='', tables=[]):
self.__x = x
self.__tables = tables
self.__suffixName = suffixName
def hit(self, hitCount):
for i in range(hi... | [
{
"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 | test/test.py | odeke-em/restAssured |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit
def cross(x0: int, y0: int, x1: int, y1: int) -> int:
return x0 * y1 - x1 * y0
@nb.njit((nb.i8, ) * 4 + (nb.i8[:, :], ), cache=True)
def solve(
x0: int,
y0: int,
x1: int,
y1: int,
xy: np.ndarray,
) -> typing.NoReturn:
n = len... | [
{
"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 | src/atcoder/abc016/d/sol_1.py | kagemeka/competitive-programming |
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from guardian.shortcuts import get_perms, remove_perm
from apps.projects.models import Project, ProjectContributor, ProjectAPIToken
from apps.reporting.models import ReportInformation
@receiver(post_save, sender=Project)
d... | [
{
"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 | apps/projects/signals.py | blockomat2100/vulnman |
from dmarc_metrics_exporter.dmarc_metrics import (
Disposition,
DmarcMetrics,
DmarcMetricsCollection,
Meta,
)
from dmarc_metrics_exporter.metrics_persister import MetricsPersister
def test_roundtrip_metrics(tmp_path):
metrics_db = tmp_path / "metrics.db"
metrics = DmarcMetricsCollection(
... | [
{
"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 | dmarc_metrics_exporter/tests/test_metrics_persister.py | Tristan971/dmarc-metrics-exporter |
# binary filter
# to complement ranker
import random
def title_filter(data) -> int:
#mockup
return random.randint(0,1)
def _filter(category: str,data: list) -> list:
for i in data:
i['filter_name'] = "low_quality"
i['filter'] = title_filter(i['title'])
return 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | filter/filter_low_quality/main.py | ege-del/sayfa_dev |
from __future__ import print_function
from benchpress.benchmarks import util
import numpy as np
bench = util.Benchmark("LU decomposition on the matrix so that A = L*U", "<size>")
def lu(a):
"""
Perform LU decomposition on the matrix `a` so that A = L*U
"""
u = a.copy()
l = np.identity(a.shape[0],... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | benchpress/benchmarks/lu/python_numpy/lu.py | bh107/benchpress |
#!/usr/bin/env python
""" A quick and extremely dirty hack to wrap matlabpipe/matlabcom as if they
were mlabraw.
Author: Dani Valevski <daniva@gmail.com>
License: MIT
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
is_win = sys.platform == 'win32'
if is_win:
from .ma... | [
{
"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 | pathmatcher/mlabwrap/mlabraw.py | lrq3000/pathmatcher |
from Voicelab.pipeline.Node import Node
from parselmouth.praat import call
###################################################################################################
# Extends the basic node with some shared voicelab functionalities
#############################################################################... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | Voicelab/toolkits/Voicelab/VoicelabNode.py | FrancisTembo/VoiceLab |
import pytz
import datetime, os
### CONVERT FROM ONE TIME ZONE TO ANOTHER
def convert_timezone(_from, to):
# samples 'Africa/Lagos', 'US/Central'
source_zone = pytz.timezone(_from)
target_zone = pytz.timezone(to)
curtime = source_zone.localize(datetime.datetime.now())
curtime = curtime.astimezone... | [
{
"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 | scripts/time_helpers.py | dtekluva/djangodashboard |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.