source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from collections import Counter
from sklearn.cluster import KMeans
import cv2
sizeX = 600
sizeY = 400
def preprocess(raw):
image = cv2.resize(raw, (sizeX, sizeY), interpolation = cv2.INTER_AREA)
image = image.reshape(image.shape[0]*image.shape[1], 3)
return image
... | [
{
"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 | get_colors.py | ireneferfo/VanGoghColorz |
import threading
import logging
import neopixel
from time import sleep
logger = logging.getLogger(__name__)
class Visualisation(threading.Thread):
def __init__(self, pixels: neopixel.NeoPixel, num_pixels: int):
super().__init__()
self.pixels = pixels
self.num_pixels = num_pixels
... | [
{
"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 | visualisation/visualisation.py | keyz182/LEDServer |
from flask import Blueprint
from dmutils.user import User
from flask_login import login_user
login_for_tests = Blueprint('login_for_tests', __name__)
# Simplified example responses from the API
USERS = {
'123': {
'id': 123,
'name': 'Name',
'emailAddress': 'email@email.com',
'role'... | [
{
"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 | dmtestutils/login.py | alphagov-mirror/digitalmarketplace-test-utils |
"""Test file for searchCommand File"""
from click.testing import CliRunner
from rawsec_cli.cli.cli import cli
rawsec_json = {
"tools": {
"binary_exploitation": {
"tools": [{"name": "tools", "website": "test"}],
},
},
"resources": {
"binary_exploitation": {"resources": [... | [
{
"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/cli/command/test_search_command.py | noraj/rawsec_cli |
from rest_framework import serializers
from profiles_api import models
class UserProfileSerializer(serializers.ModelSerializer):
"""serializes a user profile object"""
class Meta:
model = models.UserProfile
fields = ('id', 'name', 'email', 'password')
extra_kwargs = {
'pas... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | profiles_api/serializers.py | Atique-7/drf-genesis |
class Developer:
def __init__(self,name):
self.name = name
def coding(self):
print(self.name+' is developer!')
class PythonDevloper(Developer):
def coding(self):
print(self.name + ' is Python developer!')
class JavaDevloper(Developer):
def coding(self):
print(self.name... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | Python/python_programming_stu/chapter09_class/9-5.developer_polymorphism.py | min9288/Multicampus |
#! /usr/bin/env python3
# four_to_two is a little script that takes markdown text with 4-space indents on stdin and writes 2-space indented
# markdown on stdout
import math
import re
import sys
BEGINNING_WHITESPACE_RE = re.compile(r'^(\s+)(.*)')
def four_to_two(line):
match = BEGINNING_WHITESPACE_RE.match(line... | [
{
"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 | four_to_two.py | quanticle/markdown_tools |
##########################################################################
# Copyright (c) 2009, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstrasse 6, CH... | [
{
"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 | tools/harness/tests/pmaplookup.py | lambdaxymox/barrelfish |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
class FocalPoint(object):
ALIGNMENT_PERCENTAGES = {
'le... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | thumbor/point.py | mpdude/thumbor |
"""
Docker 操作相关的控制器
add on 2017-11-20 15:59:36
"""
import sys
from subprocess import Popen
from flask import jsonify, request
from buter import Q, ServiceException
from buter.app import dockerBp
from buter.server import docker
@dockerBp.route("/images", methods=['GET', 'POST'])
def images():
"""
docker ima... | [
{
"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 | buter/app/DockerController.py | 0604hx/buter |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..preprocess import WatershedSkullStrip
def test_WatershedSkullStrip_inputs():
input_map = dict(args=dict(argstr='%s',
),
brain_atlas=dict(argstr='-brain_atlas %s',
position=-4,
),
environ=dict(n... | [
{
"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 | nipype/interfaces/freesurfer/tests/test_auto_WatershedSkullStrip.py | HussainAther/nipype |
from rest_framework import serializers
from django.contrib.auth import get_user_model
from .models import CustomUser
User = get_user_model()
class TokenSerializer(serializers.Serializer):
"""
This serializer serializes the token data
"""
access = serializers.CharField(max_length=255)
refresh = se... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | backend/authentication/serializers.py | Zoki92/Calories-Counter |
class Component:
def update(self):
return self
def print_to(self, x, y, media):
return media
| [
{
"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 | actors/components/component.py | Catsuko/Westward |
class Solution(object):
def diffWaysToCompute(self, input):
"""
:type input: str
:rtype: List[int]
"""
def test_diff_ways_to_compute():
s = Solution()
assert [0, 2] == s.diffWaysToCompute("2-1-1")
assert [-34, -14, -10, -10, 10] == s.diffWaysToCompute("2*3-4*5")
| [
{
"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 | python/divide_and_conquer/0241_different_ways_to_add_parentheses.py | linshaoyong/leetcode |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# 歌曲投票
"""
Topic: 找出7号歌曲包揽5项大奖的投票组合
Desc :
云宏歌词比赛投票,总共166人参与投票
每人从1-13编号的歌曲中选5首不同的歌,依次放入1-5号大奖箱中,
最后分别将每个奖箱中得票数最多的那个号码提取出来。
请找出一个组合使得7号歌曲包揽5项大奖的投票组合
"""
__author__ = 'Xiong Neng'
def lucky_seven(rows=166, cols=5, choices=13, lucky=7, start=1):
... | [
{
"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 | algorithms/ch30sample/m14_bestsinger.py | yidao620c/core-algorithm |
from abc import ABC, abstractmethod
from contextlib import contextmanager
from typing import TYPE_CHECKING, Iterator, Optional
if TYPE_CHECKING:
from dvc.fs.ssh import SSHFileSystem
from dvc.types import StrPath
class BaseMachineBackend(ABC):
def __init__(self, tmp_dir: "StrPath", **kwargs):
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | dvc/machine/backend/base.py | lucasalavapena/dvc |
from io import StringIO
import arrow
import mdv
from .cards import *
from .utils import collect_cards, card_markdown
from .. import *
from ..utils import trim_doc
def run_card_simulator(raw=False):
card_groups = {
'Baselines': [
hp_no_invest,
dmg_no_invest,
],
'HP... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer... | 3 | kaori/plugins/gacha/engine/test/card_simulator.py | austinpray/kaori |
class Stack:
#栈的python实现
def __init__(self):
self.items = []
def push(self, item):
#append操作O(1)
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def isEmpty(self):
return self.items == []
def size(self):
return len(self.items)... | [
{
"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 | basic-ADT/stack/stack.py | Touchfl0w/Algorithm-Practices |
from flask import Flask, render_template
from flask_bcrypt import Bcrypt
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_restplus import Api
from app.config import BaseConfig
app = Flask(__name__)
app.config.from_object(BaseConfig)
app.config.from_envvar('APP_CONFIG')
# regis... | [
{
"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 | app/__init__.py | skazi0/car-stats |
'''
Author : @anushkrishnav
Built using : networkx since it is a gold standard for Python DAGs (and other graphs). You can create a networkx directed graph with a list of tuples that represent the graph edges:
'''
import networkx as nx
from matplotlib import pyplot as plt
class DAG:
def __init__(self):
... | [
{
"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 | Python/graphs/Directed_Acyclic_Graph.py | zhcet19/NeoAlgo-1 |
import pytest
from temp import (download_to_file, ensure_datafile, records_from_lines, make_record, make_value, min_spread_record,
min_spread_day_num, parse_header)
def test_download_to_file(tmpdir):
file = tmpdir.join('test.txt')
download_to_file(file.strpath, 'https://httpbin.org/get?testP... | [
{
"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 | python/kata04/test_temp.py | notapresent/codekata |
from django.test import TestCase
from django.urls import reverse
from accounts.factories import UserFactory
from transmittals.factories import create_transmittal
ack_button = '<a id="action-ack-transmittal"'
class TransmittalActionTests(TestCase):
def setUp(self):
self.trs = create_transmittal()
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/transmittals/tests/test_templates.py | PhaseDMS/phase |
#!/usr/bin/env python3
import contextlib
import os
@contextlib.contextmanager
def working_directory(path):
"""A context manager which changes the working directory to the given
path, and then changes it back to its previous value on exit.
"""
prev_cwd = os.getcwd()
os.chdir(path)
try:
... | [
{
"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 | config/build/utils.py | akavel/luna |
"""Top-level gunicorn application for `routemaster serve`."""
from typing import Callable
import gunicorn.app.base
from routemaster.utils import WSGICallable
class GunicornWSGIApplication(gunicorn.app.base.BaseApplication):
"""gunicorn application for routemaster."""
def __init__(
self,
ap... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | routemaster/gunicorn_application.py | thread/routemaster |
import numpy as np
from sklearn.utils.testing import assert_array_almost_equal
from smoothot.projection import projection_simplex
def _projection_simplex(v, z=1):
"""
Old implementation for test and benchmark purposes.
The arguments v and z should be a vector and a scalar, respectively.
"""
n_fea... | [
{
"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 | smoothot/tests/test_projection.py | cptq/smooth-ot |
from django.contrib.auth import get_user_model
from django.test import TestCase
class UsersManagersTests(TestCase):
"""
Test user creation manager
"""
def test_create_user(self):
"""
Creates a new user with email as primary identifier instead of username
"""
User = get... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | api/tests/test_user.py | josayko/SoftDeskAPI |
from django.test import TestCase
from .models import Post, Profile, Location, NeighbourHood, Business
from django.contrib.auth.models import User
# Neighbourhood Model Tests
class NeighbourhoodTestClass(TestCase):
def setUp(self):
# create a location instance
self.location = Location(name='Test L... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": fals... | 3 | neighboor/tests.py | RhonaJoyKe/Neighbourhood |
"""
PrimitivePShape.
Using a PShape to display a custom polygon.
"""
def setup():
size(640, 360, P2D)
smooth()
# First create the shape.
global star
star = createShape()
star.beginShape()
# You can set fill and stroke.
star.fill(102)
star.stroke(255)
star.strokeWeight(2)
... | [
{
"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 | mode/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pyde | timgates42/processing.py |
from __future__ import absolute_import, division, print_function
from .common import Benchmark
import numpy as np
avx_ufuncs = ['sqrt',
'absolute',
'reciprocal',
'square',
'rint',
'floor',
'ceil' ,
'trunc']
stride = [1,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | benchmarks/benchmarks/bench_avx.py | larrybradley/numpy |
from django.forms import BooleanField, ModelForm, ValidationError
from django.utils.translation import gettext_lazy as _
from pretalx.schedule.models import Schedule
class ScheduleReleaseForm(ModelForm):
notify_speakers = BooleanField(
label=_('Notify speakers of changes'), required=False, initial=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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false... | 3 | src/pretalx/orga/forms/schedule.py | xhub/pretalx |
#!/usr/bin/env python
"""
Example of a right prompt. This is an additional prompt that is displayed on
the right side of the terminal. It will be hidden automatically when the input
is long enough to cover the right side of the terminal.
This is similar to RPROMPT is Zsh.
"""
from prompt_toolkit import prompt
from pro... | [
{
"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 | examples/prompts/rprompt.py | gousaiyang/python-prompt-toolkit |
from cefpython3 import cefpython as cef
import sys
import tempfile
from src.interface import get_name
def main():
init_cef()
def init_cef():
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
settings = {'cache_path': tempfile.gettempdir()}
cef.Initialize(settings=settings)
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | src/app.py | moka491/manga-ocr |
"""Generated class for event_audit.json"""
class Audit:
"""Generated schema class"""
def __init__(self):
self.timestamp = None
self.version = None
@staticmethod
def from_dict(source):
if not source:
return None
result = Audit()
result.timestamp = source.get('timestamp')
result.... | [
{
"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 | gencode/python/udmi/schema/event_audit.py | anurag6/udmi |
from common import *
from solution import *
import copy
import sys
import datetime
num_test = 100
true, false = True, False
in_0 = []
in_org_0 = []
out = []
def load_test():
f = open('judge/tests/recover-count-array.txt', 'r')
global in_0, in_org_0
in_0 = read_int_matrix(f)
in_org_0 = copy.deepcopy(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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | judge/python/tests/recover_count_array.py | wangyanxing/fgdsb_judge |
import unittest
from app.models import Comments
class CommentTest(unittest.TestCase):
"""
Test Class to test the behaviour of the Comment class
"""
def setUp(self):
"""
Set up method that will run before every Test
"""
self.comment= Comments(opinion = 'testing testing'... | [
{
"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/testComment.py | jLuseno161/pitches |
import torch
def calculate_topk_accuracy(y_pred, y, k = 4):
with torch.no_grad():
batch_size = y.shape[0]
_, top_pred = y_pred.topk(k, 1)
top_pred = top_pred.t()
correct = top_pred.eq(y.view(1, -1).expand_as(top_pred))
correct_1 = correct[:1].reshape(-1).float().sum(0, keep... | [
{
"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 | utils.py | abhijeetdhupia/WCE-Classification |
# class that's used to open the local wave file, that's generated as spoken answer
import socket
class fileOpener():
def __init__(self):
pass
def openFile(self, uri):
# TODO: set the IP to the one that's currently used by Loomo (find it by accessing Loomo's settings)
LoomoIP = "192.16... | [
{
"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 | mycroft-core-dev/mycroft/fileOpener/__init__.py | edegeyer/masterarbeit |
import threading
import cv2
# src = "http://192.168.0.4:8080/video"
class VideoCaptureThreading:
def __init__(
self,
src="http://192.168.0.4:8080/video", # Enter current the url from ip webcam or enter ) or 1 to use local pc webcam
width=1920,
height=1080):
... | [
{
"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 | OLD_FILES/MultithreadedWebcam.py | rishavnathpati/Realtime-Gesture-Controlled-GUI |
# Copyright 2021 Dynatrace LLC
#
# 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 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_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/util/logging.py | equardo/dynatrace-aws-log-forwarder |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django_autoslugfield.utils import unique_slugify
from django_sample_generator import fields, generator
from .models import Tweet
from accounts.models import User
from common_utils import generator_fields as extra_gen... | [
{
"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 | tweets/generators.py | lesspointless/Shakal-NG |
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
import json
import random
import math
import time
import ssl
config_mqtt_broker_ip = "iot.fh-muenster.de"
config_mqtt_client_id = "dummy-receiver-" + str(random.randint(1000, 9999));
config_mqtt_topic = "sensor/60:01:94:4A:AF:7A"
ts_last_message = int(round(... | [
{
"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/Simple-Sender-Receiver/receiver-tls.py | nplab/IOT-Project |
from django.db import transaction
from rest_framework.serializers import ModelSerializer
from galaxy_api.api import models
class NamespaceLinkSerializer(ModelSerializer):
class Meta:
model = models.NamespaceLink
fields = ('name', 'url')
class NamespaceSerializer(ModelSerializer):
links = N... | [
{
"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 | galaxy_api/api/v3/serializers/namespace.py | newswangerd/galaxy-api |
"""Filters for Zinnia admin"""
from django.db.models import Count
from django.utils.encoding import smart_text
from django.contrib.admin import SimpleListFilter
from django.utils.translation import ungettext_lazy
from django.utils.translation import ugettext_lazy as _
from zinnia.models.author import Author
from zinni... | [
{
"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 | zinnia/admin/filters.py | mcfletch/django-blog-zinnia |
"""Add downloads and followers to Mod
Revision ID: 1ef399cbd2b
Revises: 29cdccab86f
Create Date: 2014-06-11 17:10:26.480478
"""
# revision identifiers, used by Alembic.
revision = '1ef399cbd2b'
down_revision = '29cdccab86f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto genera... | [
{
"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 | alembic/versions/1ef399cbd2b_add_downloads_and_followers_to_mod.py | toadicus/KerbalStuff |
import gym
import numpy as np
from igibson.robots.robot_locomotor import LocomotorRobot
class JR2(LocomotorRobot):
"""
JR2 robot (no arm)
Reference: https://cvgl.stanford.edu/projects/jackrabbot/
Uses joint velocity control
"""
def __init__(self, config):
self.config = config
... | [
{
"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 | igibson/robots/jr2_robot.py | suresh-guttikonda/iGibson |
import urllib
class cOutputParameterHandler:
def __init__(self):
self.__aParams = {}
def addParameter(self, sParameterName, mParameterValue):
if not mParameterValue:
return
self.__aParams[sParameterName] = urllib.unquote(str(mParameterValue))
def getParameterAsUri(s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | plugin.video.vstream/resources/lib/handler/outputParameterHandler.py | akuala/REPO.KUALA |
#!/usr/bin/env python
from __future__ import print_function
import yaml
from mongodb_kube_client import MongoDBEnterpriseKubeClient
def parse_config_file(path):
'''
Parses the config file in the given path
'''
with open(path, 'r') as parameters:
try:
return yaml.load(parameters)
... | [
{
"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 | mongodb/mongodb-enterprise-kubernetes/samples/kubernetes-clients/python/test_mongodb_kube_client.py | smthkissinger/docker-images |
# Copyright (c) 2017-present, Facebook, 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... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | models/pt_3dpose/detectron/utils/image.py | DreaJulca/uxsense |
"""
# Hello
Demonstrate:
* conversion of regular python script into _Jupyter notebook_
* support **Markdown**
* this is a list
"""
from __future__ import absolute_import, print_function, division
"""
## Hello
This is a *hello world* function.
"""
def hello():
"""
This is a docstring
"""
print("he... | [
{
"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 | tests/example.py | bwohlberg/py2nb |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_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 | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/GetHdfsCapacityStatisticInfoRequest.py | bricklayer-Liu/aliyun-openapi-python-sdk |
from PySide2 import QtWidgets # pip install PySide2
fenetres = [] # liste qui contient toutes les fenêtres ouvertes
def mettreAJourNombreFenetre():
nombreDeFenetres = len(fenetres)
for fenetre in fenetres:
fenetre.resultatNombreFenetre.setText(f'Nombre de fenêtres : {nombreDeFenetres}')
def creerFen... | [
{
"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 | Fenetres_Infinies/app.py | Origin4/PythonChallenges |
#!/usr/bin/env python
from __future__ import print_function
import roslib
roslib.load_manifest('csi_opencv_tester')
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
class image_converter:
def __init__(self):
# sel... | [
{
"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 | jang_src/csi_opencv_tester/src/bridger.py | leesuengyeol/goingHome_project |
import torch
import torch.nn as nn
from torchvision.transforms import ToTensor, ToPILImage
class Generator(nn.Module):
def __init__(self):
super().__init__()
self.conv_block = nn.Sequential(
nn.ConvTranspose2d(100, 512, 4, 1, 0),
... | [
{
"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 | generator.py | y3sar/painter_gan |
# 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": "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 | aliyun-python-sdk-iot/aliyunsdkiot/request/v20180120/UpdateDeviceGroupRequest.py | liuzheng/aliyun-openapi-python-sdk |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Server(models.Model):
last_contact = models.IntegerField()
version = models.CharField(max_length=32)
hostname = models.CharField(unique=True, max_length=64)... | [
{
"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": false
}... | 3 | yosim/servers/models.py | thoongnv/yosim |
from .Item import *
class IronOre(Item):
def getName(self):
return "minecraft:iron_ore"
def getTexturFile(self):
return "./assets/textures/items/iron_ore.png"
handler.register(IronOre)
| [
{
"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 | mods/mcpython/Item/iron_ore.py | uuk0/mcpython-a-minecraft-clone-in-python |
from multiprocessing import Manager
from Old_ver.CNS_data_share import CnsDataShare
from Old_ver.CNS_plot import DrawPlot
from Old_ver.CNS_data_cleaner import CnsDataCleaner
class StartAutonomous_CNS:
def __init__(self):
# 공유되는 mother memory 선언
self.mother_memory = self.make_memory()
# 실행되... | [
{
"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 | Old_ver/Main.py | LeeDaeil/CNS_Autonomous |
from typing import Any
from sqlalchemy.ext.declarative import as_declarative, declared_attr
@as_declarative()
class Base:
id: Any
__name__: str
# Generate __tablename__ automatically
@declared_attr
def __tablename__(cls) -> str:
return cls.__name__.lower()
def to_dict(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | bali/db/declarative.py | Ed-XCF/bali |
# write your first unittest!
import unittest
from ovos_plugin_manager.skills import find_skill_plugins
class TestPlugin(unittest.TestCase):
@classmethod
def setUpClass(self):
self.skill_id = "ovos-skill-timer.OpenVoiceOS"
def test_find_plugin(self):
plugins = find_skill_plugins()
... | [
{
"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 | test/plugin_tests.py | builderjer/skill-ovos-timer |
import pathlib
from bs4 import BeautifulSoup
HTML_LEAF_PAGE_SAMPLE_PATH = pathlib.Path('tests', 'fixtures', 'html', 'leaf_page_sample.html')
HTML_TEXT = ''
def setup():
global HTML_TEXT
with open(HTML_LEAF_PAGE_SAMPLE_PATH, "rt", encoding="utf-8") as handle:
HTML_TEXT = handle.read()
def teardown()... | [
{
"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/test_parser_leaf_html.py | sthagen/python-artichoke_growth |
# -*- coding: utf-8 -*-
from screws.freeze.main import FrozenOnly
from objects.CSCG._2d.mesh.trace.visualize import _2dCSCG_Trace_Visualize
from objects.CSCG._2d.mesh.trace.elements.main import _2dCSCG_Trace_Elements
class _2dCSCG_Trace(FrozenOnly):
def __init__(self, mesh):
self._mesh_ = mesh
s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | objects/CSCG/_2d/mesh/trace/main.py | mathischeap/mifem |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `dmriprep` package."""
import pytest
from click.testing import CliRunner
from dmriprep import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
... | [
{
"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 | tests/test_dmriprep.py | j1c/dmriprep |
# global
import torch
from typing import Union, Optional, Tuple, List
def roll(x: torch.Tensor, shift: Union[int, Tuple[int]], axis: Union[int, Tuple[int]]=None)\
-> torch.Tensor:
return torch.roll(x, shift, axis)
# noinspection PyShadowingBuiltins
def flip(x: torch.Tensor,
axis: Optional[Union[i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | ivy/functional/backends/torch/array_api/manipulation_functions.py | arxxv/ivy |
import os
import pickle
import numpy as np
import xarray as xr
import swot_simulator
import swot_simulator.random_signal as random_signal
ROOT = os.path.dirname(os.path.abspath(__file__))
def test_gen_signal_1d():
with open(os.path.join(ROOT, "data", "gen_signal_1d.bin"), "rb") as stream:
(fi, psi, x, n... | [
{
"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 | tests/test_random_signal.py | CNES/swot_simulator |
from rest_framework.views import APIView
import json
from common.utils import token_required_class, create_json_response
from repository.service import RepositoryService
# Create your views here.
class Repository(APIView):
repositoryService = RepositoryService()
@token_required_class
def get(self, requ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | backend/repository/views.py | nole23/UKS |
from django.db import models
from meiduo_mall.utils.models import BaseModel
# Create your models here.
class ContentCategory(BaseModel):
"""广告内容类别"""
name = models.CharField(max_length=50, verbose_name='名称')
key = models.CharField(max_length=50, verbose_name='类别键名')
class Meta:
db_table = '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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | meiduo_mall/meiduo_mall/apps/contents/models.py | 0-pangda/meiduo_project1 |
from __future__ import absolute_import
import re
def get_pages(filename):
with open(filename) as f:
data = f.read()
return data.split('\x0c')
header_pattern = re.compile(r'^RFC \d+\s+.*\s+(\w+ \d{4})$', re.M)
footer_pattern = re.compile(r'^\w+\s+\w+\s+\[Page \d+\]$', re.M)
def remove_header(page):
page = he... | [
{
"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 | irc/rfc.py | EliotNapa/slack_irc_rt_gate |
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: benedetto.abbenanti@gmail.com
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcente... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | sdks/python/test/test_AlertingGithubBugtrackerSettings.py | Brantone/appcenter-sdks |
import tkinter
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from config import Config
from matrix import Matrix
class Graphic:
TITLE = "Heat distribution in the rod(t = "
def __init__(self, a, u):
self.root = tkinter.Tk()
self.root.title(self.TITLE + str(0) + ")")
... | [
{
"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 | heat_distribution_in_the_rod/graphic.py | richiurb/physics |
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.shortcuts import render
from blog.models.clasDict import classes
from blog.models.post import Post
from django.template.defaulttags import register
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTes... | [
{
"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 | blog/views/post_cls.py | junaidiiith/Disaster-Help-Predictor |
__author__ = "Suyash Soni"
__email__ = "suyash.soni248@gmail.com"
import itertools
from ....constants.error_codes import DBErrorCode
class Error(object):
"""
Every time error needs to thrown, instance of this class must be used to represent an error.
"""
def __init__(self, error_constant, *fields, mes... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | lib/sqlalchemy_json_querybuilder/commons/error_handlers/errors/errors.py | suyash248/sqlalchemy-json-querybuilder |
import torch
import torch.nn.functional as F
import torch_glow
from collections import namedtuple
from tests.utils import jitVsGlow
# Basic test of the PyTorch conv2d Node on Glow.
def test_conv2d_basic():
def conv2d_basic(inputs, filters):
conv = F.conv2d(inputs, filters, padding=1)
return F.relu(... | [
{
"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 | torch_glow/tests/nodes/conv2d_test.py | enricoros/glow |
import warnings
import openmc.checkvalue as cv
class Nuclide(str):
"""A nuclide that can be used in a material.
Parameters
----------
name : str
Name of the nuclide, e.g. 'U235'
Attributes
----------
name : str
Name of the nuclide, e.g. 'U235'
"""
def __new__(c... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | openmc/nuclide.py | janmalec/openmc |
from flask import render_template
from flask import request
from flask import send_file
from flask import make_response
import cv2
import urllib
import numpy as np
# Add the pytorch folder to our script path
import sys
# insert at 1, 0 is the script path (or '' in REPL)
sys.path.insert(1, '/Users/danielblackburn/space... | [
{
"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 | beautiful_earth/app/routes.py | craklyn/space-apps-2019 |
import os
import unittest
import budget.util.fileloader as f
class TestFileLoaderYaml(unittest.TestCase):
testdir = os.path.dirname(__file__)
data = testdir+'/fileloader.yaml'
def runTest(self):
test = f.load_yaml(self.data)
self.assertEqual(test['Foo'], 'Bar')
test['blah'] = ['bl... | [
{
"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 | budget/tests/util/test_fileloader.py | isabella232/cloud-costs |
from __future__ import absolute_import
import re
class MessageTranslator(object):
messages = {}
def __init__(self):
self.compiled_messages = dict([(m, re.compile(m)) for m in self.messages])
def translate_messages(self, messages):
return [self.translate_message(m) for m in messages]
... | [
{
"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 | spidermon/contrib/validation/translator.py | heylouiz/spidermon |
import random
import numpy as np
from typing import Dict, List
from flask import Flask
from flask_restx import Resource, Api
# from numpy import genfromtxt
from ubatch import ubatch_decorator
# from keras.models import load_model
from sklearn.datasets import fetch_20newsgroups
from sklearn.model_selection import t... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | examples/flask_app.py | cristianMeli/ubatch |
#!/usr/bin/evn python3
# coding=utf-8
import logging
class AppException(Exception):
def __init__(self, *args, **kwargs):
logger = logging.getLogger("tornado.access")
# 控制台是否输出日志
logger.propagate = False
logger.error(f"AppException:{args}")
class AppValueError(AppException):
d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | backend/blog/util/exception.py | o8oo8o/blog |
# Space: O(n)
# Time: O(n!)
class CombinationIterator:
def __init__(self, characters: str, combinationLength: int):
self.data = characters
self.res = self.combine(self.data, combinationLength)
self.counter = 0
self.res_count = len(self.res)
def next(self) -> str:
if ... | [
{
"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 | Algorithms/1286_Iterator_for_Combination/Python/Iterator_for_Combination_Solution_1.py | lht19900714/Leetcode_Solutions |
from django import forms
from jobsapp.models import Job, Applicant
class CreateJobForm(forms.ModelForm):
class Meta:
model = Job
exclude = ('user', 'created_at',)
labels = {
"last_date": "Last Date",
"company_name": "Company Name",
"company_description"... | [
{
"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 | jobsapp/forms.py | dguillen12/anem-per-feina |
import os
from contextlib import contextmanager
@contextmanager
def working_directory(path):
"""
Temporarily change the current working directory.
Usage:
with working_directory(path):
do_things() # working in the given path
do_other_things() # back to original path
"""
current_di... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | pretext/utils.py | StevenClontz/ptxtikzjaxtest |
from rest_framework import serializers
from authentication.serializers import AccountSerializer
from posts.models import Post
class PostSerializer(serializers.ModelSerializer):
author = AccountSerializer(read_only=True, required=False)
class Meta:
model = Post
fields = ('id', 'author', 'con... | [
{
"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 | schreib_project/posts/serializers.py | krishishah/Schreib |
from __future__ import absolute_import, unicode_literals
try:
from importlib import reload
except ImportError:
pass
from django.conf.urls import url
from django.test import TestCase
from mock import patch
try:
import wagtail.core.urls as wagtail_core_urls
except ImportError: # pragma: no cover; fallback... | [
{
"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 | wagtailsharing/tests/test_urls.py | mikiec84/wagtail-sharing |
#https://github.com/openai/universe-starter-agent/blob/master/envs.py
import gym
import universe
import socketio
import eventlet.wsgi
from PIL import Image
from flask import Flask
from io import BytesIO
from TORCH_DQN import DQN
from enum import Enum
import torchvision.transforms as T
import ast
import torch
from env ... | [
{
"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/universe-driving/drive.py | arminnh/deep-q-learning |
from django.views.generic import TemplateView
from django.shortcuts import render
from django.shortcuts import redirect
from django.urls import reverse
from irekua_database.models import Collection
from irekua_database.models import SiteType
from irekua_permissions.data_collections import (
sites as site_permissio... | [
{
"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 | selia/views/create_views/collection_sites/select_type.py | IslasGECI/selia |
"""empty message
Revision ID: 108db2c7e723
Revises: 2e2a97299bb2
Create Date: 2019-11-08 17:43:35.683075
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '108db2c7e723'
down_revision = '2e2a97299bb2'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/108db2c7e723_.py | J0hnZMT/jobmonitorservice |
from django.conf import settings
from ledger.accounts.models import EmailUser
def get_user_as_email_user(sender):
try:
sender_user = EmailUser.objects.get(email__icontains=sender)
except:
EmailUser.objects.create(email=sender, password='')
sender_user = EmailUser.objects.get(email__ico... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | mooringlicensing/components/emails/utils.py | mintcoding/mooringlicensing |
import ev3dev.ev3 as ev3
class Sounds:
def __init__(self):
self.sounds = ev3.Sound
def say_red(self):
self.sounds.speak("red").wait()
def say_blue(self):
self.sounds.speak("blue").wait()
def say_white(self):
self.sounds.speak("white").wait()
def say_black(self)... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | src/sounds.py | ScampyOwl/robolab-group138 |
#!/usr/bin/env python
# license removed for brevity
import rospy, tf, socket, sys, struct
from geometry_msgs.msg import PoseStamped
topic = "/mocap_client/ARBI/pose"
UDP_IP = "10.201.0.100"
UDP_PORT = 21444
def callback(data):
x = data.pose.position.x
y = data.pose.position.y
z = data.pose.position.z
... | [
{
"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 | mocap_bridge/scripts/mocap2udp.py | diebengay/grvc-utils |
class TrendUp:
def __init__(self, df, params):
self.df = df
self.H = self.df["high"]
self.L = self.df["low"]
self.numPeriods = params["numPeriods"] if "numPeriods" in params.keys() else 3
self.coef = params["coef"] if "coef" in params.keys() else 1
self.attrName = par... | [
{
"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 | Backtest/main/Attributes/lib/TrendUp.py | simonydbutt/b2a |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, LEAM Technology System and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import cint
class RenovationDashboardLayout(Document):
def val... | [
{
"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 | renovation_core/renovation_dashboard_def/doctype/renovation_dashboard_layout/renovation_dashboard_layout.py | Abadulrehman/renovation_core |
import re
import pytest
from contextlib import contextmanager
class AnyObject:
def __eq__(self, actual):
return True
def __ne__(self, other):
return False
class SuperdictOf:
def __init__(self, required_dict):
self.required_dict = required_dict
def __eq__(self, actual):
... | [
{
"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 | tests/helpers.py | der-gabe/pynonymizer |
# coding=utf-8
"""
"""
import unittest
import os
from md_utils.md_common import silent_remove, diff_lines
from md_utils.plot_csv import main
__author__ = 'mayes'
DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data')
CSV_DIR = os.path.join(DATA_DIR, 'plot_csv')
CSV_FILE = os.path.join(CSV_DIR, 'identity.cs... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_plot_csv.py | cmayes/md_utils |
from unittest import TestCase
from api.utils.bar_utils import BARUtils
class UtilsUnitTest(TestCase):
def test_error_exit(self):
msg = "A test error message"
result = BARUtils.error_exit(msg)
expected = {"wasSuccessful": False, "error": msg}
self.assertEqual(result, expected)
... | [
{
"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/utils/test_bar_utils.py | cperolo/BAR_API |
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
from caffe2.proto import caffe2_pb2
class TestPrependDim(TestCase):
def _test_fwd_bwd(self):
old_shape = (128, 2, 4)
new_shape = (8, 16, 2, 4)
X = np.random.rand(*o... | [
{
"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 | venv/Lib/site-packages/caffe2/python/operator_test/prepend_dim_test.py | Westlanderz/AI-Plat1 |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest
import code
class TestDay01(unittest.TestCase):
# Part 01
def test_example01(self):
expense_report = [1721, 299]
expected = 514579
result = code.part01(expense_report)
self.assertEqual(result, expected)
# Do... | [
{
"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 | 2020/01/test.py | mr-bigbang/advent-of-code |
#
# Base class for Ohm's law submodels
#
import pybamm
from ..base_electrode import BaseElectrode
class BaseModel(BaseElectrode):
"""A base class for electrode submodels that employ
Ohm's law.
Parameters
----------
param : parameter class
The parameters to use for this submodel
domain... | [
{
"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 | pybamm/models/submodels/electrode/ohm/base_ohm.py | jhurreaq/PyBaMM |
# Linked List implementation
class Queue:
def __init__(self):
self._privateList = []
def enqueue(self, newElement):
self._privateList.append(newElement)
def dequeue(self):
if len(self._privateList) == 0:
return None
first = self._privateList[0]
del self._privateList[0]
return first
def peek(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 | Python/Cracking the Coding Interview/Chapter 4_Trees and Graphs/Queue.py | honghaoz/Interview-Algorithm-in-Swift |
class Vec2:
def __init__(self, x, y):
self.x = x
self.y = y
@property
def xy(self):
return self.x, self.y
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | src/vector2.py | GitRenhl/PyxelControllerTest |
from .bugzilla import MyBugzilla
import unittest
import requests_mock
from unittest import mock
import requests
class TestBugZilla(unittest.TestCase):
def test_bug_id(self):
zilla = MyBugzilla(
'tarek@mozilla.com',
server='http://example.com'
)
link = zilla.bug_link... | [
{
"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 | examples/python/unit-test-simple/bugzilla_test.py | AlaminMahamud/Test-Driven-Development---Notes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.