source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from polog.handlers.file.rotation.rules.rules.file_size_rule import AbstractRule
class DateTimeRule(AbstractRule):
@classmethod
def prove_source(cls, source):
raise NotImplementedError
def check(self):
raise NotImplementedError
| [
{
"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 | polog/handlers/file/rotation/rules/rules/date_time_rule.py | pomponchik/polog |
# coding:utf-8
# author Abdulshaheed Alqunber
# version : 1.0.0
from google_trans_new import google_translator
import markovify as mk
def back_translate(text, language_src="ar", language_dst="zh"):
"""Translate text to a foreign language then translate back to original language to augment data
Parameters:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/araugment/augment.py | ashaheedq/araugment |
import dvc.logger as logger
from dvc.command.base import CmdBase
from dvc.exceptions import DvcException
class CmdRun(CmdBase):
def _joined_cmd(self):
if len(self.args.command) == 0:
return ''
if len(self.args.command) == 1:
return self.args.command[0]
cmd = ''
... | [
{
"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 | dvc/command/run.py | IlyaKisil/dvc |
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
from ast import literal_eval
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', with_zookeeper=True)
node2 = cluster.add_instance('node2', with_zookeeper=True)
node3 = cluster.add_insta... | [
{
"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/integration/test_replica_is_active/test.py | anishbhanwala/ClickHouse |
x = int(input())
m = int(input())
if x < 10:
if x <= m:
print(1)
else:
print(0)
else:
xarr = []
while x:
xarr = [x % 10] + xarr
x //= 10
n = len(xarr)
l = max(xarr) + 1
def check(base, xarr):
ans = xarr[0] * (base ** (n - 1))
if ans > m:
... | [
{
"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 | atcoder/ABC 192/D.py | ApocalypseMac/CP |
"""Tests for distutils.
The tests for distutils are defined in the distutils.tests package;
the test_suite() function there returns a test suite that's ready to
be run.
"""
import distutils.tests
import test.support
def load_tests(*_):
# used by unittest
return distutils.tests.test_suite()
def tearDownMod... | [
{
"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 | Lib/test/test_distutils.py | cyyever/nogil |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from pushTasks.celery import app
import logging
import struct
import redis
import json
import requests
import sys
sys.path.append('../')
from util.common import install_logger
from util import Http2APNsClient
from pushserver_config ... | [
{
"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 | pushTasks/APNs2Tasks.py | szqh97/teamtalk-pushserver |
#!/usr/bin/env python
import shutil
from pathlib import Path
import uvicorn
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from settings import PROD_TORTOISE_ORM, TEST_TORTOISE_ORM
from tortoise import Tortoise
from crud import hacks, locations, participants, teams, users
from setti... | [
{
"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 | backend/app.py | eaglesemanation/CyberGarden-HackPlatform |
'''
Given:
array of integers
Objective:
return a frequency array of the elements
count the number of times a value appears in the array
NB: Aways return a 100 value frequency array
Assumptions:
Example:
arr = [1, 1, 3, 2, 1]
values range = [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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | common_problems/arrays/count_occurences_counting_sort.py | praisetompane/3_programming |
from aoc import data
import parse
from collections import Counter
def part1(inputData):
# By sorting the endpoints all horizontal segments go left to right
# and all vertical segments go top to bottom
inputData = [sorted([(line['x1'], line['y1']), (line['x2'], line['y2'])]) for line in inputData]
visi... | [
{
"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 | 2021/day5.py | snoyes/AoC |
from graphgallery.sequence import FullBatchSequence
from graphgallery import functional as gf
from graphgallery.gallery.nodeclas import PyG
from graphgallery.gallery import Trainer
from graphgallery.nn.models import get_model
@PyG.register()
class SGC(Trainer):
"""
Implementation of Simplifying Graph Conv... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | graphgallery/gallery/nodeclas/pyg/sgc.py | TobiasSchmidtDE/GraphGallery |
import typing
import sys
sys.setrecursionlimit(1 << 20)
def lowlink_undirected(
n: int,
edges: typing.List[typing.Tuple[int, int]],
) -> typing.Tuple[typing.List[int], typing.List[int]]:
graph: typing.List[typing.List[typing.Tuple[int, int]]] = [
[] for _ in range(n)
]
for i, (u, v) in enu... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | jp.ac.u-aizu.onlinejudge/GRL_3_B/6220965.py | kagemeka/aoj-submissions |
import curses
import sys
import io
# un-insane-ify the screen so we can debug
debugging=False
def debug():
global debugging
if not debugging:
curses.nocbreak()
curses.echo()
curses.endwin()
debugging = True
def end_debug():
global debugging
stdscr = curses.initscr(... | [
{
"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 | shadowlands/tui/debug.py | georgerobescu/shadowlands |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"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 | clif/testing/python/non_raising_test.py | wangxf123456/clif |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... | [
{
"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_website_group.py | JeremyTangCD/lm-sdk-python |
import pytest
import aiohttp
import aionap
pytestmark = pytest.mark.asyncio
async def test_api_base_url():
api = aionap.API("http://localhost")
assert api._store['base_url'] == "http://localhost"
await api.close()
async def test_api_format():
api = aionap.API("http://localhost")
# default jso... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_api.py | unterwegi/aionap |
from ...ir_ast.instructions import IrInstExtractElement, IrInstInsertElement, IrInstShuffleVector
from be_typing import TYPE_CHECKING
def p_ir_opcode_vector_extract(p):
# type: (YaccProduction) -> None
"""
ir-opcode : ir-instruction-assignment EXTRACTELEMENT ir-value COMMA ir-value ir-instruction-atta... | [
{
"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 | mak/libs/ircc/ir_grammar/ir_opcodes/ir_vector.py | bugengine/BugEngine |
import os
from datetime import datetime
from urllib.parse import urlparse
from flask import Flask
from flask_github import GitHub
from markdown2 import markdown as from_markdown
from markupsafe import Markup
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
app = Flask(__name__)
app.config.... | [
{
"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 | gibolt/__init__.py | Kozea/gibolt |
import asyncio
from mitmproxy.tools import main
shutdown_script = "mitmproxy/data/addonscripts/shutdown.py"
def test_mitmweb(event_loop, tdata):
asyncio.set_event_loop(event_loop)
main.mitmweb([
"--no-web-open-browser",
"-s", tdata.path(shutdown_script),
"-q", "-p", "0",
])
de... | [
{
"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 | test/mitmproxy/tools/test_main.py | illera88/mitmproxy |
# -*- coding: utf-8 -*-
u"""Twilio module.
Author: Abhishek Sharma <abhishek_official@hotmail.com> , Jan 26 2019
Version: 1.1
"""
from twilio.rest import Client
class Twilio():
"""Initilize the Twilio."""
def __init__(self, cred):
"""Init logger params.
Args:
-----
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | old stuff/web_deface/notifs/twilio_sms.py | duongsky96/RiskAssessmentFramework |
from flask_cors import cross_origin
from flask import request, jsonify
from flask import current_app as app
from api.controllers.beach_controller import BeachController
@app.route('/api/beaches', methods=['GET'])
@cross_origin()
def get_all_beaches():
return jsonify(BeachController.get_all_beaches())
@app.route... | [
{
"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 | sig-backend/api/routes/beach_routes.py | antonioalfa22/sig-playas-asturias |
"""
Copyright 2016, Andrew Lin
All rights reserved.
This software is licensed under the BSD 3-Clause License.
See LICENSE.txt at the root of the project or
https://opensource.org/licenses/BSD-3-Clause
"""
import pytest
from app.gameshow import make_gameshow
@pytest.fixture
def app():
"""The whole gameshow app."... | [
{
"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/test_gameshow.py | AndrewWasHere/gameshow |
from sklearn import tree
from digoie.core.ml.classifier.mla.base import MLAlgorithm
class MLDecisionTree(MLAlgorithm):
# ML_NAME = DECISION_TREE
def __init__(self, training_dataset, training_label):
super(MLDecisionTree, self).__init__(training_dataset, training_label)
def generate(self):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | digoie/core/ml/classifier/mla/decision_tree.py | ZwEin27/digoie-annotation |
from django import forms
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from .models import User
class UserCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password',widget=forms.PasswordInput)
password2 = forms.CharField(label='Password confirmation',widget=forms.PasswordInp... | [
{
"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 | Back/user/forms.py | BUYA-GH/heavenhold |
#!/usr/bin/env python
# encoding: utf-8
import sys, unittest
from helpers import test
from optparse import OptionError
from hadoop.runner import Runner
class MockJob(object):
def __init__(self):
super(MockJob, self).__init__()
self.actions = []
def get_actions(self):
x = self.actions
self.actio... | [
{
"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": fals... | 3 | python/tests/test_runner.py | codahale/hadoop-streaming |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "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 | jdcloud_sdk/services/ipanti/apis/EnableWebRuleJsPageRequest.py | Tanc009/jdcloud-sdk-python |
"""Module containing the tests for the default scenario."""
# Standard Python Libraries
import os
# Third-Party Libraries
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("all")
def test_package... | [
{
"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 | molecule/default/tests/test_default.py | cisagov/ansible-role-docker |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class Mail:
"""Sending an email with smtp library"""
def __init__(self, smtpaddr, smtpport):
self.smtpaddr = smtpaddr
self.smtpport = smtpport
def check_mail_inputs(self, ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | v1.0/dc/utils/mail.py | iaiting/Flask-and-pywebview-followup-application-gui |
import pytest
import os
from app import create_app
@pytest.fixture
def app(monkeypatch):
app = create_app()
monkeypatch.setenv('DATA_PATH', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'sites.yml'))
app.config.update(
DATA_PATH=os.path.join(os.path.dirname(os.path.abspath(__file__)), '... | [
{
"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 | sleepless/tests/test_sleepless.py | Shagrat/eye-of-sauron |
"""Common configuration elements for reward network training."""
import logging
from typing import Any, Mapping, Type
import sacred
from stable_baselines3.common import vec_env
from imitation.rewards import reward_nets
from imitation.util import networks
reward_ingredient = sacred.Ingredient("reward")
logger = logg... | [
{
"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 | src/imitation/scripts/common/reward.py | yulonglin/imitation |
import io
import json
from typing import List, Dict
import pandas as pd
from sentinel.exporters.base import Exporter, ExporterFactory
@ExporterFactory.register(exporter_name="csv", description="CSV Exporter")
class CSVExporter(Exporter):
"""
CSV report exporter.
"""
def __init__(self, *args, **kwar... | [
{
"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 | sentinel/exporters/csv.py | skit-ai/sentinel |
import sys
from PIL import ImageDraw, ImageFont, Image
def input_par():
print('Enter the text to insert in image: ')
text = str(input())
print('Enter the desired size of the text: ')
size = int(input())
print('Enter the color for the text(r, g, b): ')
color_value = [int(i) for i in input().sp... | [
{
"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 | meme_maker.py | nicetone/Python |
# coding: utf-8
"""
TileDB Storage Platform API
TileDB Storage Platform REST API # noqa: E501
The version of the OpenAPI document: 2.2.19
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import datetime
import unittest
import tiledb.cloud.rest_api
from tile... | [
{
"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 | tiledb/cloud/rest_api/test/test_writer.py | TileDB-Inc/TileDB-Cloud-Py |
#Main auth script
from time import time_ns as nanos
from argon2 import PasswordHasher
from argon2.exceptions import VerifyMismatchError
import json
import sys
import hashlib
import os.path as path
import mongo
common = {} #Load the 10.000 most common passwords list
with open('common.json', 'r') as f:
common =... | [
{
"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/main.py | LinoBigatti/hekate-auth |
from __future__ import absolute_import
import os
import numpy as np
import gzip
import struct
from .preprocessing import one_hotify
def load(data_dir, valid_ratio=0.0, one_hot=True, shuffle=False, dtype='float32'):
train_set, valid_set, test_set = {}, {}, {}
# Get data from binary files
for img_set, file_name... | [
{
"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 | rme/datasets/mnist.py | satishjasthi/convnet-study |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'CYX'
import aiohttp, asyncio
HOST = 'localhost'
async def url_access(session, url):
async with session.get(url) as response:
return await response.read()
async def main(url):
async with aiohttp.ClientSession() as sess:
res = await... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | rest-apis/test/api_test.py | fishermano/QShield |
from typing import Any
import discord
from redbot.core import commands
from redbot.core.utils.predicates import MessagePredicate
Cog: Any = getattr(commands, "Cog", object)
class BanMe(Cog):
"""
Ridiculous cog for a ridiculous request
"""
def __init__(self, bot):
self.bot = bot
@comman... | [
{
"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 | banme/banme.py | reo-ar/reo-cogs |
import info
class subinfo( info.infoclass ):
def setTargets( self ):
for ver in ["1.4.18"]:
self.targets[ ver ] = f"https://ftp.gnu.org/gnu/m4/m4-{ver}.tar.xz"
self.targetInstSrc[ ver ] = f"m4-{ver}"
self.targetInstallPath[ver] = "dev-utils"
self.targetDigests[... | [
{
"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 | blueprints/dev-utils/_unix/m4/m4.py | juergenhoetzel/craft |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000195"
addresses_name = "local.2018-05-03/Version 1/Democracy_Club__03May2018.tsv"
stations_name = "local.2018-05-03/Version 1/Democracy_Club__03May2018.ts... | [
{
"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 | polling_stations/apps/data_importers/management/commands/import_newcastle_under_lyme.py | danielgriffin48/UK-Polling-Stations |
from django_ontruck.notifiers import AsyncNotifier, Notifier
from ..test_app.notifiers import DummySMSNotifier
def test_sms_notifier(mocker):
notifier = DummySMSNotifier(phone_number='123', delayed=False)
assert isinstance(notifier, Notifier)
notifier.send()
def test_sms_async_notifier(mocker):
not... | [
{
"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/notifiers/test_sms_notifier.py | ontruck/django-ontruck |
from flask import Flask
from threading import Thread
app = Flask(__name__)
@app.route("/")
def hello():
return '<h2>hello</h2>'
def run():
#app.run(host='127.0.0.1',port=5000)
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
| [
{
"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 | server.py | Jacob-Lewis/Autobots |
# -*- coding: utf-8 -*-
import copy
import logging
from spaceone.core.error import *
from spaceone.core.auth.jwt import JWTUtil
from google.protobuf.json_format import MessageToDict
from spaceone.core import pygrpc
from spaceone.core import utils
from spaceone.core.transaction import Transaction
from spaceone.api.core... | [
{
"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 | src/spaceone/core/handler/authorization_handler.py | choonho/python-core |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...vml import Vml
class TestWriteXColumn(unittest.TestCase):
"""
Test the Vml _write_column(... | [
{
"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 | xlsxwriter/test/vml/test_write_column.py | DeltaEpsilon7787/XlsxWriter |
import cv2
import io
import os
import time
import sys
from redis import Redis
from panda3d.core import CardMaker, Texture, PNMImage
from direct.stdpy import threading, thread
PIPE_FILE = "panda_camera_pipe.pnm"
class CameraReader:
def __init__(self, index=1, pipe=PIPE_FILE):
self.cap = cv2.VideoCapture... | [
{
"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 | util3d/cameratex.py | aolkin/text-physics |
from flask import Flask, jsonify, send_file, url_for
import data_functions
from datetime import datetime
app = Flask(__name__) #__name__ is a special variable in python that creates an instance of the web app
@app.route("/", methods =['GET'])
def hello():
return ("Hello World")
@app.route("/hello")
def helloo():... | [
{
"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 | api/api.py | PranavPusarla/WeightTracker |
# -*- coding: utf-8 -*-
#
# Copyright (C) Hewlett Packard Enterprise Development LP
#
# 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
#
# Unles... | [
{
"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 | test/test_eridium_main.py | HPENetworking/eridium |
#!/usr/bin/env python
# Copyright (c) 2014 Park Ilsu. See LICENSE for details.
from wind.web.httpserver import HTTPServer
from wind.web.app import WindApp, path, Resource
class HelloResource(Resource):
def handle_get(self):
self.write('Hello')
self.finish()
def main():
app = WindApp([
... | [
{
"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 | examples/helloserver.py | lordpeara/wind |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_data_labels19.py | dthadi3/XlsxWriter |
import subprocess
from consolemenu.items import ExternalItem
class CommandItem(ExternalItem):
"""
A menu item to execute a console command
"""
def __init__(self, text, command, arguments=None, menu=None, should_exit=False):
"""
:ivar str command: The console command to be executed
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | consolemenu/items/command_item.py | Gimli76/console-menu |
import cbpro
import pandas as pd
from base64 import b64encode
class Coinbase:
def __init__(self, API_KEY, API_SECRET, API_PASS, ENV_URL="https://api-public.sandbox.pro.coinbase.com"):
self.API_KEY = API_KEY
self.API_SECRET = API_SECRET
self.API_PASS = API_PASS
self.ENV_URL = ENV_URL
self.client = cbpro.Auth... | [
{
"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 | cyberhead/modules/brokers/coinbase/Coinbase.py | fakecoinbase/TheCyberHeadslashCyberHead |
from nearest import nearest_square
def test_nearest_square_5():
assert(nearest_square(5) == 4)
def test_nearest_square_12():
assert(nearest_square(12) == 9) | [
{
"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 | Udacity/aws-ml-ud090/sw-part-2/test_nearest_square.py | mohammedelzanaty/myRoad2BeFullStack |
from django.db.models import fields
from rest_framework import serializers
from clients.models import Client
from clients.validators import *
class ClientSerializer(serializers.ModelSerializer):
class Meta:
model = Client
fields = '__all__'
def validate(self, data):
if not name_valid(d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | clients/serializers.py | bonetou/django-api-clients |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email successful"""
email = 'test@india.com'
password = 'Testpass123'
user = get_user_mo... | [
{
"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 | app/core/tests/test_models.py | TheHRC/recipe-app-api |
import os
from flask import Flask
from flask import send_from_directory
app = Flask(__name__)
@app.route('/')
def hello_world():
return '<a href="/download">View file</a>'
@app.route('/download')
def download():
uploads = '/home/runner/manim-repl/manim/media/videos/example_scenes/720p30/'
return send_from_dir... | [
{
"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 | main.py | lunaroyster/manim-repl |
from typing import List
import pytest
from .common import BaseTestRule
class TestPyPiApiToken(BaseTestRule):
@pytest.fixture(params=[
[
"pypi-AgEIcHlwaS5vcmc" #
"CJGE3ZjdlNzVmLTRhOGEtNGY1MC1iMzEwLWQzZTQ1NmJiYzMzMQ" #
"ACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uI... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | tests/rules/test_pypi_api_token.py | babenek/CredSweeper |
#!/usr/bin/env python
import os
import sgmake
from common import Status
from common import Support
from common import Settings
from common.Plugin import Plugin
import clean.clean
def make(project):
try:
project.cmakepath = ""
except:
pass
try:
os.mkdir("build")
except:
... | [
{
"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 | steps/make/cmake.py | flipcoder/siege-tools |
from torch import nn
from tsl.nn.utils import utils
class Dense(nn.Module):
r"""
A simple fully-connected layer.
Args:
input_size (int): Size of the input.
output_size (int): Size of the output.
activation (str, optional): Activation function.
dropout (float, optional): D... | [
{
"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 | tsl/nn/base/dense.py | TorchSpatiotemporal/tsl |
import argparse
import time
from . import encode_file, decode_file
from .utils import get_file
from .wav import Wave
parser = argparse.ArgumentParser("pysilk", description="encode/decode your silk file")
parser.add_argument("-sr", "--sample-rate", default=24000, help="set pcm samplerate")
parser.add_argument("-q", "-... | [
{
"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 | src/pysilk/__main__.py | wyapx/Python-Silk-Module |
# -*- coding: utf-8 -*-
from patientMatcher.utils.add import add_node
def test_add_client(database, test_client):
"""Test adding a client with auth token to the database"""
is_client = True
# no clients should be present in demo database
assert database["clients"].find_one() is None
inserted_i... | [
{
"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 | tests/backend/test_nodes.py | john1711/patientMatcher |
class A:
def foo(self):
print("A")
class B(A):
# def foo(self):
# print("B")
pass
class C(A):
def foo(self):
print("C")
super(C, self).foo()
class D(B, C):
def foo(self):
print("D")
super(D, self).foo()
if __name__ == '__main__':
d = D()
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | PythonAndOop/N42_super_3.py | jiauy/before_work |
import pandas as pd
from app import db, app
from app.fetcher.fetcher import Fetcher
from app.models import OckovaniSpotreba, OckovaciMisto
class UsedFetcher(Fetcher):
"""
Class for updating used vaccines table.
"""
USED_CSV = 'https://onemocneni-aktualne.mzcr.cz/api/v2/covid-19/ockovani-spotreba.csv... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | app/fetcher/used_fetcher.py | msusicky/ockovani-covid |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"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 | sdk/servicebus/azure-servicebus/tests/perf_tests/T1_legacy_tests/receive_message_stream.py | rsdoherty/azure-sdk-for-python |
import unittest
import lambda_function
class FindTaco(unittest.TestCase):
def test_find_none(self):
self.assertEqual(lambda_function.find_taco("test test :taco test"), 0)
def test_find_one(self):
self.assertEqual(lambda_function.find_taco("test test :taco: test"), 1)
def test_find_two(s... | [
{
"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 | webhook/lambda_function_test.py | shaun4477/yotaco |
import ray
import jax
import input_pipeline
@ray.remote
class Worker:
def __init__(self):
self.generator = None
def register_generator(self, func):
self.generator = iter(func())
def get_next(self):
return next(self.generator)
def make_generator():
import tensorflow as tf
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | playground/other/test_ray_dataloader.py | yf225/alpa |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | aliyun-python-sdk-dms-enterprise/aliyunsdkdms_enterprise/request/v20181101/GetDataCorrectSQLFileRequest.py | ankitdobhal/aliyun-openapi-python-sdk |
class ReplayBuff:
def __init__(self):
self.reset()
def append(self, S, action, S_new, reward, done):
"""
Separated copies are needed to save, so that we use copy() command
"""
self.d['S'].append(S)
self.d['action'].append(action)
self.d['S_new'].appen... | [
{
"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 | code/locallib.py | jskDr/tictactoe |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
DOMAIN = "domain"
class Output:
SCORE = "score"
class ScoreDomainInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"domain": {
"type": "string"... | [
{
"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 | typo_squatter/komand_typo_squatter/actions/score_domain/schema.py | xhennessy-r7/insightconnect-plugins |
import pickle
import warnings
from collections import OrderedDict
class Reporter:
def __init__(self, entries_names=None):
self.entries = None
if entries_names is not None:
self.entries = OrderedDict([(entry, [[]]) for entry in entries_names])
def move_to_new_series(self):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | kheppy/utils/reporting.py | Ewande/kheppy |
class Solution(object):
def removeDuplicates(self, nums: List[int]) -> int:
i = 0
for j in range(len(nums)):
if (i == 0 or nums[i - 1] < nums[j]):
nums[i] = nums[j]
i += 1
return i
class Solution2:
def removeDuplicates(self, nums: Li... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | leetcode/26.remove-duplicates-from-sorted-array.py | geemaple/algorithm |
import time
import helper
def time_measure(func):
"""
Decorator function to measure time
"""
def inner(*args_, **kwargs_):
"""
args_ contains: [team_id, ...]
"""
t0_ = time.time()
output = func(*args_, **kwargs_)
print("[{0}] Execution time of '{1}': {2}... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/helpers/diagnostic_helpers.py | Freudenberger/NeuralNetworks |
import os
from flask import Flask, escape, request, jsonify
from marshmallow import ValidationError
from flask_pymongo import PyMongo
from src.auth.auth_exception import UserExistsException, UserNotFoundException, AccessDeniedException
from src.auth.controllers.auth import auth_blueprint
import src.settings
from src.... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | src/app.py | taller-de-programacion-2/rest-python-flask |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... | [
{
"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 | isi_sdk_8_2_1/test/test_storagepool_unprovisioned.py | mohitjain97/isilon_sdk_python |
"""A Class for manages a Palantir configuration file"""
from datetime import datetime
import yaml
def format_time_string(time_string):
return datetime.strptime(time_string, '%d/%m/%Y')
class ConfigurationManager:
"""Represents a configuration file"""
def __init__(self, configuration_filepath):
... | [
{
"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 | src/palantir/configuration_manager.py | richardjlyon/palantir |
import os
import random
from dotenv import load_dotenv
from unittest.mock import AsyncMock
from distribution import request_smsc, Methods
load_dotenv()
def _side_effect(*args, **kwargs):
if args[0] == 'send':
return {'id': random.randint(1, 1000), 'cnt': 1}
elif args[0] == 'status':
raise N... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | app/helpers.py | wenny17/sms-sending-service |
import functools
import re
from django.conf import settings
from django.contrib.auth import hashers
from django.core.exceptions import ObjectDoesNotExist, ValidationError
def validate_password_rule(regex, password,
password_field, failure_message='invalid password'):
if not re.search(r... | [
{
"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 | cfgov/v1/util/password_policy.py | Mario-Kart-Felix/cfgov-refresh |
# ---------------------------------------------------------------------
# HP.ProCurve.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python... | [
{
"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 | sa/profiles/HP/ProCurve/get_version.py | prorevizor/noc |
class BaseError(Exception):
"""
"""
class TunicornException(BaseError):
"""
"""
class HaltServerException(TunicornException):
"""
"""
def __init__(self, reason, exit_status=1):
self.reason = reason
self.exit_status = exit_status
msg = "Halt... | [
{
"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 | tunicorn/exceptions.py | by46/tunicorn |
import logging
import time
from loguru import logger
from goodguy.service.crawl import get_recent_contest
from goodguy.timer.contest.email_job import send_contest_remind_email
from goodguy.timer.contest.feishu_job import send_contest_feishu_message
from goodguy.util.config import GLOBAL_CONFIG as GBC
from goodguy.uti... | [
{
"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 | goodguy/timer/contest/contest_job.py | ConanYu/GoodGuy |
import torch
from torch import nn
from torch.autograd import Variable
class PairWise(nn.Module):
def __init__(
self,
margin=1
):
super(PairWise, self).__init__()
self.tanh = nn.Tanh()
self.loss_fct = nn.MarginRankingLoss(
margin=margin,
reductio... | [
{
"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 | metaranker/losses/pairwise.py | thunlp/MetaAdaptRank |
import os
import requests
import csv
import datetime
import time
import json
from tqdm import tqdm
from dotenv import load_dotenv
load_dotenv()
token = os.environ.get("COIN_CAP_API_KEY")
start_date = datetime.date(2018, 1, 1)
end_date = datetime.date(2021, 11, 1)
delta = datetime.timedelta(days=1)
range = end_date -... | [
{
"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 | backend/datasets/scrape.py | rohankmr414/nighteye |
class Color(object):
""" 输出各种颜色,方便 shell观察 """
@staticmethod
def black(text):
""" 黑色 """
return '\033[90m{content}\033[0m'.format(content=text)
@staticmethod
def red(text):
""" 红色 """
return '\033[91m{content}\033[0m'.format(content=text)
@staticmethod
def ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | src/scrapy_redis_loadbalancing/tools.py | EchoShoot/scrapy-redis-loadbalancing |
import pytest
import asyncio
from starkware.starknet.testing.starknet import Starknet
from utils import Signer
signer = Signer(123456789987654321)
@pytest.fixture(scope='module')
def event_loop():
return asyncio.new_event_loop()
@pytest.fixture(scope='module')
async def ownable_factory():
starknet = await ... | [
{
"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 | tests/access/test_Ownable.py | juanigallo/cairo-contracts |
"""
Programming for linguists
Interfaces for digits
"""
from typing import Union
from algorithms.calculator.reverse_polish_notation.element import Element
class Digit(Element):
"""
Interface for presenting a digit
"""
def __init__(self, digit_as_string: Union[float, str]):
print(digit_as_st... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | algorithms/calculator/reverse_polish_notation/digit.py | VallyWonka/programming-for-linguists |
import unittest
from ddt import ddt
from ddt import file_data
from google_analytics_pipeline.core.enrichment.utm import UTMParamsEnrichmentFn
@ddt
class TestUTMEnrichment(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.test_fn = UTMParamsEnrichmentFn().process
@file_data("../... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | 3-enrich/python-enrich/google-analytics-pipeline/tests/tests/test_utm_enrichment.py | klow-analytics/klow |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | [
{
"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 | spark_auto_mapper_fhir/value_sets/consent_scope_codes.py | imranq2/SparkAutoMapper.FHIR |
# -*- coding: utf-8 -*-
from base import BaseApi
class Groups(BaseApi):
def __init__(self, cfg):
super().__init__(cfg)
self.api = 'http://%s/api/v4/groups'
#def run(self):
# super().run()
def inserts(self, source):
new_res = []
exist_res = []
target_res = []
for src in source:
sname = src['name'... | [
{
"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 | src/groups.py | hcylus/gitlab-migrator |
import re
from .common import regex_labels, re_number, re_string
keywords = ['TODO']
re_keyword = re.compile(r'\b({})\b'.format('|'.join(keywords)))
def init(document):
document.OnGenerateLabeling.add(main)
def main(document):
regex_list = [(re_keyword, 'keyword'), (re_number, 'number'), (re_string, 'stri... | [
{
"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 | fate/labeling/txt.py | Mattias1/fate |
import unittest
import hcl2
from checkov.terraform.checks.resource.linode.user_username_set import check
from checkov.common.models.enums import CheckResult
class Testuser_username_set(unittest.TestCase):
def test_success(self):
hcl_res = hcl2.loads("""
resource "linode_user" "test" {
us... | [
{
"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/terraform/checks/resource/linode/test_user_username_set.py | pmalkki/checkov |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1_iscsi_volume_source.py | redjohn/python |
"""Get the local IP address of the Home Assistant instance."""
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from .const import DOM... | [
{
"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 | homeassistant/components/local_ip/__init__.py | domwillcode/home-assistant |
# -*- coding: utf-8 -*-
"""The VFS back-end CLI arguments helper."""
from __future__ import unicode_literals
from plaso.cli import tools
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.lib import errors
class VFSBackEndArgumentsHelper(interface.ArgumentsHelper):
"""VFS bac... | [
{
"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 | plaso/cli/helpers/vfs_backend.py | rgayon/plaso |
from typing import Dict, Set, Tuple
import numpy as np
import mutation_prediction_native as native
from mutation_prediction import data
from mutation_prediction.data import Dataset
def load_alignments(dataset: Dataset) -> Dict[str, Tuple[str, Set[str]]]:
return native.load_alignments(dataset.get_msa_path(), dat... | [
{
"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 | mutation_prediction/data/msa_helper.py | Turakar/mutation-prediction |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from .escape_type_service import Escape_typeService
from .http_client import HTTPClient
from .uri_service import UriService
from .User2_0 import User2_0
BASE_URI = "http://localhost:5000"
class Client:
"""
auto-generated. don't ... | [
{
"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 | codegen/python/fixtures/method/special_chars/client/__init__.py | feeltheajf/go-raml |
import re
class RemoteJmxQueue(object):
def __init__(self, jolokia_session, broker_name, queue_name):
self.name = queue_name
self.jolokia_session = jolokia_session
self.queue_bean = (
"org.apache.activemq:type=Broker,brokerName={},"
"destinationType=Queue,destination... | [
{
"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 | test/utils/jmx/broker/remote_jmx_queue.py | julianghionoiu/tdl-client-python |
from fiasko_bro.validators import casts_input_result_to_str
def test_casts_input_result_to_str_fails(test_repo):
expected_output = 'file_with_input_to_str_cast.py:1'
output = casts_input_result_to_str(test_repo)
assert output == expected_output
def test_casts_input_result_to_str_succeeds(origin_repo):
... | [
{
"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/test_general_validators/test_has_no_cast_input_result_to_str.py | SerejkaSJ/fiasko_bro |
from hanapin import Google, Bing, DuckDuckGo, Ask
# define search engines
__SEARCH_ENGINES = {
"google": Google,
"bing": Bing,
"duckduckgo": DuckDuckGo,
"ask": Ask
}
def search(website: str, query: str):
try:
hp = __SEARCH_ENGINES[website]
except KeyError:
return "Search Engin... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | api/handler.py | TheBoringDude/am-i-indexable |
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AuthenticationForm
from django.utils.translation import ugettext_lazy as _
from .models import CustomUser
class CustomUserCreationForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = CustomUser... | [
{
"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 | users/forms.py | DmitrySevostianov/base_lerning_project |
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, "pages/index.html")
def about(request):
return render(request, "pages/about.html")
def contact(request):
return render(request, "pages/contact.html")
def team(request):
return render(request, "p... | [
{
"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 | pages/views.py | mosalaheg/django3.2 |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
import math
from individual import Individual
class Evaluator(metaclass=ABCMeta):
def __init__(self):
Individual.set_evaluator(self)
def evaluate(self, individual):
"""個体を評価する
Args:
individual (individual):... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | src/evaluator.py | ryoutoku/real-coded-genetic-algorithm |
class _OBJECT_ATTRIBUTES(_OBJECT_ATTRIBUTES):
@classmethod
def from_string(cls, path, attributes=OBJ_CASE_INSENSITIVE): # Directly on constructor ?
self = cls()
self.Length = ctypes.sizeof(self)
self.RootDirectory = 0
self.ObjectName = ctypes.pointer(LSA_UNICODE_STRING.from_strin... | [
{
"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 | ctypes_generation/extended_structs/_OBJECT_ATTRIBUTES.py | IMULMUL/PythonForWindows |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.