source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from rest_framework.response import Response
from rest_framework import status
from shipments.logic import ShipmentLogic
from ecommerce.core.views import BaseDetailView, BaseView
from ecommerce.views import BaseAPIView
class ShipmentView(BaseView):
def __init__(self):
super().__init__()
self.lo... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | ecommerce/apps/shipments/views.py | crstnrm/ecommerce |
import csv
import pandas as pd
from django.core.management import BaseCommand
from ...models import Movie
class Command(BaseCommand):
help = 'Load a movie csv file into the database'
def add_arguments(self, parser):
parser.add_argument('--path', type=str)
def handle(self, *args, **kwargs):
... | [
{
"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 | recommender/movierecommender/management/commands/load_movies.py | ibm-developer-skills-network/oroir-Build-a-Personal-Movie-Recommender-with-Django |
import random
from os import urandom
from data_gateway.dummy_serial.constants import ALPHABET, NUMBERS
def random_bytes(length=8, as_bytearray=False):
"""Generate a random bytes object of a given length.
:param length: Length of bytes object to generate (default 8)
:type length: int
:param as_bytear... | [
{
"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 | data_gateway/dummy_serial/utils.py | aerosense-ai/data-gateway |
import math
from collections.abc import Iterator
from pathlib import Path
def solution_part1(report_file_path: Path) -> int:
total = 0
previous = math.inf
with report_file_path.open() as report_reader:
for number in report_reader:
number = float(number)
if number > previous... | [
{
"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 | 2021/day_1/solution.py | Kronopt/advent-of-code |
import asyncio
from aiohttp import web
from tt_web import log
from tt_web import postgresql
async def initialize(config, loop):
await postgresql.initialize(config['database'], loop=loop)
async def deinitialize(config, loop):
await postgresql.deinitialize()
async def on_startup(app):
await initializ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | src/tt_bank/tt_bank/service.py | devapromix/the-tale |
from dataclasses import dataclass
from typing import Dict, List, Tuple
import base64
import io
import PIL.Image
import numpy as np
@dataclass
class BBox:
"""Bounding box dataclass.
(x1, y1) - top left corner, (x2, y2) - bottom right one
"""
x1: int
y1: int
x2: int
y2: int
class BaseOb... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | telesto/utils.py | telesto-ai/telesto-base |
def getNewBytes(conn):
"""Checks a pipe connection for new messages."""
# Check for new messages
readAttempts = 0
receivedData = bytearray()
while readAttempts < 100:
dataAvailable = conn.poll(0)
if dataAvailable:
receivedData += conn.recv_bytes()
else:
... | [
{
"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 | python/mesh/generic/multiProcess.py | MinesJA/meshNetwork |
#!/usr/bin/python3
########################################################################
############## Check the AIX system fix filesets and lpp! ##############
########################################################################
import os
import re
class FixLppCheck():
# Check the AIX system fix filesets
... | [
{
"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 | script/fix_lpp_ck.py | bond-huang/AIX-Check-Script |
from config.config_dto import ConfigDTO
from service import ServiceDataBase
class ControllerDataBase(object):
def __init__(self, config:ConfigDTO = None, collection_name = None):
self.__config = config
self.__service = ServiceDataBase(config=config, collection_name=collection_name)
def ge... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | controller.py | josmejia2401/angox-core-lib |
import boto3
def get_es_client(access_key, secret_key, region):
"""
Returns the client object for AWS Elasticsearch
Args:
access_key (str): AWS Access Key
secret_key (str): AWS Secret Key
region (str): AWS Region
Returns:
obj: AWS Elasticsearch Object
"""
retu... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | installer/core/providers/aws/boto3/es.py | Diffblue-benchmarks/pacbot |
# To the extent possible under law, ALBERT Inc. has waived all copyright and
# related or neighboring rights to this work.
# For legal code, see ``CC0.txt`` distributed with this file or
# <https://creativecommons.org/publicdomain/zero/1.0/>_.
#
# We thank to the original author Sebastiano Vigna.
from collections impor... | [
{
"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 | xoshiro.py | ALBERT-Inc/blog-groupnorm |
import helpers
import pytest
import meshio
@pytest.mark.parametrize(
"mesh",
[
helpers.line_mesh,
helpers.tri_mesh,
# helpers.triangle6_mesh,
helpers.quad_mesh,
helpers.quad8_mesh,
helpers.tri_quad_mesh,
helpers.tet_mesh,
# helpers.tet10_mesh,
... | [
{
"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 | test/test_permas.py | sopherrmann/meshio |
from . import client
import json
# Testing the main page
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "The Entire Application"}
# Testing if new users with valid
# credentials can register successfully.
def test_user_registrati... | [
{
"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 | tests/test_a.py | Skhendle/Blogger-Block- |
import komand
from .schema import ReverseIpWhoisInput, ReverseIpWhoisOutput
# Custom imports below
from komand_domaintools.util import util
class ReverseIpWhois(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='reverse_ip_whois',
description='P... | [
{
"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 | domaintools/komand_domaintools/actions/reverse_ip_whois/action.py | killstrelok/insightconnect-plugins |
""" Wrapper function to suppress and instead only log error. Use with caution """
import sys
import re
import traceback
from functools import wraps
from typing import Callable
from src.logger_handler import LoggerHandler
from src.machine.controller import MACHINE
def logerror(func: Callable):
""" Log... | [
{
"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 | src/error_handler.py | AndreWohnsland/CocktailBerry |
# ============================================================================
# FILE: lsp/workspace_symbols.py
# AUTHOR: Takahiro Shirasaka <tk.shirasaka@gmail.com>
# License: MIT license
# ============================================================================
import os
import sys
sys.path.insert(1, os.path.di... | [
{
"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 | rplugin/python3/denite/source/lsp/workspace_symbols.py | tk-shirasaka/denite-utils |
#!/usr/bin/python
import sys
import subprocess
printers = []
def getPrinters():
global printers
if not sys.platform == "linux2":
return ['default']
if len(printers) > 0: return printers
try:
process = subprocess.Popen(["lpstat", "-a"], stdout=subprocess.PIPE)
result = process.communicate()[0].strip()
# KO... | [
{
"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 | printing.py | shuckc/printerface |
from . import GB, HDB
from typing import Literal
class Client:
def __init__(self, t: Literal["gb", "hbba", "dbba"]):
self.type = t
def create(self):
if self.type == "gb":
return GB()
elif self.type == "hb":
return HDB("hbba")
elif self.type == "db":
... | [
{
"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 | standard/client.py | Lasx/gb688_downloader |
from dependency_management.requirements.ExecutableRequirement import (
ExecutableRequirement)
from dependency_management.requirements.PlatformRequirement import (
PlatformRequirement)
from dependency_management.requirements.Command import (
Command)
class PortageRequirement(PlatformRequirement):
"""
... | [
{
"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 | dependency_management/requirements/PortageRequirement.py | yzgyyang/dependency_management |
from bocadillo import App
from bocadillo.testing import create_client
def test_no_allowed_origins_by_default():
app = App(enable_cors=True)
@app.route("/")
async def index(req, res):
pass
client = create_client(app)
response = client.options(
"/",
headers={
"o... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | tests/test_cors.py | sfermigier/bocadillo |
"""
Boost Build Conan Generator
This is a simple project-root.jam generator declaring all conan dependencies
as boost-build lib targets. This lets you link against them in your Jamfile
as a <library> property. Link against the "conant-deps" target.
"""
from conans.model import Generator
def JamfileOutput(dep_cpp_... | [
{
"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 | conans/client/generators/boostbuild.py | datalogics-kam/conan |
"""
rm - remove files or directories
"""
from os import path
from ..Transformer import TransformerLlvm
from ...constants import EXECFILEEXTENSION
class TransformAr(TransformerLlvm):
""" transform ar commands """
@staticmethod
def can_be_applied_on(cmd):
return (cmd.bashcmd.startswith("rm -f ") a... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | makeadditions/transform/llvm/rm.py | hutoTUM/MakeAdditions |
"""
FUNÇÕES BÁSICAS PARA O PROGRAMA
"""
from time import sleep
# Imprimir caracter especial
def linha(tam=40):
print(f"{'='*tam}")
# Recebe e valida um nome
def ler_nome(txt):
stop = True
while stop:
stop = False
nome = input(txt).strip()
lista_nome = nome.split()
... | [
{
"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 | base.py | thiagosouzalink/Python_Projeto-CRUD_Using_File |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... | [
{
"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": fals... | 3 | dbops_venv/lib/python3.5/site-packages/alembic/templates/generic/env.py | fractal520/dbops |
# Third-party modules
try:
import simplejson as json
except ImportError:
import json
import sqlalchemy
from sqlalchemy.ext import mutable
from sqlalchemy_utils.types.json import JSONType
# Custom modules
from . import track
class NestedMutableDict(mutable.Mutable, track.TrackedDict):
@classmethod
de... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
... | 3 | sqlalchemy_json/alchemy.py | cysnake4713/sqlalchemy-json |
""" Python 'unicode-internal' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is in... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false... | 3 | env/lib/python3.7/encodings/unicode_internal.py | JacobMiske/nuclear-database-APIs |
import os
import sys
import pytest
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from base import TestBaseClass
class TestClassOelintVarsBugtrackerIsUrl(TestBaseClass):
@pytest.mark.parametrize('id', ['oelint.vars.bugtrackerisurl'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.... | [
{
"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 | tests/test_class_oelint_vars_bugtrackerurl.py | vermaete/oelint-adv |
'''
Some helpful utlity functions and classes.
'''
import random
class RandomMac(object):
def __init__(self):
self.used_macs = set()
def get_mac(self):
temp = self._random_mac()
while True:
if temp not in self.used_macs:
self.used_macs.add(temp)
... | [
{
"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 | dhcpclient/utilities.py | Gambellator/Bulk-DHCP-Client-Tester |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : redis_conn.py
# @Author: Fred Yangxiaofei
# @Date : 2019/8/23
# @Role : Redis连接信息
import redis
from settings import settings
from websdk.consts import const
def create_redis_pool():
redis_configs = settings[const.REDIS_CONFIG_ITEM][const.DEFAULT_RD_KEY... | [
{
"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 | cmdb-compliance/libs/redis_conn.py | zjj1002/aws-cloud-cmdb-system |
from tkinter import *
#Palomo, Nemuel Rico O.
class ButtonLab:
def __init__(self, window):
self.color = Button(window, text='Color', fg='red', bg='blue')
self.button = Button(window, text='<---Click to change the color of the button :)', fg='black', command=self.changeColor)
self... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | Lab (The Coders) #5.py | nemuelpalomo/OOP--58002 |
from flask import Flask, abort, make_response, jsonify
from modules import file_management as fmanage
import asyncio, aiohttp
import os
from modules.utils import settings
app = Flask(settings.Config.getConfigValue('default', 'name'))
# todo actually work on the REST interface
@app.route('/')
def hello_world():
retu... | [
{
"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 | server/server.py | Tidanium/librarium |
from mycroft import MycroftSkill, intent_file_handler
class ExamplePrompts(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('prompts.example.intent')
def handle_prompts_example(self, message):
self.speak_dialog('prompts.example')
def create_skill():
... | [
{
"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 | __init__.py | krisgesling/example-prompts-skill |
from models.google_cloud import GoogleLanguageTranslationModel, HuggingFaceLanguageTranslationModel
from models.en2spa_transformer import En2SpaSeq2SeqTransformer
def test_google_translation():
model = GoogleLanguageTranslationModel()
assert model.predict(text='Hello', target='de') == 'Hallo'
def test_hugging... | [
{
"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 | examples/Translation/ai/tests.py | hungpdn/h1st |
import torch
from torch import nn
from torch.utils.data import DataLoader, Dataset
class DatasetSplit(Dataset):
def __init__(self, dataset, idxs):
self.dataset = dataset
self.idxs = list(idxs)
def __len__(self):
return len(self.idxs)
def __getitem__(self, item):
image, la... | [
{
"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 | TrainingNoise_CIFAR10/Update.py | lynshao/NoisyNN |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CommonPrizeModelVo import CommonPrizeModelVo
class AlipayFundCouponWufuLiveAcceptResponse(AlipayResponse):
def __init__(self):
super(AlipayFundCouponWufu... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | alipay/aop/api/response/AlipayFundCouponWufuLiveAcceptResponse.py | antopen/alipay-sdk-python-all |
# Link --> https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list/problem
# Code:
def reverse(head):
currentNode = head
nodes = []
while currentNode:
nodes.insert(0, currentNode.data)
currentNode = currentNode.next
newHead = DoublyLinkedList()
for i in range(le... | [
{
"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 | HackerRank/Python/Reverse_a_doubly_linked_list.py | GoTo-Coders/Competitive-Programming |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: sched
import heapq
from collections import namedtuple
__all__ = [
'scheduler']
Event = namedtuple('Event', 'time, priority, action, arg... | [
{
"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 | sched.py | theclashingfritz/Cog-Invasion-Online-Dump |
import math
from GeometricObject import GeometricObject
class Triangle(GeometricObject):
def __init__(self, side1 = 1.0, side2 = 1.0, side3 = 1.0, *args):
super().__init__(*args)
self.__side1 = side1
self.__side2 = side2
self.__side3 = side3
def get_side1(self):
return ... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | Homework/Homework6/12_1.py | 404nofound/CS521-Info-Str-Python |
from decimal import Decimal
from django.urls import reverse
from ...models import Order
from ....core.utils import build_absolute_uri
def get_error_response(amount: Decimal, **additional_kwargs) -> dict:
"""Create a placeholder response for invalid or failed requests.
It is used to generate a failed transa... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | saleor/payment/gateways/sberbank/utils.py | vovababay/saleor-back |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
def all_combinations_with_value(base_values, desired_value):
all_combinations = find_all_combinations(base_values)
return find_by_value(all_combinations, desired_value)
def find_by_value(all_combinations, desired_value):... | [
{
"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 | Python/zzz_training_challenge/Python_Challenge/solutions/ch07_recursion_advanced/solutions/ex06_math_operations.py | Kreijeck/learning |
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/RPC2',)
with SimpleXMLRPCServer(('0.0.0.0', 12345), requestHandler=RequestHandler) as server:
server.register_introspection_functions()
server... | [
{
"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 | rpc/server/Server1.py | vollero/asdsw2021 |
from typing import List, Dict
from pyhcl.ir.low_ir import *
from pyhcl.ir.low_prim import *
from pyhcl.passes._pass import Pass
@dataclass
class Optimize(Pass):
def run(self, c: Circuit):
def get_name(e: Expression) -> str:
if isinstance(e, (SubField, SubIndex, SubAccess)):
retu... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 line... | 3 | pyhcl/passes/optimize.py | raybdzhou/PyChip-py-hcl |
import responses
from gitjoke.extractor import get_joke, get_jokes
def stub_request():
def request_callback(request):
body = 'foo\nbar\n'
return (200, {}, body)
url = 'https://raw.githubusercontent.com/EugeneKay/git-jokes/lulz/Jokes.txt' # noqa: E501
responses.add_callback(responses.GET... | [
{
"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/gitjoke/test_extractor.py | vitakrya/git-joke-cli |
import readfiles
import learnAlgorithms as learn
from plot import Plot as Plot
class Adapter(object):
def __init__(self, kernel, turnPlot, interactions):
self.log("Lendo Dados")
rf = readfiles.ReadFiles()
self.data = rf.getData()
self.labels = rf.getLabels()
self.la = learn... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | scripts/adapter.py | Skalwalker/BreastCancerRecognition |
import datetime
import bson
from common.mongo import oplog
from common import event_emitter
mo = oplog.MongoOplog('mongodb://eslocal:PHuance01@172.16.100.150,172.16.100.151,172.16.100.152/?replicaSet=foobar',
ts=bson.Timestamp(1524735047, 1))
@event_emitter.on(mo.event_emitter, 'data')
def on_d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | test/basic/test_oplog.py | KentWangYQ/mongo2es |
from collections.abc import Iterable
from itertools import product
import pytest
import fib
def flat_prod(*xs):
# itertools.chain cannot be used for flattening because it cannot handle
# functions as elements
fs = []
for ps in product(*xs):
fp = []
for p in ps:
if isinstanc... | [
{
"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 | tests/test_fib/test_fib_single.py | AdamChristiansen/python-venv-template |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_axis28.py | totdiao/XlsxWriter |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/client/petstore/python-experimental/test/test_parent.py | MalcolmScoffable/openapi-generator |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
from ..core.variable import Variable
from ..core.pycompat import OrderedDict
from .common import AbstractWritableDataStore
class InMemoryDataStore(AbstractWritableDataStore):
... | [
{
"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 | xarray/backends/memory.py | martindurant/xarray |
""" Full assembly of the parts to form the complete network """
import torch.nn.functional as F
from models.unet_parts import *
class UNet(nn.Module):
def __init__(self, n_channels, n_classes, bilinear=True):
super(UNet, self).__init__()
self.n_channels = n_channels
self.n_classes = n_cl... | [
{
"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 | models/unet_model.py | ImadEddineBek/HIP-PROJECT |
import unittest, sys
from lxml.tests.common_imports import make_doctest
from lxml.etree import LIBXML_VERSION
import lxml.html
from lxml.html.clean import Cleaner
class CleanerTest(unittest.TestCase):
def test_allow_tags(self):
html = """
<html>
<head>
</head>
... | [
{
"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 | pyinstaller-2.0/swim3/lxml/html/tests/test_clean.py | alexsigaras/SWIM |
from flask import render_template, Blueprint, request, jsonify
from twitoff.twitter import add_users, TWITTER_USERS
from twitoff.models import User
from twitoff.predict import predict_user
compare_routes = Blueprint("compare_routes", __name__)
@compare_routes.route('/predictions')
def get_predictions():
users =... | [
{
"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 | twitoff/routes/compare_routes.py | hurshd0/TwitOff |
import json, uuid
from datetime import datetime, date
from decimal import Decimal
from werkzeug.http import http_date
from django.db.models import Model
from django.db.models.base import ModelBase
from django.db.models.query import QuerySet, ValuesQuerySet
from django.db.models.fields.related import ManyToManyField
fro... | [
{
"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 | uppsell/util/serialize.py | upptalk/uppsell |
import random
proxy_list = [
'http://p.webshare.io:19999'
]
def random_proxy():
i = random.randint(0, len(proxy_list) - 1)
p = {
'http': proxy_list[i]
}
return p
def remove_proxy(proxy):
proxy_list.remove(proxy)
print(f'Removed {proxy}-- {len(proxy_list)} proxies left') | [
{
"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 | dataset/proxies.py | unknown/reddit-aita |
from urllib.parse import quote
import requests
class Http_operation:
'''
这是一个用于简单操作http api的类
具有post发送信息的函数和post发送文件的函数
具有的参数有:
url 提交的url链接 包含域名以及api等路由
data 用于提交的字符串
file_path 被上传文件的路径(目前只支持图片)
'''
def __init__(self,url,data,file_path):
self.url = url
self.data = data
self.file_path = file_path
... | [
{
"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 | test/http_api.py | lucycore/hlby_web |
from azureml.pipeline.steps import PythonScriptStep
class TrainStep:
def __init__(self, workspace, env, compute, config, pipeline_parameters,
output_pipelinedata):
self.workspace = workspace
self.env = env
self.compute = compute
self.config = config
self.pi... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | samples/appendable-template/ml_service/pipelines/steps/diabetes_regression_train_step.py | h2floh/MLOpsManufacturing-1 |
from unittest import TestCase
from estrutura_dados.ordering_algorithms import bubble_sort, quick_sort
numbers = [82, 9, 6, 16, 5, 70, 63, 64, 59, 72, 30, 10, 26, 77, 64, 11, 10, 7, 66, 59, 55, 76, 13, 38, 19, 68, 60, 42, 7, 51]
_sorted = [5, 6, 7, 7, 9, 10, 10, 11, 13, 16, 19, 26, 30, 38, 42, 51, 55, 59, 59, 60, 63, ... | [
{
"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 | python_src/tests/tests_ordering_algorithms.py | gustavo-veiga/estrutura-dados |
from pygears.conf import safe_bind
from pygears.typing import TypingNamespacePlugin, Queue, Tuple, Union, typeof
def factor(type_):
if typeof(type_, Union):
for t in type_.types:
if not typeof(t, Queue):
return type_
else:
union_types = []
for t ... | [
{
"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 | pygears/typing_common/factor.py | Risto97/pygears |
from random import randint
def opposite_direction(d):
if d == 'north':
return 'south'
elif d == 'south':
return 'north'
elif d == 'west':
return 'east'
return 'west'
def capitalize(s):
return s[0].upper() + s[1:]
def is_int(s):
try:
int(s)
return True
... | [
{
"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/python/kogen/utils.py | adrianogil/kogen |
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
__all__ = ["FrozenDict", "to_hashable"]
class FrozenDict(dict):
"""
A special subclass of `dict` that is immutable and hashable. Instances of this "dict" can be
use... | [
{
"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 | python/dazl/prim/map.py | DACH-NY/dazl-client |
import os
import oriskami
import warnings
from oriskami.test.helper import (OriskamiTestCase)
class OriskamiAPIResourcesTests(OriskamiTestCase):
def test_event_queue_retrieve(self):
response = oriskami.EventQueue.retrieve("1")
event = response.data[0]
self.assertEqual(event["id"], "1")
... | [
{
"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 | oriskami/test/resources/test_event_queue.py | oriskami/oriskami-python |
from flask import Flask, render_template, request
from datetime import datetime
from ChartHelper import ChartHelper
from werkzeug.middleware.proxy_fix import ProxyFix
app = Flask(__name__)
#
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_host=1)
@app.route("/")
def index():
return render_template('index.html',... | [
{
"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 | python/app.py | webbhm/GBE_T |
from rest_framework import serializers
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
class UserSerializer(serializers.ModelSerializer):
""" Serializer for the users object """
class Meta:
model = get_user_model()
fields = (... | [
{
"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 | app/user/serializers.py | DiegoTGJ/django-udemy-recipe |
from python_framework import Repository
import User
@Repository(model = User.User)
class UserRepository:
def findAll(self) :
return self.repository.findAllAndCommit(self.model)
def existsByKey(self,key) :
return self.repository.existsByKeyAndCommit(key, self.model)
def findByKey(self,key... | [
{
"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 | api/src/repository/UserRepository.py | thalesgelinger/truco-alpha |
def setup(bot):
# This module isn't actually a cog
return
def clean(string):
# A helper script to strip out @here and @everyone mentions
zerospace = ""
return string.replace("@everyone", "@{}everyone".format(zerospace)).replace("@here", "@{}here".format(zerospace)) | [
{
"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 | Cogs/Nullify.py | Damiian1/techwizardshardware |
# -*- encoding=utf-8 -*-
import socket
import threading
class TCPServer:
def __init__(self, server_address, handler_class):
self.server_address = server_address
self.HandlerClass = handler_class
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.is_shutdown = Fal... | [
{
"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 | server/socket_server.py | YouHao0809/Simple-HTTP-Server |
# pylint: disable=missing-docstring
from __future__ import annotations
import pytest
from beancount.query.query import run_query
from fava.core import FavaLedger
from fava.util import excel
def test_to_csv(example_ledger: FavaLedger) -> None:
types, rows = run_query(
example_ledger.all_entries,
... | [
{
"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 | tests/test_util_excel.py | LinAGKar/fava |
from util import test_remote
from util import ID
import random
class Pool:
def __init__(self, pool=None):
def app(id, idx):
if idx < 10:
id = id + "0"
return id + str(idx)
POOL = \
[app("matrix", i) for i in range(1, 45)] + \
[app("sp... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answe... | 3 | remote/pool.py | danalex97/nfsTorrent |
def exercise_the_api():
var1 = java_common.JavaRuntimeInfo
var2 = JavaInfo
var3 = java_proto_common
exercise_the_api()
def my_rule_impl(ctx):
return struct()
java_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does java-related things.",
attrs = {
"first": a... | [
{
"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 | src/test/java/com/google/devtools/build/skydoc/testdata/java_basic_test/input.bzl | ArielleA/bazel |
# stdlib
import socket
import time
from typing import Any
from typing import List
# syft absolute
from syft.lib.python import List as SyList
from syft.lib.python.string import String
# relative
from ...syft.grid.duet.process_test import SyftTestProcess
def do_send(data: Any, port: int) -> None:
# syft absolute
... | [
{
"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 | packages/syft/tests/benchmarks/pytest_benchmarks/benchmark_send_get_multiprocess_test.py | callezenwaka/PySyft |
import rospy
import smach
import smach_ros
import threading
from operator import itemgetter
import numpy as np
from apc_msgs.srv import DetectObject2D
from apc_msgs.srv import DetectObject2DRequest
from geometry_msgs.msg import Pose, Point, Quaternion
# ==========================================================
class... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | apc_state_machine/state_machine/scripts/chooseWhereToGoState.py | Juxi/apb-baseline |
# Copyright 2021 The MLX Contributors
#
# SPDX-License-Identifier: Apache-2.0
# coding: utf-8
"""
MLX API
MLX API Extension for Kubeflow Pipelines # noqa: E501
OpenAPI spec version: 0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_impo... | [
{
"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 | api/client/test/test_api_list_pipelines_response.py | krishnakumar27/mlx |
# -*- coding: utf-8 -*-
import re
from distutils.util import strtobool
from streamlink.compat import quote
from streamlink.plugin import Plugin, PluginArguments, PluginArgument
from streamlink.stream import HLSStream, HTTPStream
from streamlink.plugin.api.useragents import CHROME
from streamlink.plugin.api.utils impor... | [
{
"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 | rik.py | Twilight0/unofficial-greek-cypriot-streamlink-plugins |
# -*- coding: utf-8 -*-
'''
Package management operations specific to APT- and DEB-based systems
====================================================================
'''
from __future__ import absolute_import
# Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | salt/states/aptpkg.py | preoctopus/salt |
"""
scaffoldgraph tests.core.test_fragment
"""
import pytest
from rdkit import Chem
from scaffoldgraph.core.fragment import *
@pytest.fixture(name='mol')
def test_molecule():
smiles = 'CCN1CCc2c(C1)sc(NC(=O)Nc3ccc(Cl)cc3)c2C#N'
return Chem.MolFromSmiles(smiles)
def canon(smiles):
"""Canonicalize SMILE... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/core/test_fragment.py | trumanw/ScaffoldGraph |
# -*- coding: utf-8 -*-
import asyncio
import os
from connections import RedisSettings
from cron import cron
async def say_hello(ctx, name) -> None:
await asyncio.sleep(30)
print(f"Hello {name}")
async def say_hi(ctx, name) -> None:
await asyncio.sleep(3)
print(f"Hi {name}")
async def startup(ct... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | arq/tasks_.py | PY-GZKY/arq |
import torch
def clip_grad(gradient, clip_value):
""" clip between clip_min and clip_max
"""
return torch.clamp(gradient, min=-clip_value, max=clip_value)
def clip_grad_norm(gradient, clip_value):
norm = (gradient**2).sum(-1)
divisor = torch.max(torch.ones_like(norm).cuda(), norm / clip_value)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | utils.py | 2channelkrt/VLAE |
# """
# This is Master's API interface.
# You should not implement it, or speculate about its implementation
# """
# class Master:
# def guess(self, word: str) -> int:
class Solution:
def findSecretWord(self, wordlist: List[str], master: 'Master') -> None:
word = wordlist[0]
words = set(wordlis... | [
{
"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 | Python/843.py | JWang169/LintCodeJava |
from ...external.qt.QtGui import QTableWidget, QTableWidgetItem
from ...external.qt.QtCore import Qt
class SettingsEditor(object):
def __init__(self, app):
w = QTableWidget(parent=None)
w.setColumnCount(2)
w.setRowCount(len(list(app.settings)))
w.setHorizontalHeaderLabels(["Settin... | [
{
"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 | glue/qt/widgets/settings_editor.py | bsipocz/glue |
from conans import ConanFile, CMake
import os
channel = os.getenv("CONAN_CHANNEL", "testing")
username = os.getenv("CONAN_USERNAME", "memsharded")
class EasyLoggingTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "easyloggingpp/9.94.1@%s/%s" % (username, channel)
generato... | [
{
"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 | test_package/conanfile.py | amrayn/conan-easyloggingpp |
# Time: O(n)
# Space: O(1)
# 413
# A sequence of number is called arithmetic if it consists of at least three elements
# and if the difference between any two consecutive elements is the same.
#
# For example, these are arithmetic sequence:
#
# 1, 3, 5, 7, 9
# 7, 7, 7, 7
# 3, -1, -5, -9
# The following sequence is no... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Python/arithmetic-slices.py | RideGreg/LeetCode |
from util import *
import re
lines=get_file_contents("../input/day19-sample.txt", False)
lines=get_file_contents("../input/day19.txt", False)
d = {}
rgx = {}
def getrules():
global lines
global d, rgx
for i in range(len(lines)):
if lines[i] == '8: 42':
lines[i] = '8: 42 | 42 8'... | [
{
"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 | 2020/src/day19b.py | Sujatha-Nagarajan/AdventOfCode |
#!/usr/bin/python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that finds and runs a binary by looking in the likely locations."""
import os
import subprocess
import sys
def run_comman... | [
{
"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": fals... | 3 | tools/find_run_binary.py | pospx/external_skia |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django import template
from floreal import models as m
register = template.Library()
@register.filter
def price(f):
return u"%.02f€" % f
@register.filter
def price_nocurrency(f):
return u"%.02f" % f
@register.filter
def weight(w):
if w>=1: return u"%.2... | [
{
"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 | floreal/templatetags/floreal_filters.py | roco/circuit-court |
class Record:
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
def equal_id(self):
return self.record_id == self.parent_id
class Node:
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def valida... | [
{
"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 | exercises/practice/tree-building/.meta/example.py | samr1ddh1/python-1 |
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit
from sklearn.utils import shuffle as skshuffle
def shuffle(x, random_state=None):
return skshuffle(x, random_state=random_state)
def split_shuffle(X,y=None, random_state=None):
sss = ShuffleSplit(n_splits=1, test_size=0.25, random_state=... | [
{
"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 | ceo/sampling.py | trailofbits/ceo |
import getpass
import os
import platform
class SystemUtil:
__SYSTEM_NAMES_WINDOWS: set = ['Windows']
@staticmethod
def isWindows() -> bool:
osName: str = platform.system()
return osName in SystemUtil.__SYSTEM_NAMES_WINDOWS
@staticmethod
def getCurrentUserName() -> s... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | src/cmd_exec/util/SystemUtil.py | ahuyuktepe/cmd-exec |
import torch
from torch.autograd import Function
class DiceCoeff(Function):
"""Dice coeff for individual examples"""
def forward(self, input, target):
self.save_for_backward(input, target)
eps = 0.0001
self.inter = torch.dot(input.view(-1), target.view(-1))
self.uni... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | dice_loss.py | vios-s/RA_FA_Cardiac |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | [
{
"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 | ooobuild/dyn/security/signature_exception.py | Amourspirit/ooo_uno_tmpl |
import datetime
from django.db import models
from django_extensions.db.models import TimeStampedModel
class Video(TimeStampedModel):
youtube_id = models.CharField(max_length=100, unique=True)
url = models.URLField(max_length=512)
title = models.TextField()
duration = models.IntegerField(null=True)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | youtubeadl/apps/downloader/models.py | oceancloud82/youtubeaudio |
import mock
from moto.athena import mock_athena
from oedi.AWS.athena import OEDIAthena
@mock_athena
@mock.patch("oedi.AWS.athena.Connection")
def test_oedi_athena__properties(mock_connection):
staging_location = "s3://my-testing-bucket/"
region_name = "us-west-2"
athena = OEDIAthena(staging_location, re... | [
{
"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 | tests/unit/AWS/test_athena.py | digitalrager/open-data-access-tools-2 |
import graphene
from graphene_django.converter import convert_django_field
from grapple.utils import resolve_queryset
from modelcluster.contrib.taggit import ClusterTaggableManager
from taggit.models import Tag
from .structures import QuerySetList
@convert_django_field.register(ClusterTaggableManager)
def convert_... | [
{
"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 | grapple/types/tags.py | ARogovskyy/wagtail-grapple |
# uwsgi --queue 10 --queue-store test.queue --master --module tests.queue --socket :3031
import uwsgi
import os
from flask import Flask,render_template,request,redirect,flash
app = Flask(__name__)
app.debug = True
app.secret_key = os.urandom(24)
@app.route('/')
def index():
return render_template('queue.html', ... | [
{
"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 | vmaig_blog/uwsgi-2.0.14/tests/queue.py | StanYaha/Blog |
import pymongo
class DbClient:
"""Creates an instance of pymongo client and stores it in a private variable.
The instance of this class is injected as a dependency for request validators and processors.
Attributes:
database (Database): The database object.
collection_list (list): List of ... | [
{
"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 | database/dbclient.py | sonudoo/password-manager |
#!/usr/bin/python3
import sys
import json
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
import pickle
class Payload:
def __init__(self, svm, vect):
self.svm = svm
self.vect = vect
def use(self, comm):
return self.svm.predict(self.vect.tr... | [
{
"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 | analyzeData/script.py | Tiloon/Movie-processing |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Talkcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from binascii import hexlify
fr... | [
{
"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 | share/rpcauth/rpcauth.py | bitcointallkcoin/bitcointalkcoin |
class Parrot:
# class attribute
species = "bird"
# instance attribute
def __init__(self, name, age):
self.name = name
self.age = age
# instance method
def sing(self, song):
return "{} sings {}".format(self.name, song)
def dance(self):
return "{} is... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | python/src/parrot.py | newwuhan5/code-peekers |
from flask import Flask
from sqlbag.flask import FS, proxies, session_setup
s = proxies.s
def get_app():
a = Flask(__name__)
a.s = FS("postgresql:///example", echo=True)
session_setup(a)
return a
app = get_app()
@app.route("/")
def hello():
# returns 'Hello World!' as a response
return s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | sampleflaskapp.py | gjbadros/sqlbag |
import threading
import time
from concurrent.futures import ThreadPoolExecutor
def task(n):
time.sleep(1)
print(f'Processing {n} in {threading.current_thread()}')
def main():
print('Starting ThreadPoolExecutor')
with ThreadPoolExecutor(max_workers=3) as executor:
future = executor.submit(tas... | [
{
"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 | src/07_executors_pools/context.py | rurumimic/concurrency-python |
# -*- coding: utf-8 -*-
# Source https://leetcode.com/problems/3sum-closest/
def three_sum_closest(nums, target):
n = len(nums)
if n < 3:
raise Exception('expected at least a three element array')
nums.sort()
closest = nums[0] + nums[1] + nums[2]
for i in range(n-2):
a = nums[i]
... | [
{
"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 | interview/leetcode/three_sum_closest.py | topliceanu/learn |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.