source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# ./PongPong/pong/paddle.py
import pyglet
from pyglet.window import key
from typing import Tuple
class Paddle(pyglet.shapes.Rectangle):
def __init__(self, *args, **kwargs):
super(Paddle, self).__init__(*args, **kwargs)
self.acc_left, self.acc_right = 0.0, 0.0
self.rightx = 0
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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | PongPong_Game/pong/paddle.py | Wish1991/Python |
from sumo.monkeypatch import URLWidget
class PatternURLWidget(URLWidget):
"""A URLWidget with a pattern attribute, set by self.pattern."""
def render(self, *args, **kwargs):
self.attrs['pattern'] = self.pattern
return super(PatternURLWidget, self).render(*args, **kwargs)
class FacebookURLWi... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | apps/users/widgets.py | storagebot/kitsune |
# -*- coding: utf-8 -
import os
import multiprocessing
from gunicorn.app.base import BaseApplication
from print3.main import app as application
def number_of_workers():
return (multiprocessing.cpu_count() * 2) + 1
class StandaloneApplication(BaseApplication):
def __init__(self, app, options=None):
... | [
{
"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 | print3/wsgi.py | geoadmin/service-print |
class FileManagerInterface:
"""FileManagerInterface defines interface for handling read/write
files to its asset/meta storage inside tintin's projects
"""
def list(self, prefix: str) -> [str]:
"""list: list all elements (including files and dirs) under the prefix
Args:
pref... | [
{
"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 | python/tintin/file/file_manager.py | FootprintAI/tintin-sdk |
class Beam(object):
def __init__(self):
super().__init__()
def get_number_of_rays(self):
raise NotImplementedError("method is abstract")
def get_rays(self):
raise NotImplementedError("method is abstract")
def get_ray(self, ray_index):
raise NotImplementedError("metho... | [
{
"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 | rafry/raytracer/beam.py | oasys-kit/rafry |
from peewee import *
import datetime
from config import *
database = PostgresqlDatabase(POSTGRES_DATABASE, user=POSTGRES_USER, password=POSTGRES_PASSWORD, host=POSTGRES_HOST)
class TblOrganisation(Model):
id = PrimaryKeyField()
identifier = CharField()
type = IntegerField()
country = CharField()
i... | [
{
"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 | src/scrape/organisation_model.py | younginnovations/iati-organisations-cleanup |
import os
from flask import render_template, url_for, redirect
from werkzeug.utils import secure_filename
from app import app
from app.forms import ScriptForm
from Script_reader import table_creator
@app.route('/', methods=['POST', 'GET'])
@app.route('/index', methods=['POST', 'GET'])
def index():
form = ScriptF... | [
{
"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 | app/routes.py | felixtomlinson/Script_Location_Reader |
import base64
import json
import arc.tables
from event import Event
from event_handler import EventHandler
from slack_api import SlackApi
def handler(request, context):
slack_api = SlackApi()
event_handler = EventHandler(
slack_api,
user_table=arc.tables.table(tablename="users"),
karm... | [
{
"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 | src/http/post-index/index.py | StrataOncology/karmabot |
'''
Created on Aug 9, 2012
:author: Sana Development Team
:version: 2.0
'''
from django.db import models
from mds.api.utils import make_uuid
QUEUE_STATUS=((0,'Failed Dispatch'))
class EncounterQueueElement(models.Model):
""" An element that is being processed
"""
class Meta:
app_label = "core"
... | [
{
"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": false
}... | 3 | src/mds/core/models/queue.py | m-socha/sana.mds |
# ---------------------------------------------------------------------
# Segment handlers
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules... | [
{
"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 | fm/handlers/alarm/segment.py | sbworth/getnoc |
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def getVal(self,l):
val = ""
while l != None:
val += str(l.val)
l = l.next
return int(val[::-1])
def toList(self,num):
arrayN = []
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | Python/leetcode_challenges/leetcode_add-two-numbers.py | liv335/public |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function, division, unicode_literals, absolute_import
import os
from distutils.version import LooseVersion
from .info import (LONG_DESCRIPTION as __doc... | [
{
"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 | nipype/__init__.py | sebastientourbier/nipype |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function
from distutils.version import LooseVersion
# first test occurs with astropy import locally
def test_monkeypatch_warning(recwarn):
import astropy
if LooseVersion(astropy.version.version) < LooseVersion('0.3.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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | astroquery/tests/test_import.py | mdboom/astroquery |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import colored
import sys
def colstr(color, string):
return f"{color}{string}{colored.style.RESET}"
def li(item, bullet=" *", color=colored.fore.LIGHT_GREEN, printer=print):
"""Print a list item"""
printer(colstr(color, bullet), item)
def print_action(a... | [
{
"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 | ogma/utils/__init__.py | jdevera/ogma |
def convert_to_int(integer_string_with_commas):
comma_separated_parts = integer_string_with_commas.split(",")
for i in range(len(comma_separated_parts)):
if len(comma_separated_parts[i]) > 3:
return None
if i != 0 and len(comma_separated_parts[i]) != 3:
return None
in... | [
{
"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 | src/data/preprocessing_helpers.py | gokhankesler/python-ds-unit-testing |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import requests
import re
import os
import time
from PIL import Image
def parseImageUrls(wxUrl):
rsp = requests.get(wxUrl)
imgs = re.findall(r'<p><img (.*?)></p>', rsp.text)
imgUrls = []
for img in imgs:
data_src = re.search(r'data-src="(.*?)"', 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | grapWxImage.py | shinancao/GrapImages |
import math
class calc:
def __init__(self):
self.result = 0
def add(a,b):
self.result += float(b)
return self.result
def minus(a,b):
self.result -= float(b)
return self.result
def c_(self):
self.result = 0
return 0
def mult(a,b)... | [
{
"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 | cal_class.py | kwondohun0308/Beakjoon |
import cv2
import pose_detection as pose_d
pose_model = pose_d.load_pose_model('pre_trained\AFLW2000.pkl')
def detect_face(img_PATH, model_PATH):
# Load the cascade
face_cascade = cv2.CascadeClassifier(model_PATH)
# Read the input image
img = cv2.imread(img_PATH)
# Convert into grayscale
gray = cv2.cvtCo... | [
{
"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 | face_detection_cv2.py | HDWilliams/User_Verification_HPE |
import tensorflow as tf
import keras.backend.tensorflow_backend as ktf
from keras.callbacks import ModelCheckpoint
from soclevr import load_all, Timer
import os
import argparse
import numpy as np
from model import RN, RN2
def run(attempt, gpunum):
os.environ["CUDA_VISIBLE_DEVICES"] = gpunum
def get_session(gp... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | keras_not_working/train.py | bgshin/rn |
import requests
def send_queries(queries):
"""
Send a list of queries to the server and return the response.
"""
url = "http://localhost:8080/rank"
headers = {"Content-Type": "application/json"}
data = {"queries": queries}
response = requests.post(url, headers=headers, data=data)
retur... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/util.py | elihschiff/ranking-h |
# -*- coding: utf-8 -*-
"""
[googleSearch.py]
Google Search Plugin
[Author]
Justin Walker
[About]
Returns the first three links from a google search.
[Commands]
>>> .google <<search term>>
returns search links
"""
try:
from googlesearch import search
except ImportError:
print("No modu... | [
{
"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 | honeybot/plugins/google.py | marceloyb/honeybot |
from threading import Thread
from pyfirmata import Arduino, pyfirmata, util
from pyfirmata.util import ping_time_to_distance
import time
### Start of pin configuration
board = Arduino() # or Arduino(port) define board
print("Communication successfully started!")
it = util.Iterator(board)
it.start()
sonarEcho = board... | [
{
"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 | Examples/ultrassonic_thread_HC_SR04.py | BosonsHiggs/arduPython |
# 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, software
# distributed under t... | [
{
"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 | osc_placement/tests/unit/test_plugin.py | takanattie/osc-placement |
import discord
from discord.ext import commands
import datetime
class JoinLogs(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self, member):
join_logs = member.guild.get_channel(self.bot.config.get("join_logs_chan", None))
... | [
{
"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 | cogs/join-logs.py | baptiste0928/userinfo-bot |
#!/usr/bin/env python
# coding=utf-8
#
# Python Script
#
# Copyleft © Manoel Vilela
#
#
WIDTH,HEIGHT = 2,3
from random import shuffle, randrange
def make_maze(w=WIDTH, h=HEIGHT):
vis = [[0] * w + [1] for _ in range(h)] + [[1] * (w + 1)]
nowalls = []
def walk(x, y):
vis[x][y] = 1
d =... | [
{
"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 | labyrinth_generator.py | ImTheTom/labyrinth-explorer |
"""
Jordi explained that a recursive search may not work as you might
first follow an extremely long path.
Thus, the process should be done by levels
"""
import os
from collections import defaultdict
class Computer:
def __init__(self):
self.operations = {'cpy': self.copy, 'inc': self.add, 'de... | [
{
"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 | 2016/iker/day12/leonardo_s_monorail.py | bbglab/adventofcode |
# PrettifyPage.py
from bs4 import BeautifulSoup
import requests
import BusinessPaths
import pathlib
class PrettifyPage:
def __init__(self):
self.bpath = BusinessPaths.BusinessPaths()
def prettify(self, soup, indent):
pretty_soup = str()
previous_indent = 0
for line in soup.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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | jupyterlab/PrettifyPage.py | Larz60p/MakerProjectApril2019 |
fh = 0
col = 0
def update(tick):
global h
global col
print("UP: ", button(UP), end=", ")
print("DOWN: ", button(DOWN), end=", ")
print("LEFT: ", button(LEFT), end=", ")
print("RIGHT: ", button(RIGHT))
r = 0
g = 0
b = 0
if button(A):
r = 100
if button(B):
g =... | [
{
"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 | micropython/examples/picosystem/test.py | Fordi/picosystem |
"""Wykop API JSON praser module."""
from __future__ import absolute_import
try:
import simplejson as json
except ImportError:
import json
from wykop.api.parsers.base import BaseParser, Error
class JSONParser(BaseParser):
def __init__(self, exception_resolver, **json_kwargs):
super(JSONParser, se... | [
{
"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 | wykop/api/parsers/json.py | krasnoludkolo/wykop-sdk |
from rdflib import Graph
import requests
import ipaddress
import json
import socket
from urllib.parse import urlparse
from .base import BaseLDN
class Sender(BaseLDN):
def __init__(self, **kwargs):
super(self.__class__, self).__init__(**kwargs)
self.allow_localhost = kwargs.get('allow_localhost'... | [
{
"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 | ldnlib/sender.py | trellis-ldp/py-ldnlib |
'''
REVERSE A LINKED LIST
Reverse a singly linked list.
'''
# Recursive Solution, Time Complexity: O(N) ; Space Complexity: O(N) (Stack)
def reverseList(head: ListNode) -> ListNode:
return self.reverse(head, None)
def reverse(node: ListNode, prev: ListNode) -> ListNode:
if not node:
return ... | [
{
"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 | LC206.py | urjits25/leetcode-solutions |
MAIOR_IDADE = 18
class Pessoa:
def __init__(self, nome, idade):
self.nome = nome
self.idade = idade
def __str__(self):
if not self.idade:
return self.nome
return f'{self.nome} - {self.idade}'
def is_adult(self):
return (self.idade or 0) >= MAIOR_IDAD... | [
{
"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 | ProgramacaoOO/Loja/pessoa.py | VictorMello1993/CursoPythonUdemy |
# MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# 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, modif... | [
{
"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 | tests_from_past/past/acceptance/bys_test.py | AkioYuki/selene |
# coding: utf8
"""
题目链接: https://leetcode.com/problems/binary-tree-postorder-traversal/description.
题目描述:
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree [1,null,2,3],
1
\
2
/
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | Tree/145_BinaryTreePostorderTraversal.py | cls1991/leetcode |
from ..source import GitSource
from ..package import Package
from ..patch import LocalPatch
from ..util import target_arch
class Libxslt(Package):
source = GitSource('https://github.com/QPYPI/libxslt.git', alias='libxslt', branch='qpyc-1.1.32')
patches = [
#LocalPatch('0001-Fix-libtoolize-s-issue-in-au... | [
{
"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 | pybuild/packages/libxslt.py | xxtEchjovs44/chain |
from editor.attributes.player.player_attribute import (
PlayerAttribute,
PlayerAttributeTypes,
)
from editor.attributes.player.player_attribute_wb import (
PlayerAttributeWb,
)
from editor.attributes.player.player_attribute_acceleration import (
PlayerAttributeAcceleration,
)
from editor.attributes.p... | [
{
"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 | editor/attributes/player/player_attribute_wb_acceleration.py | PeterC10/COFPES-OF-Editor-6 |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running
mu... | [
{
"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 | test/functional/create_cache.py | martin-braun/Nuwa |
import json
async def request_get_stub(url: str, stub_for: str, status_code: int = 200):
"""Returns an object with stub response.
Args:
url (str): A request URL.
stub_for (str): Type of stub required.
Returns:
StubResponse: A StubResponse object.
"""
return StubResponse(s... | [
{
"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 | tests/utils.py | 3D-Beacons/3d-beacons-hub-api |
from uuid import uuid4
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from datachimp.models.project import Project
from datachimp.models.membership import Membership
from datachimp.serializers.project import ProjectSerializer
c... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | datachimp/views/api/project.py | ModelChimp/datachimp |
from flask import session
from flask_socketio import emit, join_room, leave_room
from .. import socketio, connected_players
@socketio.on('joined', namespace='/play')
def joined():
join_room('quizzy')
emit('status', {'msg': session.get('name') + ' has joined the game.'}, room='quizzy')
@socketio.on('/status'... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | app/blueprints/events.py | vabs/quizzy |
#!/usr/bin/python
################################################################################
# 2301f556-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | pcat2py/class/2301f556-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
import dmc2gym
from domains.wrappers import ConcatObs
def mdp():
return dmc2gym.make(domain_name="cartpole", task_name="swingup", keys_to_exclude=[], frame_skip=5, track_prev_action=False)
def p():
return dmc2gym.make(domain_name="cartpole", task_name="swingup", keys_to_exclude=['velocity'], frame_skip=5, t... | [
{
"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 | offpcc/domains/dmc_cartpole_su.py | zhihanyang2022/CleanRL |
# -*- coding: utf-8 -*-"""
"""
This module provides a simple CLI for extracting Red-Green-Blue from images
"""
import argparse, argcomplete
import os.path as osp
import sys
from .lamplight import image_info, image_split, save_images
def interface(filename, directory):
img_type, name, src_image = image_info(fi... | [
{
"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 | src/project/lamplibs/extractRGB.py | probinso/color-pollution |
"""Collection of generic functions"""
import os
from typing import List
def split(path: str) -> List[str]:
"""
Split a path into all of its parts
:param path: path to file or directory
:return: parts of the path
"""
parts = []
head, tail = os.path.split(path)
parts.append(tail)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | src/utils/path.py | altndrr/persona |
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
import os
from java.io import Fi... | [
{
"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 | src/test/resources/docker/initialize/xld_initialize.py | xebialabs-community/xld-duckcreek-plugin |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | kubernetes/test/test_apiregistration_v1beta1_service_reference.py | Scalr/kubernetes-client-python |
# -*- coding: utf-8 -*-
from benedict.core import clone as _clone
from benedict.core import traverse as _traverse
import unittest
class traverse_test_case(unittest.TestCase):
def test_traverse(self):
i = {
'a': {
'x': 2,
'y': 3,
'z': {
... | [
{
"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 | tests/core/test_traverse.py | next-franciscoalgaba/python-benedict |
# coding:utf-8
from captcha.image import ImageCaptcha # pip install captcha
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import random
import time
import sys
from constants import number
from constants import alphabet
from constants import ALPHABET
# 验证码一般都无视大小写;验证码长度4个字符
def random_capt... | [
{
"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 | 1.Cnn_Captcha/gen_captcha.py | JhonLiuljs/tensorflow_demo |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from fairseq import utils
class LearnedPositionalEmbeddingMul(nn.Embedding):
"""
This module learns positiona... | [
{
"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 | fairseq/modules/learned_positional_embedding_mul.py | ggzhang0071/Self-Supervised-Embedding-Fusion-Transformer |
import shutil
from os import system
import pytest
@pytest.fixture(params=["t1-linear", "t1-volume"])
def cli_commands(request):
if request.param == "t1-linear":
test_input = [
"t1-linear",
"data/dataset/OasisCaps_example",
"results/quality_check.tsv",
"--no... | [
{
"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 | tests/test_qc.py | sophieloiz/clinicadl |
from itertools import izip
from collections import defaultdict
from src.abstract_classifier import AbstractClassifier
import lib.sequence_lib as seq_lib
class CdsGap(AbstractClassifier):
"""
Are any of the CDS introns too short?
Since sqlite3 lacks a BOOL type, reports 1 if TRUE and 0 if FALSE
"""... | [
{
"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/cds_gap.py | ifiddes/mus_strain_cactus |
from boa3.builtin import public
a = b = c = d = 10
c += 5
@public
def get_a() -> int:
return a
@public
def get_c() -> int:
return c
@public
def set_a(value: int):
global a
a = value
@public
def set_b(value: int):
global b
b = value
| [
{
"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 | boa3_test/test_sc/variable_test/GlobalMultipleAssignments.py | hal0x2328/neo3-boa |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from urlparse import urljoin
import validation_check as vc
__author__ = "Robert Wen <robert.wen@nyu.edu>, Caicai Chen <caicai.chen@nyu.edu>"
'''
Bing Web Search Engine Crawler
'''
class BingWebCrawler(object):
''' Bing Web... | [
{
"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 | web-search-engine/crawln/bing_crawl.py | robertwenquan/nyu-course-assignment |
import json
import os
from typing import Mapping
_TESTS_DIR_PATH = os.path.dirname(__file__)
def get_test_file_path(path: str) -> str:
filepath = os.path.join(
_TESTS_DIR_PATH,
path,
)
return filepath
def read_test_file_bytes(path: str) -> bytes:
filepath = os.path.join(
_T... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | tests/utils.py | fyntex/lib-cl-sii-python |
def method(method_name, acc_modifier, return_type, params, body):
param_string = ""
if params:
for name, var_type in params.items():
param_string += "{} {},".format(var_type, name)
param_string = param_string[:-1]
return """ {} {} {}({}){{{}}}""".format(acc_modifier, return_t... | [
{
"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 | pojen/builders.py | giuseongit/pojen |
class UnionFind:
def __init__(self, size):
if size <= 0:
raise ValueError("Size cannot be less than or equal to 0")
self.size = size
self.num_components = size
self.id = [None] * size
self.sz = [None] * size
for i in range(size):
self.id[i] = ... | [
{
"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 | src/code/data-structures/UnionFind/UnionFind.py | angshumanHalder/discord-bot |
def mul(cur_num,x):
cur_num=cur_num[::-1]
carry=0
for i in range(0,len(cur_num)):
temp=cur_num[i]*x+carry
cur_num[i]=temp%10
carry=temp//10
if i+1==len(cur_num) and carry!=0:
cur_num.append(carry)
return cur_num[::-1]
def fact(n):
cur_num=[1]
for i in... | [
{
"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 | Beginner/FCTRL2.py | NixonZ/Code_Chef |
from flask import Flask, render_template, Response
from camera import VideoCamera
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
def gen(camera):
while True:
frame = camera.get_frame()
yield (b'--frame\r\n'
b'Content-Type:... | [
{
"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 | main.py | HILAYTRIVEDI/Facial_expression_detection |
from Stack import Stack
class StackOfPlates:
def __init__(self, stackSize):
self.stackSize = stackSize
self.stackList = []
self.stackList.append(Stack())
def push(self, item):
if len(self.stackList[-1]) > self.stackSize:
self.stackList.append(Stack())
self.... | [
{
"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 | exercises/Stacks and Queues/StackOfPlates.py | RakaPKS/StructuresAlgorithmsAndConcepts |
import h5
import numpy as np
class MeshFile:
def __init__(self,fpath, mode='r'):
self.h5file = h5.File(fpath,mode)
self.elemInfo = self.get('ElemInfo')
self.nodeCoords = self.get('NodeCoords')
self.domain = np.array([
[self.nodeCoords[:,i].min() for i in range(0,... | [
{
"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 | tools/lib/hopr.py | jmark/turbubox |
from os import system
from pymongo import MongoClient
class SingletonConnection(object):
__cliente = None
@classmethod
def get_connection(cls):
if cls.__cliente is None:
cls.__cliente = MongoClient('127.0.0.1', 27017)
return cls.__cliente
@classmethod
def get_banco(c... | [
{
"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 | connections/singletonConnection.py | Link-Hawks/Edgar |
@abstract
class Abstract:
some_property: int
@require(lambda some_property: some_property > 0)
def __init__(self, some_property: int) -> None:
self.some_property = some_property
def some_func(self) -> None:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
| [
{
"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 | test_data/intermediate/expected/interface/basic/meta_model.py | gillistephan/aas-core-codegen |
import enum
import os
class FileUse(enum.Enum):
INPUT = 1,
GENERATED = 2,
OUTPUT = 3
class FileRef:
def __init__(self, tag, ext, use, output_step=None):
self.tag = tag
self.output_step = None
self.ext = ext
self.use = use
def __eq__(self, b):
return self.t... | [
{
"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 | textle/fileref.py | mincrmatt12/textle |
#!/usr/bin/python
import sdk_common
import slackclient
# Block in charge of notifying of a new release
class ReleaseNotifier(sdk_common.BuildStep):
def __init__(self, logger=None):
super(ReleaseNotifier, self).__init__('Release notification', logger)
self.token = self.common_config.get_config().ge... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | scripts/sdk_notify.py | PelionIoT/mbed-cloud-sdk-java |
import pytest
from collections import namedtuple
SignedBlockHeader = namedtuple("SignedBlockHeader", "unsignedBlockHeader signature")
@pytest.fixture(scope="session")
def ownable_contract(deploy_contract):
return deploy_contract("Ownable")
@pytest.fixture(scope="session")
def authorizable_contract(deploy_cont... | [
{
"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 | tests/conftest.py | trustlines-network/contract-library |
def test_import():
# just try to import some packages that use namespace
import google.cloud.language
import azure.storage.blob
import dateutil
def test_xgboost():
import xgboost.training
def test_numpy():
import numpy
import tests._test
| [
{
"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 | examples/tests/test_import.py | tommilligan/rules_pip |
# -*- coding: utf-8 -*-
"""
@author: %(Mikel Val Calvo)s
@email: %(mikel1982mail@gmail.com)
@institution: %(Dpto. de Inteligencia Artificial, Universidad Nacional de Educación a Distancia (UNED))
@DOI: 10.5281/zenodo.3759306
"""
#%%
class SlotsManager:
# Inicializa la lista de callbacks
def __init__(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | GENERAL/slots_manager.py | Couso99/EEG-Environment |
# -*- coding: UTF-8 -*-
import sqlite3
import pytest
from vicuna.db import get_db
def test_get_close_db(app):
with app.app_context():
db = get_db()
assert db is get_db()
with pytest.raises(sqlite3.ProgrammingError) as e:
db.execute('SELECT 1')
assert 'closed' in str(e.value)
d... | [
{
"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 | tests/test_db.py | lf328359263/vicuna |
import cv2
import gym
from gym.core import ObservationWrapper
from gym.spaces import Box
from preprocessing import atari_wrappers
from preprocessing.framebuffer import FrameBuffer
ENV_NAME = "BreakoutDeterministic-v4"
class PreprocessAtariObs(ObservationWrapper):
def __init__(self, env):
"""A gym wrappe... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | preprocessing/BreakoutDeterministic.py | dsinghnegi/attari_RL_agent |
# -*- coding: utf-8 -*-
"""
View
~~~~~~~~~
:copyright: (c) 2018 by geeksaga.
:license: MIT LICENSE 2.0, see license for more details.
"""
from sqlalchemy import Column, Integer, String
from . import Base
class View(Base):
__tablename__ = 'gs_view'
id = Column(Integer, primary_key=True)
... | [
{
"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 | ahoy/model/view.py | geekflow/ahoy |
# Workaround to encode/decode indexes in protobuf messages
# Based on https://developers.google.com/protocol-buffers/docs/encoding#varints
from io import BytesIO
from karapace.protobuf.exception import IllegalArgumentException
from typing import List
ZERO_BYTE = b"\x00"
def read_varint(bio: BytesIO) -> int:
"""... | [
{
"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 | karapace/protobuf/encoding_variants.py | dswiecki/karapace |
#!C:\Users\DTI-GSAMPAIO\Python\Day of Data Science\GPTo\venv\Scripts\python.exe
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter use: 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | venv/Scripts/rst2odt_prepstyles.py | sampaiowysk/GPTo |
# This file is a part of Arjuna
# Copyright 2015-2021 Rahul Verma
# Website: www.RahulVerma.net
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0... | [
{
"point_num": 1,
"id": "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 | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna |
import pandas as pd
from netstats.fsan import Fsan
class ListaDataframe:
def __init__(self, operacao):
self.operacao = operacao
def dataframe(self):
"""
Retorna uma lista de dataframes por FSAN, cada dataframe contém as operações realizadas
com a FSAN.
... | [
{
"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 | netstats/lista_dataframe.py | liragabriel/DS |
import torch
from .base_model import BaseModel
class Classifier(BaseModel):
def __init__(self, model, **kwargs):
super(Classifier, self).__init__(**kwargs)
self.model = model
self.model_name = self.model.name
if self.optimizer is not None:
self.optimizer = self.optimizer... | [
{
"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 | model/models/classifier.py | elviva404/food-detection-yolov5 |
from PyQt5.QtWidgets import qApp, QMainWindow
from save import SaveMenuAction, SaveMenuActionHandler
from status_widget import StatusWidget
class Ui(object):
def __init__(self, plugin):
plugin.logger.debug('Initating the plugin UI')
# we need to find the ida main window in order to add
#... | [
{
"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 | Revether/revether/ui/ui.py | Revether/Revether |
# core
from django.db import models
from django.utils import timezone
from django.contrib.auth import get_user_model
from django.urls import reverse
# django-taggit
from taggit.managers import TaggableManager
# django-markdownx setting
from markdownx.models import MarkdownxField
from markdownx.utils import markdownif... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | blog/models.py | harryghgim/django-blog |
import logging
import pickle
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, Union
from numpy.typing import NDArray
from sklearn.preprocessing import LabelEncoder
from predictions.face_recognizer import ModelType
from settings import output
logger = logging.getLogger(__name__)
def... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | src/predictions/trainers/trainer.py | sqoshi/masked-face-recognizer |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | kubernetes/test/test_v1_deployment.py | jashandeep-sohi/kubernetes-python |
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
import pyautogui
import time
from selenium.webdriver.common.keys import Keys
def signin(path,confidence=0.9):
... | [
{
"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 | main.py | Andrewzekid/MCExcelAPI |
"""
Reads Classified Module.
This chart shows the proportion of reads in each sample assigned to different groups.
"""
from app.display_modules.display_module import SampleToolDisplayModule
from app.tool_results.reads_classified import ReadsClassifiedResultModule
# Re-export modules
from .models import ReadsClassifi... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | app/display_modules/reads_classified/__init__.py | MetaGenScope/metagenscope-server |
# -*- coding: utf-8 -*-
import six
from flask import Blueprint, jsonify, current_app
from ..utils import MountTree
from .utils import is_testing
api_bp = Blueprint('api', __name__.rsplit('.')[1])
if is_testing():
@api_bp.route('/_hello/')
def api_hello():
return jsonify('api hello')
@api_bp.route(... | [
{
"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 | mlcomp/board/views/api.py | korepwx/mlcomp |
# encoding: utf-8
# module PySide.QtXml
# from C:\Python27\lib\site-packages\PySide\QtXml.pyd
# by generator 1.147
# no doc
# imports
import Shiboken as __Shiboken
class QXmlDTDHandler(__Shiboken.Object):
# no doc
def errorString(self, *args, **kwargs): # real signature unknown
pass
def notation... | [
{
"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 | resources/dot_PyCharm/system/python_stubs/-762174762/PySide/QtXml/QXmlDTDHandler.py | basepipe/developer_onboarding |
from tempfile import TemporaryDirectory
import numpy as np
from numpy.testing import assert_allclose
from astropy import units as u
from ctapipe.reco.energy_regressor import EnergyRegressor
def test_prepare_model():
cam_id_list = ["FlashCam", "ASTRICam"]
feature_list = {"FlashCam": [[1, 10], [2, 20], [3, 3... | [
{
"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 | ctapipe/reco/tests/test_energy_regressor.py | Pluto9th/ctapipe |
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
import processout
import json
from processout.networking.request import Request
from processout.networking.response import Response
# The content of this file was automatically generated
class InvoiceRisk(object):
... | [
{
"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 | processout/invoicerisk.py | processout/processout-python |
class LeapYearFinder(object):
def __init__(self):
pass
def findLeapYear(self, startYear, endYear):
leapYearRecord = []
for i in range(int(startYear),int(endYear)):
year = i
print(year,end = "\t")
#If year is divisible by 4... | [
{
"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 | LeapYearFinderClass.py | MichaelWiciak/LeapYearFinderClass |
# Static variables are class level variables
# Static variables are always referenced by class name
# Local variables are local to methods
class Student:
school = 'PQR' #Static variable
def __init__(self,name,roll,section):
super().__init__()
self.name = name #Instance variable
self.r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | ObjectOrientedPython/StaticAndLocalVariables.py | dsabhrawal/python-examples |
# content of test_electricity.py
from premise import DATA_DIR
from premise.electricity import Electricity
from premise.data_collection import IAMDataCollection
REGION_MAPPING_FILEPATH = (DATA_DIR / "regionmappingH12.csv")
PRODUCTION_PER_TECH = (DATA_DIR / "electricity" / "electricity_production_volumes_per_tech.csv")
... | [
{
"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 | tests/test_electricity.py | tngTUDOR/premise |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import pymysql
pymysql.install_as_MySQLdb()
class Database:
def __init__(self) -> None:
self.__app = Flask(__name__)
self.__app.config['SQLALCHEMY_DATABASE_URI'] ='mysql://root:admin@ctn-mysql-db/school'
self.__db = SQLAlch... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer":... | 3 | sql-alchemy/sql_alchemy/database.py | ChristopherNothmann-lab/SqlAlchemy |
# Copyright The PyTorch Lightning team.
#
# 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": "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 | flash/graph/classification/cli.py | LoopGlitch26/lightning-flash |
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcornd aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delete the... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | test/functional/feature_abortnode.py | proteanx/Bitcorn-Test |
# Generated by Django 2.1.1 on 2018-09-30 01:34
from django.db import migrations
from django.utils import timezone
def forward(apps, schema_editor):
Operative = apps.get_model('operative', 'Operative')
Order = apps.get_model('consumer', 'Order')
# create placeholder operative
operative = Operative.o... | [
{
"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 | api/src/consumer/migrations/0007_order_base_operative_20180930_0134.py | asermax/msa |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import errno
import os
import shutil
import sys
def Main():
parser = argparse.ArgumentParser(description='Create Mac Framework symlinks')
... | [
{
"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 | build/config/mac/package_framework.py | akbiggs/buildroot |
import src.utils.helper_ab_test as f
def test_report_conversions(df_ab_test, out_report_conversions):
assert (
f.report_conversions(
data=df_ab_test,
group_col="group",
group_filter="control",
convert_col="converted",
page_col="landing_page",
... | [
{
"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/utils/test_helper_ab_test.py | avisionh/abtest |
#LetterFrequency.py
#This program will create a CSV file of frequencies based on a text file.
#Use Excel or similar spreadsheet software to visualize the frequencies of the CSV file.
import os
def countLetters(message):
dir_path = os.path.dirname(os.path.realpath(__file__))
os.chdir(dir_path)
alpha = "AB... | [
{
"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 | doc/CyberSecurity/Classic_Cryptography/code/LetterFrequency.py | tanducmai/.dotfiles |
class Pesan:
def __init__(self):
print("Ini class Order")
def setOrder(self, noPesan, tglPesan, checkIn, checkOut, bykTamu):
Pesan.nomorPesanan = noPesan
Pesan.tanggalPesan = tglPesan
Pesan.tanggalMasuk = checkIn
Pesan.tanggalKeluar = checkOut
Pesan.jumlahTamu = ... | [
{
"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 | novice/01-03/kasus/pesanHotel.py | mailoa-ev/NLP-zimera |
#!/usr/bin/env python3
########################################################################
# Filename : I2CLCD1602.py
# Description : Use the LCD display data
# Author : freenove
# modification: 2018/08/03
########################################################################
from PCF8574 import PCF8574_... | [
{
"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 | I2CLCD1602.py | vito-royeca/gpio-tutorials |
from alembic_utils.pg_function import PGFunction
from alembic_utils.replaceable_entity import register_entities, registry
from alembic_utils.testbase import run_alembic_command
def to_upper():
return PGFunction(
schema="public",
signature="to_upper(some_text text)",
definition="""
... | [
{
"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 | src/test/test_duplicate_registration.py | FlyrInc/alembic_utils |
import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('categories', [
['b', 'a', 'c'],
['a', 'b', 'c', 'd'],
])
def test_factorize(categories, ordered):
cat = pd.Categorical(['b', 'b', 'a', 'c', No... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | pandas/tests/categorical/test_algos.py | stillmatic/pandas |
import django_filters.rest_framework as filters
from rest_framework import generics
from rest_framework.pagination import CursorPagination
from rest_framework.permissions import IsAuthenticated
from .models import AuditLog
from .serializers import AuditLogSerializer
class ActionAtCursorPagination(CursorPagination):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | audit/views.py | praekelt/seed-control-interface-service |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.