source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from tulip import *
import tulipplugins
class SetSizeComponent(tlp.SizeAlgorithm):
def __init__(self, context):
tlp.SizeAlgorithm.__init__(self, context)
self.addSizePropertyParameter("Size property","The size property to modify",
"viewSize", True, True, False)
self.addStringCollectio... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | TulipUIHelpers/setSizeComp.py | renoust/TulipPythonPluginFarm |
# -*- coding: utf-8 -*-
"""
@Time : 2020/12/11 11:57
@Author : Corey
"""
from flask import Flask, request
from flask_restful import Api, Resource, marshal, fields, reqparse
app = Flask(__name__)
# restful接口方法
api = Api(app)
class UserApi(Resource):
def get(self):
return 'get restful api data'
de... | [
{
"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 | restful_test.py | Corey0606/FlaskSite |
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
saved = [
"din0",
"din1",
"din2",
"din3",
"sel0",
"sel1",
"sel_b0",
"sel_b1",
"dout",
]
def read_data(f):
data = defaultdict(lambda: [])
for line in f.readlines():
values = line.... | [
{
"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 | sramgen/testbenches/column_mux_4/column_mux_4.py | rahulk29/sram22 |
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Access-Control-Al... | [
{
"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 | static_server.py | bdon/80s.nyc |
from importlib.resources import path
import sys
import os
import shutil
from git import Repo
from subprocess import call
from git import RemoteProgress
import git
from tqdm import tqdm
from pathlib import Path
dir_path = (os.path.expanduser('~/Documents') + "\server")
os.chdir(dir_path)
gitaddress = str("https://gith... | [
{
"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 | main.py | 0xol/server-installer |
from abc import ABC, abstractmethod
from mycloud.common import sha256_file
from mycloud.constants import VERSION_HASH_LENGTH
class CalculatableVersion(ABC):
@abstractmethod
def calculate_version(self):
raise NotImplementedError()
class BasicStringVersion(CalculatableVersion):
def __init__(sel... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | mycloud/drive/filesystem/file_version.py | ThomasGassmann/swisscom-my-cloud-backup |
#!/usr/bin/env python3
"""
Author: Ken Youens-Clark <kyclark@gmail.com>
Purpose: Say hello
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get the command-line arguments"""
parser = argparse.ArgumentParser(description='Say hello')
parser.add_argument('-n', '-... | [
{
"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 | 01_Hello/hello08_formatted.py | davidlg2005/tiny_python_projects |
from conans import ConanFile, CMake
import os
class TinyreflTool(ConanFile):
name = 'tinyrefl-tool'
version = '0.4.1'
url = 'https://github.com/Manu343726/tinyrefl'
description = ' A work in progress minimal C++ static reflection API and codegen tool'
scm = {
'type': 'git',
'url': 'http... | [
{
"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 | tool/conanfile.py | Bjoe/tinyrefl |
import ctypes
import multiprocessing as mp
from procgen_adventure.utils.synchronize import RWLock
class AsyncReplayBufferMixin:
"""Mixin class which manages the buffer (shared) memory under a read-write
lock (multiple-reader, single-writer), for use with the asynchronous
runner. Wraps the ``append_sample... | [
{
"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 | procgen_adventure/replays/async_.py | Laurans/procgen_adventure |
import binascii
import requests
from Crypto.PublicKey import RSA
from common.transaction import Transaction
from common.transaction_input import TransactionInput
from common.transaction_output import TransactionOutput
from common.utils import calculate_hash
class Owner:
def __init__(self, private_key: str = "")... | [
{
"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/wallet/wallet.py | MikitaSaladukha/my-blockchain |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Abstract Transport
"""
import typing
import abc
from apt.transport.directorylisting import DirectoryListing
class Transport:
"""
Abstract class for retrieving information from repos
The functions 'exists' and 'open_read' are required to be implemented... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
... | 3 | apt/transport/transport.py | javajawa/debian-repo-remux |
from django.shortcuts import render
from django.http import HttpResponse, Http404, HttpResponseRedirect
from .models import Shortener
from .forms import ShortenerForm
def home_view(request):
template = 'shortener/home.html'
context = {}
# Empty form
context['form'] = ShortenerForm()
if request... | [
{
"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 | shortener/views.py | malakbenr/Shorty_URL-Shortner |
import re
from datetime import datetime
from django.utils.timezone import make_aware
# return the file paths who has .jpg extension
def select_jpg(files):
return [f for f in files if re.search(r'.jpg$', f)]
# parse data from file path
# string example:
# inbox/cam1/6M07E3EPAGC7C0F/2021-05-28/001/jpg/09/30.20[R]... | [
{
"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 | poultrycam/ftp/utils.py | AlexGolovaschenko/PoultryCam |
import pandas as pd
import numpy as np
import math
from pandasql import sqldf
def add_expression_column(table, new_cols, formulas, expr_type='sqlite'):
_table = table.copy()
print(locals())
for nc, f in zip(new_cols, formulas):
if expr_type == 'sqlite':
_table[nc] = sqldf('select ... | [
{
"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 | function/python/brightics/function/extraction/add_expression_column.py | seungrojoo/studio |
from nose.tools import * # noqa: F403
from tests.base import AdminTestCase
from osf_tests.factories import NodeFactory, UserFactory
from osf.utils.permissions import ADMIN
from admin.nodes.serializers import serialize_simple_user_and_node_permissions, serialize_node
class TestNodeSerializers(AdminTestCase):
def... | [
{
"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 | admin_tests/nodes/test_serializers.py | gaybro8777/osf.io |
# main file
# Please use multiclasses
# ~ZaZa
#Main by zekiahepic
import os
import sys
import yaml
class __main__:
def __init__(self):
print("ENTER LANGUAGE: (DE) (EN)")
language = input(">> ").lower()
self.handleStartup(language)
def handleStartup(self, language):
print(sel... | [
{
"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 | messenger/main.py | kant/MessengerPy |
import idautils
import idaapi
import idc
def set_hexrays_comment(address, text):
cfunc = idaapi.decompile(address)
tl = idaapi.treeloc_t()
tl.ea = address
tl.itp = idaapi.ITP_SEMI
cfunc.set_user_cmt(tl, text)
cfunc.save_user_cmts()
def get_guid(address):
CurrentGUID = []
... | [
{
"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 | ida_uefi_re/utils.py | CrackerCat/UEFI_RETool |
from kol.request.GenericRequest import GenericRequest
from kol.manager import PatternManager
import kol.Error as Error
from kol.util import Report
class RespondToTradeRequest(GenericRequest):
def __init__(self, session, tradeid, items=None, meat=0, message=""):
super(RespondToTradeRequest, self).__sup... | [
{
"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 | src/kol/request/RespondToTradeRequest.py | danheath/temppykol |
import boto3
from botocore.config import Config
class Connector:
def __init__(self, srv_name):
# If you prefer using specific region rather than ~/.aws/credentials
self.config = Config(
region_name='ap-northeast-3',
signature_version='v4',
retries={
... | [
{
"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 | libs/connector.py | exsky/ironman2021 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | aliyun-python-sdk-live/aliyunsdklive/request/v20161101/DeleteLiveStreamsNotifyUrlConfigRequest.py | DataDog/aliyun-openapi-python-sdk |
from django.db import models
class Area(models.Model):
"""
省区划 自关联的表 ,外键指向本身
"""
name = models.CharField(max_length=20, verbose_name='名称')
parent = models.ForeignKey('self', on_delete=models.SET_NULL, related_name='subs', null=True, blank=True,
verbose_name='上级行政区划')... | [
{
"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 | meiduo_mall/meiduo_mall/apps/areas/models.py | ld-xy/Django_html_vue.js |
"""
.. currentmodule:: modlit.types
.. moduleauthor:: Pat Daburu <pat@dabru.net>
This module contains custom GeoAlchemy/SQLAlchemy types.
"""
# pylint: skip-file
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
"""
This i... | [
{
"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 | modlit/types.py | patdaburu/modlit |
import click
import json
import subprocess
from sys import exit
def get_unbonded_atom(address):
try:
process = subprocess.check_output("gaiacli account %s" % (address), shell=True, stderr=subprocess.STDOUT)
return {
"success": True,
"output": json.loads(process)
}
... | [
{
"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 | bonder/check.py | gkrizek/bond |
import os
import pandas as pd
import pytest
import polars as pl
from .. import read_sql
@pytest.fixture(scope="module") # type: ignore
def postgres_url() -> str:
conn = os.environ["POSTGRES_URL"]
return conn
def test_modin(postgres_url: str) -> None:
query = "SELECT * FROM test_table"
df = read_s... | [
{
"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 | connectorx-python/connectorx/tests/test_polars.py | ives9638/connector-x |
from zugh.db.connection import ConnectConfigError, connect
from zugh.db.pool import ConnectionPool
from zugh.db.query import execute
class DataBase:
conn_config = None
conn_pool = None
def __init__(self, name: str, conn_config: dict = None, pool: ConnectionPool = None):
self.name = name
... | [
{
"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 | schema/db.py | StephenKevin/zugh |
from flask_apispec import MethodResource
from flask_apispec import use_kwargs, doc
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from webargs import fields
from decorator.catch_exception import catch_exception
from decorator.log_request import log_request
from decorator.verify_admin_ac... | [
{
"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 | oxe-api/resource/user/update_user_group_assignment.py | CybersecurityLuxembourg/openxeco |
import sys
sys.path.append('/TabPy')
from geocode import geocodeReverse
def prepGeo(input):
prepData = geocodeReverse(input,"token")
return prepData
def get_output_schema():
return pd.DataFrame(
{
"InitialQuery": prep_string(),
"ReturnAddress": prep_string(),
"A... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/prepReverse.py | domlet/tableauGeocode |
import argparse
import pysam
# parse the read group strings from a bam/sam header
# return array of read group strings
def read_groups_from_bam(bam_filename, use_libraries=False):
bam = pysam.AlignmentFile(bam_filename, "rb")
header = bam.header
results = {}
if 'RG' in header:
read_groups = header['RG']
if... | [
{
"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 | read_groups_from_bam.py | DReichLab/adna-workflow |
import time
import RPi.GPIO as GPIO
from moisture import *
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
def servoinit():
GPIO.setup(24, GPIO.OUT)
def servodown():
pwm=GPIO.PWM(24,100)
pwm.start(8.5)
pwm.ChangeDutyCycle(8.5)
time.sleep(0.8)
def servoup():
pw... | [
{
"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 | servo.py | raghav16259/Garden-Bot |
from django.test import TestCase
from tests.utils import TestConfiguration
class JobModelTestCase(TestCase):
def setUp(self) -> None:
self.config = TestConfiguration()
def test_downstream_jobs(self):
downstream_jobs = self.config.job.get_downstream_jobs(include_self=False)
self.asse... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/test_models/test_job.py | fruviad/combine |
# 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": "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 | aliyun-python-sdk-pts/aliyunsdkpts/request/v20190810/ListScenesRequest.py | yndu13/aliyun-openapi-python-sdk |
#!//usr/bin/env python3
"""Fetch a list of words from a URL.
Args:
url: the url of a UTF_8 text document.
Returns:
A list of strings conataining the words from the document
"""
import sys
from urllib.request import urlopen
def fetch_words(url):
"""Fetch a list of words from a URL.
Args:
url: the... | [
{
"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 | python3/readingfromurl.py | deepikavashishtha/pythonLearning |
"""
Advanced reporter configuration module
This module retrieves configuration in YAML format and converts it to JSON
There is only PUT method for editing the configuration
Path to configuration is specified in config.ini in this folder.
"""
from liberouterapi import config
from liberouterapi.error import ApiExcepti... | [
{
"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 | Nemea/backend/Reporters.py | Akhady/Nemea-GUI |
# coding: utf8
# try something like
def index():
rows = db((db.sponsor.text!="")&(db.sponsor.active==True)&(db.sponsor.level!=SPONSOR_LEVELS[-3])).select()
if rows:
return dict(sponsors_detail=rows)
else:
return plugin_flatpage()
def prospectus(): return plugin_flatpage()
@auth.requires_lo... | [
{
"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 | controllers/sponsors.py | bkahlerventer/web2congress |
from flask_restful import abort
class HTTPExceptions(object):
msg = "HTTP Error: %s"
@classmethod
def not_found(cls, message=msg % "Object does not exist"):
abort(404, message=message)
@classmethod
def already_exists(cls, message=msg % "Object already exists"):
abort(409, messag... | [
{
"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 | zfs_cluster_deployer/app_exceptions.py | AymenSegni/zfs-manager-api |
from typing import Any, Dict
import pytest
from assertpy import assert_that
from src.models.rename import Rename
from src.services.exceptions import InvalidRenameLookup, MissingRename
from src.services.renaming import rename_path
@pytest.mark.parametrize(
"path,rename,render_context,expected",
[
(
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | tests/test_renaming.py | JoelLefkowitz/templ8 |
from lib.install import install
import subprocess
import tempfile
import unittest
class TestInstall(unittest.TestCase):
def test_install_3x(self):
with tempfile.TemporaryDirectory() as install_dir:
install(install_dir, '3.2.0.0')
output = subprocess.check_output([f'{install_dir}/bin/cabal', '--versi... | [
{
"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 | test/test_install.py | sestrella/asdf-cabal |
# -*- coding: utf-8 -*-
from unittest import TestCase
from nose import tools
from django.contrib import admin
from ella.core.models import Author
from ella.articles.models import Article
from ella.positions.admin import PositionOptions
from ella.positions.models import Position
class TestPositionAdmin(TestCase):
... | [
{
"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_ella/test_positions/test_admin.py | hamsavardhini09/AWSLearning |
from slyd.gitstorage.repoman import Repoman
from slyd.gitstorage.projectspec import GitProjectSpec
from slyd.dash.dashclient import search_spider_names
from slyd.errors import BadRequest
class ProjectSpec(GitProjectSpec):
@classmethod
def setup(cls, storage_backend, location, dash_url, **kwargs):
Git... | [
{
"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 | slyd/slyd/dash/projectspec.py | ruairif/portia |
import time
from optparse import OptionParser
def build_option_parser():
parser = OptionParser()
parser.add_option("-t", "--time", dest="given_time", type="string", help="Use HH:MM format for timer")
return parser.parse_args()
def countdown_timer(given_time_seconds):
while given_time_seconds:
... | [
{
"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 | officetimer/timer_controller.py | adityakamble49/office-timer |
from django.shortcuts import render
from django.http import HttpResponse
from rango.models import Category
def index(request):
category_list = Category.objects.order_by('-likes')[:5]
context_dict = {}
context_dict['boldmessage'] = 'Crunchy, creamy, cookie, candy, cupcake!'
context_dict['categories'] =... | [
{
"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 | main/files/rango/views.py | Recol/Django-Tango |
from PLC.Parameter import Parameter, Mixed
from PLC.Method import Method, xmlrpc_type
from functools import reduce
class methodSignature(Method):
"""
Returns an array of known signatures (an array of arrays) for the
method name passed. If no signatures are known, returns a
none-array (test for type != ... | [
{
"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 | PLC/Methods/system/methodSignature.py | dreibh/planetlab-lxc-plcapi |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 12 11:46:51 2017
@author: terevaldivia
"""
import os
from CC3501Utils_personal import *
import numpy as np
class Fondo(Figura):
def __init__(self, pos=Vector(0, 0), rgb=(1.0, 1.0, 1.0)):
super(Fondo, self).__init__(pos, rgb)
... | [
{
"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 | Fondo.py | tere-valdivia/icy_tower_tarea |
import pytest
import json
import os
from lkmltools.linter.rules.filerules.data_source_rule import DataSourceRule
from conftest import get_lookml_from_raw_lookml
def test_run1():
raw_lookml = """
view: aview {
sql_table_name: bqdw.engagement_score ;;
}
"""
lookml = get_lookml_from_raw_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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/test_data_source_rule.py | iserko/lookml-tools |
from abc import ABCMeta, abstractmethod
class IBeatmap:
__metaclass__ = ABCMeta
@abstractmethod
def get_diff_data(self):
raise NotImplementedError
@abstractmethod
def get_hitobjects(self):
raise NotImplementedError | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | osu_interfaces/IBeatmap.py | abraker-osu/osu_score_exporter |
import enum
from sqlalchemy import Column, Integer, String, Enum
from vwsfriend.model.base import Base
class UnitOfLength(enum.Enum):
KM = 'km'
MI = 'mi'
class UnitOfTemperature(enum.Enum):
C = 'C'
F = 'F'
class Settings(Base):
__tablename__ = 'settings'
id = Column(Integer, primary_key=... | [
{
"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 | vwsfriend/vwsfriend/model/settings.py | cmantsch/VWsFriend |
#coding=utf-8
"""
Implementation of some commonly used losses.
"""
# python 2.X, 3.X compatibility
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
#import os
#import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class BC... | [
{
"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 | losses/normal_loss.py | mzhaoshuai/RMI |
from gpiozero import Servo
from gpiozero import LED
from time import sleep
from WeatherDataCW import WeatherData
class WeatherDashboard:
servo_pin = 17
led_pin = 14
servoCorrection=0.5
maxPW=(2.0+servoCorrection)/1000
minPW=(1.0-servoCorrection)/1000
def __init__(self, servo_position=... | [
{
"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 | WeatherDashboardCW.py | kuzned/rpi_weather |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
{
"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 | reinforcement_learning/dqn/atari_utils.py | AaratiAkkapeddi/nnabla-examples |
"""ChQuery the comments Migration
Revision ID: 8b25b23d386f
Revises: a21b8da19c7d
Create Date: 2022-03-12 09:58:47.379065
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8b25b23d386f'
down_revision = 'a21b8da19c7d'
branch_labels = None
depends_on = None
def ... | [
{
"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 | migrations/versions/8b25b23d386f_chquery_the_comments_migration.py | macc254/Personal-Blog |
from __future__ import absolute_import, print_function
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.asymmetric.utils import (
encode_dss_signature,
)... | [
{
"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 | docs/development/custom-vectors/secp256k1/verify_secp256k1.py | dvaerum/cryptography |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.base import View
from django.shortcuts import render, redirect
from report.backend import ReportBackend
class ReportView(LoginRequiredMixin, View):
def get(self, request):
return render(
request,
'r... | [
{
"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 | report/views.py | Aimsucks/blue_donut |
from pyglet.libs.darwin.objc_runtime import *
# This class is a wrapper around NSCursor which prevents us from
# sending too many hide or unhide messages in a row. Apparently
# NSCursor treats them like retain/release messages, which can be
# problematic when we are e.g. switching between window & fullscreen.
class S... | [
{
"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 | pyglet/window/cocoa/systemcursor.py | seeminglee/pyglet64 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy... | [
{
"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 | watchdog_kj_kultura/users/models.py | watchdogpolska/watchdog-kj-kultura |
"""
Make sure that tiddler fields which are not strings
are stringified, otherwise, the text serialization will
assplode.
"""
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.tiddler import Tiddler
def setup_module(module):
pass
def test_float_field():
tiddler = Tiddler('foo', 'bar')
t... | [
{
"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 | test/test_tiddler_fields_as_strings.py | funkyeah/tiddlyweb |
centerX = 500/2
centerY = 500/2
leng = 350
angle = PI/4
weight = 1
counter = 0
class myline():
def render(self, centerX, centerY, angle):
x1 = centerX - cos(angle)*leng/2
y1 = centerY + sin(angle)*leng/2
x2 = centerX + cos(angle)*leng/2
y2 = centerY - sin(angle)*leng/2
... | [
{
"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 | processing/chapter8/sketch_8_2_L55/sketch_8_2_L55.pyde | brickdonut/2019-fall-polytech-cs |
class Human:
def __init__(self,name):
self.name = name
self.age = 0
def change_age(self,num):
if num > 0:
self.age = num
else:
print('ne baluisya')
new_human = Human(name='maksim')
new_human1 = Human(name='emir')
new_human1.change_age(-20) | [
{
"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 | CLASS1/CLASS 1.py | zarina494/CLASS |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "t 0.1, s, t 1, s, t 3, s, t 4, s, q"
tags = "Repeat"
import cocos
from cocos.... | [
{
"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 | team_9/cocos/test/test_repeat.py | Donnyvdm/dojo19 |
import ranger.api
import ranger.core.fm
import ranger.ext.signals
import subprocess
hook_init_old = ranger.api.hook_init
def hook_init(fm: ranger.core.fm.FM):
def zoxide_add(signal: ranger.ext.signals.Signal):
path = signal.new.path
process = subprocess.Popen(["zoxide", "add", path])
proc... | [
{
"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 | ranger_zoxide.py | rif/zoxide |
# bot implementation
import discord
from discord.ext import commands
# class DndBotClient(discord.Client):
class DndBotClient(commands.Bot):
async def on_ready(self):
print(f"logged in as {self.user} (ID: {self.user.id})")
print("------")
async def on_member_join(self, member):
guil... | [
{
"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 | dnd_bot.py | difoster7/dnd-discord |
from sklearn import metrics
import numpy as np
import logging
logger = logging.getLogger(__name__)
# TODO: add others
# TODO: add ability to include generic functions
def r2_score(true_target, prediction):
# R2 metric
return metrics.r2_score(y_true=true_target, y_pred=prediction)
def rms_score(true_target,... | [
{
"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 | cd4ml/model_tracking/validation_metrics.py | camila-contreras/CD4ML-Scenarios |
import wave
from threading import Thread
from pyaudio import PyAudio
def play_wav(path):
def target():
chunk = 1024
f = wave.open(path)
p = PyAudio()
stream = p.open(format=p.get_format_from_width(f.getsampwidth()), channels=f.getnchannels(),
rate=f.getfram... | [
{
"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 | src/sound/sound.py | junhg0211/Kreylin |
from threeML.io.fits_file import FITSExtension, FITSFile
import numpy as np
import astropy.io.fits as fits
import pytest
class DUMMYEXT(FITSExtension):
def __init__(self, test_value):
data_list = [("TEST_VALUE", test_value)]
super(DUMMYEXT, self).__init__(
tuple(data_list), (("EXTNA... | [
{
"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 | threeML/test/test_fits_file.py | jasonfan1997/threeML |
import pytest
import pystatuspage
import os
SECRETS_FILE = 'secrets.json'
@pytest.fixture(scope="module")
def secrets():
if os.path.exists(SECRETS_FILE):
import json
with open(SECRETS_FILE) as json_file:
secrets = json.load(json_file)
else:
secrets = {}
secrets['o... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | test/conftest.py | srgrn/pystatuspage |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | [
{
"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 | dev/Gems/CloudGemFramework/v1/AWS/common-code/ServiceClient_Python/test/test_unit_service_client.py | brianherrera/lumberyard |
"""
spotilyzer test mock describe_instance_types paginator
"""
# system imports
import os
import json
# test imports
from .base import MockPaginatorsBase
class MockDescribeInstanceTypesPaginator(MockPaginatorsBase):
def __init__(self):
super(MockDescribeInstanceTypesPaginator, self).__init__()
... | [
{
"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 | tests/mocks/paginators/describe_instance_types.py | conrad-mukai/spotilyzer |
# Copyright 2021 Huawei Technologies Co., Ltd.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 ap... | [
{
"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 | ecosystem_tools/mindconverter/mindconverter/graph_based_converter/mapper/onnx/ops/floor_mapper.py | mindspore-ai/mindinsight |
from chainer.backends import cuda
from chainer import function_node
from chainer.utils import type_check
class Copy(function_node.FunctionNode):
"""Copies the input variable onto the specified device."""
def __init__(self, out_device):
self.out_device = out_device
def check_type_forward(self, i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | chainer/functions/array/copy.py | Evanc123/chainer |
# -*- coding: utf-8 -*-
# --------------------------------------
# @Time : 2020/11/01
# @Author : Oscar Chen
# @Email : 530824679@qq.com
# @File : ops.py
# Description :base operators.
# --------------------------------------
import tensorflow as tf
def leaky_relu(x):
return tf.nn.leaky_relu(x, alpha=0.1... | [
{
"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 | model/ops.py | 530824679/YOLOv2 |
def FactorialNonRecursion(number):
"""
>>> FactorialNonRecursion(3)
6
>>> FactorialNonRecursion(5)
120
>>> FactorialNonRecursion(0)
1
>>> FactorialNonRecursion(1)
1
"""
if isinstance(number, float):
raise ValueError("Non integer number is not allowed")
if number <... | [
{
"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 | algorithms/Python/recursion/factorial.py | Tanmoy07tech/DSA |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaebusiness.business import CommandExecutionException
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
from tekton.gae.middleware.json_middleware import JsonResponse
from chamado_app impor... | [
{
"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 | backend/appengine/routes/chamados/rest.py | cbeloni/pychronesapp |
import os_clf as clf
import numpy as np
from sklearn.linear_model import SGDClassifier
# SGD
img_dim = 230400
class pool:
def __init__(self):
self.classifiers = {}
self.errors = {}
self.occurrences = {}
def add_classifier(self, new_class, index):
#self.classif... | [
{
"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 | os_clf_pool.py | CopperWasp/CNNField |
import numpy as np
import matplotlib.pyplot as plt
def estimate(particles, weights):
"""returns mean and variance of the weighted particles"""
pos = particles
mean = np.average(pos, weights=weights, axis=0)
var = np.average((pos - mean)**2, weights=weights, axis=0)
return mean, var
def 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | 002_Particle_Filter/Particle_Filter.py | zhyongquan/Automotive-Software-Blog |
#!/usr/bin/env python
import sys
import tarfile
import json
import cheesepi as cp
def slurp_file(dao, series, fd):
"""Read a file into the 'series' database"""
content = fd.read()
points = json.loads(content)
dao.slurp(series, points)
def slurp_database(dao, filename):
"""Read a tgz filename into the database"... | [
{
"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 | storage/slurp.db.py | stephenmac98/cheesepi_python3 |
"""
Find the first non-repeated character in a string
https://www.codeeval.com/open_challenges/12/
"""
import unittest
def first_unique_character(s):
return
class FirstUniqueCharacterTest(unittest.TestCase):
def test_yellow(self):
self.assertEquals('y', first_unique_character('yellow'))
if __name... | [
{
"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 | 2017/future/first_unique_character.py | littlepea/beijing-python-meetup |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_table11.py | timgates42/XlsxWriter |
# IMPORT MANAGEMENT
try:
import gevent.monkey
except ModuleNotFoundError:
import os
os.system('pip install -r requirements.txt')
import gevent.monkey
gevent.monkey.patch_all() # patch everything
import colorama
colorama.init(autoreset=True)
import discord.commands
import asyncio
import discord
import... | [
{
"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 | src/bot.py | nsde/novalix |
import unittest
import os
from hamcrest import *
from service.smplayservice import SmPlayServiceStarter
from smcontext import SmContext, SmApplication
class TestSmPlayService(unittest.TestCase):
test_dir = os.path.join(os.path.dirname(__file__), "../")
def setUp(self):
sm_application = SmApplication(self.tes... | [
{
"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 | test/unit/test_smplayservice.py | elabeca/service-manager |
# SPDX-License-Identifier: MIT
# (c) 2019 The TJHSST Director 4.0 Development Team & Contributors
import asyncio
import json
from typing import Any, Dict
import websockets
from docker.models.services import Service
from ..docker.services import get_director_service_name, get_service_by_name
from ..docker.utils impor... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside ... | 3 | orchestrator/orchestrator/consumers/logs.py | darius-kia/director4 |
def capitalize_header(event_name):
pass
def format_date(event_date):
pass
def display_icons(icons):
pass
def print_leaflet(event_name, icons, authors, event_date=None):
pass
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | exercises/concept/pretty-leaflet/string_formatting.py | highb/python |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config
from sqlalchemy.engine.base import Engine
from pyramid.paster import get_appsettings, setup_logging
from www.models.meta import Base
config = context.config
setup_logging(config.config_file_name)
engine = en... | [
{
"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 | www/alembic/env.py | tompetersjr/photography |
# -*- coding: utf-8 -*-
"""
@author: Amin Asbai
"""
import json
import pandas as pd
import requests
def update_Weather_data(df):
url='http://api.openweathermap.org/data/2.5/weather?q=Andratx&units=metric&appid=1e47e582bff799e3514239429b76f2aa'
response = requests.get(url)
climate_data=response.json()
... | [
{
"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 | Main Code/WeatherData.py | ArmenFirman/Intelligent-Solar-Energy-Manager |
import os
import tempfile
import boto3
from PIL import Image
s3 = boto3.client('s3')
DEST_BUCKET = os.environ['DEST_BUCKET']
SIZE = 128, 128
def lambda_handler(event, context):
for record in event['Records']:
source_bucket = record['s3']['bucket']['name']
key = record['s3']['object']['key']
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | service_compute_lamda/LinuxAcademyLab1/lambda_handler.py | anandibhat/awssa02 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MediaContentList import MediaContentList
class AlipayCommerceTransportEtcMediaGetResponse(AlipayResponse):
def __init__(self):
super(AlipayCommerceTransp... | [
{
"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 | alipay/aop/api/response/AlipayCommerceTransportEtcMediaGetResponse.py | snowxmas/alipay-sdk-python-all |
# Copyright (c) 2013 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.
import collections
class Profiler(object):
"""A sampling profiler provided by the platform."""
def __init__(self, browser_backend, platform_backend... | [
{
"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 | tools/telemetry/telemetry/core/platform/profiler/__init__.py | pozdnyakov/chromium-crosswalk |
from typing import List
from task1.const import ALPHABET, SYLLABLE_LEN
def swap(s: str, i: int, j: int) -> str:
str_list = list(s)
str_list[i], str_list[j] = str_list[j], str_list[i]
return ''.join(str_list)
def preprocess(text: str) -> str:
return ''.join(ch for ch in text.lower() if ch in ALPHAB... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | task1/utils.py | SN4KEBYTE/fundamentals_of_cryptography |
from django.contrib import admin
from .models import Artist, Song
admin.AdminSite.site_title = 'Chords administration'
admin.AdminSite.site_header = 'Chords Administration'
class ArtistAdmin(admin.ModelAdmin):
exclude = ['slug']
actions = ['delete_selected']
search_fields = ['name']
def delete_sele... | [
{
"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 | chords/admin.py | Ilias95/guitarchords |
# 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | aliyun-python-sdk-cs/aliyunsdkcs/request/v20151215/PauseClusterUpgradeRequest.py | yndu13/aliyun-openapi-python-sdk |
#functions: used to wrap code for resuse
def doSomething():
print('Hello Grace')
x=7*8*9
print(x)
uservalidation=input("What's your name?")
if uservalidation==("Grace"):
doSomething()
else: print('Invalid User')
def verify(a,b,c):
print('Hello Grace')
x=a*b*c
print('The answer is', x)
... | [
{
"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 | Lesson 03.gf/functions.py | gfoo003/programming-together |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import hashlib
from... | [
{
"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 | contrib/scrooge/src/python/pants/contrib/scrooge/tasks/java_thrift_library_fingerprint_strategy.py | AllClearID/pants |
# Copyright 2018 Red Hat, Inc.
#
# 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 agre... | [
{
"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 | otcdocstheme/paths.py | OpenTelekomCloud/otcdocstheme |
import xml.etree.ElementTree as ET
import os
from Element import Element
class GMXToPython(object):
def __init__(self, xmlFile):
self.gmxroot = ET.parse(xmlFile).getroot()
self.root = Element(self.gmxroot)
for child in self.gmxroot:
self.process(child, self.root)
def process(self, element, parent):
ele... | [
{
"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 | GMXToPython.py | Karuji/GMProjectImporter |
import os
import requests
import logging
from html.parser import HTMLParser
logger = logging.getLogger(__name__)
EARTHDATA_USER = os.getenv("RF_EARTHDATA_USER")
EARTHDATA_PASS = os.getenv("RF_EARTHDATA_PASS")
def get_stream(session, url, auth, previous_tries):
"""Traverse redirects to get the final url for MOD... | [
{
"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 | app-tasks/rf/src/rf/uploads/modis/download_modis.py | pomadchin/raster-foundry |
import numpy as np
import tensorflow as tf
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=(None,dim) if dim else (None,))
def placeholders(*args):
return [placeholder(dim) for dim in args]
def mlp(x, hidden_sizes=(32,), activation=tf.tanh, output_activation=None):
for h in hidd... | [
{
"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 | spinup/algos/tf1/td3/core.py | ANCL/QuadPPO |
#algoritmo utilizado para ordenação de uma lista.
#a cada execução ele percorre toda lista e coloca o menor na posição (n-1)
def encontraMenor(lista):
#armazena o valor do indice 0 a variavel
menorValor = lista[0]
#considera que index zero tem o menor valor
menorIndex = 0
#percorre lista do indice... | [
{
"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 | selectionsort.py | maxProgrammer/Entendendo_Algoritmos |
import taichi as ti
class Atom:
def __init__(self, radius, dim=3):
self.radius = radius
self.dim = dim
self.color = ti.Vector.field(dim, ti.f32, shape=1)
self.pos = ti.Vector.field(dim, ti.f32, shape=1)
def display(self, scene):
scene.particles(self.pos, sel... | [
{
"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 | src/final/cloud.py | andy971022/acg-project |
from rest_framework import viewsets
from .serializers import (
CollectionSerializer, TextSerializer, SourceSerializer,
UriSerializer, TempEntityClassSerializer)
from .models import Collection, Text, Source, Uri, TempEntityClass
class CollectionViewSet(viewsets.ModelViewSet):
queryset = Collection.objects.... | [
{
"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 | metainfo/api_views.py | acdh-oeaw/apisbaseproject |
import os
import unittest
import pandas as pd
import mofax
from mofax.plot import *
TEST_MODEL = os.path.join(os.path.dirname(__file__), "mofa2_test_model.hdf5")
class TestMofaModelConnection(unittest.TestCase):
def test_connection(self):
self.assertIsInstance(mofax.mofa_model(TEST_MODEL), mofax.mofa_m... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | tests/test_core.py | gtca/mofax |
import click
from flask.cli import with_appcontext
from .models import db, User, OAuth
@click.command(name="createdb")
@with_appcontext
def create_db():
db.create_all()
db.session.commit()
print("Database tables created")
def shell_context_processor():
return {"db": db, "User": User, "OAuth": OAuth}... | [
{
"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 | app/cli.py | jkedra/flask-dance-multi-provider |
import unittest
import finvizlite as fl
class TestFinvizlite(unittest.TestCase):
def test_rows_to_pages(self):
self.assertEqual(fl.rows_to_pages(115), 6)
self.assertEqual(fl.rows_to_pages(15), 1)
self.assertEqual(fl.rows_to_pages(20), 1)
self.assertEqual(fl.rows_to_pages(21), 2)
... | [
{
"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 | tests/test_finvizlite.py | andr3w321/finvizlite |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.