source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
class Solution(object):
def backspaceCompare(self, S1, S2):
r1 = len(S1) - 1
r2 = len (S2) - 1
while r1 >= 0 or r2 >= 0:
char1 = char2 = ""
if r1 >= 0:
char1, r1 = self.getChar(S1, r1)
if r2 >= 0:
char2, r2 = 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 | stack/0844_backspace_string_compare/0844_backspace_string_compare.py | zdyxry/LeetCode |
# 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/python/unittest/test_container.py | jheo4/incubator-tvm |
"""new fields in user moodel
Revision ID: f1578ff17ae1
Revises: bda639e5aafd
Create Date: 2021-01-11 10:01:54.417977
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f1578ff17ae1'
down_revision = 'bda639e5aafd'
branch_labels = None
depends_on = None
def upgra... | [
{
"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 | migrations/versions/f1578ff17ae1_new_fields_in_user_moodel.py | aboladebaba/flaskTut |
import tensorflow as tf
class MockModel(tf.keras.Model):
"""
A Mock keras model to test basic tester functionality.
This model only has one variable: a weight matrix of shape 2x1.
This model accepts 2-dimensional input data and outputs 1-d data
"""
def __init__(self):
super(MockModel, ... | [
{
"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/utils.py | TTitcombe/tfShell2 |
# Python program for implementation of heap Sort
# To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greater than root
if l < n ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Python/HeapSort.py | Mario263/Hacktoberfest_2021 |
'''
Created on Sep 3, 2012
@author: Daniel J. Rivers
'''
from DataAccess.TableData import TableData
from DataAccess.TableHandler import TableHandler
class EpisodeHandler( TableHandler ):
pass
class Episode( TableData ):
def __init__( self ):
self.columnNames = [ ( "SEASON_ID", "INTEGE... | [
{
"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 | FileInventory/DataAccess/Tables/EpisodeHandler.py | ErebusMaligan/python |
from djangobench.utils import run_benchmark
def benchmark():
global Book
Book.objects.all().delete()
def setup():
global Book
from query_delete_related.models import Book, Chapter
b1 = Book.objects.create(title='hi')
b2 = Book.objects.create(title='hi')
b3 = Book.objects.create(title='hi'... | [
{
"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 | djangobench/benchmarks/query_delete_related/benchmark.py | smithdc1/djangobench |
import numpy as np
__all__ = ["binomial"]
def binomial(chr1, chr2):
"""
Picks one allele or the other with 50% success
:type chr1: Sequence
:type chr2: Sequence
"""
if len(chr1) != len(chr2):
raise ValueError("Incompatible chromosome lengths")
choice_mask = np.random.binomial(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | genetic/recombination/_recombination.py | skoblov-lab/genetic |
import sys
if sys.version_info[0] >= 3:
INT_TYPES = (int,)
else:
INT_TYPES = (int, long)
def pow2_check (n):
return n > 0 and (n & (n - 1)) == 0
def pow2_round_down (n, p):
assert pow2_check(p)
return n & ~(p - 1)
def pow2_round_up (n, p):
assert pow2_check(p)
return (n + p - 1) & ~(p - ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | zlx/int.py | icostin/zlx-py |
from __future__ import absolute_import, division, print_function
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer import EmpiricalMarginal, TracePredictive
from pyro.infer.mcmc import MCMC, NUTS
from tests.common import assert_equal
def model(num_trials):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/infer/test_abstract_infer.py | neerajprad/pyro |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"point_num": 1,
"id": "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 | djsniper/contrib/sites/migrations/0003_set_site_domain_and_name.py | justdjango/django-nft-sniper |
import numpy as np
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from torchvision import datasets
from tqdm import tqdm
from pixelsnail import PixelSNAIL
def train(epoch, loader, model, optimizer, device):
loader = tqdm(loader)
criterion = nn.CrossEntropyLoss(... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | pixelsnail_mnist.py | sajjad2014/vq-vae-2-pytorch |
# coding: utf-8
"""
Keras target formatters.
"""
__all__ = ["KerasModelFormatter", "TFKerasModelFormatter"]
from law.target.formatter import Formatter
from law.target.file import get_path
class ModelFormatter(Formatter):
@classmethod
def accepts(cls, path):
return get_path(path).endswith(".h5")
... | [
{
"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 | law/contrib/keras/formatter.py | b-fontana/law |
from math import sin, cos, radians
def func_args_unpack(func, args):
return func(*args)
def get_len(iterable, total):
try:
length = iterable.__len__()
except AttributeError:
length = total
return length
def cpu_bench(number):
product = 1.0
for elem in range(number):
... | [
{
"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 | parallelbar/tools.py | dubovikmaster/parallelbar |
import os
import json
import requests
from datetime import datetime, date
class Common:
def __init__(self):
pass
def make_json_request(self,uri:str,body:dict = None):
if body is None:
response = requests.get(uri)
return response.json()
else:
response ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | app/modules/common.py | Rabbit994/NoVA-Stonk-Bot |
from sqlalchemy import and_, exists, func
from sqlalchemy.orm import Session
from src.customer.domain.entities import Customer
class SQLACustomerRepository:
def __init__(self, sqla_session: Session):
self.sqla_session = sqla_session
def get_by_id(self, customer_id):
return (
self... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | src/customer/repository.py | csmaniottojr/wishlist_api |
import xml.etree.ElementTree as ET
import requests
import random
from functions.config import config
def dl_connect():
configuration = config()
link = configuration['Datalogger']['ip'] + configuration['Datalogger']['key']
try:
# When the session is expired, this link returns an error
# ... | [
{
"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 | functions/electricity/datalogger_connecter.py | FrancescoRisso/Domotico-casa |
# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.trial import unittest
from twisted.words.xish import xmlstream
class XmlStreamTest(unittest.TestCase):
def setUp(self):
self.errorOccurred = False
self.streamStarted = False
self.streamEnded = Fa... | [
{
"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 | python2.7/site-packages/twisted/words/test/test_xmlstream.py | 84KaliPleXon3/sslstrip-hsts-openwrt |
"""auto generate book_transaction table
Revision ID: 2e2c34db1cf5
Revises: 856336fb4dfc
Create Date: 2022-02-19 21:11:52.730614
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2e2c34db1cf5'
down_revision = '856336fb4dfc'
branch_labels = None
depends_on = None
... | [
{
"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 | alembic/versions/2e2c34db1cf5_auto_generate_book_transaction_table.py | KamalDGRT/libms |
"""Tool for displaying a selection of colours."""
import math
import pathlib
from PIL import Image, ImageDraw, ImageFont
_font_path = str(pathlib.Path(__file__).parent.absolute() / 'res' / 'font.ttf')
FONT = ImageFont.truetype(_font_path, size=20)
class ColourDisplayer:
"""Tool for displaying a selection of co... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | src/colour_displayer.py | Artemis21/image-analysis |
class Status:
OK = "OK"
ERROR = "ERROR"
class Response(dict):
def __init__(self, status, data):
super().__init__()
self["status"] = status
self["data"] = data
| [
{
"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 | app/model/response.py | Djaler/VkGraph |
from storm.variables import Variable
from spans import *
__all__ = [
"RangeVariable",
"IntRangeVariable",
"FloatRangeVariable",
"DateRangeVariable",
"DateTimeRangeVariable"
]
class RangeVariable(Variable):
"""
Extension of standard variable class to handle conversion to and from Psycopg2
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | stormspans/variables.py | runfalk/stormspans |
# Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | [
{
"point_num": 1,
"id": "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 | tests/test_png_rw.py | crtrentz/MONAI |
#!/usr/bin/env python3
import os
import errno
import logging
from src.issue import Issue
from settings import jira_to_zen_backlog_map, jira_to_zen_sprint_map, zen_to_jira_map, urls
logger = logging.getLogger(__name__)
def check_for_git_config(git_config_file):
"""
User must have ~/.gitconfig in home direct... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | src/utilities.py | ucsc-cgp/sync_agile_boards |
import sys, copy
from itertools import *
from StringIO import StringIO
import benchbase
from benchbase import with_attributes, with_text, onlylib, serialized
############################################################
# Benchmarks
############################################################
class XSLTBenchMark(benc... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | desktop/core/ext-py/lxml/benchmark/bench_xslt.py | t3hi3x/hue |
#!/usr/bin/python3
def check_brackets_match(text):
"""
Checks, whether brackets in the given string are in correct sequence.
Any opening bracket should have closing bracket of the same type.
Bracket pairs should not overlap, though they could be nested.
Returns true if bracket sequence is correct... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | Python scripts/match_brackets.py | 0xd2e/python_playground |
import unittest
from policy_sentry.writing.minimize import minimize_statement_actions
from policy_sentry.querying.all import get_all_actions
class MinimizeWildcardActionsTestCase(unittest.TestCase):
def test_minimize_statement_actions(self):
actions_to_minimize = [
"kms:CreateGrant",
... | [
{
"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 | test/writing/test_minimize.py | backwardn/policy_sentry |
"""Gaussian Elimination"""
import numpy as np
def gaussian_elimination(matrix: np.ndarray):
return matrix
def main():
matrix = np.array([[4, 8, -4, 4],
[3, 8, 5, -11],
[-2, 1, 12, -17]])
values = gaussian_elimination(matrix)
print(values)
if __name__... | [
{
"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 | systems_of_linear_equations/gaussian_elimination.py | jrpespinas/numerical-analysis |
from flask import Blueprint, render_template, redirect, url_for, flash, jsonify
from sqlalchemy import exc
from application import db
from application.routes.leads.models import Lead
from application.routes.leads.forms import AddLeadForm
leads = Blueprint("leads", __name__)
@leads.route("/")
def inde... | [
{
"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 | application/routes/leads/views.py | dejbug/full-stack-python-test-1 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Joan Massich <mailsik@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
#
# License: Simplified BSD
import pytest
import warnings
def has_vtki():
"""Check that... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | mne/viz/backends/tests/_utils.py | kalenkovich/mne-python |
from sanskrit_data.db.interfaces import DbInterface, get_random_string, users_db, ullekhanam_db
from sanskrit_data.schema.common import JsonObject
class InMemoryDb(DbInterface):
def __init__(self, db_name_frontend, external_file_store=None):
super(InMemoryDb, self).__init__(external_file_store=external_file_sto... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | sanskrit_data/db/in_memory.py | sanskrit-coders/sanskrit_data |
import pytest
from theheck.types import Command
from theheck.rules.brew_uninstall import get_new_command, match
@pytest.fixture
def output():
return ("Uninstalling /usr/local/Cellar/tbb/4.4-20160916... (118 files, 1.9M)\n"
"tbb 4.4-20160526, 4.4-20160722 are still installed.\n"
"Remove all... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | tests/rules/test_brew_uninstall.py | jlandrum/theheck |
class Mancala:
def __init__(self):
print("(python) Mancala::init")
self.state = 0
def get_state(self):
print("(python) Mancala::get_state")
self.state += 1
return "(python) current state: {!r}".format(self.state)
def play_position(self, value):
print("(pyth... | [
{
"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/py_mancala/mancala.py | jgsogo/godot-python |
# Copyright 2021 The Narrenschiff Authors
# 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... | [
{
"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/test_log.py | petarGitNik/narrenschiff |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
def register(request):
if request.method == "POST":
form = UserRegisterForm(request.POST)
... | [
{
"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 | users/views.py | Sammeeey/quick_mart |
def lend_money(debts, person, amount):
value = debts.get(person, 0)
quantity = [amount]
if value != 0:
debts[person] = value + quantity
else:
debts[person] = quantity
print(debts)
def amount_owed_by(debts, person):
value = debts.get(person, [0])
out = sum(va... | [
{
"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 | set3/p3_4.py | Felpezs/IPL_2021 |
import logging
import math
import torch
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
class WarmupLinearScheduleNonZero(_LRScheduler):
""" Linear warmup and then linear decay.
Linearly increases learning rate from 0 to max_lr over `warmup_steps` training steps.
... | [
{
"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 | utils/optim_utils.py | hudaAlamri/visdial-bert |
import braintree
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
from orders.models import Order
gateway = braintree.BraintreeGateway(settings.BRAINTREE_CONF)
def payment_process(request):
order_id = request.session.get('order_id')
order = get_object_or_404(O... | [
{
"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 | payment/views.py | kbilak/Personal-E-commerce |
#!/usr/bin/env python
import argparse
from datetime import date
import hashlib
import logging
import sys
import textwrap
from classes.resource import Resource
from classes.dbmanager import ResourceStorage
from classes.reporter import HtmlReport
import helpers
def get_reports_path(path):
today = date.today()
... | [
{
"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 | resdiffcheck/diffcheck.py | bayotop/resdiffcheck |
from browser import document, alert
import sys
from pprint import pprint
class redirect:
def write(text, text2):
document["output"].innerHTML += text2
sys.stdout = redirect()
sys.stderr = redirect()
d = document["output"]
d.clear()
d.innerHTML = "Hello"
print("Hello again")
def hello(ev):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | data/tests/redirect.py | citizendatascience/ErysNotes |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from .models import FAQSinglePluginModel, FAQCategoryPluginModel, FAQ
class FAQTOCPlugin(CMSPluginBase):
model = CMSPlu... | [
{
"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 | danceschool/faq/cms_plugins.py | benjwrdill/django-danceschool |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class ExportTestCase(Integratio... | [
{
"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 | tests/integration/bulkexports/v1/test_export.py | ashish-s/twilio-python |
import re
import os
import logging
import locale
import json
import datetime, time
from django import forms
from django.conf import settings
from django.db.models import CharField
from django.core.exceptions import ValidationError
from django.forms.utils import flatatt
from django.utils.safestring import mark_safe
l... | [
{
"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 | workon/forms/business_hours.py | devittek/django-workon |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `jr_tools` package."""
import unittest
from click.testing import CliRunner
from jr_tools import cli
class JasperReportsToolsTestCase(unittest.TestCase):
"""Tests for `jr_tools` package."""
def setUp(self):
"""Set up test fixtures, if any.... | [
{
"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 | tests/test_jr_tools.py | erickgnavar/jr_tools |
from functools import reduce
import keyfunctions.globals as consts
def create_key(values, depth):
"""
This function returns a Z-order key for any number of dimensions.
:param values: a list of floats - one of dimension - each of them with value between 0 and 1 [0,1)
:param depth: an strictly positi... | [
{
"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 | keyfunctions/core.py | cugni/keyfunctions-python |
from abc import ABC
from dataclasses import dataclass, asdict
from typing import Set, Dict
@dataclass
class Mixin(ABC):
pass
@dataclass
class AsDictMixin(Mixin):
def as_dict(self, exclude: Set["str"]) -> Dict:
entity_dict = asdict(self)
for key in exclude:
del entity_dict[key]
... | [
{
"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 | memrise/core/mixins.py | kolesnikov-bn/django-memrise-scraper |
### 多个函数间的配合
## 变量的作用域
rent = 3000
variable_cost = 0
def cost():
global variable_cost # 使用全局的变量
utilities = int(input('请输入本月的水电费用'))
food_cost = int(input('请输入本月的食材费用'))
variable_cost = utilities + food_cost
print('本月的变动成本费用是' + str(variable_cost))
def sum_cost():
sum = rent + variable_cos... | [
{
"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 | code/day09/demo04.py | picktsh/python |
from http import HTTPStatus
from api import app, database
from flask import jsonify, request, abort, make_response
def check_and_insert(company):
"""
Inserts the supplied company record if it doesnt already exists
"""
# Get the companies collection from the database
company_collection = database()
... | [
{
"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 | api/companies/create_company.py | taha27/restipy |
import os
import pickle
import time
_KEEPTIME = 300 # 5 minutes
class CacheItem(object):
def __init__(self, etag, content, cached_at):
self.etag = etag
self.content = content
self.cached_at = cached_at
class URLCache(object):
"""
URLCache is a simple pickle cache, intended ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | insights/client/url_cache.py | dpensi/insights-core |
from brownie import *
from helpers.constants import AddressZero
from helpers.registry import registry
from dotmap import DotMap
def connect_gnosis_safe(address):
return Contract.from_abi(
"GnosisSafe", address, registry.gnosis_safe.artifacts.GnosisSafe["abi"],
)
class GnosisSafeSystem:
def __ini... | [
{
"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 | scripts/systems/gnosis_safe_system.py | EchoDao-BSC/badger-system |
def mergesort(items):
if len(items) <= 1:
return items
mid = len(items) // 2
left = items[:mid]
right = items[mid:]
left = mergesort(left)
right = mergesort(right)
return merge(left, right)
def merge(left, right):
merged = []
left_index = 0
right_index... | [
{
"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 | Searching and Sorting/Merge sort/Python/merge_sort.py | Subrato-oid/cs-algorithms |
#!/bin/env/python3
# -*- encoding: utf-8 -*-
import os
__version__ = '0.1.0dev'
__license__ = 'BSD3'
__author__ = 'Kyle B. Westfall'
__maintainer__ = 'Kyle B. Westfall'
__email__ = 'westfall@ucolick.org'
__copyright__ = '(c) 2018, Kyle B. Westfall'
def enyo_source_dir():
"""Return the root path to the DAP source... | [
{
"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 | enyo/__init__.py | Keck-FOBOS/enyo |
import torch
import torch.nn as nn
import torch.nn.init as init
class Net(nn.Module):
def __init__(self, upscale_factor):
super(Net, self).__init__()
self.relu = nn.ReLU()
self.conv1 = nn.Conv2d(1, 64, (5, 5), (1, 1), (2, 2))
self.conv2 = nn.Conv2d(64, 64, (3, 3), (1, 1), (1, 1))
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | super_resolution/model.py | janilbols-w/examples |
import shutil
import os
import string
class ArrangeScripts:
def __init__(self, path_to_folder):
self.folders = ['a_e', 'f_j', 'k_o', 'p_t', 'u_z']
self.folder_mapping = {}
for alphabet in list(string.ascii_lowercase):
if alphabet in list('abcde'):
self.folder_ma... | [
{
"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 | folders_arranger/folders_arranger.py | devded/Automation-scripts |
"""
This Python script is designed to perform unit testing of Wordhoard's
Synonyms module.
"""
__author__ = 'John Bumgarner'
__date__ = 'September 20, 2020'
__status__ = 'Quality Assurance'
__license__ = 'MIT'
__copyright__ = "Copyright (C) 2021 John Bumgarner"
import unittest
import warnings
from wordhoard import S... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | test cases/unittest_synonym_module.py | johnbumgarner/wordhoard |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if not head or not head.next:
return head
temp = ListNode(0)
temp.next = head
p ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | 24.py | RafaelHuang87/Leet-Code-Practice |
from .base_element import BaseElement
from ....utilities.datamodel import Element
class TimeFrame(BaseElement):
def __init__(self, element: Element):
super().__init__(element)
@property
def start(self):
return self._element['start']
@property
def duration(self):
return se... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | source1/dmx/sfm/time_frame.py | half5life/SourceIO |
'''
Check that various monitors work correctly.
'''
from brian2 import *
from brian2.tests.features import FeatureTest, InaccuracyError
class SpikeMonitorTest(FeatureTest):
category = "Monitors"
name = "SpikeMonitor"
tags = ["NeuronGroup", "run",
"SpikeMonitor"]
def run(self):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | brian2/tests/features/monitors.py | CharleeSF/brian2 |
from flask import Flask, request
from hbase_manager import HBaseRecord
import json
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
@app.route('/test')
@app.route('/hello')
def hello():
return 'Hello World!'
@app.route('/get_places', methods=['GET', 'POST'])
def get_places():
if ... | [
{
"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 | projects/g3h2-cc/src/get_places_web_api.py | keybrl/xdu-coursework |
#
# 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... | [
{
"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 | flink-ai-flow/ai_flow/graph/ai_nodes/executable.py | MarvinMiao/flink-ai-extended |
import unittest
import pandas as pd
from scripts import FilePaths
from scripts import data_factory as factory
class TestDataFactory(unittest.TestCase):
def setUp(self):
self.__df = pd.read_pickle(FilePaths.us_patents_random_100_pickle_name)
self.__df = self.__df.reset_index()
def test_read... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/test_data_factory.py | ExesiosPB/libm |
import smtplib
from django.core.mail.backends.locmem import EmailBackend as LocMemEmailBackend
class FakeConnection(object):
def __getstate__(self):
raise TypeError("Connections can't be pickled")
class TestMailerEmailBackend(object):
outbox = []
def __init__(self, **kwargs):
self.conne... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/__init__.py | jaap3/django-mailer |
class Person:
def __init__(self,fname,lname):
self.firstname=fname #proerties
self.lastname=lname
def printname(self): #Method
print(self.firstname,self.lastname)
class Student(Person): #child class
def __init__(self, fname, lname):
Person.__init__(self, fname, lname)
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": fa... | 3 | BasicPythonPrograms/PythonInheritance.py | Pushkar745/PythonProgramming |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Marc-Olivier Buob, Maxime Raynal"
__maintainer__ = "Marc-Olivier Buob, Maxime Raynal"
__email__ = "{marc-olivier.buob,maxime.raynal}@nokia.com"
__copyright__ = "Copyright (C) 2020, Nokia"
__license__ = "BSD-3"
from collections imp... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | pybgl/prune_incidence_automaton.py | nokia/PyBGL |
import uuid
from datetime import datetime
from sqlalchemy.orm.scoping import scoped_session
import factory
import factory.fuzzy
from app.extensions import db
# import SQLAlchemy model
GUID = factory.LazyFunction(uuid.uuid4)
TODAY = factory.LazyFunction(datetime.now)
FACTORY_LIST = []
class FactoryRegistry:
d... | [
{
"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 | services/nris-api/backend/tests/factories.py | parc-jason/mds |
import pytest
from django.conf import settings
from django.test import RequestFactory
from newsapp.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL:
return ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | newsapp/conftest.py | darmhoo/newsapp |
import logging
from typing import Set
import falcon
from common.consts import HTTP_WRITE_METHODS
from common.falcon_utils import auth_token
from common.util import is_public
from ui import BackendController
class ContentTypeValidator:
def process_resource(self, req: falcon.Request, _resp: falcon.Response, resou... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | ui/middleware.py | ove/ove-asset-manager |
#!/usr/bin/env python
#
# ======================================================================
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://ge... | [
{
"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/pytests/materials/obsolete/TestGenMaxwellPlaneStrain.py | Grant-Block/pylith |
# -*- coding: utf-8 -*-
"""Models helper
These are helper functions for models.
"""
import torch.optim as optim
import torch.nn as nn
from configs.supported_info import SUPPORTED_OPTIMIZER, SUPPORTED_CRITERION
def get_optimizer(cfg: object, network: object) -> object:
"""Get optimizer function
This is fu... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | models/helper.py | kobakobashu/posenet-python |
#! /usr/bin/env python3
#-*- coding: utf-8 -*-
##
# Cryptokitty Create tables
#
##
import pymysql,traceback
import logging
from contextlib import closing
from tokens import Tokens
logging.basicConfig(filename="createdb.log", level=logging.DEBUG)
create_user_table_string = """
CREATE TABLE IF NO... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | src/createdb.py | xlanor/CryptoKitties |
# The tests for the CI server - ci.sagrid.ac.za
# Run with testinfra --host=ansible@ci.sagrid.ac.za
# - make sure you have ssh credentials.
# - make sure the test starts with "test"
# Most tests require access to sensitive information, so use the
# --sudo option
def test_ssh_protocol(host):
file = host.file('/et... | [
{
"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 | Testing/TestInfra/ci.py | ezeasorekene/DevOps |
import os
from ..sprite import Sprite
import pygame
class FirebatFire(Sprite):
"""
Represents a firebat fire
"""
def __init__(
self,
position,
max_health: float = 100,
path: str = 'advancing_hero/images/sprites/boss_enemies/fire/',
) -> None:
super().__init_... | [
{
"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 | advancing_hero/sprites/boss_enemies/firebat_fire.py | EnzoVargasM/advancing-hero |
import sqlite3
con = sqlite3.connect("ogrenciler.db")
cursor = con.cursor()
def tabloolustur():
cursor.execute("CREATE TABLE IF NOT EXISTS ogrenciler(ad TEXT,soyad TEXT,numara INT,ogrenci_notu INT)")
def degerekle():
cursor.execute("INSERT INTO ogrenciler VALUES('Gulay Busenur','Elmas','2014010213007','78'... | [
{
"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 | Sqlite_Database.py | elmasbusenur/Sqlite_Database |
# (c) Copyright 2017-2018 SUSE 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 to in writ... | [
{
"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 | ardana_installer_server/util.py | rsalevsky/ardana-installer-server |
import os
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend
from dcr.scenario_utils.common_utils import random_alphanum
class OpenSshKey(object):
"""
Represents an OpenSSH key pair.
... | [
{
"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 | dcr/scenario_utils/crypto.py | ce-bu/WALinuxAgent |
from PySock import client
def abc(data,con):
print(f"Message from {data['sender_name']} : {data['data']}")
con.SEND("test","Hurrah! it's working.")
def client_msg(data):
print(f"Message from : {data['sender_name']} => {data['data']}")
c = client(client_name = "swat", debug = True)
c.CLIENT("localhost",88... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | shiSock-0.3.0/test/test_one_unsecure/t2.py | AnanyaRamanA/shiSock |
####### Special object
class Person(object):
def __init__(self, name, age):
self.name=name
self.age=age
def getName(self):
return 'My name is '+self.name
def getAge(self):
return self.age
| [
{
"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 | examples/attributes/Person.py | irmen/Pyro3 |
"""added public id for users
Revision ID: 7cf6acee3bbb
Revises: fb69e94ff942
Create Date: 2019-02-15 19:55:34.010287
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7cf6acee3bbb'
down_revision = 'fb69e94ff942'
branch_labels = None
depends_on = None
def upgra... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/7cf6acee3bbb_.py | mmb186/MobileApp_API |
from django.db import models
CHOICES = (
('Gray', 'Серый'),
('Black', 'Чёрный'),
('White', 'Белый'),
('Ginger', 'Рыжий'),
('Mixed', 'Смешанный'),
)
class Owner(models.Model):
first_name = models.CharField(max_length=128)
last_name = models.CharField(max_length=128)
def __str__(self)... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | cats/models.py | a-s-frolov/kittygram_plus |
import unittest
import mppysam.mp_helper as mpp
def add(a=0, b=0):
return (a + b, )
class TestApplyWithAdd(unittest.TestCase):
"""Test apply() with a simple add function."""
def test_returns_empty_list_if_empty_args(self):
args_list = []
self.assertEqual(mpp.apply(add, args_list, processe... | [
{
"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 | mppysam/tests/test_mp_helper.py | jamesbaye/mppysam |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | test/test_v1beta1_custom_resource_subresources.py | tantioch/aiokubernetes |
from __future__ import absolute_import, division, print_function
from getpass import getpass
def get_input(prompt=''):
try:
line = raw_input(prompt)
except NameError:
line = input(prompt)
return line
def get_credentials():
"""Prompt for and return a username and passwo... | [
{
"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 | mytools.py | richard-ziga/csv2show2csv |
#!/usr/bin/env python3
# Automatically generated file by swagger_to. DO NOT EDIT OR APPEND ANYTHING!
"""Implements the client for test."""
# pylint: skip-file
# pydocstyle: add-ignore=D105,D107,D401
import contextlib
import json
from typing import Any, BinaryIO, Dict, List, MutableMapping, Optional
import requests
i... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | tests/cases/py_client/parameter_name_conflict/client.py | koji8y/swagger-to |
import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
@onnx_op("SequenceErase")
class SequenceErase(BackendHandler):
@classmethod
def chk_pos_in_bounds(cls, input_seq, pos):
"""
Check the position is in-bounds with respect to the... | [
{
"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 | onnx_tf/handlers/backend/sequence_erase.py | malisit/onnx-tensorflow |
# -*- coding: utf-8 -*-
# pylint: disable=unused-argument
"""Tests for the `CifBaseParser`."""
from aiida_codtools.calculations.cif_filter import CifFilterCalculation
def test_cif_filter(aiida_profile_clean, fixture_localhost, fixture_calc_job_node, generate_parser):
"""Test a default `cif_filter` calculation."""... | [
{
"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 | tests/parsers/test_cif_filter.py | aiidateam/aiida-codtools |
from cwltool.main import main
from .util import get_data
def test_missing_cwl_version():
"""No cwlVersion in the workflow."""
assert main([get_data('tests/wf/missing_cwlVersion.cwl')]) == 1
def test_incorrect_cwl_version():
"""Using cwlVersion: v0.1 in the workflow."""
assert main([get_data('tests/w... | [
{
"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 | tests/test_cwl_version.py | jayvdb/cwltool |
# Copyright (c) 2019 - now, Eggroll Authors. 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 ... | [
{
"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 | python/eggroll/core/aspects.py | liszekei/eggroll |
# Advent of Code 2021 - Day: 24
# Imports (Always imports data based on the folder and file name)
from aocd import data, submit
def solve(lines):
# We need to simply find all the pairs of numbers, i.e. the numbers on lines 6 and 16 and store them.
pairs = [(int(lines[i * 18 + 5][6:]), int(lines[i * 18 + 15][6:])) fo... | [
{
"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 | Solutions/2021/24.py | Azurealistic/Winter |
from __future__ import annotations
import itertools
import unittest
from rules_python.python.runfiles import runfiles
import sudoku_solver
class TestSudokuSolver(unittest.TestCase):
def _assert_solved_instance(self) -> None:
self.assert_solved_instance(
"example_sudoku.txt",
[
... | [
{
"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 | test_sudoku_solver.py | MichaelRHead/sudoku_solver |
import db
from src.modeling.model_manager.files import download_file
from src.modeling.reporting.feature_importance import display_importances
def get_column(column, id):
query = f"SELECT {column} FROM model_manager WHERE id = {id}"
data = db.execute(query).fetchone()[0]
return data
def get_y_test(id):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | src/modeling/model_manager/load.py | NovaSBE-DSKC/retention-evaluation |
import unittest
import pytest
import numpy as np
from spikeinterface.core.tests.testing_tools import generate_recording
from spikeinterface.toolkit.utils import (get_random_data_chunks,
get_closest_channels, get_noise_levels)
def test_get_random_data_chunks():
rec = g... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | spikeinterface/toolkit/tests/test_utils.py | marcbue/spikeinterface |
#-*- coding: utf-8 -*-
#Vstream https://github.com/Kodi-vStream/venom-xbmc-addons
from resources.lib.handler.requestHandler import cRequestHandler
from resources.lib.parser import cParser
from resources.hosters.hoster import iHoster
class cHoster(iHoster):
def __init__(self):
self.__sDisplayName = 'FileP... | [
{
"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 | plugin.video.vstream/resources/hosters/filepup.py | akuala/REPO.KUALA |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
{
"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 | openstack-placement-1.0.0/placement/db_api.py | scottwedge/OpenStack-Stein |
import pytest
from data.map import Map
from data import constants
def test_set_get_map():
map = Map()
map.set_map(
[
[(0, 0), constants.DEFAULT_WALL, 0],
[(0, 1), constants.DEFAULT_WALL, 90],
[(0, 2), constants.DEFAULT_WALL, 180]
]
)
assert map.... | [
{
"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 | lightbike/tests/test_map.py | ethancharles02/cse210-project |
#fake database to get the pygame running
import random
questions = ["Question 1?", "Question 2?", "Question 3?", "Question 4?"]
answers = ["Answer 1", "Answer 2", "Answer 3", "Answer 4"]
def get_question():
return(random.choice(questions))
def get_answer():
return(random.choice(answers)) | [
{
"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 | quiz/fake_db.py | KelstonClub/quiz |
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.serializers import PrimaryKeyRelatedField, RelatedField
class UniqueRelatedField(RelatedField):
"""
Like rest_framework's PrimaryKeyRelatedField, but selecting by any unique
field instead of the primary key.
"""
default_err... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | apps/api/serializers.py | azengard/reseller-api |
from django import forms
from django.forms.models import inlineformset_factory
from django.utils.translation import pgettext_lazy
from crispy_forms.layout import (
Row,
Column,
Layout,
Field,
MultiField,
Fieldset
)
from projectjose.core.forms import (
BaseForm,
AjaxSelect2ChoiceField,
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | projectjose/dashboard/social/forms.py | Chaoslecion123/blog_jose |
import py, os
class NullPyPathLocal(py.path.local):
def join(self, *args):
return self.__class__(py.path.local.join(self, *args))
def open(self, mode):
return open(os.devnull, mode)
def __repr__(self):
return py.path.local.__repr__(self) + ' [fake]'
| [
{
"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 | rpython/tool/nullpath.py | nanjekyejoannah/pypy |
### Drawing line using Digital Differential Analyzer Line Drawing Algorithm in Computer Graphics.
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
w, h = 25,25
m=0
def ROUND(a):
return int(a + 0.5)
def drawDDA(x1,y1,x2,y2):
x,y = x1,y1
length = abs((x2-x1) if abs(x2-x1) > abs(y2-y... | [
{
"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 | Computer Engineering/Third Year/Computer Graphics/Python/digital differential analyzer.py | jatin-eleven/Somaiya-University |
from tkinter import *
from tkinter.ttk import * # styling library
from random import randint
root = Tk()
root.title("GUESS ME")
root.geometry("350x100")
root.configure(background='#AEB6BF')
#Style
style = Style()
style.theme_use('classic')
for elem in ['TLabel', 'TButton']:
style.configure(elem, background='#AEB6BF'... | [
{
"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 | guess.py | kmranrg/GuessMe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.