source
string
points
list
n_points
int64
path
string
repo
string
import pygame class WelcomeScreen(): def __init__(self, root): self.root = root font = pygame.font.SysFont('digitaltsplum', 70) img = font.render('Cellular Automaton', True,(81, 113, 165)) self.center_element(img, 40) def center_element(self, text_img: pygame.Surface, y:int): ...
[ { "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/welcome_screen.py
Ermite28/cellular_automaton
class Sources: ''' sources class to define news sources objects ''' def __init__(self,id,name,description,url,category,country): self.id = id self.name = name self.description=description self.url=url self.category=category self.country=country cla...
[ { "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
app/models.py
Kipkorir2017/News-Site
from .generated import dog_pb2, dog_pb2_grpc from .owner_client import GrpcOwnerClient class Dog(dog_pb2_grpc.dogServicer): def __init__(self): self.owner_client = GrpcOwnerClient() def CallDog(self, request, context): dog_name = request.dogName res = f"{dog_name} is going to bark!" ...
[ { "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
python-dog-microservice/server/dog_grpc.py
mahsayedsalem/beyond-rest-grpc
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import os import pytest from datadog_checks.dev import docker_run from datadog_checks.snmp import SnmpCheck from .common import COMPOSE_DIR, SCALAR_OBJECTS, SCALAR_OBJECTS_WITH_TAGS, TABULAR_OBJECTS, generate_instan...
[ { "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
snmp/tests/conftest.py
andersenleo/integrations-core
""" Helper functions for uploading image to Flickr """ import flickr_api from django.conf import settings from django.core.files.storage import FileSystemStorage def handle_uploaded_file(uploaded_file, duck_id, duck_name, comments): """ Upload duck location image to flickr """ title = 'Duck #' + str(duck_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_params_annotated", "question": "Does every function parameter in this file have a ty...
3
django/duck/media.py
lastcoolnameleft/duckiehunt
import zipfile from os import listdir from os.path import isfile, join, splitext import concurrent.futures def unzip_file(file): try: print(f'Unzinping file: {file}') with zipfile.ZipFile(file, 'r') as zip_ref: zip_ref.extractall(splitext(file)[0]) return {'status':'OK', 'file...
[ { "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
unzip_files.py
tslima/copy-files-from-g-drive
from pylab import * K = arange(-100,100,.01) def psi(x): return sum([exp(1j * x * k) for k in K]) def phi(x): return sum([exp(1j * x * k) / (k * k + 10) if k >.2 else 0 for k in K]) X = arange(-10,10,.1) psis = [psi(x) for x in X] phis = [phi(x) for x in X] plot(X, psis / norm(psis)) plot(X, phis / norm(phi...
[ { "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
gist/qftfreestate.py
Neelraj21/phython
import unittest from statistics import mean from package1.subpackage1_1 import num from package2 import expo from package2.subpackage2_1 import stat class TestPackag2(unittest.TestCase): a = 0 b = 0 def setUp(self): global a, b a = num.give_number() b = num.give_number() def...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false ...
3
tests/test_package2.py
anubhavj880/sample
def rotate90acw(matrix): outMatrix = [] for x in range(len(matrix)): outArray = [] for y in range(len(matrix)): outArray.append(matrix[len(matrix)-1-y][len(matrix)-1-x]) outMatrix.append(outArray[::-1]) return outMatrix def rotate90cw(matrix): ...
[ { "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
rotateMatrix90/rotMat90.py
lowylow/InterviewQuestions
import sys import smtplib import json def send_email(senderEmail,senderPassword, recipients, subject, body): ''' recipients: a list Return True if email sent successfully ''' FROM = senderEmail TO = recipients SUBJECT = subject TEXT = body message = """From: %...
[ { "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
Emailer/Emailer.py
ktranm2/Emailer
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from emtract.model import Model, ModelType import pandas as pd class ModelInference: MODEL_BASE_PATH = 'build/models/' DATA_BASE_PATH = './emtract/data/' def __init__(self, model_type): if model_type == 'twitter': self.model = Model(...
[ { "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
emtract/model_inference.py
dvamossy/EmTract
#Hkr import msvcrt import os import sys import random from ctypes import windll, byref, wintypes from ctypes.wintypes import SMALL_RECT STDOUT = -11 WIN_X = 100 WIN_Y = 60 hdl = windll.kernel32.GetStdHandle(STDOUT) rect = wintypes.SMALL_RECT(0, 0, WIN_X, WIN_Y) # (left, top, right, bottom) windll.kernel32.SetConsoleW...
[ { "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
New Tests.py
NewLife1324/PyStorage
#!/usr/bin/python # -*- coding: utf-8 -*- """Tests for the PL/SQL Recall event formatter.""" from __future__ import unicode_literals import unittest from plaso.formatters import pls_recall from tests.formatters import test_lib class PlsRecallFormatterTest(test_lib.EventFormatterTestCase): """Tests for the PL/SQ...
[ { "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/formatters/pls_recall.py
ir4n6/plaso
NOT_PROVIDED = object() class FieldCacheMixin: """Provide an API for working with the model's fields value cache.""" def get_cache_name(self): raise NotImplementedError def get_cached_value(self, instance, default=NOT_PROVIDED): cache_name = self.get_cache_name() try: ...
[ { "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
django/db/models/fields/mixins.py
jmcdono362/django
import csv import tkinter as tk import tkinter.ttk as ttk class App(tk.Tk): def __init__(self, path): super().__init__() self.title("Ttk Treeview") columns = ("#1", "#2", "#3") self.tree = ttk.Treeview(self, show="headings", columns=columns) self.tree.heading("#1", text="L...
[ { "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
Chapter08/code/chapter8_03.py
sTone3/Tkinter-GUI-Application-Development-Cookbook
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class Swan(MakefilePackage): """SWAN is a third-generation wave model, developed at Delf...
[ { "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
var/spack/repos/builtin/packages/swan/package.py
jeanbez/spack
import uuid from logging.handlers import RotatingFileHandler from flask import Flask, g from werkzeug.middleware.proxy_fix import ProxyFix from app.util import mail, limiter, configure_mongo from app.errorhandlers import setup_handlers def create_app(): cache_buster = uuid.uuid4() app = Flask('quickpaste') ...
[ { "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": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false ...
3
app/create_app.py
tachyondecay/quickpaste
from logging import getLogger from typing import Dict from typing import Optional from piperider.artifacts.aws.s3 import S3PrefixArtifact from piperider.types import AwsCredentials from piperider.utils.aws import athena logger = getLogger(__name__) class AthenaArtifact(S3PrefixArtifact): """ It represents a...
[ { "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
piperider/artifacts/aws/athena.py
zinkosuke/piperider
from rest_framework import serializers from demo_app import models from rest_framework import viewsets class HelloSerializer(serializers.Serializer): """ Serializes a name field for testing our APIView""" name = serializers.CharField(max_length=10) class UserProfileSerializer(serializers.ModelSerializer): ...
[ { "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
demo_app/serializers.py
singhlovepreet1/demo-Django_rest-api
from abc import ABCMeta, abstractmethod from copy import deepcopy from itertools import product from numbers import Real from typing import Any, Dict, Iterator, List class Variation(metaclass=ABCMeta): @abstractmethod def expand(self) -> List[Any]: """ Expands the variation to a list of values. "...
[ { "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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (exc...
3
dalloriam/data/combine.py
dalloriam/python-stdlib
import itertools import multiprocessing import runpy import sys from os import path as osp import pytest def run_main(*args): # patch sys.args sys.argv = list(args) target = args[0] # run_path has one difference with invoking Python from command-line: # if the target is a file (rather than a dire...
[ { "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
test/test_examples.py
SenneRosaer/habitat-lab
import torch from torchvision import datasets, transforms train_transforms = transforms.Compose([transforms.RandomRotation(30), transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), tra...
[ { "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
load_data.py
oleurud/aipnd-project
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import numpy as np from sklearn.decomposition import PCA from reco_utils.dataset.download_utils import maybe_download from IPython import embed def length_normalize(matrix): """Length normalize the matrix Args: ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "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
reco_utils/recommender/geoimc/geoimc_utils.py
suhoy901/recommenders
# -*- coding:utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.urls import reverse from django.utils.html import format_html from .models import Category, Story from reading.custom_site import custom_site from .adminforms import StoryAdminForm from reading.custom_admin imp...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true...
3
reading/book/admin.py
Family-TreeSY/reading
from random import randint from timeit import timeit from matplotlib import pyplot as plt import matplotlib.patches as mpatches def generate_dataset(n_inst, n_attr, n_val): instances = [] for i in range(n_inst): i = {} for j in range(n_attr): i[str(j)] = randint(1, n_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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding ...
3
concept_formation/tests/benchmark_cobweb.py
ThomasHoppe/concept_formation
import pytest import os import sys import json from click.testing import CliRunner from ...cli.main import cli from ...core.project import Project remotetest = pytest.mark.skipif('TEST_DSBFILE' not in os.environ, reason="Environment variable 'TEST_DSBFILE' is required") def get_te...
[ { "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
datasciencebox/tests/salt/utils.py
danielfrg/datasciencebox
import discord from discord.ext import commands import aiohttp import random class Meme(commands.Cog): def __init__(self, client): self.client = client @commands.command() async def meme(self, ctx): async with aiohttp.ClientSession() as cs: async with cs.get("https://www.red...
[ { "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
cogs/meme.py
toxic3918/fiirrd-bot
import random as rd import time as t def Seed(): rd.seed(int(str(t.time()).split(".")[0])) Seed() def Random(): return rd.gauss(0,0.01) def RandomZeroMask(Prob=0.1): r= rd.random() if r<Prob: return 0.0 else: return 1.0
[ { "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
DYNAMIC/Rand.py
ssuurrffaaccee/ToyNeuralNetworkImplementation
class ModelBase: def __init__(self): pass def InitByMainKey(self, MainKeyObj): pass def InsertAllInfoToForm(self): pass
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }...
3
DataBaseModels/model_base.py
ZhuTou409/oa-flask
import pygame import constants class Bullet(pygame.sprite.Sprite): def __init__(self, screen, plane, speed=30): super().__init__() # 绘制屏幕对象 self.screen = screen # 发射子弹的飞机 self.plane = plane self.speed = speed self.image = pygame.image.load(constants.BUL...
[ { "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
project/plant_fight/game/bullet.py
Firekiss/python_learn
# pylint: disable=unused-argument # pylint: disable=redefined-outer-name import pytest from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node = cluster.add_instance('node', main_configs=["configs/config.d/storage_configuration.xml"], ...
[ { "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/integration/test_tmp_policy/test.py
pdv-ru/ClickHouse
#!/usr/bin/env python3 # encoding: utf-8 """A snipMate snippet after parsing.""" from UltiSnips.snippet.definition.base import SnippetDefinition from UltiSnips.snippet.parsing.snipmate import parse_and_instantiate class SnipMateSnippetDefinition(SnippetDefinition): """See module doc.""" SNIPMATE_SNIPPET_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": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a ty...
3
sources_non_forked/ultisnips/pythonx/UltiSnips/snippet/definition/snipmate.py
khatchad/vimrc
from typing import List, Tuple from dbnd import config, dbnd_run_cmd, parameter from dbnd_test_scenarios.test_common.task.factories import TTask class TestParameterNamespaceTask(object): def testWithNamespaceConfig(self): class A(TTask): task_namespace = "mynamespace" p = paramete...
[ { "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
modules/dbnd/test_dbnd/task/basics/test_task_parameter_namespace.py
ipattarapong/dbnd
# -*- coding: utf-8 -*- """ * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-蓝鲸 PaaS 平台(BlueKing-PaaS) available. * Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except in co...
[ { "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
sdks/blue-krill/blue_krill/models/fields.py
piglei/bkpaas-python-sdk
# voom_mode_org.py # Last Modified: 2013-10-31 # VOoM -- Vim two-pane outliner, plugin for Python-enabled Vim 7.x # Website: http://www.vim.org/scripts/script.php?script_id=2657 # Author: Vlad Irnov (vlad DOT irnov AT gmail DOT com) # License: CC0, see http://creativecommons.org/publicdomain/zero/1.0/ """ VOoM markup ...
[ { "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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "ans...
3
vimsetting/bundle/VOom/autoload/voom/voom_mode_org.py
thuleqaid/boost_study
# Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
[ { "point_num": 1, "id": "has_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
src/robot/parsing/restsupport.py
phil-davis/robotframework
"""empty message Revision ID: 166ae4251208 Revises: Create Date: 2020-09-10 11:25:13.286571 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '166ae4251208' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
[ { "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/166ae4251208_.py
ianterrell/uva-covid19-testing-communicator
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
[ { "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
py/test/selenium/webdriver/common/page_load_timeout_tests.py
shubhramittal/selenium
# -*- coding: utf-8 -*- import click from click._bashcomplete import get_choices def test_basic(): @click.group() @click.option('--global-opt') def cli(global_opt): pass @cli.command() @click.option('--local-opt') def sub(local_opt): pass assert list(get_choices(cli, 'lol...
[ { "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
lib/click-6.6/tests/test_bashcomplete.py
brianrodri/google_appengine
import requests class TwitchApiPy(): def __init__(self): self.ClientID = "" self.OAuth = "" """ You don't really use this its for other requests """ def GetUserID(self,name): r = requests.get(url = "https://api.twitch.tv/helix/users?login={}".format(name), headers = {'Clien...
[ { "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
TwitchApiPy/TwitchApiPy.py
xegepa/Twitch-Api-Py
import torch from torch import nn import torch.nn.functional as F class ContentLoss(nn.Module): """ Content Loss for the neural style transfer algorithm. """ def __init__(self, target: torch.Tensor, device: torch.device) -> None: super(ContentLoss, self).__init__() batch_size, channe...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written i...
3
nst/losses.py
visualCalculus/neural-style-transfer
from checkov.common.models.enums import CheckCategories, CheckResult from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check from checkov.common.util.type_forcers import force_list import re class NginxIngressCVE202125742Lua(BaseK8Check): def __init__(self): name = "Prevent NGINX Ingre...
[ { "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
checkov/kubernetes/checks/resource/k8s/NginxIngressCVE202125742Lua.py
nmrad-91/checkov
import discord from discord.ext import commands from discord.ext.commands.errors import BadArgument class Fun(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot def setup(bot): bot.add_cog(Fun(bot)) print(f'Cog "Fun" loaded!')
[ { "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
cogs/fun.py
kai13xd/ShihTzu-Bott
import pytest from flask import json from elasticsearch import ElasticsearchException from elasticsearch_dsl.exceptions import ElasticsearchDslException from backend.service import ProductService from backend.util.response.products_count import ProductsCountSchema from backend.util.response.error import ErrorSchema ...
[ { "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
backend/tests/unit/controller/api/start/test_start_controller.py
willrp/willstores-ws
def transpose(mat, rows, cols): # Input matrix keeps the non-zero elements using an adjancy list in sorted order t_rows = cols ptr = [0] * rows t_mat = [[] for i in range(t_rows)] for i in range(t_rows): for j in range(rows): if ptr[j] < len(mat[j]) and mat[j][ptr[j]][0] == i+1: t_mat[i].app...
[ { "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
data-structures/p10895.py
sajjadt/competitive-programming
""" Database models """ from flask_sqlalchemy import SQLAlchemy # import database, capital for global scope DB = SQLAlchemy() class User(DB.Model): """Twitter users that we analyze""" id = DB.Column(DB.BigInteger, primary_key=True) name = DB.Column(DB.String(15), nullable=False) newest_tweet_id = DB....
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": false }, { ...
3
TWITOFF/models.py
CurtCalledBurt/twitoff
# Copyright 2014 Hewlett-Packard Development Company, L.P. # 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...
[ { "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
glance/tests/functional/db/test_rpc_endpoint.py
komawar/glance
"""Misc. file parsers that are useful for other parsers""" from xml.sax import saxutils, parse, parseString class ExcelHandler(saxutils.handler.ContentHandler): """ This class is taken from the Python Cookbook so I guess the copyright goes to them. Memo: changed the handler from DefaultHandler to Con...
[ { "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
plateo/parsers/file_parsers.py
Edinburgh-Genome-Foundry/plateo
# %% import os import numpy as np import pandas as pd import flask from flask import Flask, jsonify, request, make_response import tensorflow as tf from evprediction import convert_to_array # %% # Load saved model # model_path = os.path.abspath(os.path.join(os.getcwd(), 'models')) model_name = 'evmodel.h5' model = t...
[ { "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
app/app.py
rohithdesikan/evprediction
class Warrior: def __init__(self, name, weapon): '实例化时自动调用' self.name = name self.weapon = weapon def speak(self, words): print("I'm %s, %s" % (self.name, words)) def show_me(self): print("我是%s, 我是一个战士" % self.name) if __name__ == '__main__': gy = Warrior('关羽',...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than clas...
3
nsd1902/python02/day03/myclass.py
MrWangwf/nsd2019
from .base import BaseGrader class OptimizationGrader(BaseGrader): def __init__(self, problem): super().__init__(problem) self.num_tasks = problem.num_tasks def grade(self, submission, score): task = submission.task self.task_number = task.task_number self.task_data = t...
[ { "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
website/example_problem_graders/optimization.py
czhu1217/cmimc-online
import csv import itertools class SigirBatchedGenerator: """ Class to read a csv file in batched number of lines. File must contain a header row with the names of the columns. Uses csv.DictReader. Meant to be used with with keyword. Methods ------- get_batches(batch_size=1000) Yi...
[ { "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
remote_flow/metaflow/data_processing/data_loaders/sigir_data_loader.py
JSpenced/you-dont-need-a-bigger-boat
#!python3.6 import click import schedule import time from coinmarketcap import Market from states import ProfileStateSwap def getBTC_PercentChange(): market = Market() bitcoin = market.ticker(currency='bitcoin')[0] percent_change = float(bitcoin['percent_change_1h']) print('Checking BTC 1 Hour PCHG:...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", ...
3
crypt0twitter-btc-sync.py
run2dev/cryp0twitter-btc-sync
from flask import Flask, render_template, request import pickle import numpy as np model = pickle.load(open('data.pkl','rb')) app = Flask(__name__) @app.route('/') def man(): return render_template('index.html') @app.route('/predict', methods=['POST']) def home(): data1 = request.form['a'] # arr = ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "...
3
Flask-pages/app.py
gourab337/chatbot-iiitdwd
import torch import torch.nn.functional as F from nemo.backends.pytorch.nm import LossNM from nemo.core.neural_types import * from nemo.utils.decorators import add_port_docs class OnlineTripletLoss(LossNM): """ Online Triplet loss Takes a batch of embeddings and corresponding labels. Triplets are gene...
[ { "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
loss/triplet.py
SerafinH/triplet_loss_kws
# -*- coding: utf-8 -*- import argparse import pdb import traceback from itertools import combinations from math import prod from typing import List, Tuple def find_matching_sum(values: List[int], goal: int, k: int) -> Tuple[int, ...]: for trie in combinations(values, k): if sum(trie) == goal: ...
[ { "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
2020/01-report_repair/report_repair.py
BrendanLeber/adventofcode
import sys, getopt from nwafu_login import NwafuLogin def guide(argv): print("Usage:\n"+argv+" -u <username> -p <password> \n"+argv+" --username=<username> --password=<password>\n") def main(argv): username = '' passwd = '' try: opts, args = getopt.getopt(argv, "hu:p:", ["username=", "password...
[ { "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
login.py
dingyx99/nwafu-srun
# # Script to scrape 43877 encoded Xiangqi games from wxf.ca # import scrapy from scrapy.crawler import CrawlerProcess class Xqdb(scrapy.Spider): name = 'xqdb' def start_requests(self): for page in range(41, 43919): yield scrapy.Request( url='http://wxf.ca/xq/xqdb/jgam...
[ { "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
xqdb/xqdb.py
maksimKorzh/wukong-xiangqi
# class node to create a node for the queue linked list class Node : def __init__(self, val) : self.val = val self.next = None class Queue : # contructor of the queue class def __init__(self) : self.front = None self.rear = None # method to insert an elem...
[ { "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
Data Structures/Queues/QueueList.py
ayushkr459/Data-Structures-And-Algorithms
"""Test the colors module of the logger.""" from simber.colors import ColorFormatter from colorama import Fore def test_color_formatter(): """Test the color_formatter method of the class""" s = "%gnana%" output = Fore.GREEN + "nana" + Fore.RESET assert ColorFormatter().format_colors(s) == output, "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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true...
3
tests/test_colors.py
deepjyoti30/simber
from nltk import PCFG from PSDProduction import PSDProduction from nltk import Nonterminal from typing import List, Set, Dict, Tuple, Optional, Callable class PSDG(PCFG): def __init__( self, start: Nonterminal, productions: List[PSDProduction], calculate_leftcorners: bool = 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": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "an...
3
src/python/PSDG.py
ml4ai/tomcat-planrec
from typing import Union import math from skbandit.bandits.base import Bandit class WeightedMajority(Bandit): """Optimal bandit in an adversarial setting. As all good algorithms for adversarial bandits, it randomises its decisions. This algorithm supposes access to full information (i.e. the reward for...
[ { "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
skbandit/bandits/adversarial.py
dourouc05/scikit-bandit
from core.validate_md5_s3_trigger.service import handler as validate_md5_s3_trigger from core.validate_md5_s3_trigger.service import make_input # from core.validate_md5_s3_trigger.service import STEP_FUNCTION_ARN import pytest from ..conftest import valid_env from datetime import datetime import mock def test_build_r...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "...
3
tests/core/validate_md5_s3_trigger/test_service.py
pkerpedjiev/tibanna
# Spiral Matrix class Solution(object): def spiralOrder(self, matrix): if not any(matrix): return [] # mark the boundary lines top, bottom = 0, len(matrix) - 1 left, right = 0, len(matrix[0]) - 1 result = [] while True: for j in range(left, r...
[ { "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
algorithms/others/spiral_matrix.py
kevinshenyang07/Data-Structure-and-Algo
class MTAThreadAttribute: """ Indicates that the COM threading model for an application is multithreaded apartment (MTA). MTAThreadAttribute() """ def ZZZ(self): """hardcoded/mock instance of the class""" return MTAThreadAttribute() instance=ZZZ() """hardcoded/returns an instance of the class""...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
release/stubs.min/System/__init___parts/MTAThreadAttribute.py
tranconbv/ironpython-stubs
"""Compare vis_cpu with pyuvsim visibilities.""" import numpy as np from pyuvsim.analyticbeam import AnalyticBeam from vis_cpu import conversions, plot nsource = 10 def test_source_az_za_beam(): """Test function that calculates the Az and ZA positions of sources.""" # Observation latitude and LST hera_l...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", ...
3
tests/test_plot.py
HERA-Team/vis_cpu
from django.shortcuts import render,redirect from .models import Image,Location,Category # Create your views here. def intro(request): images = Image.objects.all() return render(request, 'intro.html',{'images':images}) def search_results(request): if 'image' in request.GET and request.GET["image"]: ...
[ { "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
snaps/views.py
thuitafaith/My-gallery
import insightconnect_plugin_runtime from .schema import CalculateInput, CalculateOutput, Input, Output, Component from insightconnect_plugin_runtime.exceptions import PluginException from simpleeval import simple_eval class Calculate(insightconnect_plugin_runtime.Action): _result = None def __init__(self): ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false ...
3
plugins/math/komand_math/actions/calculate/action.py
lukaszlaszuk/insightconnect-plugins
import click import os from battleforcastile.utils.select_all_files import select_all_files from battleforcastile.utils.display_card import display_card from battleforcastile.constants import CARDS_FOLDER_NAME CURRENT_PATH = os.path.dirname(os.path.abspath(__file__)) @click.group(help='List of cards in the game') ...
[ { "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
battleforcastile/cli/cards.py
battleforcastile/battleforcastile
import django from distutils.version import StrictVersion def clear_builtins(attrs): """ Clears the builtins from an ``attrs`` dict Returns a new dict without the builtins """ new_attrs = {} for key in attrs.keys(): if not(key.startswith('__') and key.endswith('__')): ne...
[ { "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
moderation/utils.py
daynejones/django-moderation
# # -*- coding: utf-8 -*- # # Copyright (c) 2018 Intel Corporation # # 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 app...
[ { "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
mlt/utils/process_helpers.py
mas-dse-greina/mlt
import elasticsearch import curator import os import click from click import testing as clicktest from mock import patch, Mock from . import CuratorTestCase import logging logger = logging.getLogger(__name__) host, port = os.environ.get('TEST_ES_SERVER', 'localhost:9200').split(':') port = int(port) if port else 920...
[ { "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
test/integration/test_cli_utils.py
wjimenez5271/curator
import datetime def unix_time(dt): epoch = datetime.datetime.utcfromtimestamp(0) delta = dt - epoch return delta.total_seconds() def unix_time_millis(dt): return unix_time(dt) * 1000.0
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answe...
3
todo_project/todo/utils.py
linhyo/todo
import sys from collections import deque N, M = map(int, sys.stdin.readline().split()) def pprint(arr): for line in arr: print(line) def bfs(): mx = [1, 0, -1, 0] my = [0, 1, 0, -1] q = deque([(0,0,1)]) visited = [(0,0)] cnt = 0 while q: x, y, c = q.popleft() cnt = ...
[ { "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
04.DFS_BFS/HG/B2178.py
SP2021-2/Algorithm
import os from tkinter import * import db_save filepath = os.path.dirname(__file__) icon_eq = os.path.join(filepath, "data\\pics\\pleczak.ico") tlos = os.path.join(filepath, "data\\pics\\hg.png") tloe = os.path.join(filepath, "data\\pics\\hp.png") def informacja(tresc, zrodlo_pliku): eq = "☆ Otrzy...
[ { "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
tk_box.py
policmajsterdev/game
# mypy: allow-untyped-defs from unittest import mock import pytest from tools.ci.tc import decision @pytest.mark.parametrize("run_jobs,tasks,expected", [ ([], {"task-no-schedule-if": {}}, ["task-no-schedule-if"]), ([], {"task-schedule-if-no-run-job": {"schedule-if": {}}}, []), (["job"], {"job-pres...
[ { "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
tools/ci/tc/tests/test_decision.py
BasixKOR/wpt
import os import re from colicoords import load from addict import Dict def gen_paths(src): for d in os.listdir(src): pth = os.path.join(src, d) if os.path.isdir(pth): yield from gen_paths(pth) else: yield pth def load_dirs_to_dict(src, client, regex=''): file...
[ { "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
src/base_funcs.py
Jhsmit/T3SS-paper
""" Implementation of Inverse Reinforcement Learning algorithm for Time series""" import torch class MultiModelIRL(torch.nn.Module): def __init__(self, *model_hyperparameters, **kwargs): super(MultiModelIRL, self).__init__() for dictionary in model_hyperparameters: for key in dictiona...
[ { "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
traja/models/predictive_models/irl.py
MaddyThakker/traja
from typing import List import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor class SoftCrossEntropyLoss(nn.Module): """ Calculate the CrossEntropyLoss with soft targets. :param weight: Weight to assign to each of the classes. Default: None :type weight: list of...
[ { "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
data_augmentation/eda/image/modules/soft_cross_entropy_loss.py
vishalbelsare/emmental-tutorials
from time import sleep import numpy as np import matplotlib.pyplot as plt def get_initial_state(size): return np.random.choice([0, 1], size) def compute_next_state(state): new_state = np.zeros(state.shape, dtype=int) for i in range(state.shape[0]): for j in range(state.shape[1]): low...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding s...
3
main.py
ankurankan/game_of_life
import logging; log = logging.getLogger(__name__) from .Menu import Menu class HitboxMenu(Menu): """A menu for examining a hitbox.""" def __init__(self, parent): super().__init__(parent) self.title = "Hitboxes" self.refresh() def refresh(self): if self.parent.model is Non...
[ { "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
modelviewer/programs/SfaModel/Menu/HitboxMenu.py
knight-ryu12/StarFoxAdventures
import pathlib import pkg_resources from clvm_tools.clvmc import compile_clvm from hddcoin.types.blockchain_format.program import Program, SerializedProgram def load_serialized_clvm(clvm_filename, package_or_requirement=__name__) -> SerializedProgram: """ This function takes a .clvm file in the given packag...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "a...
3
hddcoin/wallet/puzzles/load_clvm.py
JakubSido/hddcoin-blockchain
# DarkCoder def sum_of_series(first_term, common_diff, num_of_terms): """ Find the sum of n terms in an arithmetic progression. >>> sum_of_series(1, 1, 10) 55.0 >>> sum_of_series(1, 10, 100) 49600.0 """ sum = ((num_of_terms/2)*(2*first_term+(num_of_terms-1)*common_diff)) # formula f...
[ { "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
maths/sum_of_arithmetic_series.py
Pratiyush27/Python
''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. ''' import os import subprocess import time EXIT_SUCESS = 0 def _execute(cmd, env=None, **kwargs): proc = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kw...
[ { "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": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": t...
3
keylime/cmd_exec.py
ansasaki/keylime
from urllib.parse import urlsplit, urlunsplit import pytest import requests _KUMA_STATUS = None def pytest_configure(config): """Configure pytest for the Kuma deployment under test.""" global _KUMA_STATUS # The pytest-base-url plugin adds --base-url, and sets the default from # environment variab...
[ { "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
mdn/yari/testing/integration/conftest.py
private-face/webextensions-docset
# -*- coding: utf-8 -*- """ @file @brief Helpers about processes. """ from .flog import fLOG def reap_children(timeout=3, subset=None, fLOG=fLOG): """ Terminates children processes. Copied from `psutil <http://psutil.readthedocs.io/en/latest/index.html?highlight=terminate#terminate-my-children>`_. Tri...
[ { "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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls...
3
src/pyquickhelper/loghelper/process_helper.py
Pandinosaurus/pyquickhelper
from tests.cryptocompy_vcr import cryptocompy_vcr from cryptocompy import mining @cryptocompy_vcr.use_cassette() def test_get_mining_contracts(): coin_data, mining_contracts = mining.get_mining_contracts() assert coin_data == {} assert len(mining_contracts) == 192 assert '16762' in mining_contracts...
[ { "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_mining.py
philipperemy/cryptocompy
class GradeCalculator: MAX_FAILING_GRADES_TO_PASS = 2 @staticmethod def normal_promotion_policy(final_grades): failing_grades = GradeCalculator.get_number_of_failing_grades(final_grades) if failing_grades > GradeCalculator.MAX_FAILING_GRADES_TO_PASS: return False retur...
[ { "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
Part_2_intermediate/mod_6/lesson_1/ex_3_raise/estudent/grade_calculator.py
Mikma03/InfoShareacademy_Python_Courses
# coding: utf-8 """ Metacore IoT Object Storage API Metacore Object Storage - IOT Core Services # noqa: E501 OpenAPI spec version: 1.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import metacore_api_python_cli fr...
[ { "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
test/test_devices_location.py
metacore-io/metacore-api-client-python
import numpy as np class Main: def __init__(self): self.li = list(map(int, input().split())) self.np_li = np.array(self.li) def output(self): print(np.reshape(self.np_li, (3,3))) if __name__ == '__main__': obj = Main() obj.output()
[ { "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
Python/Numpy/Shape and Reshape.py
pavstar619/HackerRank
from django.template import Context, Template from django.test import SimpleTestCase, override_settings class DjangoHtmxScriptTests(SimpleTestCase): def test_non_debug_empty(self): result = Template("{% load django_htmx %}{% django_htmx_script %}").render( Context() ) assert r...
[ { "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/templatetags/test_django_htmx.py
felixxm/django-htmx
# -*- coding: utf-8 -*- # Copyright 2017 IBM RESEARCH. 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 # # U...
[ { "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
qiskit/qasm/_node/_id.py
NickyBar/QIP
# -*- encoding: utf-8 -*- # Copyright (c) 2020 Stephen Bunn <stephen@bunn.io> # ISC License <https://choosealicense.com/licenses/isc> """ """ from string import printable from typing import Optional import pytest from hypothesis import given from hypothesis.strategies import SearchStrategy, composite, from_regex, in...
[ { "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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "ans...
3
tests/test_color.py
stephen-bunn/chalk
import webbrowser import cv2 from tkinter import Tk, filedialog, Button, Label,Entry class App: def __init__(self): self.window = Tk() self.window.title("image color converter") self.window.geometry("600x500") def open_image(self): file_path = filedialog.askopenf...
[ { "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
image_color_converter_gui.py
alamin3637k/image-converter
from pathlib import Path import sys TEST_MODE = bool(len(sys.argv) > 1 and sys.argv[1] == "test") def phase1(v): return next(v[i]*v[j] for i in range(len(v)) for j in range(i,len(v)) if v[i]+v[j] == 2020) def phase2(v): return next(v[i]*v[j]*v[k] for i in range(len(v)) for j in range(i,len(v)) for k in range...
[ { "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
aoc_2020/day1.py
akohen/AdventOfCode
class Queue: def __init__(self): self.data = [] def __str__(self): values = map(str, self.data) return ' <- '.join(values) def enque(self, val): self.data.append(val) def deque(self): return self.data.pop(0) def peek(self): return s...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer":...
3
queue/crud.py
maransowthri/data-structures-algorithms
import unittest from grapy.vivino_search import VivinoSearch class TestVivinoSearch(unittest.TestCase): """ env variables ALGOLIA_APP_ID, ALGOLIA_API_KEY and ALGOLIA_INDEX must be set in .env """ def setUp(self): self.vivino = VivinoSearch() def test_search(self): res = self.vivino.searc...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
tests/grapy/test_vivino_search.py
nl-hugo/grapy
from unittest.mock import patch from django.core.management import call_command from django.db.utils import OperationalError from django.test import TestCase class CommandTests(TestCase): def test_wait_for_db_ready(self): """Test waiting for db when db is available""" with patch('django.db.utils...
[ { "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
app/core/tests/test_commands.py
pshop/recipe-app-api
class FFmpegProfile: def __init__(self, profile_dict: dict): self._profile_dict = profile_dict @property def inputs(self): return self._profile_dict['inputs'] @property def outputs(self): return self._profile_dict['outputs']
[ { "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
profile.py
einsfr/pyffwrapper
import datetime from typing import Dict from ..helpers import CollectionAppointment DESCRIPTION = "Example scraper" URL = "" TEST_CASES: Dict[str, Dict[str, str]] = {} class Source: def __init__(self, days=20, per_day=2, types=5): self._days = days self._per_day = per_day self._types = 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": "more_functions_than_classes", "question": "Does this file define more functions than cla...
3
custom_components/waste_collection_schedule/package/source/example.py
trstns/hacs_waste_collection_schedule