source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
'''
Advent of Code - 2019
--- Day 2: 1202 Program Alarm ---
'''
from utils import *
from intcode import IntcodeRunner, HaltExecution
def parse_input(day):
return day_input(day, integers)[0]
def part1(program, noun=12, verb=2):
runner = IntcodeRunner(program)
runner.set_mem(1, noun)
runner.set_... | [
{
"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 | challenges/2019/python/d02.py | basoares/advent-of-code |
from vp_suite.base.base_model import VideoPredictionModel
class CopyLastFrame(VideoPredictionModel):
r"""
"""
# model-specific constants
NAME = "CopyLastFrame"
REQUIRED_ARGS = []
TRAINABLE = False
def __init__(self, device=None, **model_kwargs):
r"""
Args:
d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | vp_suite/models/copy_last_frame.py | angelvillar96/vp-suite |
import sys
import mrjob
from mrjob.job import MRJob
import re
from itertools import islice, izip
import itertools
from mrjob.step import MRStep
from mrjob.protocol import JSONValueProtocol
WORD_RE = re.compile(r'[a-zA-Z]+')
class BigramCount(MRJob):
OUTPUT_PROTOCOL = JSONValueProtocol
def m... | [
{
"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 | Homeworks/Homework5/code/p3.py | akhilaSharon/big-data-python-class |
#!/usr/bin/env python3
# Software Name: ngsildclient
# SPDX-FileCopyrightText: Copyright (c) 2021 Orange
# SPDX-License-Identifier: Apache 2.0
#
# This software is distributed under the Apache 2.0;
# see the NOTICE file for more details.
#
# Author: Fabien BATTELLO <fabien.battello@orange.com> et al.
# SPDX-License-Id... | [
{
"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/test_client.py | huangwanquan/python-orion-client |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `pyevr.main`."""
import pytest
from click.testing import CliRunner
from pyevr.main import main
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
#... | [
{
"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 | tests/test_main.py | thorgate/pyevr |
import os
import json
def iter_example_names():
specdir = os.path.join(os.path.dirname(__file__), 'spec')
for spec in sorted(os.listdir(specdir)):
yield spec
def load_example(name):
filename = os.path.join(os.path.dirname(__file__), 'spec', name)
with open(filename, 'r') as f:
return... | [
{
"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 | altair/examples/__init__.py | jakevdp/altair2 |
from random import sample
class ReplayMemory:
def __init__(self, max_size):
# deque object that we've used for 'episodic_memory' is not suitable for random sampling
# here, we instead use a fix-size array to implement 'buffer'
self.buffer = [None] * max_size
self.max_size = max_siz... | [
{
"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 | src/utils/memory.py | Junyoungpark/Pytorch-AWAC |
# Copyright (c) 2020
# Author: xiaoweixiang
import distutils.command.bdist_wininst as orig
class bdist_wininst(orig.bdist_wininst):
def reinitialize_command(self, command, reinit_subcommands=0):
"""
Supplement reinitialize_command to work around
http://bugs.python.org/issue20819
... | [
{
"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 | venv/lib/python3.8/site-packages/setuptools/command/bdist_wininst.py | realxwx/leetcode-solve |
# !/usr/bin/python
# -*- coding:utf-8 -*-
import subprocess, time, sys
from subprocess import Popen
from typing import Optional
TIME = 3600
CMD = "run.py"
class Auto_Run():
def __init__(self, sleep_time, cmd):
if sys.version_info < (3, 6):
print("only support python 3.6 and later version")
... | [
{
"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 | main.py | Chise1/bilibili-live-tools |
from mycroft import MycroftSkill, intent_file_handler
class SkillPlayground(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('playground.skill.intent')
def handle_playground_skill(self, message):
self.speak_dialog('playground.skill')
def create_skill()... | [
{
"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 | __init__.py | wamsachel/skill-playground-skill |
from pyfingerprint.pyfingerprint import PyFingerprint
from pyfingerprint.pyfingerprint import FINGERPRINT_CHARBUFFER1
from pyfingerprint.pyfingerprint import FINGERPRINT_CHARBUFFER2
#from src.mongo import check_person_in_biometrics
from time import sleep
from src.lcd import lcd_write
f = PyFingerprint('/dev/ttyUSB0',... | [
{
"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 | src/biometrics.py | Somanath-KC/RFID-Fingerprint-Attendance |
from numba import jit, int32
@jit(int32(int32, int32))
def f(x, y):
# A somewhat trivial example
return x + y
print(f)
# print(f(123, 123**30))
@jit(nopython=True)
def f(x, y):
return x + y
| [
{
"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 | attic/specialization.py | IMS-workshop/cython-numba |
from . import registry
def step(match):
def outer(func):
registry.add(match, func)
def inner(*args, **kwargs):
func(*args, **kwargs)
return inner
return outer
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | maxixe/decorators.py | tswicegood/maxixe |
# -*- coding: UTF-8 -*-
import getopt
import os
import sys
def update_web_files():
import shutil
shutil.rmtree('static')
shutil.copytree("web/dist", "static")
def commit_web_file():
os.system('git add static/')
os.system('git commit -m "更新前端文件"')
def static_file_updated():
try:
# 1... | [
{
"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 | app/tool4convert.py | wulihtc/SmartTodo |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2007-2010 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
{
"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 | packages/mcni/tests/mcni/components/NeutronFromStorage_mpi_TestCase.py | mcvine/mcvine |
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
'{{last_name}} {{company_suffix}}',
'{{last_name}} {{last_name}} {{company_suffix}}',
'{{last_name}} {{last_name}} {{company_suffix}}',
'{{last_name}}',
)
company_suffixes = (
'... | [
{
"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 | faker/providers/company/fi_FI/__init__.py | StabbarN/faker |
from machinetranslation import translator
from flask import Flask, render_template, request
import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def englishToFrench():
textToTranslate = request.args.get('textToTranslate')
translation = translator.englishToFrench(englishText=textToTranslate... | [
{
"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 | final_project/server.py | jozuk/xzceb-flask_eng_fr |
# -*- coding:utf-8 -*-
import scrapy
from report_crawler.spiders.__Global_function import get_localtime
from report_crawler.spiders.__Global_variable import now_time, end_time
class SYSU001_Spider(scrapy.Spider):
name = 'NWSUAF001'
start_urls = ['http://cie.nwsuaf.edu.cn/xzhd/index.htm']
domains = 'http:/... | [
{
"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 | report_crawler/report_crawler/spiders/spiders_001/_N/NWSUAF001.py | HeadCow/ARPS |
from nltk.tree import Tree as Tree
from binary import *
Binary = Binary()
class Why:
def is_why(self, tree):
for t in tree.subtrees(lambda t: t.label() == "SBAR"):
if "because" in t.leaves() or "since" in t.leaves() or "so" in t.leaves():
return True
return False
def remove_SBAR(self, tree):
top_l... | [
{
"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 | why.py | HajFunk/nlp_qa_project |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# bittrex_websocket/summary_state.py
# Stanislav Lazarov
from time import sleep
from bittrex_websocket.websocket_client import BittrexSocket
if __name__ == "__main__":
class MyBittrexSocket(BittrexSocket):
def on_open(self):
self.client_callbacks = [... | [
{
"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 | bittrex_websocket/summary_state.py | ericsomdahl/python-bittrex-websocket |
from django.shortcuts import render,redirect
from django.http import HttpResponse , HttpResponseRedirect
from django.contrib.auth.models import User , auth
from django.contrib.auth import authenticate , login , logout
from django.contrib import messages
def home(request):
return render(request,'home.html')
def h... | [
{
"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 | Home/views.py | poppingpixel/DjangoWebsite.io |
from django.urls import reverse_lazy
from django.views import generic
from django.contrib.auth import views
from .forms import CustomUserCreationForm
from organizations.models import OrganizationModel
from .models import CustomUser
from django.views import View
from django.shortcuts import render, render_to_response, r... | [
{
"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 | users/views.py | ahmetelgun/meetup-app-with-django |
#!/usr/bin/env python3
#
# Author: Hao Tang, 2016-05-22
import sys
import urllib.request
import urllib.parse
import json
import re
import datetime
import time
def query_page(title, lang):
'''
Return a JSON string fetched from wikipedia.
title is the page title to fetch written in the specified language.
... | [
{
"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 | crawl_wikipedia.py | camilleg/crawl-wiki |
import sys
import pytest
from okdata.cli.command import BaseCommand
BASECMD_QUAL = f"{BaseCommand.__module__}.{BaseCommand.__name__}"
def set_argv(*args):
old_sys_argv = sys.argv
sys.argv = [old_sys_argv[0]] + list(args)
@pytest.fixture
def mock_print_success(mocker):
return mocker.patch(f"{BASECMD_QU... | [
{
"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 | conftest.py | oslokommune/origo-cli |
from IProcess import IProcess, EDataType
from ImageData import PipelineManager
#from euclideanDistance import euclideanDistance
#from kNearestNeighbour import kNearestNeighbour
class LOOCV(IProcess):
def __init__(self):
IProcess.__init__(self)
pass
def toId(self):
return self.getTypeAsString()
def getTyp... | [
{
"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 | LOOCV.py | FrieAT/MD_CompressedWavelet |
import uvicorn
from fastapi import (FastAPI, File, UploadFile)
from starlette.responses import RedirectResponse
from tensorflow.python.keras.preprocessing import image as imgx
import requests
from PIL import Image
from application.components import predict, read_imagefile
from application.schema import Symptom
from app... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | application/server/main.py | EgoPro1/InceptionV2 |
# Copyright (c) 2015 Deutsche Telekom AG
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | tempest/tests/fake_tempest_plugin.py | KiranPawar72/tempest |
def add(a,b):
return a+b
def subtract(a,b):
return a-b
def multiply(a,b):
return a*b
def divide(a,b):
try:
return a/b
except ZeroDivisionError:
return "Zero Division Error"
print("Select Operation")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
choice = input("E... | [
{
"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 | SimpleCalculator.py | kchittamori/Python |
import sys
if not "tinypy" in sys.version:
from boot import *
import tokenize,parse,encode
def _compile(s,fname):
tokens = tokenize.tokenize(s)
t = parse.parse(s,tokens)
r = encode.encode(fname,s,t)
return r
def _import(name):
if name in MODULES:
return MODULES[name]
py = name+".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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | py2bc.py | scrgiorgio/tinypy |
# Copyright 2017 Real Kinetic, LLC. All Rights Reserved.
import unittest
import cloudstorage
import mock
from cloud_ftp import error
from cloud_ftp.storage.providers.gcs import GCSStorageProvider
class GCSTestCase(unittest.TestCase):
def test_path(self):
p = GCSStorageProvider(bucket='bucket')
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test/storage/providers/gcs_test.py | RealKinetic/cloud-ftp |
import re
from client import *
import serial
import os
if os.path.exists ('/dev/ttyACM0') == True:
port = "/dev/ttyACM0"
print("ACM0")
elif os.path.exists ('/dev/ttyACM1') == True:
port = "/dev/ttyACM1"
print("ACM1")
elif os.path.exists ('/dev/ttyACM2') == True:
port = "/dev/ttyACM2"
prin... | [
{
"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 | Pi code/final.py | k-shenbagaraj/GoCHART_manual_drive |
from rest_framework import serializers
from goods.models import SKU
class CartSerializer(serializers.Serializer):
"""添加商品到购物车序列化器"""
sku_id = serializers.IntegerField(label="sku_id", min_value=1)
count = serializers.IntegerField(label="数量", min_value=1)
selected = serializers.BooleanField(label="是否勾选... | [
{
"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 | shopping_mall/shopping_mall/apps/carts/serializers.py | lzy00001/SHOP_CENTER |
import click
from packit_service.worker.whitelist import Whitelist
"""
This is cli script to approve user manually after he installed github_app to repository
"""
@click.group()
def cli():
pass
@click.command("approve")
@click.argument("account_name", type=str)
def approve(account_name):
"""
Approve us... | [
{
"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 | files/scripts/whitelist.py | phracek/packit-service |
import typer
import uvicorn
from .app import app
from .config import settings
cli = typer.Typer(name="fastapi_workshop API")
@cli.command()
def run(
port: int = settings.server.port,
host: str = settings.server.host,
log_level: str = settings.server.log_level,
reload: bool = settings.server.reload,
... | [
{
"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 | fastapi_workshop/cli.py | diogoro/fastapi-workshop |
from common.database import db
from flask_restful import fields
from sqlalchemy.ext.orderinglist import ordering_list
from sqlalchemy.sql import func
contato_campos = {
'id': fields.Integer(attribute='id'),
'nome': fields.String(attribute='nome'),
'email': fields.String(attribute='email'),
'telefone':... | [
{
"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 | ServicoApp/models/contato.py | LADOSSIFPB/LaNoCentro |
# This script takes a bed file that is the result of the wig2bed operation and converts it to the bed format expected by mutperiod.
from mutperiodpy.helper_scripts.UsefulFileSystemFunctions import DataTypeStr, getDataDirectory
from mutperiodpy.Tkinter_scripts.TkinterDialog import TkinterDialog
from typing import List
i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | Python/WigBedToCustomBed.py | bmorledge-hampton19/project_protista |
# Copyright 2016 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.
from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter
fr... | [
{
"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 | third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/analyze_baselines_unittest.py | Wzzzx/chromium-crosswalk |
# Python multiple inheritance examples
class Base1:
# class properties
value = "I am base 1"
# class methods
def __init__(self,val1="I am base 1"):
print("Base 1 Constructor called")
self.value = val1
def display(self):
print("Base 1 display called")
class Base2:
# c... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | multinherit.py | robbroadhead/PythonCertificationSeries |
from contextlib import contextmanager
import errno
import os
import re
from random import SystemRandom
import tempfile
from rstr import Rstr
from ._compat import which
rstr = Rstr(SystemRandom())
import_module = __import__
def genpass(pattern=r'[\w]{32}'):
"""generates a password with random chararcters
... | [
{
"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 | passpie/utils.py | bcfurtado/passpie |
# -*- coding: utf-8 -*-
from django.forms import ModelForm, Form
from django.forms.models import inlineformset_factory
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from betterforms.multiform import MultiModelForm
from collections import OrderedDict
from datetimewidget.wid... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | core/forms.py | sergiorb/askkit |
#!/usr/bin/env python3
from __future__ import annotations
from typing import Generator, Iterable, Optional
from turnips.model import Model
from turnips.multi import (
MultiModel,
TripleModels,
SpikeModels,
DecayModels,
BumpModels,
)
from turnips.ttime import AnyTime
class MetaModel(MultiModel):... | [
{
"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 | src/turnips/meta.py | theastropath/turbot |
# Author: Khalid - naam toh suna hi hoga
# Steps to run ->
# :~$ python yoyo.py
from flask import Flask
from flask import request
from flask import render_template
import stringComparison
app = Flask(__name__)
@app.route('/')
def my_form():
return render_template("my-form.html")
@app.route('/', methods=['POST'])... | [
{
"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 | plagiarismChecker.py | saurabhkumar29/website |
##################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020 #
##################################################
import torch
import torch.nn as nn
from ..cell_operations import ResNetBasicblock
from .cells import InferCell
# The macro structure for architectures in NAS-Bench-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_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | lib/models/cell_infers/tiny_network.py | MUST-AI-Lab/NAS-Projects |
"""Test cases for the console module."""
from unittest.mock import Mock
from click.testing import CliRunner
import pytest
from anu.cli import main
@pytest.fixture
def runner() -> CliRunner:
"""Fixture for invoking command-line interfaces."""
return CliRunner()
def test_main_succeeds(runner: CliRunner, moc... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | tests/test_console.py | ankitskvmdam/anu |
from click import Option
from unleash import opts, log, commit
from unleash import __version__ as unleash_version
PLUGIN_NAME = 'footer'
# make sure version info is written first, so the footer does not get
# overwritten
PLUGIN_DEPENDS = ['versions']
FOOTER_FORMAT = u'\n[commit by unleash {}]\n'
def setup(cli):
... | [
{
"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 | unleash/plugins/footer.py | mbr/unleash |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_hyperlink23.py | hugovk/XlsxWriter |
# 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_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 | aliyun-python-sdk-baas/aliyunsdkbaas/request/v20180731/DescribeSmartContractJobsRequest.py | yndu13/aliyun-openapi-python-sdk |
"""Test loading data."""
from pathlib import Path
import cloudpickle
from lifelines import CoxTimeVaryingFitter
from sklearn.isotonic import IsotonicRegression
from nbaspa.model.tasks import LoadData, LoadModel
def test_load_model_data(data, gamelocation):
"""Test loading fake model data."""
# Run the task ... | [
{
"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 | tests/test_model/test_tasks/test_io.py | ak-gupta/nbaspa |
from struct import pack
from bitcoin.main import *
def little_endian_varint(integer):
"""Convert an integer to the Bitcoin variable length integer.
See here for the protocol specification:
https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer
See here for the `struct.pack` forma... | [
{
"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 | bitcoin/extended/utils2.py | wizardofozzie/pybitcointools |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.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": "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 | kubernetes/test/test_v1beta1_network_policy_list.py | anemerovsky-essextec/python |
import requests,base64
def request_download_file_by_url(download_url, file_name):
r = requests.get(download_url)
with open(file_name, 'wb') as f:
f.write(r.content)
def request_get_rss_news(rss_url):
try:
r = requests.get(rss_url)
# print(r.encoding)
print(r.text)
... | [
{
"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 | http_request/request_utils.py | ivanlevsky/cowabunga-potato |
"""empty message
Revision ID: 577055ed7da4
Revises: 732b6fffe866
Create Date: 2021-08-19 02:09:56.472249
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '577055ed7da4'
down_revision = '732b6fffe866'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/577055ed7da4_.py | Evantually/cash-and-associates |
from django import forms
from .models import Reclamacao,Login,Comentario
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class CadastraReclamacaoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(CadastraReclamacaoForm,self).__init__(*args,... | [
{
"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 | Application/ReclamaCaicoProject/ReclamaCaicoApp/forms.py | WesleyVitor/ReclamaCaico |
import subprocess
from i3pystatus import IntervalModule
class Keyboard_locks(IntervalModule):
"""
Shows the status of CAPS LOCK, NUM LOCK and SCROLL LOCK
Available formatters:
* `{caps}` — the current status of CAPS LOCK
* `{num}` — the current status of NUM LOCK
* `{scroll}` — the current ... | [
{
"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 | i3pystatus/keyboard_locks.py | crwood/i3pystatus |
# Copyright 2020 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": "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 | refex/python/test_python_pattern.py | ssbr/refex |
import sys
import pprint
def get_edges(fh):
return [tuple(line.strip().split('-')) for line in fh]
def build_path_graph(edges):
graph = {}
for (a,b) in edges:
if a in graph:
graph[a].update(set([b]))
else:
graph[a] = set([b])
# And the same but in the oppo... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | 12-passage-pathing/12-passage-pathing-02.py | kforiordan/advent-of-code |
from pathlib import Path
from shutil import rmtree
from fixtures import fixture
from virtool_workflow.data_model import Job
from virtool_workflow.api.client import authenticated_http
from virtool_workflow.api.jobs import acquire_job
@fixture
def results() -> dict:
return {}
@fixture
def work_path(config: dict)... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | virtool_workflow/builtin_fixtures.py | eroberts9789/virtool-workflow |
"""
Python program to implement Graph
@Author: Archibald
@Date: Sept. 12
"""
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = [None] * self.V
def add_directed_edge(self, tail, header):
node = Node(header)
node.next = self.graph[tail]
... | [
{
"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 | Workspace for Python/studying file/Data Structure and Algorithm Analysis/Week14/Graph.py | ArchibaldChain/python-workspace |
from rest_framework_json_api.renderers import JSONRenderer
from django.contrib.auth.models import AnonymousUser
class BluebottleJSONAPIRenderer(JSONRenderer):
def get_indent(self, *args, **kwargs):
return 4
@classmethod
def build_json_resource_obj(
cls,
fields,
resource,
... | [
{
"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 | bluebottle/bluebottle_drf2/renderers.py | terrameijar/bluebottle |
# coding: utf-8
"""
Genomic Data Store Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
im... | [
{
"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 | libica/openapi/libgds/test/test_job_progress_status.py | umccr-illumina/libica |
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username="admin", password="secret"):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_name(... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | fixture/session.py | MishaM1/python_training |
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import better_exchook
better_exchook.install()
class Song:
def __init__(self, fn):
sel... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | test_replaygain.py | pvinis/music-player |
"""
test_wuvt.py - tests for the wuvt module
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
"""
import re
import unittest
from mock import MagicMock
from modules import wuvt
from web import catch_timeout
@catch_timeout
class TestWuvt(unittest.TestCase):
def setUp(self):
self.phenny = MagicMock()
... | [
{
"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 | modules/test/test_wuvt.py | shardulc/phenny |
from db import db
class User(db.Model):
usr_id = db.Column(db.Integer, primary_key=True)
fullname = db.Column(db.String(100), nullable=False)
username = db.Column(db.String(50), unique=True, nullable=False)
password = db.Column(db.String(250), nullable=False)
def __repr__(self):
return '<Name %r>' % self.fullna... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | models.py | chantellecv/E-commerce-Site |
from django.db import models
import uuid
from django.contrib.auth.models import User
from article.models import ArticlePost
from ckeditor.fields import RichTextField
from mptt.models import MPTTModel, TreeForeignKey
# Create your models here.
class Comment(models.Model): # 博文评论
article = models.ForeignKey(
... | [
{
"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 | comment/models.py | jackyfzh/j_django_blog |
import discord
import json
import CloudDB
import nqrng
from cloudant.result import Result
global CONFIG
client = discord.Client()
token = ""
#import config file
with open('config.json', 'r') as f:
getFile = json.load(f)
global CONFIG
CONFIG = getFile["services"]["discord"][0]
token = CONFIG["token"]
#... | [
{
"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 | quantum-ugly-duckling-main/discord_bot.py | rochisha0/quantum-ugly-duckling |
#
import wandb
from . import preinit
def set_global(
run=None,
config=None,
log=None,
summary=None,
save=None,
use_artifact=None,
log_artifact=None,
define_metric=None,
alert=None,
plot_table=None,
mark_preempting=None,
):
if run:
wandb.run = run
if 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": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | wandb/sdk/lib/module.py | borisgrafx/client |
#
# Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending
#
""" This module provides access to the Deephaven server configuration. """
import jpy
from deephaven import DHError
from deephaven.time import TimeZone
_JDHConfig = jpy.get_type("io.deephaven.configuration.Configuration")
_JDateTimeZone = jpy.get_... | [
{
"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 | py/server/deephaven/config/__init__.py | mattrunyon/deephaven-core |
from unicorn.arm_const import UC_ARM_REG_R0
from .. import native
def get_fuzz(uc, size):
"""
Gets at most 'size' bytes from the fuzz pool.
If we run out of fuzz, something will happen (e.g., exit)
:param size:
:return:
"""
return native.get_fuzz(uc, size)
def fuzz_remaining():
return... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | harness/fuzzware_harness/user_hooks/fuzz.py | fuzzware-fuzzer/fuzzware-emulator |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import pdb
import numpy as np
def tensor_clamp(t, min, max, in_place=True):
if not in_place:
res = t.clone()
else:
res = t
idx = res.data < min
res.data[idx] = min[idx]
... | [
{
"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 | Classification/attack_algo.py | VITA-Group/CV_A-FAN |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# cds-migrator-kit is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Pytest configuration."""
from __future__ import absolute_import, print_f... | [
{
"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 | tests/conftest.py | CERNDocumentServer/cds-migrator |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
class News163SpiderPipeline:
fp = None
... | [
{
"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 | News163_Spider/News163_Spider/pipelines.py | a904919863/Spiders_Collection |
from autokeras.bayesian import *
from tests.common import get_add_skip_model, get_concat_skip_model, get_conv_dense_model
def test_edit_distance():
descriptor1 = get_add_skip_model().extract_descriptor()
descriptor2 = get_concat_skip_model().extract_descriptor()
assert edit_distance(descriptor1, descripto... | [
{
"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 | tests/test_bayesian.py | eric-erki/autokeras |
# Copyright 2019 The Forte Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
{
"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 | forte/pipeline_component.py | atif93/forte |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def show_image(image):
plt.imshow(-image, cmap='Greys')
plt.show()
def show_two(image1, image2):
plt.subplot(121)
plt.imshow(-image1, cmap='Greys')
plt.subplot(122)
plt.imshow(-image2, cmap='Greys')
plt.show()
def plot_hist(img)... | [
{
"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 | ocr/paint.py | BumagniyPacket/ocr |
import cv2
import numpy as np
import copy
from tensorflow.python.lib.io import file_io
import io
from PIL import Image
def url2img(uri):#IO function compliant to loading gs:// url images
file= file_io.FileIO(uri, mode='rb')
file = file.read()
img= Image.open(io.BytesIO(file)).convert('RGB')
return np.asarray(im... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},... | 3 | move_to_cloudshell/trainer/data_augment.py | leoninekev/training-frcnn-google-ml-engine |
"""Tiles, number swapping game.
Exercises
1. Track a score by the number of tile moves.
2. Permit diagonal squares as neighbors.
3. Respond to arrow keys instead of mouse clicks.
4. Make the grid bigger.
"""
from random import *
from turtle import *
from freegames import floor, vector
tiles = {}
neighbors = [
... | [
{
"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 | freegames/tiles.py | rezaa2002/free-python-games |
"""
This module defines various utilities for dealing with the network.
"""
from asyncio import iscoroutinefunction, iscoroutine
def combine_action_handlers(*handlers):
"""
This function combines the given action handlers into a single function
which will call all of them.
"""
# make su... | [
{
"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 | nautilus/network/events/util.py | AlecAivazis/python |
import threading
from funcy import cached_property, wrap_prop
from dvc.scheme import Schemes
# pylint:disable=abstract-method
from .base import FileSystem
class WebHDFSFileSystem(FileSystem):
scheme = Schemes.WEBHDFS
REQUIRES = {"fsspec": "fsspec"}
PARAM_CHECKSUM = "checksum"
@classmethod
def ... | [
{
"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 | dvc/fs/webhdfs.py | tirkarthi/dvc |
# -*- coding: utf-8 -*-
import subprocess
from pyhammer.tasks.taskbase import TaskBase
class TortoiseSvnCommitTask( TaskBase ):
def __init__( self, path ):
super(TortoiseSvnCommitTask, self).__init__()
self.__path = path
def RunCmd( self, CmdLine, CmdDir = None ):
p = subprocess.Pope... | [
{
"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 | pyhammer/tasks/svn/tortoisesvncommittask.py | webbers/pyhammer |
# Copyright 2019 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
{
"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 | qnarre/doc/justifier.py | quantapix/qnarre.com |
class User():
"""存储用户信息"""
def __init__(self,first_name,last_name):
self.first_name = first_name
self.last_name = last_name
def describe_user(self):
print("Hi Welcome "+self.first_name+self.last_name)
def greet_user(self):
print('Welcome ')
my_user = User('he','mm')
my_user.describe_user()
my_user.greet_u... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | 9/9.3/admin.py | liqiwa/python_work |
from flask import Flask, request, flash, redirect
from rest.v1.user import app as user_api_v1
from rest.v1.transcripe_and_translate import app as tat_api_v1
from flask_socketio import SocketIO, emit
import json
from helpers import converter as converter_helper, user as user_helper
from flask_cors import CORS, cross_ori... | [
{
"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.py | zilehuda/transtreaming-europa |
from __future__ import absolute_import
from setuptools import setup, find_packages
from setuptools.command.install import install
class InstallCommand(install):
user_options = install.user_options + [
('no-ml', None, "Don't install without Machine Learning modules."),
]
boolean_options = install.... | [
{
"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 | setup.py | jeanpro/talon |
from django.db import models
CATEGORY_CHOICES = (
('A', 'ACTION'),
('D', 'DRAMA'),
('C', 'COMEDY'),
('R', 'ROMANCE'),
)
LANGUAGE_CHOICES = (
('EN', 'ENGLISH'),
)
STATUS_CHOICES = (
('RA', 'RECENTLY ADDED'),
('MW', 'MOST WATCHED'),
('TR', 'TOP RATED'),
)
LINK_CHOICES = (
('T', 'WAT... | [
{
"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 | imdb/movie/models.py | nijatmursali/MovieWebsitePythonDjango |
import numpy as np
def smallest_multiple_of_n_geq_m(n: int, m: int) -> int:
## n = 3
## m = 25 - 9 = 16
## 16 + ((3 - (16 % 3)) % 3)
return m + ((n - (m % n)) % n)
class PrimeListSieve:
def __init__(self):
self._primes: list[int] = [2, 3, 5, 7]
self.end_segment: int = 1
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | PrimeTheory/primes_list.py | kbrezinski/Candidacy-Prep |
# SPDX-FileCopyrightText: 2017 Radomir Dopieralski for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_rgb_display.hx8353`
====================================================
A simple driver for the HX8353-based displays.
* Author(s): Radomir Dopieralski, Michael McWethy
"""
try:
from micropy... | [
{
"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 | rgb_display/hx8353.py | jrmoserbaltimore/Adafruit_CircuitPython_RGB_Display |
from random import randint
class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
left = 0
right = len(nums) - 1
while left <= right:
pivot_idx = randint(left, right)
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | 200-299/215-kth-largest-element.py | bcongdon/leetcode |
import os
import re
import inspect
def _get_parser_list(dirname):
files = [ f.replace('.py','') for f in os.listdir(dirname) if not f.startswith('__')
]
return files
def _import_parsers(parserfiles):
m = re.compile('.+parsers',re.I)
_modules = __import__('weatherterm.parsers',globals(),locals(),pa... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | weatherterm/core/parser_loader.py | eustone/weather-app |
# coding: utf-8
# 定义全局空间的foo函数
def foo():
print("全局空间的foo方法")
# 全局空间的bar变量
bar = 20
class Bird:
# 定义Bird空间的foo函数
def foo(self):
print("Bird空间的foo方法")
# 定义Bird空间的bar变量
bar = 200
# 调用全局空间的函数和变量
foo()
print(bar)
# 调用Bird空间的函数和变量
Bird.foo()
print(Bird.bar)
| [
{
"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 | PythonBaseDemo/classAndObjDemo/6.2/class_space.py | CypHelp/TestNewWorldDemo |
import unittest
class SampleTest(unittest.TestCase):
def setUp(self):
return
def tearDown(self):
return
def test_non_unique_name(self):
pass
def test_asdf2(self):
pass
def test_i_am_a_unique_test_name(self):
pass
if __name__ == '__main__':
unittest... | [
{
"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 | plugin.video.mrknow/mylib/tests_pydevd_runfiles/samples/nested_dir/nested2/deep_nest_test.py | mrknow/filmkodi |
from domain.model.environment import EnvironmentName
from domain.model.zone import ZoneRepository, ZoneName, Zone
from ..SQLAlchemyBase import SQLAlchemyBase
from ..model.ZoneModel import ZoneModel
class ZoneRepositorySQL(ZoneRepository):
def __init__(self, base_repo: SQLAlchemyBase):
self.base_repo = ba... | [
{
"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 | fwl-automation-decisions/infrastructure/src/infrastructure/flsql/repository/ZoneRepositorySQL.py | aherculano/fwl-project |
# ---------------------------------------------------------------------
# Syslog server
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
im... | [
{
"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 | services/syslogcollector/syslogserver.py | prorevizor/noc |
import asyncio
from datetime import datetime
from typing import Callable
import discord
from discord.ext import commands
class AoiTask:
def __init__(self, task: asyncio.Task, ctx: commands.Context, status: Callable[[], str]):
self.task = task
self.ctx = ctx
self._status = status
s... | [
{
"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 | aoi/task.py | Yat-o/Aoi |
import dim
from ..operate import Operate
from ..constant import Constant
class PowOperate(Operate):
def __init__(self,left,right,args=None,name=None):
super(PowOperate,self).__init__(left,right,"pow",args,name)
def partGrad(self,partial,prevOp):
if (partial.type!="Variable"): raise Exception("partial参数必... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | dim/autograd/modules/powOperate.py | xhqing/dim |
import csv
class AllelePrimarySequenceManager:
AMINO_ACIDS_WITH_UNKNOWN = ['^', '-', 'A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
'S', 'T', 'V', 'W', 'Y', 'X']
NUM_AMINO_ACID = len(AMINO_ACIDS_WITH_UNKNOWN)
sequence_index_dict = {}
sequence... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | MHCSeqNet/PredictionModel/Utility/AllelePrimarySequenceManager.py | cmbcu/-MHCSeqNet |
"""
Unit tests for '.models'.
"""
from myproj.models import (Defaults, Parameters)
def test_Parameters_init():
res = Parameters()
assert type(res) is Parameters
def test_Parameters_to_dict():
res = Parameters().to_dict()
assert type(res) is dict
def test_Defaults_init():
res = Defaults()
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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/unit_models.py | rohank63/htsinfer |
# -*- coding: utf-8 -*-
# Copyright 2020 Quentin Gliech
#
# 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 la... | [
{
"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 | synapse/rest/oidc/callback_resource.py | littlebenlittle/synapse |
from __future__ import annotations
from asyncio import iscoroutine
from contextlib import AsyncExitStack
from typing import Any, Callable
import attr
from anyio import create_task_group
from anyio.abc import TaskGroup
from ..abc import AsyncEventBroker
from ..events import Event
from ..util import reentrant
from .ba... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/apscheduler/eventbrokers/async_local.py | sasirajpuvvada/apscheduler |
import unittest
import os
import numpy as np
from dotenv import load_dotenv
from nlpaug.util import AudioLoader
import nlpaug.augmenter.spectrogram as nas
class TestLoudnessSpec(unittest.TestCase):
@classmethod
def setUpClass(cls):
env_config_path = os.path.abspath(
os.path.join(os.path.d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | test/augmenter/spectrogram/test_loudness_spec.py | lucidworks/nlpaug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.