source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# error if not grade for a student
# OPTION 2: change the policy
def get_stats(class_list):
new_stats = []
for item in class_list:
new_stats.append([item[0], item[1], avg(item[1])])
return new_stats
def avg(grades):
try:
return sum(grades)/len(grades)
except ZeroDivisionError:
... | [
{
"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 | 01_week4_exceptions_testing_debugging/get_stats2.py | shellytang/intro-cs-python |
import unittest
from config import Config
class CommitteeTestCase(unittest.TestCase):
def testCreateCommittee(self):
params = {
"url": " ",
"account": "1.2.25"
}
gph = Config().gph
try:
print("CreateCommittee:", gph.committee_member_create(**par... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/unittest/committee_test.py | Cocos-BCX/Python-Middleware |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from pprint import pprint
class UserSerializer(serializers.ModelSerializer):
"""serializer for the users object"""
class Meta:
mode... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
}... | 3 | app/user/serializers.py | madisonalgo/recipe-app-api |
# Copyright 2010 New Relic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
{
"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 | newrelic/core/graphql_utils.py | newrelic/newrelic-python-agen |
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""Fail functions because called from wrong mode test for vimiv's test suite."""
from unittest import main
from vimiv_testcase import VimivTestCase
class FailingModeTest(VimivTestCase):
"""Failing Mode Tests."""
@classmethod
def setUpClass(cls):
... | [
{
"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 | tests/invalid_mode_test.py | karlch/vimiv |
# -*- coding: utf8 -*-
from flask import Flask, request, session, url_for, redirect, \
render_template, abort, g, flash, send_from_directory, \
jsonify, Response
from elasticsearch import Elasticsearch
import logging
import logging.config
# site config
DEBUG = True
HOST = '0.0.0.0'
PORT = 50407
ES_HOST = 'l... | [
{
"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 | server.py | focusheart/ancientbooksearch |
import re
from django import template
from django.template.loader import render_to_string
register = template.Library()
admin_re = re.compile(r'^admin\/')
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the a... | [
{
"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 | base/site-packages/mobileadmin/templatetags/mobile_admin_modify.py | edisonlz/fastor |
from find_the_odd_int import find_it
class TestFindIt:
def test_0(self):
assert find_it([20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]) == 5
def test_1(self):
assert find_it([1,1,2,-2,5,2,4,4,-1,-2,5]) == -1
def test_2(self):
assert find_it([20,1,1,2,2,3,3,5,5,4,20,4,5]) == 5
def... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | python/kyu-6/find-the-odd-int/test_find_the_odd_int.py | ledwindra/codewars |
import json
import hashlib
from tornado import httpclient as hc
from tornado import gen
from graphite_beacon.handlers import LOGGER, AbstractHandler
class PagerdutyHandler(AbstractHandler):
name = 'pagerduty'
# Default options
defaults = {
'subdomain': None,
'apitoken': None,
'... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | graphite_beacon/handlers/pagerduty.py | z1nkum/graphite-beacon |
"""
Python wrapper for libui.
"""
import ctypes
from . import clibui
class uiCombobox(ctypes.Structure):
"""Wrapper for the uiCombobox C struct."""
pass
def uiComboboxPointer(obj):
"""
Casts an object to uiCombobox pointer type.
:param obj: a generic object
:return: uiCombobox
"""
... | [
{
"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 | pylibui/libui/combobox.py | superzazu/pylibui |
from pylab import *
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
from image_source_reverb.shapes import equilateral_triangle
# TODO: Improve
def gaussian_point_source_2D(t, r, tightness=50):
"""
A somewhat close approximation to the 2D Wave Equation with gaussian initial cond... | [
{
"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 | demos/triangular_drum.py | frostburn/image-source-reverb |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Contains tests for accessing environment variables as a float.
import pytest
from djangokeys.core.djangokeys import DjangoKeys
from djangokeys.exceptions import EnvironmentVariableNotFound
from djangokeys.exceptions import ValueIsEmpty
from djangokeys.exceptions impor... | [
{
"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 | tests/djangokeys/core/djangokeys/test_float.py | alanverresen/django-keys |
from . import session_api
import tornado.gen
@session_api(direct=True)
async def sleep(delay, handler=None):
await tornado.gen.sleep(delay)
@session_api(direct=True)
async def moment(handler=None):
await tornado.gen.moment
| [
{
"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 | exec/api/session/common.py | 0x55AAh/anthill_gaming |
from emonitor.utils import Module
from emonitor.extensions import babel
from .content_frontend import getFrontendContent, getFrontendData
class LocationsModule(Module):
info = dict(area=['frontend'], name='locations', path='locations', icon='fa-code-fork', version='0.1')
def __repr__(self):
return "l... | [
{
"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 | emonitor/modules/locations/__init__.py | Durburz/eMonitor |
# -*- coding: utf-8 -*-
# app.py
from flask import Flask, request, render_template
import pickle
import gzip
import numpy as np
import AiPoems
#start up cell -- import necessary metadata for model
with open('tokenizer.pickle', 'rb') as handle:
tokenizer = pickle.load(handle)
with gzip.GzipFile('predictors.npy.gz'... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | app.py | keklarup/POET_AiPoetry |
from pathlib import PurePath
import os.path
import glob
from trivia import trivia_questions
from discord.ext import commands
from trivia.trivia_manager import TriviaManager
TOKEN = os.environ.get('DISCORD_TOKEN')
bot_name = "Temflix"
custom_commands = ["find", "commands", "popular", "findactor", "findactress", "findmo... | [
{
"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 | temflix.py | teSill/temflix |
'''
'''
from .point import ColinearPoints
class Polygon:
def __contains__(self, point):
try:
r = [p.is_ccw(q, point) for p, q in self.edges]
except ColinearPoints:
return True
return not (any(r) and not all(r))
@property
def edges(self):
if len(... | [
{
"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 | src/geometry3/polygon.py | JnyJny/Geometry3 |
class Solution:
def checkValid(self, matrix: List[List[int]]) -> bool:
"""
XOR solution
Complexities:
Time O(N^2)
Space O(1)
"""
n = len(matrix)
xored = 0
for i in range(1, n+1):
xored ^= i
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | 2133-check-if-every-row-and-column-contains-all-numbers/2133-check-if-every-row-and-column-contains-all-numbers.py | jurayev/data-structures-algorithms-solutions |
def fatorial(n):
f = 1
for c in range(1, (n+1)):
f *= c
return f
def dobro(n2):
return n2 * 2
def triplo(n3):
return n3 * 3
| [
{
"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 | Python/Curos_Python_curemvid/Uteis/__init__.py | Jhonattan-rocha/Meus-primeiros-programas |
"""
Module: 'io' on esp32_LoBo
MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.24', version='ESP32_LoBo_v3.2.24 on 2018-09-06', machine='ESP32 board with ESP32')
Stubber: 1.0.0
"""
class BufferedWriter:
''
def flush():
pass
def write():
pass
class BytesIO:
''
def ... | [
{
"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 | stubs/loboris-esp32_lobo-3_2_24/io.py | RonaldHiemstra/micropython-stubs |
#!/usr/bin/env python2
import rospy
from geometry_msgs.msg import Twist
import numpy as np
class FlowerTurtle:
""" Use numpy to draw a flower."""
def __init__(self):
pass
def draw_flower(self):
count = 0
times = 1
while not rospy.is_shutdown():
# Use numpy for trig operations.
cou... | [
{
"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/rpal_ros_test/src/singleflower.py | wbthomason-robotics/ros-test |
import pytest
from bencode import decode_int, decode_str, decode_lst
class TestClass:
def test_int(self):
bencode = [b'i42e', b'i-42e', b'i238327832e']
real = [42, -42, 238327832]
for (bencode, real) in list(zip(bencode, real)):
assert decode_int(bencode, 0)[0] == ... | [
{
"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_class.py | lewisrobbins/Bencode |
# @pytest.mark.parametrize(参数名, [参数值 1,参数值 2,....])
# def test_xxx(self, 参数名)
# @pytest.mark.parametrize( [参数名1,参数名2,...], [ (参数值 1,参数值 2), (参数值 3,参数值 4),...])
# def test_yyy(self, 参数名1,参数名2,...)
import pytest
@pytest.mark.parametrize('a', [1, 2, 3])
def test_1(a):
print(a)
print('test 1')
@pytest.mark.p... | [
{
"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 | 测试/pytest-codes/test_mark_parametrize.py | hhyluor/Code_Repository- |
# Following is the implementation of RSA Encryption and Decryption Algorithm
# Input any number as plaintext
# The public and private keys change everytime as we generate random prime numbers everytime
# Eg:
# Enter message to encrypt: 234
# Public Key: e = 4205, n = 23213
# Private Key: d = 8297, n = 23213
# Ciphertex... | [
{
"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 | Python/rsa-encrypt-decrypt.py | astro-ravi/Hacktoberfest2021-1 |
import sys
sys.path.append('..')
from collections import UserString
from emrap.common import Cacheable, Sortable, \
SortedUniqueContainer, ReverseOrderedContainer, \
ReverseOrderedUniqueContainer
class C(Cacheable):
_holds = list
class S(Sortable, UserString):
@property
def _comparables(self):
... | [
{
"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": true
},
{
... | 3 | tests/test_common.py | aayla-secura/eMRaP |
class Node:
"""Create a Node object"""
def __init__(self, val, next=None):
"""Constructor for the Node object"""
self.val = val
self._next = next
def __repr__(self):
return '{val}'.format(val=self.val)
def __str__(self):
return self.__repr__
| [
{
"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 | interviews/is_palindrome/node.py | zarkle/data-structures-and-algorithms |
import pathlib
import subprocess
import pytest
from setuptools import sandbox
from pysen.path import change_dir
TARGET_EXAMPLE = "sync_cmdclass_pyproject"
@pytest.mark.examples
def test_cli_run(example_dir: pathlib.Path) -> None:
target = example_dir / TARGET_EXAMPLE
with change_dir(target):
subpro... | [
{
"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 | tests/example_tests/test_sync_cmdclass_pyproject.py | linshoK/pysen |
from newton.rules.rule import Rule
from newton.exchange.action import Action
from newton.exchange.currency_pairs import CurrencyPair
class Entry(Rule):
def __init__(self, currency_pair, amount, action='bid', name=None):
self.currency_pair = CurrencyPair(currency_pair)
self.amount = amount
... | [
{
"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 | newton/rules/entry/base.py | thermo2nd/newton_old |
import json
import os
def write_to_file(file_path, value):
"""
Write value to file.
"""
directory = os.path.dirname(file_path)
os.makedirs(directory, exist_ok=True)
if not isinstance(value, str):
value = str(value)
fout = open(file_path, "w")
fout.write(value + "\n")
fout.c... | [
{
"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 | chexnet/utils.py | simran-arora/emmental-tutorials |
from typing import Sequence
import numpy as np
import xarray
from xarray import DataArray
from xclim.indices.run_length import rle_1d
def get_longest_run_start_index(
arr: DataArray,
window: int = 1,
dim: str = "time",
) -> DataArray:
return xarray.apply_ufunc(
get_index_of_longest_run,
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | icclim/user_indices/stat.py | larsbarring/icclim |
import pytest
from django.contrib.auth import get_user_model
from .models import Category
@pytest.fixture(autouse=True)
def tenants():
User = get_user_model()
User.objects.create(username='John')
User.objects.create(username='Mary')
return User.objects.all()
@pytest.fixture(autouse=True)
def categ... | [
{
"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 | tests/conftest.py | fp4code/django-entangled |
# Copyright 2013 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
{
"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 | tests/v2/test_client.py | alexpilotti/python-glanceclient |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for the `drf-rw-serializers` viewsets module.
"""
from __future__ import absolute_import, unicode_literals
from django.utils import version as django_version
from model_mommy import mommy
from test_utils.base_tests import (
BaseTestCase, TestListRequestSucc... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | tests/test_viewsets.py | wwnbb/drf-rw-serializers |
from fontTools.misc.eexec import decrypt, encrypt
def test_decrypt():
testStr = b"\0\0asdadads asds\265"
decryptedStr, R = decrypt(testStr, 12321)
assert decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\x1a<6\xa1'
assert R == 36142
def test_encrypt():
testStr = b'0d\nh\x15\xe8\xc4\xb2\x15\x1... | [
{
"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 | Tests/misc/eexec_test.py | odidev/fonttools |
from abc import abstractmethod
from matplotlib import pyplot as plt
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from qtpy import QtWidgets
from solarviewer.config.base import Viewer, DataModel
from solarviewer.ui.plo... | [
{
"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 | solarviewer/app/plot.py | RobertJaro/qt-solar-viewer |
from scrapy.spider import BaseSpider
class InitSpider(BaseSpider):
"""Base Spider with initialization facilities"""
def __init__(self, *a, **kw):
super(InitSpider, self).__init__(*a, **kw)
self._postinit_reqs = []
self._init_complete = False
self._init_started = False
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | scrapy/contrib/spiders/init.py | emschorsch/scrapy |
'''
48. Rotate Image Medium
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
'''
class Solution:
def rotate(... | [
{
"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 | leetcode/48_Rotate_Image.py | PhillipLeeHub/algorithm-and-data-structure |
import traceback
from pathlib import Path
import cv2
import fire
import pandas as pd
from tqdm.contrib.concurrent import thread_map
from manga_ocr_dev.env import FONTS_ROOT, DATA_SYNTHETIC_ROOT
from manga_ocr_dev.synthetic_data_generator.generator import SyntheticDataGenerator
generator = SyntheticDataGenerator()
... | [
{
"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 | manga_ocr_dev/synthetic_data_generator/run_generate.py | srt19/manga-ocr |
"""Update ip pool API method."""
from ibsng.handler.handler import Handler
class updateIPpool(Handler):
"""Update ip pool method class."""
def control(self):
"""Validate inputs after method setup.
:return: None
:rtype: None
"""
self.is_valid(self.ippool_id, int)
... | [
{
"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 | ibsng/handler/ippool/update_i_ppool.py | ParspooyeshFanavar/pyibsng |
import rl
from core import do_one, exhaust, switch
from traverse import top_down
def subs(d, **kwargs):
""" Full simultaneous exact substitution
Example
=======
>>> from sympy.strategies.tools import subs
>>> from sympy import Basic
>>> mapping = {1: 4, 4: 1, Basic(5): Basic(6, 7)}
>>> ex... | [
{
"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 | sympy/strategies/tools.py | eriknw/sympy |
from __future__ import absolute_import, print_function, division
from .scala_kernel import SpylonKernel
from .scala_magic import ScalaMagic
from .init_spark_magic import InitSparkMagic
from .scala_interpreter import get_scala_interpreter
def register_ipython_magics():
"""For usage within ipykernel.
This wil... | [
{
"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 | spylon_kernel/__init__.py | Gr4vi7y/spylon-kernel |
# Stdlib
import inspect
# Sayonika Internals
from framework.objects import logger
from framework.route import Route
from framework.sayonika import Sayonika
__all__ = ("RouteCog",)
class RouteCog:
"""
Similar to a discord.py cog, this holds several routes with unified concept
"""
def __init__(self, ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | framework/routecog.py | martmists/server |
import pytest
import connaisseur.validators.interface as vi
def test_init():
assert vi.ValidatorInterface("")
@pytest.mark.asyncio
async def test_validate():
with pytest.raises(NotImplementedError):
assert await vi.ValidatorInterface("").validate(None)
def test_healthy():
with pytest.raises(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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/validators/test_interface.py | funkypenguin/connaisseur |
from concurrent.futures import ProcessPoolExecutor
import math
import random
AMOUNT_OF_MATHS = 8
MAX_WORKERS = 8
def do_maths():
for i in range(random.randint(1000000, 3000000)):
final_sqrt = math.sqrt(i)
return final_sqrt
def main():
# Context manager defaults to waiting for all procs to comp... | [
{
"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 | day4/concurrency/collateral/context_manager.py | twin-bridges/pyplus-ons |
import wx
from wx.tools.img2py import img2py
import sys, os
class myImg2py(object):
def __init__(self):
pass
def start(self):
imgFolderPath = os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), 'img')
fileLists = os.listdir(imgFolderPath)
for file in fil... | [
{
"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 | utils/img2py.py | zephyr-fun/easy_comtool |
from . import values
class UndefinedValue(Exception):
"""Raised when a value is not defined."""
class Invalid(Exception):
"""Raised when a validator failed."""
class InvalidValue(Invalid):
"""Raised when a type is not as expected."""
def __init__(self, node, msg=None, **kwargs):
super(... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},... | 3 | src/objective/exc.py | diefans/objective |
import os
import requests
from bs4 import BeautifulSoup
from core.providers.base import MusicProvider
SOUNDCLOUD_CLIENT_ID = os.environ.get('SOUNDCLOUD_CLIENT_ID')
class SoundCloud(MusicProvider):
NAME = 'SoundCloud'
_MUSIC_URL = 'https://soundcloud.com/{}/{}'
def get_music_name(self, url):
so... | [
{
"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 | core/providers/soundcloud.py | telegrambotdev/music-share-bot |
import math
import unittest
def get_line(arr, x, y, ln, dx, dy):
ret = []
for i in range(ln):
ret.append(arr[x][y])
x = x + dx
y = y + dy
return ret
def get_square(arr, x, y, ln):
if ln == 0:
return []
if ln == 1:
return [arr[x][y]]
ret = []
ret.... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | spiral.py | vimithamanohar/practice |
from typing import List
import strawberry
from api.pretix.query import get_user_orders, get_user_tickets
from api.pretix.types import AttendeeTicket, PretixOrder
from api.submissions.types import Submission
from conferences.models import Conference
from submissions.models import Submission as SubmissionModel
@straw... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | backend/api/users/types.py | patrick91/pycon |
import attr
@attr.s(cmp=False, repr=False)
class LogicalClock:
"""
A basic clock implementation supporting getters and increment methods.
"""
_time: int = attr.ib(init=False)
def __attrs_post_init__(self):
self.reset()
def reset(self, init_time: int = 0):
self._time = init_ti... | [
{
"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 | databutler/pat/analysis/clock.py | rbavishi/databutler |
class C(object):
def __enter__(self):
return self
class D(C):
def foo(self):
pass
with D() as cm:
cm.foo() # pass
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | python/testData/inspections/PyUnresolvedReferencesInspection/contextManagerSubclass.py | truthiswill/intellij-community |
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
import numpy as np
from niapy.task import StoppingTask
from niapy.problems import Problem
from niapy.algorithms.basic import ParticleSwarmAlgorithm
cla... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | examples/custom_problem.py | eltociear/NiaPy |
from os import environ, path
from collections import namedtuple
from json import load
MySQLConfig = namedtuple('MySQLConfig', 'host port user password db')
AppConfig = namedtuple('AppConfig', 'host port')
def read_mysql_config():
return MySQLConfig(
host=environ['MSQL_HOST'],
port=int(environ['MS... | [
{
"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 | kiwi-random/kiwi/config.py | bubblegumsoldier/kiwi |
import os
import sys
from platon_keys import keys
from platon_utils.curried import keccak, text_if_str, to_bytes
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def gen_node_keypair(extra_entropy=''):
extra_key_bytes = text_if_str(to_bytes, extra_entropy)
key_bytes = keccak(os.urandom(32) + extra_key_... | [
{
"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 | platon_env/utils/key/keytool.py | shinnng/platon-env |
import geoopt
import torch
import pytest
@pytest.mark.parametrize(
"line_search_params",
[dict(), dict(c1=1e-3, c2=0.99), dict(amax=1, amin=1e-12), dict(stabilize=10)],
)
@pytest.mark.parametrize("batch_size", [None, 1, 16])
@pytest.mark.parametrize("line_search_method", ["armijo", "wolfe"])
@pytest.mark.para... | [
{
"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 | tests/test_rlinesearch.py | tao-harald/geoopt |
horasextra = int(input("¿Cuantas horas extra has trabajado? "))
horas = horasextra + 35 #elminimo
extra = 0
sueldo = 0
class trabajo:
def __init__(self, horasextra, horas, extra, sueldo): #defino el constructor
self.horasextra = horasextra
self.horas = horas
self.extra = extra
self.s... | [
{
"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 | ej11.py | joseluis031/Introducci-n-a-la-algor-tmica |
import TestConstants
from generator.ExpressionParser import ExpressionParser
import unittest
class TestExpressionParser(unittest.TestCase):
# Test to verify the minute functionality & */multiple expression check.
def test_valid_minute_parsing(self):
expressionParser = ExpressionParser(TestConstants.V... | [
{
"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/TestExpressionParser.py | imrushabh/cronjob-expression-parser |
#!/usr/bin/env python3
"""
Model representation of a docXRefSectType from doxygen
<xsd:complexType name="docXRefSectType">
<xsd:sequence>
<xsd:element name="xreftitle" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="xrefdescription" type="descriptionType" />
</xsd:sequence>
<x... | [
{
"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 | doxyparser/compound/types/docxrefsect.py | cobhimself/doxyparser |
#!/usr/bin/env python3
from flask import Flask, render_template, request
from werkzeug import secure_filename
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/upload', methods=['POST'])
def upload():
if request.method == 'POST':
f = request.files.get... | [
{
"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 | flask/server.py | graykode/kubernetes-glusterfs-aws |
"""
0744. Find Smallest Letter Greater Than Target
Easy
Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target.
Letters also wrap around. For example, if the target is target = 'z' and let... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | Algorithms_easy/0744. Find Smallest Letter Greater Than Target.py | VinceW0/Leetcode_Python_solutions |
# coding:utf-8
class RestartRequestedMessage(object):
def __init__(self, cg):
self.cg = cg
class RestartCompleteMessage(object):
def __init__(self, cg):
self.cg = cg
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | captain_comeback/restart/messages.py | waldo2590/captain-comeback |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1, s, t 2, s, t 3, s, t 4, s, t 5.1, s, t 5.5, s, q"
tags = "loop"
impor... | [
{
"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 | test/test_loop.py | East196/hello-cocos2d |
from .utils import (
buildMenuOptions,
getPrompt,
removeTrailSlash,
createNewSessionId,
cloneStrategyRepository,
cleanWorkspace,
replaceAll,
prepareWorkspace,
isBinAvailableInPath,
)
from os import path
def test_prepareWorkspace():
sessionUuid = createNewSessionId()
prepar... | [
{
"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 | ocpeasy/utils_test.py | ocpeasy/ocpeasy |
import time
from click import argument, option
from flask.cli import AppGroup
from flask_migrate import stamp
import sqlalchemy
from sqlalchemy.exc import DatabaseError
from sqlalchemy.sql import select
from sqlalchemy_utils.types.encrypted.encrypted_type import FernetEngine
manager = AppGroup(help="Manage the 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 | backend/cli/database.py | XiaoYang1127/flask-server-in-python |
class NewsSource:
'''
News Source class to define News Source Objects
'''
def __init__(self,id,name,description,url,category,country):
self.id =id
self.name = name
self.description = description
self.url = url
self.category = category
self.country = count... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | app/models.py | Roychela/News-highlight |
import logging
import os
from functools import wraps
from timeit import default_timer as timer
def setup_logs(save_file):
## initialize logger
logger = logging.getLogger("HomeCredit")
logger.setLevel(logging.INFO)
## create the logging file handler
fh = logging.FileHandler(save_file)
## create the loggin... | [
{
"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 | src/instrumentation.py | mratsim/home-credit-default-risk |
from importlib import import_module
from django.db.models.signals import post_migrate
from django.apps import AppConfig
def default_data_setup(sender, **kwargs):
from django.contrib.auth.models import User
try:
anon = User.objects.get(username='ANONYMOUS_USER')
except User.DoesNotExist:
pr... | [
{
"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 | radio/apps.py | MaxwellDPS/trunk-player |
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm, tqdm_notebook
from ml_metrics import auc
from sklearn.datasets import make_classification
class LogsticRegression(nn.Module):
def __init__(self, in_dim, n_class):
super().__init__()
self.fc1 = nn.Linear(in_di... | [
{
"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 | models/lr.py | Jie-Yuan/Torchappy |
from solvers.utils import *
class CaveSolver(AbstractSolver):
def __init__(self, pzprv3):
matched = match('pzprv3/cave/(\\d+)/(\\d+)/(.*)/', pzprv3)
self.height = int(matched.group(1))
self.width = int(matched.group(2))
self.grid = parse_table(matched.group(3))[:self.height]
... | [
{
"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 | solvers/cave.py | kevinychen/nikoli-puzzle-solver |
import os
RED = 31
GREEN = 32
BLUE = 34
MAGENTA = 35
def color(code, string):
return '\033[' + str(code) + 'm' + string + '\033[0m'
def display_path(path):
return color(MAGENTA, path)
def colon():
return color(BLUE, ':')
EXCLUDE_DIRS = ['.git', '.vagrant']
def project_path():
# One dirname fo... | [
{
"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 | tests/util.py | ecoal95/saltfs |
import requests
from typing import Optional
from pydantic import Field
from dbt_cloud.command.command import DbtCloudAccountCommand
class DbtCloudJobListCommand(DbtCloudAccountCommand):
"""Returns a list of jobs in the account."""
order_by: Optional[str] = Field(
description="Field to order the resul... | [
{
"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 | dbt_cloud/command/job/list.py | jeremyyeo/dbt-cloud-cli |
from flask import Flask, render_template
app = Flask(__name__, static_url_path="/static")
navigation = [
("Home", "/"),
("CV", "/cv"),
("Projects", "/projects"),
];
def page(name: str):
with open(f"pages/{name}.html") as f:
content = f.read()
kwargs = {
"content": conte... | [
{
"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 | app.py | EMattfolk/mattfolk.xyz |
"""
1D Histogram renderer
Configuration options:
title: histogram title (top of plot)
xlabel: x axis label
ylabel: y axis label
filename: output filename, with fields
{0} renderer name
{1} count index, starting from 0
{2} burst_id from update data (default 0 if no suc... | [
{
"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 | snewpdag/plugins/renderers/Histogram1D.py | dallaval5u/snewpdag |
import json
import urllib.request
class GoogleGeocodeAPI:
def __init__(self, api_key):
self.API_KEY = api_key
self.url = "https://maps.googleapis.com/maps/api/geocode/json"
def get_geocode(self, latitude, longitude):
url = f'{self.url}?latlng={latitude},{longitude}'
return sel... | [
{
"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 | geo_coding_platform_test/apps/geocoding/utils.py | saduqz/geo-coding-platform-test |
from pybulletgym.envs.roboschool.envs.locomotion.humanoid_env import HumanoidBulletEnv
from pybulletgym.envs.roboschool.robots.locomotors import HumanoidFlagrun, HumanoidFlagrunHarder
class HumanoidFlagrunBulletEnv(HumanoidBulletEnv):
random_yaw = True
def __init__(self):
self.robot = HumanoidFlagrun... | [
{
"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 | pybullet-gym/pybulletgym/envs/roboschool/envs/locomotion/humanoid_flagrun_env.py | SmaleZ/vcl_diayn |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import
## batteries
import os
import sys
import pytest
## 3rd party
import pandas as pd
## package
from pyTecanFluent import Utils
# data dir
test_dir = os.path.join(os.path.dirname(__file__))
data_dir = os.path.join(test_dir, 'data')
# tests
def test_make_range():
... | [
{
"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/test_Utils.py | leylabmpi/pyTecanFluent |
import random
class Solution:
def __init__(self, head: ListNode):
"""
@param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains at least one node.
"""
self.head = head
def getRandom(self) -> int:
"""
Re... | [
{
"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 | December Month Challenge/2LinkedListRandomNodeReservoirSampling.py | adesh-gadge/LeetCodePractice |
# Owner(s): ["oncall: aiacc"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
from torch.testing._internal.common_fx2trt import AccTestCase, InputTensorSpec
from torch.testing._internal.common_utils import run_tests
class TestBatchNormConverter(AccTestCase):
def test_batchnorm(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": false... | 3 | test/fx2trt/converters/acc_op/test_batchnorm.py | steffenerickson/pytorch |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
{
"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 | imperative/python/megengine/module/dropout.py | Neutron3529/MegEngine |
from dataclasses import dataclass
from dechainy.plugins import Probe
from dechainy.ebpf import EbpfCompiler
@dataclass
class Valid(Probe):
def __post_init__(self):
self.ingress.required = True
self.ingress.cflags.append("-DCUSTOM_VARIABLE=0")
self.egress.required = False
super().... | [
{
"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 | tests/dumb_plugins/valid/__init__.py | dechainers/dechainy |
from flask import Flask, escape, request
from flask import send_file
from Graph.plot import Plot
app = Flask(__name__)
@app.route('/', methods=["POST"])
def hello():
print(request.method)
req_data= request.get_json()
print(req_data)
name = request.args.get("name", "World")
return f'Hello, {escape(name)... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | server.py | serchrod/PlotWebService |
import nuke
elements = []
def getElements(layer):
for element in layer:
if isinstance(element, nuke.rotopaint.Layer):
getElements(element)
elif isinstance(element, nuke.rotopaint.Stroke) or isinstance(element, nuke.rotopaint.Shape):
elements.append(element)
return e... | [
{
"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 | _mod_Community/mod_autolife.py | tianlunjiang/_NukeStudio_v2 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
import pyre
class ifac(pyre.protocol, family="deferred.ifac"):
"""sample protocol"""
@classmethod
def pyre_default(cls, **kwds): return comp
class comp(pyre.component, family="defer... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tests/pyre/components/component_instance_binding_deferred.py | lijun99/pyre |
from flask_sqlalchemy import SQLAlchemy
from pyhive import sqlalchemy_presto
from rating.api import config
import sqlalchemy
from sqlalchemy import create_engine
def setup_database(app):
db.init_app(app)
def presto_engine():
sqlalchemy.dialects.presto = sqlalchemy_presto
presto_database_uri = config.... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | src/rating/api/db.py | alterway/rating-api |
# Paolo Vega
# SQLAlchemy Challenge
# Bootcamp
# Versión 1.0.0 May-24-2020
# Versión 1.0.1 May-24-2020
# Versión 1.0.2 May-24-2020
#################################################
# Import Modules
#################################################
from flask import Flask
from flask import render_template
from flask ... | [
{
"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 | web_app.py | palolo02/web-scraping-challenge |
import sys
import os
from qtpy.QtWidgets import QApplication
from bioimageit_framework.theme import BiThemeAccess, BiThemeSheets
from bioimageit_framework.widgets import BiWidget, BiTable, showInfoBox
class MyExampleTable(BiWidget):
"""Create a table with an open button in the first row
Parameters
-----... | [
{
"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 | examples/table_button.py | bioimageit/bioimageit_framework |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division
import logging
log = logging.getLogger("forecast")
has_pywapi = False
try:
import pywapi
has_pywapi = True
except:
log.error("Error loading library pywapi. Library not found.")
def fahrenheit_to_celcius(f):
r... | [
{
"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 | pyfibot/modules/available/module_forecast.py | fgeek/pyfibot |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-qualitycheck/aliyunsdkqualitycheck/request/v20190115/DelThesaurusForApiRequest.py | leafcoder/aliyun-openapi-python-sdk |
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
@pytest.fixture(scope="session")
def driver(request):
wd=webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_admin_log... | [
{
"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 | test_example.py | kaapitoshka/AntonStudy |
from srcgen.basic import *
def test_Word():
w = Word('hey')
assert w.realize()=='hey'
def test_Line():
l = Line()
assert l.realize()==''
l.add('hey')
assert l.realize()=='hey'
l.add(' you')
assert l.realize()=='hey you'
l.restore()
assert l.realize()==''
l.add(['hei ','you... | [
{
"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 | srcgen/tests/test_basic.py | pemryan/f2py |
import pytest
from openapi_tester.case_checks import is_camel_case
from openapi_tester.exceptions import SpecificationError
camel_case_test_data = [
{'incorrect': 'snake_case', 'correct': 'snakeCase'},
{'incorrect': 'PascalCase', 'correct': 'pascalCase'},
{'incorrect': 'kebab-case', 'correct': 'kebabCase'... | [
{
"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/unit/test_camel_case.py | MissiaL/openapi-tester |
from proso.rand import roulette
import abc
import random
class Strategy(metaclass=abc.ABCMeta):
@abc.abstractmethod
def assign_setups(self, user_id, setups_by_experiment):
pass
class RandomStrategy(Strategy):
def assign_setups(self, user_id, setups_by_experiment):
random.seed(user_id)
... | [
{
"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": false... | 3 | proso_configab/assignment.py | adaptive-learning/proso-apps |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from .models import Post
# Create your views here.
def post_create(request):
return HttpResponse("<h1>Create</h1>")
def post_detail(request, id=None): #retrieve
#instance = Post.objects.get(id=1)
instance = get_object_or_... | [
{
"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/posts/views.py | Sivaraj23/Django |
import discord
from discord.ext import commands
from .emojis import GREEN_TICK, RED_TICK
from .menus import BasicPages, ConfirmView, MenuPages, TablePages
from .utils import reply_to
class Context(commands.Context):
@property
def guild_prefix(self):
return self.bot.guild_prefix(self.guild)
@prop... | [
{
"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 | clam/utils/context.py | Clam-Bot/Clam |
from utils import Compression
class Vertex(object):
def __init__(self, identifier, ctype):
self.id = identifier
self.type = ctype
def compress(self):
return Compression.compress(self)
@staticmethod
def decompress(val):
return Compression.decompress(val)
def __repr... | [
{
"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 | src/vertex.py | lavish205/graph-db |
import pytest
from app.request_schemes.deregister_request_data import DeregisterRequestData
pytestmark = pytest.mark.asyncio
@pytest.mark.usefixtures('unstub')
class TestDeregisterRequestData:
@pytest.mark.parametrize("data", [
{'eventType': ''},
{'eventType': '', 'jobName': ''},
{'event... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | tests/request_schemes/test_deregister_request_data.py | futuresimple/triggear |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#pylint: skip-file
from nose.tools import assert_equal
from iot_message.cryptor.plain import Cryptor
from iot_message.message import Message
__author__ = 'Bartosz Kościów'
import iot_message.factory as factory
class TestCryptorPlain(object):
def setUp(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 | iot_message/tests/test_plain_cryptor.py | bkosciow/python_iot-1 |
from helpers import setup_logger
import requests
import html2text
import pyfiglet
menu_name = "Browser Test" # App name as seen in main menu while using the system
from subprocess import call
from time import sleep
from ui import Menu, TextReader, Printer, MenuExitException, UniversalInput, Refresher, DialogBox, e... | [
{
"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 | apps/browser/main.py | hpagseddy/ZPUI |
from typing import Callable, Dict, Any, Union
import numpy as np
from keanu.vartypes import (numpy_types, tensor_arg_types, runtime_numpy_types, runtime_pandas_types,
runtime_primitive_types, runtime_bool_types, runtime_int_types, runtime_float_types,
primitive_... | [
{
"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 | keanu-python/keanu/infer_type.py | rs992214/keanu |
import torch
import torch.nn.functional as F
def clamp_probs(probs):
eps = torch.finfo(probs.dtype).eps
return torch.clamp(probs, min=eps, max=1-eps)
def concrete_sample(logits, temperature, shape=torch.Size([])):
'''
Sampling for Concrete distribution.
See Eq. 10 of Maddison et al., 2017.
'... | [
{
"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 | selection/layers/utils.py | icc2115/dl-selection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.