source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import discord
from discord.ext import commands
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
# Comands
@commands.command(pass_context=True, aliases=("commands", "cmd"))
async def help(self, ctx):
embed = discord.Embed(title="There are all commands I know", descrip... | [
{
"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 | cogs/help.py | Tutuviz/yunna-bot |
import os
from enums import Status
class FakeFS:
def __init__(self, base_dir="/var/fake_fs"):
self.base_dir = base_dir
def get_chunk(self, path):
full_path = self.base_dir + path
if not os.path.isfile(full_path):
return {'status': Status.not_found}
data = None
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | fake_fs.py | osteotek/yamr |
from unittest import mock
from django.test import TestCase
from oscar.apps.shipping import methods, repository
class TestDefaultShippingRepository(TestCase):
def setUp(self):
self.repo = repository.Repository()
def test_returns_free_when_basket_is_non_empty(self):
basket = mock.Mock()
... | [
{
"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/integration/shipping/test_repository.py | QueoLda/django-oscar |
from ..utils import Object
class PageBlockRelatedArticle(Object):
"""
Contains information about a related article
Attributes:
ID (:obj:`str`): ``PageBlockRelatedArticle``
Args:
url (:obj:`str`):
Related article URL
title (:obj:`str`):
Article titl... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheri... | 3 | pytglib/api/types/page_block_related_article.py | iTeam-co/pytglib |
from csapp.models import Kruptos
from rest_framework import viewsets, permissions
from rest_framework.response import Response
from rest_framework import status
from .serializers import KruptosSerializer
class KruptosViewSet(viewsets.ModelViewSet):
permission_classes = [
permissions.AllowAny
]... | [
{
"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 | kruptos/csapp/api.py | ashwani762/Kruptos |
import os
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import gfile
from tensorface.const import PRETREINED_MODEL_DIR
MODEL_FILE_NAME = '20180402-114759/20180402-114759.pb'
# to get Flask not complain
global tf
_tf = tf
global sess
sess = None
def load_model(pb_file, input_map=None):
... | [
{
"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 | src/tensorface/embedding.py | TomasBombadil/tf-face-recognition |
x = 2
g = (x for x in range(10))
def f(l):
for i in range(l):
yield i ** 2
def ff(f):
yield from f
print("Noise")
| [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | tests/data/Action/Yielding.py | aalireza/arep |
# Owner(s): ["oncall: fx"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
from torch.testing._internal.common_fx2trt import AccTestCase, InputTensorSpec
from parameterized import parameterized
from torch.testing._internal.common_utils import run_tests
class TestReshapeConverter(AccTestCase):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
},... | 3 | test/fx2trt/converters/acc_op/test_reshape.py | you74674/pytorch |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | [
{
"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 | test/test_list_xrp_ripple_transactions_by_block_height_r_data.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python |
from interface import *
class M2:
interface = Interface()
def __init__(self, tamanhoDaLista, tempoDeAtraso, charPixel = ' '):
self.guardarNumero = 0
self.interface.set_tamanhoDaLista(tamanhoDaLista)
self.interface.set_tempoDeAtraso(tempoDeAtraso)
self.interface.set... | [
{
"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 | 07-programasDeAlgoritmo/1-programaDeAlgoritmoTipo1/0versoesAntigas/9-programa/algoritmo2.py | jonasht/Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .get_job import *
from .job import *
from .list_job_credentials import *
from ._... | [
{
"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 | sdk/python/pulumi_azure_nextgen/databox/v20200401/__init__.py | pulumi/pulumi-azure-nextgen |
from nextcord.ext import commands
import requests
# the prefix is not used in this example
bot = commands.Bot(command_prefix='$')
# @bot.event
# async def on_message(message):
# print(f'Message from {message.author}: {message.content}')
@bot.command()
async def ping(ctx):
await ctx.send(f"The bot latency is ... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | bot.py | parnexcodes/discord-bot-tutorial |
def dict_to_float(d):
"""
Converts all strings to floats from a dict
"""
if type(d) is dict:
for key, value in d.items():
if type(value) is str:
try:
d[key] = float(value)
except ValueError:
d[key] = str(value)
... | [
{
"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 | geminipy/helpers.py | Vanclief/gemini-python |
# Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character.
# input: S = "ab#c", T = "ad#c"
# output: true
# Explanation: Both S and T become "ac".
# input: S = "ab##", T = "c#d#"
# output: true
# Explanation: Both S and T become "". # is a specia... | [
{
"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 | 2.leet_code/contest/backspaceCompare.py | jimmymalhan/Coding_Interview_Questions_Python_algoexpert |
import torch
import torch.nn as nn
import sys
from functools import reduce
class JointLoss(nn.Module):
def __init__(self, alpha, beta):
super(JointLoss, self).__init__()
self.MSELoss = nn.MSELoss(size_average=False)
self.BCELoss = nn.BCELoss(size_average=True)
self.alpha = alpha
... | [
{
"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 | metrics.py | Zhaoyi-Yan/PFDNet |
from algo.apex.func import disable_info_logging, ray_remote_config, \
create_learner, create_monitor, create_evaluator
def create_worker(
Worker, worker_id, config,
env_config, buffer_config):
config = config.copy()
env_config = env_config.copy()
buffer_config = buffer_config.copy()
... | [
{
"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 | algo/seed/func.py | xlnwel/grl |
import json
from flask import Flask, request, Response, send_from_directory, redirect, flash
from flask_login import LoginManager, current_user, login_user
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired
from ..models ... | [
{
"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 | augur/routes/user.py | guowenbin90/augur |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20180510/DescribeCdnDeletedDomainsRequest.py | yndu13/aliyun-openapi-python-sdk |
"""Views for listing and configuring integrations."""
from __future__ import unicode_literals
from djblets.integrations.views import (BaseAdminIntegrationConfigFormView,
BaseAdminIntegrationListView)
from reviewboard.integrations.base import GetIntegrationManagerMixin
from rev... | [
{
"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 | reviewboard/integrations/views.py | amalik2/reviewboard |
import unittest
from net.wyun.mer.basicfunction import BasicFunction
class TestBasicFunction(unittest.TestCase):
def setUp(self):
self.func = BasicFunction()
def test_1(self):
self.assertTrue(True)
def test_2(self):
self.assertTrue(True)
def test_3(self):
self.ass... | [
{
"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 | net/wyun/tests/basic/test_basicfunction.py | michaelyin/im2markup-prep |
from graphene import ObjectType, String, Schema
class ExampleQuery(ObjectType):
hello = String()
def resolve_hello(self):
return "Hello"
class RootQuery(ExampleQuery, ObjectType):
pass
schema = Schema(query=RootQuery) | [
{
"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 | demo/graphQLDemos/spacy/schema.py | jehalladay/React-Playground |
"""Parser for LINK operation from KEGG API."""
import logging
from collections import defaultdict
from dabeplech.models.kegg import KeggLinksModel
from dabeplech.parsers.base import BaseParser
logging.basicConfig()
logger = logging.getLogger()
class KeggLinkParser(BaseParser):
"""Parser for LINK operation 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | dabeplech/parsers/kegg/link.py | motleystate/dabeplech |
import unittest
from rdflib import events
class AddedEvent(events.Event):
pass
class RemovedEvent(events.Event):
pass
def subscribe_to(source, target):
target.subscribe(AddedEvent, source._add_handler)
target.subscribe(RemovedEvent, source._remove_handler)
def subscribe_all(caches):
for cac... | [
{
"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 | test/test_events.py | odanoburu/rdflib |
import sys
def GetHumanReadable(size, precision=2):
"""Takes a byte sized input and computes the closest
human readable format, e.g., in megabytes etc."""
suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffixIndex = 0
while size > 1024 and suffixIndex < 4:
suffixIndex += 1
size = size / ... | [
{
"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 | exercise_05/exercise_code/networks/compute_network_size.py | Sihifu/i2dl |
import json
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import (
MessageDecoder, MessageEncoder,
)
from django.utils import six
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
"""
... | [
{
"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 | Lib/site-packages/django/contrib/messages/storage/session.py | ashutoshsuman99/Web-Blog-D19 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import unittest
from rest_framework import serializers
from ...serializers.swapping import SwappingSerializerMixin
class ChildSerializer(serializers.Serializer):
foo = serializers.IntegerField()
bar = serializer... | [
{
"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 | drf_braces/tests/serializers/test_swapping.py | wlongo/django-rest-framework-braces |
from hypothesis import given
from rene.exact import Point
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.points)
def test_reflexivity(point: Point) -> None:
assert point == point
@given(strategies.points, strategies.points)
def test_symmet... | [
{
"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 | tests/exact_tests/point_tests/test__eq__.py | lycantropos/rene |
"""Utilties for distributed processing"""
import horovod.tensorflow.keras as hvd
def rank():
try:
return hvd.rank()
except ValueError:
return 0
def barrier():
try:
hvd.allreduce([], name='Barrier')
except ValueError:
pass
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | CSCS/benchmarks/cosmoflow/implementations/cosmoflow-benchmark/utils/distributed.py | bgerofi/hpc_results_v0.7 |
import click
from .current import current
from .update import update
__all__ = [
'build'
]
@click.group(help='Manage tool versions.')
def versions() -> None:
pass
def build(cmd: click.Group) -> None:
"""親コマンドにサブコマンドを追加する。
Args:
cmd (click.Group): 親コマンド
"""
versions.add_command(cu... | [
{
"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 | src/create_github_project/commands/versions/__init__.py | nkomiya/create-github-project |
from .common import EventBuilder
from .. import utils
class Raw(EventBuilder):
"""
Raw events are not actual events. Instead, they are the raw
:tl:`Update` object that Telegram sends. You normally shouldn't
need these.
Args:
types (`list` | `tuple` | `type`, optional):
The typ... | [
{
"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 | telethon/events/raw.py | sipinrajvr/telePrg |
import winbrew
class Glslang(winbrew.Formula):
url = 'https://github.com/KhronosGroup/glslang/archive/7.8.2853.zip'
homepage = 'https://github.com/KhronosGroup/glslang'
sha1 = '8f7e1ba2bab166e39182790974564d27d6d628c8'
build_deps = ('cmake',)
deps = ()
def build(self):
self.cmake_buil... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | formula/glslang.py | FnControlOption/winbrew |
from scrape_utils import retrieveWebpage
from sportsreview_importer import retrieveLinks, bulkDownloadData, collateData
def saveSportReviewWebpage():
baseURL = 'https://www.sportsbookreviewsonline.com/scoresoddsarchives/nba/nbaoddsarchives.htm'
saveFile = 'data/sportsbookreview_nba_odds_archive.html'
element = '... | [
{
"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 | main.py | adv1996/nba-historical-betting |
"""
Pinger application. Periodically poll hosts to see if they are up. Log state in the
document database, but report state changes to the message Q
"""
from asyncio import run, get_event_loop, create_task
from aio_pika import ExchangeType, connect_robust
from tentacruel.config import get_config
from tentacruel.pi... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tentacruel/pinger/run.py | paulhoule/tentacruel |
import subprocess
import sys
import setup_util
import os
root = os.getcwd() + "/nancy"
app = root + "/src"
def start(args, logfile, errfile):
if os.name == 'nt':
return 1
setup_util.replace_text(app + "/Web.config", "localhost", args.database_host)
try:
# build
subprocess.check_call("rm -rf bin ... | [
{
"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 | nancy/setup_nginx.py | lightyeare/FrameworkBenchmarks |
from typing import List
from aiohttp import web
from asyncworker import App, RouteTypes
from asyncworker.http.decorators import parse_path
from asyncworker.http.wrapper import RequestWrapper
from asyncworker.routes import call_http_handler
class MyApp(App):
def http(self, routes: List[str], methods: List[str] = ... | [
{
"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 | baas/app.py | b2wads/baas-transfer |
# First create a Shuffle list
my_shuffle_list = [1,2,3,4,5]
# Now Import shuffle
from random import shuffle
shuffle(my_shuffle_list)
print(my_shuffle_list) # check wether shuffle is working or not
# Now let's create Guess Game. First create a list
mylist = ['','o','']
# Define function which will used furth... | [
{
"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 | python_basics/Method_ function/mixed_function_guess_game.py | alok8765/basic_python_practicse |
from django import forms
from .utils import number2powers, BitOptions
class BitOptionsWidget(forms.CheckboxSelectMultiple):
"""
Default BitOptionsField widget to present every option (bit) as checkbox.
"""
def value_from_datadict(self, data, files, name):
"""
Given a dictionary of da... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | bitoptions/widgets.py | amateja/django-bitoptions |
"""
This module contains functions to read Caltrans PEMS station data and metadata files.
"""
import pandas as pd
import sys
from ..caada_typing import pathlike as _pathlike
def read_pems_station_csv(csv_file: _pathlike) -> pd.DataFrame:
"""Read a Caltrans PEMS daily station .csv file
Parameters
------... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | caada/ca_pems/readers.py | joshua-laughner/CAADA |
from typing import Sequence, TypeVar, Union
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.core.anyof import any_of
from hamcrest.core.description import Description
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
from hamcrest.core.matcher import Matcher
__author__ = "Jon Reid"
__c... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | Lib/site-packages/hamcrest/library/collection/issequence_onlycontaining.py | Priyansh863/e-backend |
"""Tests for the Elgato Key Light integration."""
import aiohttp
from homeassistant.components.elgato.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from tests.components.elgato import init_integration
from tests.test_util.aiohttp import Aioh... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | tests/components/elgato/test_init.py | andersop91/core |
import pytest
import allure
from api_requests.preconditions import Preconditions
@allure.severity(allure.severity_level.NORMAL)
@pytest.mark.account
@pytest.mark.delete
def test_delete_account(app):
app.global_header.navigate_to_object('Account', 'Account')
app.list_view_page.open_list_view('All Accounts')
... | [
{
"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 | test/test_delete_record.py | Eduard-z/SF_project_pytest |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.nic.fr/fr/property_status_missing
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser impo... | [
{
"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 | test/record/parser/test_response_whois_nic_fr_fr_property_status_missing.py | huyphan/pyyawhois |
import math
class WebMercator(object):
@staticmethod
def lon_to_x(lon: float) -> float:
# return lon * 6378137.0 * math.pi / 180.0
return lon * 111319.490793274
@staticmethod
def lat_to_y(lat: float) -> float:
sin = math.sin(lat * math.pi / 180.0)
return 3189068.5 * ma... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/main/python/webmercator/__init__.py | mraad/WebMercator |
"""Module for the XacroFile substitution class."""
from pathlib import Path
from typing import Text, cast
import xacro
from launch.launch_context import LaunchContext
from launch.some_substitutions_type import SomeSubstitutionsType
from launch.substitution import Substitution
from launch.substitutions import Substit... | [
{
"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/slamcore_ros2_examples/python/slamcore_ros2_examples/xacro_file_contents.py | slamcore/slamcore-ros2-examples |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 18:19:15 2019
@author: pepo
"""
import libardrone
import pygame
from time import sleep
import time
import cv2
drone = libardrone.ARDrone()
def operation(sleep):
t1 = time.time()
t2=t1
while t2-t1<sleep:
drone.turn_left()
t2=time.time()
... | [
{
"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 | code/poc/emergency.py | a10pepo/parrot_ar_drone |
import shutil
from typing import Dict
from covid_shared import workflow
import covid_model_seiir_pipeline
from covid_model_seiir_pipeline.pipeline.parameter_fit.specification import FIT_JOBS, FitScenario
class BetaFitTaskTemplate(workflow.TaskTemplate):
tool = workflow.get_jobmon_tool(covid_model_seiir_pipeline... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/covid_model_seiir_pipeline/pipeline/parameter_fit/workflow.py | yukgu/covid-model-seiir-pipeline |
import logging
from distutils.dir_util import copy_tree
logger = logging.getLogger(__name__)
class Theme(object):
def __init__(self, course, name, source, theme_data):
self.course = course
self.hidden = False
self.name = name
self.source = source
keys = ('title','path','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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | makeCourse/theme.py | dualspiral/makecourse |
# encoding: utf-8
import unittest
import datetime
from timingsutil import Throttle
import logging_helper
logging = logging_helper.setup_logging()
class TestConfiguration(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_throttle(self):
t = Throttle(2)... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | venv/Lib/site-packages/timingsutil/unittests/test_throttle.py | avim2809/CameraSiteBlocker |
from collections import defaultdict
class Solution:
# Dict (Accepted), O(n) time and space
def videoStitching(self, clips: List[List[int]], time: int) -> int:
d = defaultdict(int)
for start, end in clips:
if start < time:
d[start] = max(d[start], end)
prev, ... | [
{
"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 | sols/1024.py | Paul11100/LeetCode |
from bot.decorators import error_handler
from bot.Cats_more_pages import MorePagesCats
import requests
URL_DOGS = 'https://izpriuta.ru/sobaki'
class MorePagesDogs: # The class for pages-parsing dogs
def __init__(self, url):
self.url = url
@error_handler
def parse_dogs(self):
html = requ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | bot/Dogs_more_pages.py | AlexanderZug/VKBotPetsParser |
class A(object):
def __init__(self):
self._x = 1
@property
def foo(self):
return self._x
@foo.setter
def foo(self, x):
self._x = x
@foo.deleter
def foo(self):
pass
@property
def boo(self):
return self._x
@boo.setter # name mismatch
def boo1(self, x):
self._x = x
@bo... | [
{
"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 | python/testData/inspections/PyPropertyDefinitionInspection26/src/prop_test.py | myvyang/intellij-community |
"""timeflux.core.exceptions: define exceptions"""
__all__ = [
"WorkerInterrupt",
"WorkerLoadError",
"GraphDuplicateNode",
"GraphUndefinedNode",
"ValidationError",
]
class TimefluxException(Exception):
"""Generic Exception."""
class GraphDuplicateNode(TimefluxException):
"""Raised when a... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | timeflux/core/exceptions.py | HerySon/timeflux |
import os, re
import frappe
from frappe import _
import frappe.sessions
from six import text_type
def get_context(context):
if (frappe.session.user == "Guest" or
frappe.db.get_value("User", frappe.session.user, "user_type")=="Website User"):
frappe.throw(_("You are not permitted to access this page."), frappe.Pe... | [
{
"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 | dashboard_z/www/reclamaciones.py | Lewinta/Dashboard_z |
from flask import Flask, escape
app = Flask(__name__)
@app.route('/user/username')
def show_user_profile(username):
return 'User %s' % escape(username)
@app.route('/post/<int:post_id>')
def show_post(post_id):
return 'Post %d' % post_id
@app.route('/path/<path:subpath>')
def show_subpath(subpath):
return... | [
{
"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 | novice/03-02/latihan/user.py | anisarizqi/praxis-academy |
import tensorflow as tf
# DISCLAIMER:
# Parts of this code file were originally forked from
# https://github.com/tkipf/gcn
# which itself was very inspired by the keras package
def masked_logit_cross_entropy(preds, labels, mask):
"""Logit cross-entropy loss with masking."""
loss = tf.nn.sigmoid_cross_e... | [
{
"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 | graphsage/metrics.py | gelareh1985/GraphSAGE |
import os
import json
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from starlette.config import Config
from starlette.requests import Request
from starlette.middleware.sessions import SessionMiddleware
from starlette.responses import HTMLResponse, RedirectResponse
from authlib.integr... | [
{
"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 | backend/app/api.py | Joel-hanson/fastapi-reactjs-boilerplate |
from .. import _Menu
from . import _layout_node_json
from nanome.util import Logs
import json
def parse_json(menu_json):
new_menu = _Menu._create()
assert(menu_json.read("is_menu", True))
new_menu._title = menu_json.read("title", new_menu._title)
new_menu._width = menu_json.read("width", new_menu._wid... | [
{
"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 | nanome/_internal/_ui/_io/_menu_json.py | nanome-ai/nanome-plugin-api |
from itertools import zip_longest
DAY = 'day'
HOUR = 'hour'
NAME = 'name'
class Formatter:
def __init__(self, indent=5 * ' '):
self.indent = indent
def append(self, text, tag=None):
raise NotImplementedError('Must override append() in derived class')
def println(self, *args):
se... | [
{
"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 | unjabberlib/formatters.py | adsr303/unjabber |
from meross_iot.api import MerossHttpClient
from meross_iot.supported_devices.power_plugs import Mss310
import os
import unittest
import time
EMAIL = os.environ.get('MEROSS_EMAIL')
PASSWORD = os.environ.get('MEROSS_PASSWORD')
class TestHttpMethods(unittest.TestCase):
def setUp(self):
self.client = Meros... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | tests/test_power_plugs.py | ictes/MerossIot |
import requests
import xmltodict
# TODO: Find out why this occasionally hangs
def request_json(url, **kwargs):
r = requests.get(url.format(**kwargs), timeout=5)
r.raise_for_status()
return r.json()
def request_xml(url, **kwargs):
r = requests.get(url.format(**kwargs), timeout=5)
r.raise_for_stat... | [
{
"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 | pizzapi/utils.py | MMRichardson/PizzaCLI |
import numpy as np
from sklearn import metrics
def auc(y_true, y_pred, **kwargs):
# y_pred.shape = (N, C)
# AUC for melanoma (class 0)
return {'auc': metrics.roc_auc_score((y_true==0).astype('float'), y_pred[:,0])}
def mel_auc(y_true, y_pred, **kwargs):
# y_pred.shape = (N, C)
# AUC for melanom... | [
{
"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/factory/evaluate/metrics.py | i-pan/kaggle-melanoma |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
import collections
from pylint.constants import MSG_TYPES
_MsgBase = collections.namedtuple(
"_MsgBase",
[
"msg_id",
"symbol",
"msg",
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | .venv/lib/python3.9/site-packages/pylint/message/message.py | linuscyl/multimedia-computing-assignment |
# article_manage/modles.py
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self) -> str:
return self.name
class Article(models.Model):
title = models.CharField(max_length=100)
subtitle = models.CharField(max_length=250)
... | [
{
"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 | article_manage/models.py | li195111/Article-Management-API |
from django import forms
from django.forms import widgets
from core.registration.static.models import StaticReg
from core.utils import resolve_ip_type
from mozdns.forms import BaseForm
from mozdns.utils import ensure_label_domain
class StaticRegForm(BaseForm):
class Meta:
model = StaticReg
fields... | [
{
"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 | core/registration/static/forms.py | jlin/inventory |
# Copyright (c) 2021 PaddlePaddle 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 by appli... | [
{
"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 | lite/tests/unittest_py/op/backends/x86/test_elementwise_div_op.py | xiebaiyuan/PaddleLite |
from typing import Union, Dict, List
from src.contexts.shared.domain.errors.DomainError import DomainError
class CryptoKeyInvalidValueError(DomainError):
ERROR_ID = '8fd818c5-10dc-4639-82ac-d4b37394517d'
def __init__(self, msg: str = None):
if msg is None:
msg = 'Invalid value for Crypto... | [
{
"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/contexts/kms/cryptokeys/domain/create_one/CryptoInvalidValueError.py | parada3desu/foxy-key-broker |
#!/usr/bin/env python
import pytest
"""
Test 1871. Jump Game VII
"""
@pytest.fixture(scope="session")
def init_variables_1871():
from src.leetcode_1871_jump_game_vii import Solution
solution = Solution()
def _init_variables_1871():
return solution
yield _init_variables_1871
class TestCl... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | tests/test_1871.py | yurirocha15/coding_practice |
#!/usr/bin/env python
import rospy, copy
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.msg import LightSensorValues
class WallStop():
def __init__(self):
self.cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
self.sensor_values = Li... | [
{
"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 | script/wall_stop.py | ei0410/pimouse_run_corridor |
import sqlalchemy as sa
import ocdskingfisherviews.cli.commands.base
from ocdskingfisherviews.field_counts import FieldCounts
class FieldCountsCommand(ocdskingfisherviews.cli.commands.base.CLICommand):
command = 'field-counts'
def configure_subparser(self, subparser):
subparser.add_argument("viewnam... | [
{
"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 | ocdskingfisherviews/cli/commands/field_counts.py | CDSPY/kingfisher-views |
from flask import Flask
from flask_mail import Message, Mail
from app.lazy import lazy_async
class MailAgent:
def __init__(self, app: Flask):
self.mail = Mail(app)
self.app = app
@lazy_async
def _async_mail(self, msg: Message):
with self.app.app_context():
self.mail.se... | [
{
"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 | app/model/mail_agent.py | dwdraugr/YADS |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-rest-admin
------------
Tests for `django-rest-admin` models module.
"""
from django.test import TestCase
from django_rest_admin import models
class TestDjango_rest_admin(TestCase):
def setUp(self):
pass
def test_something(self):
... | [
{
"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_models.py | inmagik/django-rest-admin |
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, BaggingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | NewClassifier.py | Youssefares/IMDB-sentiment-analysis |
# https://www.codewars.com/kata/577a98a6ae28071780000989/
def minimum(arr):
return min(arr)
def maximum(arr):
return max(arr)
| [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | codewars/find_min_max.py | Imbafar/Codewars_solutions |
from typing import Tuple
from torch.utils.data import IterDataPipe
class StreamReaderIterDataPipe(IterDataPipe[Tuple[str, bytes]]):
r""" :class:`StreamReaderIterDataPipe`
Iterable DataPipe to load IO stream with label name,
and to yield bytes with label name in a tuple
args:
chunk : bytes to ... | [
{
"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 | torch/utils/data/datapipes/iter/streamreader.py | vulcantron/pytorch |
import pytest
@pytest.fixture
def argtest():
class TestArgsClass(object):
cast = str
def __call__(self, arg):
self.arg = arg
return self.cast(arg)
def casted(self, cast):
self.cast = cast
return TestArgsClass()
@pytest.fixture
def invalid():
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | tests/conftest.py | OvalMoney/envi |
import unittest
import textwrap
from typing import Any, List
from hstest.check_result import CheckResult
from hstest.stage_test import StageTest
from hstest.test_case import TestCase
class FeedbackOnExceptionTest4(StageTest):
def generate(self) -> List[TestCase]:
return [
TestCase(feedback_o... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | .idea/VirtualEnvironment/Lib/site-packages/tests/outcomes/feedback_on_exception_test_4/test.py | ariawahyuw/Coffee-Machine |
# -*- coding: latin-1 -*-
"""
Created on Thu Mar 10 17:41:37 2016
@author: Celestin
"""
from Kaafhet.Inter import *
TEAM_ENEMY = WHILD
def once():
global TEAM_ENEMY
if gro.team == TEAM_1:
TEAM_ENEMY = TEAM_2
elif gro.team == TEAM_2:
TEAM_ENEMY = TEAM_1
def loop(turn):
if gro.waffle ... | [
{
"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 | game/gro.py | PictElm/Kaafhet |
ADJACENTS = ((-1 - 1j), (0 - 1j), (1 - 1j), (-1 + 0j), (1 + 0j), (-1 + 1j), (0 + 1j), (1 + 1j))
def compute_step():
new_flashes = set()
for k in octopuses:
octopuses[k] += 1
if octopuses[k] > 9:
octopuses[k] = 0
new_flashes.add(k)
while new_flashes:
for k i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | day_11/day_11.py | GuillaumeGandon/advent-of-code-2021 |
from django.shortcuts import redirect, render
from django.views.generic import TemplateView
from ..models import Student
class SignUpView(TemplateView):
template_name = 'registration/signup.html'
def home(request):
if request.user.is_authenticated:
if request.user.is_teacher:
return redir... | [
{
"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 | django_school/classroom/views/classroom.py | netomo/django-schools |
# Every server should implement "run" function.
# If need reload feature, server should implement "reload" function.
# "reload" function in this module is designed for reloading programtically.
# And this "reload" will only work in the main process.
# "reload" feature for APP should be implement manually.
# Example for... | [
{
"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 | utils/server/__init__.py | ethpch/api.ethpch |
"""
Copyright (c) 2018-2019 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 applicable law or agreed to i... | [
{
"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 | model-optimizer/extensions/ops/assert_op.py | zhoub/dldt |
##
# File: WfDataObjectImportTests.py
# Date: 10-Oct-2018 E. Peisach
#
# Updates:
##
"""Test cases for wwpdb.utils.wf - simply import everything to ensure imports work"""
__docformat__ = "restructuredtext en"
__author__ = "Ezra Peisach"
__email__ = "peisach@rcsb.rutgers.edu"
__license__ = "Creative Commons Attributi... | [
{
"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 | wwpdb/utils/tests_wf/WfDataObjectImportTests.py | epeisach/py-wwpdb_utils_wf |
# coding=utf-8
"""Dialog test.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'g.b... | [
{
"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 | AdnReport/test/test_Adn_Report_dialog.py | METIS-GEO/plugins |
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta):
def __init__(self,title,author):
self.title=title
self.author=author
@abstractmethod
def display(): pass
| [
{
"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 | 13)Abstract classes.py | SriCharan220800/RomanReigns |
from datetime import datetime
from chess_game.daos.player_dao import PlayerDao
from chess_game.models.player import Player
def test_player_dao_init(mongo_database):
player_dao = PlayerDao(mongo_database)
assert mongo_database == player_dao._mongo_database
def test_dao_create_and_find_player(mongo_database)... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | test/integration/daos/test_player_dao.py | jrj92280/python-eve-backend |
import numpy as np
import math
def diamond(lmbda=1, n=100):
"get points along diamond at distance lmbda from origin"
points = []
x = np.linspace(0, lmbda, num=n // 4)
points.extend(list(zip(x, -x + lmbda)))
x = np.linspace(0, lmbda, num=n // 4)
points.extend(list(zip(x, x - lmbda)))
x = ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | code/linreg/reg_support.py | dashbrookhart/msds621 |
from torchvision import transforms
from ..base import BaseTransforms
class ResizeCenterCropFlipHVToTensor(BaseTransforms):
def __call__(self, sample):
data_transforms = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize(256),
transforms.CenterCro... | [
{
"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 | aitlas/transforms/classification.py | tiendzung-le/aitlas |
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Mess... | [
{
"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 | app/email.py | superchilli/webapp |
from django.contrib import admin
from models import Post, Comment, Tag
from forms import PostFormAdmin
class CommentInline(admin.TabularInline):
"""
Inline definition for comments
"""
model = Comment
extra = 0
class PostAdmin(admin.ModelAdmin):
form = PostFormAdmin
fields = ('title', 'slu... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
},... | 3 | richtext_blog/admin.py | timmygee/django-richtext-blog |
import matplotlib.pyplot as plt
class PolCurve:
def __init__(self, current_density, voltage):
self.current_density = current_density
self.voltage = voltage
def plot_pol_curve(self, label=None, return_axes=None, ax=None):
if ax is None:
ax = plt.gca()
ax.plot(se... | [
{
"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 | fctest/__PolCurve__.py | akin-aroge/NXCT |
import os
import inspect
import importlib
def _not_hidden(f):
return f[0] != "_" and f[0] !='.'
def _get_files(file_):
return [
os.path.splitext(f.name)[0]
for f in os.scandir(os.path.dirname(file_))
if f.is_file() and _not_hidden(f.name)
]
def _get_dirs(file_, ignore=[]):
... | [
{
"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 | wa_simulator/_import.py | WisconsinAutonomous/wa_simulator |
from abc import ABCMeta
from abc import abstractproperty
# The base class for all BMI Exceptions
# Made abstract since it is recommended to raise the specific subclass
class BMIException(Exception):
__metaclass__ = ABCMeta
@abstractproperty
def status_code(self):
pass
# The base class for all e... | [
{
"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 | m2-modified/ims/exception/exception.py | CCI-MOC/ABMI |
"""
The player's AI code
Functions here are called by clock.py to run the AI code
"""
import random
import math
from clientLogic.logging import logPrint
from clientLogic import clientData, commands
def onConnect():
"""
Called when the player initially connects to the server but before the tank first spaw... | [
{
"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 | aiLogic/tankAI.py | JoelEager/pyTanks.Player |
from django.contrib.gis import admin
from django import forms
from django.utils.translation import gettext_lazy as _
from treebeard.forms import movenodeform_factory
from froide.helper.admin_utils import ForeignKeyFilter
from froide.helper.forms import get_fk_raw_id_widget
from .models import GeoRegion
class GeoRe... | [
{
"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 | froide/georegion/admin.py | lanmarc77/froide |
import pytest, sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../src/')
from sqlitedriver import sqliteclass
dbname = 'test.db'
shorturl = "shortdata"
longurl = "longdata"
@pytest.fixture(scope='module')
def resource_setup(request):
print('Setting up resources for testi... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | test/test_sqlitedriver.py | ahplummer/jutestring |
"""
https://github.com/svenkreiss/socialforce
Field of view computation.
"""
import numpy as np
class FieldOfView(object):
"""Compute field of view prefactors.
The field of view angle twophi is given in degrees.
out_of_view_factor is C in the paper.
"""
def __init__(self, twophi=200.0, out_of_vie... | [
{
"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 | misc/social_forces/fieldofview.py | umautobots/osp |
# RUN: %PYTHON %s
import absl.testing
import numpy
import test_util
import urllib.request
from PIL import Image
model_path = "https://tfhub.dev/tensorflow/lite-model/mobilenet_v2_1.0_224_quantized/1/default/1?lite-format=tflite"
class MobilenetQuantTest(test_util.TFLiteModelTest):
def __init__(self, *args, **kwar... | [
{
"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 | tflitehub/mobilenet_quant_test.py | rsuderman/iree-samples |
"""
Check if container weights can be properly seeded.
"""
import unittest
from conflowgen.domain_models.distribution_models.container_weight_distribution import ContainerWeightDistribution
from conflowgen.domain_models.distribution_seeders import container_weight_distribution_seeder
from conflowgen.tests.substitute_... | [
{
"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 | conflowgen/tests/domain_models/distribution_model_seeder/test_container_weight_distribution_seeder.py | bbargstaedt/conflowgen |
"""Wrapper class for DNS actions"""
class ZoneController(object):
def __init__(self, zone):
"""Initialize zone controller given a zone"""
self.zone = zone
def create_zone(self, **kwargs):
"""Create a zone under the specific cloud"""
return self.zone.cloud.ctl.dns.create_zone(... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | src/mist/api/dns/controllers.py | SpiralUp/mist.api |
from __future__ import unicode_literals
from django.db import models
#FIXME: Should be made more generic and probably pre-populated supported list
# but for now, since we only have a ZM400, this will do.
PRINTER_MODELS=[ ('Zebra ZM400', 'Zebra ZM400'),
('Zebra ZM600', 'Zebra ZM600')]
LABEL_SHAPES ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | bcmagic/models.py | detrout/htsworkflow |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.