source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
def load_from_backup():
"""
"""
# TODO
pass
def save_to_backup():
"""
"""
# TODO
pass
if __name__ == "__main__":
pass | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | flask-microservice/api/util/backup_handlers.py | sashaobucina/coronatracker |
from sqlalchemy.orm import Query
from .paginator import Paginator
class BaseQuery(Query):
"""The default query object used for models. This can be subclassed and
replaced for individual models by setting the :attr:`~SQLAlchemy.query_cls`
attribute.
This is a subclass of a standard SQLAlchemy
:cl... | [
{
"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 | sqla_wrapper/base_query.py | ramuta/sqla-wrapper |
import asyncio
async def get_html(url):
print(f"get {url} ing")
# if url == "https://www.asp.net":
# raise Exception("Exception is over")
await asyncio.sleep(2)
return f"<h1>This is a test for {url}</h1>"
def callback_func(task):
print(type(task))
if task.done():
print(f"done... | [
{
"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 | python/5.concurrent/ZCoroutine/z_new_code/2.call_back.py | lotapp/BaseCode |
def is_leap(year):
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
return True
else:
return False
else:
return True
else:
return False
#Defining the function returning the number of days in the specified month
def days_in_month(year, month):
#Testing if the... | [
{
"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 | Day 10/day-10-1-exercise/main.py | Jean-Bi/100DaysOfCodePython |
from random import randrange
from time import time
def bubble_sort(arr):
for i in range(len(arr)):
for j in range(len(arr)-1, i, -1):
if arr[j] < arr[j-1]:
# меняем элементы местами
arr[j], arr[j-1] = arr[j-1], arr[j]
return arr
def opt_bubble_sort(arr):
... | [
{
"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 | 09.py | Michanix/Algorithms-Intro-Course |
import backtrader as bt
from backtrader.indicators import ExponentialMovingAverage as EMA
class Pullbacks(bt.Indicator):
"""
An indicator to detect pullbacks to EMA
Params :
- ema_period : int
EMA period, default is 50
- period : int
Period for pullbacks calcula... | [
{
"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 | bot/models/Indicators/Pullbacks.py | estebanthi/BinanceTradingBotV4 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Default rendering returning a default web page."""
from __future__ import absolut... | [
{
"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 | invenio_previewer/extensions/default.py | invenio-toaster/invenio-previewer |
import re
from .delta import Inf, d_expr_dimension
from .linear import Linear
from .lyndon import to_lyndon_basis
from .util import get_one_item
def word_expr_weight(expr):
return len(get_one_item(expr.items())[0])
def word_expr_max_char(expr):
return max([max(word) for word, _ in expr.items()])
def words_... | [
{
"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 | python/polypy/lib/word_algebra.py | amatveyakin/polykit |
import torch.nn as nn
import torch
import torch.cuda
from onmt.utils.logging import init_logger
class MatrixTree(nn.Module):
"""Implementation of the matrix-tree theorem for computing marginals
of non-projective dependency parsing. This attention layer is used
in the paper "Learning Structured Text Repres... | [
{
"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 | onmt/modules/structured_attention.py | philhchen/OpenNMT-evidential-softmax |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Blob helper functions."""
import numpy as np
# from scipy.misc impo... | [
{
"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 | lib/model/utils/blob.py | K2OKOH/da-faster-RCNN-ChineseComment |
import numpy as np
import sklearn.metrics as sk
SUPPORTED_METRICS = ['accuracy', 'auc', 'rmse']
def error_check(flat_true_values, pred_values):
if len(flat_true_values) != len(pred_values):
raise ValueError("preds and true values need to have same shape")
def accuracy(flat_true_values, pred_values):
... | [
{
"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 | source-py/pyBKT/util/metrics.py | shaoliangliang1996/pyBKT |
from django.db.models.signals import pre_save, post_save
from django.core.signals import request_finished
from django.dispatch import receiver
from .my_singal import action
def pre_save_model(sender, **kwargs):
print(sender)
print(kwargs)
def post_save_func(sender, **kwargs):
# 记个日志
print... | [
{
"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 | t9/__init__.py | whoareyou0401/mytest |
from django.db import models
# Create your models here.
class Product(models.Model):
product_brand = models.CharField(max_length=50)
product_article_code = models.CharField(max_length=20)
product_code= models.IntegerField()
product_name= models.CharField(max_length=150)
product_unit_packaging_number = models.Inte... | [
{
"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 | products/models.py | benoitboyer/DjangoBio |
def is_alpha(c):
result = ord('A') <= ord(c.upper()) <= ord('Z')
return result
def is_ascii(c):
result = 0 <= ord(c) <= 127
return result
def is_ascii_extended(c):
result = 128 <= ord(c) <= 255
return result
| [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return ... | 3 | utils/text/general.py | goztrk/django-htk |
import time
import datetime as datetime
class BusData:
def __init__(self, number, destination, timeLiteral, operator):
self.number = number
self.destination = destination
self.timeLiteral = timeLiteral
self.operator = operator
self.time = prepare_departure_time(timeLiteral)
def prepare_departure... | [
{
"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 | departure/provider/nexus/bus_data_model.py | Woll78/departure-python |
import os.path
import pypandoc
from mkdocs.config import config_options
from mkdocs.plugins import BasePlugin
class BibTexPlugin(BasePlugin):
"""
Allows the use of bibtex in markdown content for MKDocs.
Options:
bib_file (string): path to a single bibtex file for entries, relative to mkdocs.yml.... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | mkdocs_bibtex/plugin.py | alexvoronov/mkdocs-bibtex |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
from django.contrib import admin
from notification.models import MobileDevice
class MobileDeviceAdmin(admin.ModelAdmin):
list_display = ['id', 'user', 'app', 'token', 'device_id', 'active']
list_filter = ['app', '... | [
{
"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 | web/transiq/notification/admin.py | manibhushan05/transiq |
class call_if(object):
def __init__(self, cond):
self.condition = cond
def __call__(self, func):
def inner(*args, **kwargs):
if getattr(args[0], self.condition):
return func(*args, **kwargs)
else:
return None
return inner | [
{
"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 | toast/decorators/__init__.py | joshuaskelly/Toast |
import re
from functools import reduce
def completely_invalid_sum(defs, ticket):
invalid, s = False, 0
for val in ticket:
found = False
for ((x1, x2), (y1, y2)) in defs:
if (x1 <= val <= x2) or (y1 <= val <= y2):
found = True
break
if not fou... | [
{
"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 | Day10-19/16.py | bcongdon/advent_of_code_2020 |
import numpy as np
fwhm_m = 2 * np.sqrt(2 * np.log(2))
def fwhm(sigma):
"""
Get full width at half maximum (FWHM) for a provided sigma /
standard deviation, assuming a Gaussian distribution.
"""
return fwhm_m * sigma
def gaussian(x_mean, x_std, shape):
return np.random.normal(x_mean, x_... | [
{
"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 | setigen/distributions.py | bbrzycki/setigen |
import sqlite3
import requests
from bs4 import BeautifulSoup
from datetime import datetime
conn = None
conn = sqlite3.connect("db/db_scrapper.db")
def showAll():
cur = conn.cursor()
cur.execute("SELECT * FROM LOG_TEST")
rows = cur.fetchall()
for row in rows:
print(row)
... | [
{
"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 | init.py | PabloCBX/Scrapper-Retail-CL |
import torch
from torch.optim.lr_scheduler import MultiStepLR
from theconf import Config as C
def adjust_learning_rate_resnet(optimizer):
"""
Sets the learning rate to the initial LR decayed by 10 on every predefined epochs
Ref: AutoAugment
"""
if C.get()['epoch'] == 90:
return MultiStepL... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | FastAutoAugment/lr_scheduler.py | zherlock030/fast-autoaugment |
from flask import Blueprint, render_template
from macronizer_cores import db
# create error blueprint
errors = Blueprint('errors', __name__)
# SECTION - routes
# NOTE - app_errorhandler() is a method inherited from Blueprint that is equivalent to errorhandler() inherited from flask
@errors.app_errorhandler(404)
def... | [
{
"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 | macronizer_cores/errors/routes.py | triethuynh2301/macronizer-project |
from django.conf import settings
from django.utils import timezone
from datetime import timedelta
from paypal.standard.models import ST_PP_COMPLETED
from paypal.standard.ipn.signals import (
valid_ipn_received,
invalid_ipn_received)
def show_me_the_money(sender, **kwargs):
instance = sender
# if inst... | [
{
"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 | work/jobs/hooks.py | ralphleyga/django-jobportal |
import os
from itertools import count
from pathlib import Path
from typing import cast
from fastapi import FastAPI
from piccolo.columns import Integer, Text
from piccolo.conf.apps import AppConfig, AppRegistry
from piccolo.engine import SQLiteEngine, engine_finder
from piccolo.table import Table
from pytest import fix... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | tests/ext/test_piccolo.py | liu-junyong/fastapi-pagination |
from tortoise import Tortoise
from loguru import logger
from app.core.config import DB_TYPE, DB_USER, DB_PASSWORD, DB_HOST, DB_PORT, DATABASE
DB_URL = f'{DB_TYPE}://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DATABASE}'
async def init():
"""初始化连接"""
logger.info(f'Connecting to database')
await Tortois... | [
{
"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 | app/db/database.py | Huangkai1008/market-admin |
from autoPyTorch.training.base_training import BaseBatchLossComputationTechnique
import numpy as np
from torch.autograd import Variable
import ConfigSpace
import torch
class Mixup(BaseBatchLossComputationTechnique):
def set_up(self, pipeline_config, hyperparameter_config, logger):
super(Mixup, self).set_up... | [
{
"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 | autoPyTorch/training/mixup.py | thomascherickal/Auto-PyTorch |
import sys
sys.path.append("..")
from CGPython import CodeGenerationTransformer
from CGPython.Commands import ModifyMethodCommand
from ast import ClassDef, FunctionDef, Name
class TrueStaticTransformer(CodeGenerationTransformer):
def Transform(self):
def func(cmd:ModifyMethodCommand, name:str):
return cmd.Decora... | [
{
"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 | src/Transformers/TrueStaticTransformer.py | BlackBeard98/Code-Generation |
import cv2
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import img_to_array
class OCR():
def __init__(self):
self.loaded_model = None
self.load_models()
def load_models(self):
self.loaded_model = load_model("digits.h5")
return
def predi... | [
{
"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 | Sudoku Solver/Recognizer.py | Ch-V3nU/Projects |
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
# decorators = [login_required, ]
# @method_decorator(decorators, name='dispatch')
class BenchmarkViewAppCGOne(TemplateView):
template_name = "benchmar... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | smpc_demo_platform/benchmarking/views.py | Safe-DEED/mpc-mock-up |
#!/usr/bin/env python3
import asyncio
import websockets
import json
import random
import time
import numpy as np
URI = "wss://api-proxy.auckland-cer.cloud.edu.au/dynamic_network_graph"
#URI = "ws://api-proxy.auckland-cer.cloud.edu.au:6789"
#URI = "ws://localhost:6789"
SESSION_ID = "STRESS_TEST"
connections = []
asyn... | [
{
"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 | stress_test.py | UoA-eResearch/dynamic_network_graph |
# 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-linkwan/aliyunsdklinkwan/request/v20190301/GetLocalConfigSyncTaskRequest.py | yndu13/aliyun-openapi-python-sdk |
# Copyright 2019, The Emissions API Developers
# https://emissions-api.org
# This software is available under the terms of an MIT license.
# See LICENSE fore more information.
class RESTParamError(ValueError):
"""User-specific exception, used in :func:`~emissionsapi.utils.polygon_to_wkt`.
"""
pass
def b... | [
{
"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 | emissionsapi/utils.py | shaardie/emissions-api |
from . import resource
from botocore.exceptions import ClientError
class Elb(resource.Resource):
METRICS = {
"Latency": "レイテンシー",
"RequestCount": "リクエストカウント",
"HealthyHostCount": "正常EC2数",
"UnHealthyHostCount": "危険EC2数",
"HTTPCode_ELB_4XX": "HTTPレスポンスコード(4xx)",
... | [
{
"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 | backend/models/resource/elb.py | crosspower/naruko |
#!/usr/bin/env python
# -*- coding: utf-8
import os
def has_utility(cmd):
path = os.environ['PATH']
return any(os.access(os.path.join(p, cmd), os.X_OK) for p in path.split(os.pathsep))
def is_macos():
return os.uname()[0] == 'Darwin'
class Driver(object):
arch = "amd64"
@property
def nam... | [
{
"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 | minikube/drivers/common.py | j-boivie/fiaas-deploy-daemon |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
from abc import abstractmethod
from typing import Dict
class Backend:
"""Interface for backend"""
@abstr... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | ads/opctl/backend/base.py | oracle/accelerated-data-science |
"""
---------
loader.py
---------
A minimal code to store data in MongoDB
"""
import csv
import json
from datetime import datetime
from pymongo import MongoClient
def load_orders():
"""Load orders sample data"""
client = MongoClient('localhost', 27017)
orders = client["orders"]
# insert customers da... | [
{
"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 | mongodb/assets/loader.py | Code360In/katacoda-scenarios-34 |
from unittest import TestCase
from Implementations.FastIntegersFromGit import FastIntegersFromGit
from Implementations.helpers.Helper import ListToPolynomial, toNumbers
from Implementations.FasterSubsetSum.RandomizedVariableLayers import RandomizedVariableExponentialLayers
from benchmarks.test_distributions import Dist... | [
{
"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/FasterSubsetSumTests/test_randomizedVariableLayers.py | joakiti/Benchmark-SubsetSums |
import requests
from . import FeedSource, _request_headers
# pylint: disable=no-member
class WorldCoinIndex(FeedSource): # Weighted average from WorldCoinIndex
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.timeout = getattr(self, 'timeout', 15)
if not hasattr... | [
{
"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 | bitshares_pricefeed/sources/worldcoinindex.py | bitshares/nbs-pricefeed |
from abc import abstractmethod
from wai.common.adams.imaging.locateobjects import LocatedObject
from ....core.component import ProcessorComponent
from ....core.stream import ThenFunction, DoneFunction
from ....core.stream.util import RequiresNoFinalisation
from ....domain.image.object_detection import ImageObjectDete... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | src/wai/annotations/isp/coercions/component/_Coercion.py | waikato-ufdl/wai-annotations-core |
import time
import threading
import random
from queue import Queue
from pool_workers import Pool
# Our logic to be performed Asynchronously.
def our_process(a):
t = threading.current_thread()
# just to semulate how mush time this logic is going to take to be done.
time.sleep(random.uniform(0, 3))
print(f'{t.getN... | [
{
"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 | examples/example_1.py | medram/Pool_Workers |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | [
{
"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/unit/test_compat.py | mathiascode/pyinstaller |
import unittest
from CSVReader import CSVReader, class_factory
class MyTestCase(unittest.TestCase):
def setUp(self):
self.csv_reader = CSVReader('/src/Unit Test Addition.csv')
def test_return_data_as_object(self):
num = self.csv_reader.return_data_as_object('number')
self.ass... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/CSVTest.py | cadibemma/Calculator |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis import ... | [
{
"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 | pytorch-frontend/caffe2/python/operator_test/glu_op_test.py | AndreasKaratzas/stonne |
import datetime
import os
from pathlib import Path
import attr
import orjson
from dis_snek.mixins.serialization import DictSerializationMixin
from storage.genius import Genius
from storage.nerf import Nerf
@attr.s(slots=True)
class Container(DictSerializationMixin):
nerf: Nerf = attr.ib(factory=dict, converter=... | [
{
"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 | storage/storage.py | np-overflow/bytehackz-discord-bot |
from scripts.plugin_base import ArtefactPlugin
from scripts.ilapfuncs import logfunc, tsv
from scripts import artifact_report
class AdbHostsPlugin(ArtefactPlugin):
"""
"""
def __init__(self):
super().__init__()
self.author = 'Unknown'
self.author_email = ''
se... | [
{
"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 | scripts/artifacts/adb_hosts.py | JamieSharpe/ALEAPP |
# coding: utf-8
"""
Galaxy 3.2 API (wip)
Galaxy 3.2 API (wip) # noqa: E501
The version of the OpenAPI document: 1.2.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import openapi_client
from openapi_client.models.tags_page import TagsPage... | [
{
"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 | client_apis/python/test/test_tags_page.py | alikins/galaxy-api-swaggerhub |
from cms import models
def test_create_no_media(db):
"""
Test creating an info panel.
"""
models.InfoPanel.objects.create(
text="The quick brown fox jumped over the lazy dog.", title="No Media"
)
def test_ordering(info_panel_factory):
"""
Panels should be ordered by their ``order... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | darksite/cms/test/models/test_info_panel_model.py | UNCDarkside/DarksiteAPI |
#!python3
#encoding:utf-8
from abc import ABCMeta, abstractmethod
import AGitHubUser
import BasicAuthenticationUser
class TwoFactorAuthenticationUser(BasicAuthenticationUser.BasicAuthenticationUser):
def __init__(self, username, password, secret):
super().__init__(username, password)
self.__secret =... | [
{
"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 | TwoFactorAuthenticationUser.py | ytyaru/GitHubUser.201704101437 |
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core Developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test dclrcoind aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delete 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | test/functional/feature_abortnode.py | DclrCoin/dclrcoin |
from django.test import TestCase
from .models import Editor,Pics,tags,Category,Location
class EditorTestClass(TestCase):
# Set up method
def setUp(self):
self.james = Editor(first_name = 'James', last_name ='Muriuki', email ='james@moringaschool.com')
# Testing instance
def test_instance(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 | pics/tests.py | AmosMwangi/bavilion |
# Scraper for California's First District Court of Appeal
# CourtID: calctapp_1st
# Court Short Name: Cal. Ct. App.
from juriscraper.opinions.united_states.state import cal
class Site(cal.Site):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.court_id = self.... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | juriscraper/opinions/united_states/state/calctapp_1st.py | EvandoBlanco/juriscraper |
def solution(number): # O(N)
"""
Write a function to compute the fibonacci sequence value to the requested iteration.
>>> solution(3)
2
>>> solution(10)
55
>>> solution(20)
6765
"""
m = {
0: 0,
1: 1
} ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | python/recursion/fibonacci.py | suddi/coding-challenges |
from __future__ import print_function
import pytest
import six
import sys
from abc import ABCMeta, abstractmethod
from inspect import isabstract
class Foo(object):
pass
class Abstract:
__metaclass__ = ABCMeta
@abstractmethod
def foo(self):
pass
@six.add_metaclass(ABCMeta)
class AbstractSi... | [
{
"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 | python/test_abstract_2.py | berquist/eg |
from tests.integration.util import (
create_client,
CREDENTIALS,
SANDBOX_INSTITUTION,
)
access_token = None
def setup_module(module):
client = create_client()
response = client.Item.create(
CREDENTIALS, SANDBOX_INSTITUTION, ['identity'])
global access_token
access_token = response... | [
{
"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/integration/test_identity.py | mattiskan/plaid-python |
class ClassE:
def __init__(self):
"""
This is ClassE, a class whose constructor has
no keyword arguments and which has a class
method with no keyword args
"""
pass
@classmethod
def from_string(cls):
return cls()
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | integration_tests/test-packages/python/testpkguno/testpkguno/ClassE.py | franklinen/doppel-cli |
from typing import Tuple
import pytest
from flake8_annotations.error_codes import Error
from testing.helpers import check_is_empty, check_is_not_empty, check_source
from testing.test_cases.overload_decorator_test_cases import (
OverloadDecoratorTestCase,
overload_decorator_test_cases,
)
class TestOverloadDe... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | testing/test_overload_decorator.py | python-discord/flake8-annotations |
"""
Read from the MLB Gameday API.
Base URL: https://statsapi.mlb.com/docs/#operation/stats
Hitter stat URL: https://statsapi.mlb.com/api/v1/stats?stats=season&group=hitting
"""
from typing import Dict, List
from schema.player import Player
from schema.team import Team
import requests
import utils
def get_top_hitt... | [
{
"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 | mlb-ml/api/gameday_api_handler.py | alhart2015/mlb-ml |
from .models import Shop
import logging
import requests
import time
logger = logging.getLogger('storelocator')
def update_shops():
limit = 2500
for shop in Shop.objects.filter(latitude=None, longitude=None)[:limit]:
location = "%s %s %s" % (shop.city, shop.postalcode, shop.street)
try:
... | [
{
"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 | storelocator/updaters/google.py | moccu/django-storelocator |
import itertools
import random
import networkx as nx
import sys
import pandas as pd
sys.setrecursionlimit(2000)
def prettyGenome(arr):
return '(' + ' '.join('{0:+d}'.format(_) for _ in arr) + ')'
def GreedySorting(genome):
length = len(genome)
res = []
for i in range(1, length+1):
try:
... | [
{
"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 | solutions/ba6a.py | RafikFarhad/Bioinformatics_Codes |
#!usr/bin/emv python3
# -*- coding: utf-8 -*-
# metaclass是创建类,所以必须从`type`类型派生
class ListMetaclass(type):
def __new__(cls, name, bases, attrs):
attrs['add'] = lambda self, value: self.append(value)
return type.__new__(cls, name, bases, attrs)
# 指示使用ListMetaclass来定制类
class MyList(list, metaclass=Lis... | [
{
"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 | py_codes/037metaclass.py | fusugz/lifeisshort |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | [
{
"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 | scripts/linters/test_files/invalid_python_three.py | yash10019coder/oppia |
import os
from minifw import config_default
class Dict(dict):
def __init__(self, names=(), values=(), **kwargs):
super().__init__(**kwargs)
for k, v in zip(names, values):
self[k] = v
def __getattr__(self, key):
try:
return self[key]
except KeyError:
... | [
{
"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 | minifw/config.py | ResolveWang/minifw |
import numpy as np
def random(texture, num):
# idx = np.random.choice(texture.shape[0], num, replace=False) # 乱数を抽出するときに重複を許さない場合(ただし、サンプル数が少ないとエラーになりやすい)
idx = np.random.choice(texture.shape[0], num) # 乱数を抽出するときに重複を許す場合(ただし、サンプル数が少ない時でも安定)
return texture[idx]
def stat(texture, num):
pass
... | [
{
"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 | extract.py | akusumoto/sample_dash |
from typing import Dict, Optional
from ciphey.iface import Checker, Config, ParamSpec, registry
@registry.register
class HumanChecker(Checker[str]):
@staticmethod
def getParams() -> Optional[Dict[str, ParamSpec]]:
pass
def check(self, text: str) -> Optional[str]:
with self._config().paus... | [
{
"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 | ciphey/basemods/Checkers/human.py | blackcat-917/Ciphey |
from http import HTTPStatus
from src.app.post.enum import PostStatus
from src.app.post.model import PostModel
from src.common.authorization import Authorizer
from src.common.decorator import api_response
from src.common.exceptions import (ExceptionHandler, ItemNotFoundException)
class GetService(object):
def __i... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/app/post/get.py | Thiqah-Lab/aws-serverless-skeleton |
import pytest
from peer_lending.users.models import User
from peer_lending.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | peer_lending/conftest.py | jamesreinhold/peerlending_starter |
from idunn.blocks.services_and_information import InternetAccessBlock
def test_internet_access_block():
internet_access_block = InternetAccessBlock.from_es({"properties": {"wifi": "no"}}, lang="en")
assert internet_access_block is None
def test_internet_access_block_ok():
internet_access_block = Interne... | [
{
"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_internet_access.py | QwantResearch/idunn |
from flask import Flask, render_template, url_for, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
app.config['SQLALCHEMY_TRACK MODIFICATIONS'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
class User(db.Model):
id = db.Column(db.Integer, primar... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | app.py | PrateekBing/fake-instagram-page |
from conftest import run_validator_for_test_file
def test_always_ok_for_empty_file():
errors = run_validator_for_test_file('empty.py')
assert not errors
errors = run_validator_for_test_file('empty.py', max_annotations_complexity=1)
assert not errors
def test_ok_for_unannotated_file():
errors = r... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_annotations_complexity.py | michael-k/flake8-annotations-complexity |
from . import GIT
from . import functions
from . import root
from pathlib import Path
import datetime
import os
NONE, STAGED, CHANGED, UNTRACKED = 'none', 'staged', 'changed', 'untracked'
PREFIX = '_gitz_'
SAVE_FILE = Path('._gitz_save_.txt')
@root.run_in_root
def save(untracked=False, stash=True):
timestamp = d... | [
{
"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 | gitz/git/save.py | rec/gitz |
"""
exceptions
Created by: Martin Sicho
On: 7/23/20, 10:08 AM
"""
import json
import traceback
class GenUIException(Exception):
def __init__(self, original, *args, **kwargs):
super().__init__(*args)
self.original = original
def getData(self):
return ''
def __repr__(self):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | src/genui/utils/exceptions.py | Tontolda/genui |
"""
Code originates from: https://machinelearningmastery.com/a-gentle-introduction-to-normality-tests-in-python/
"""
from scipy.stats import shapiro, normaltest, anderson
"""
Shapiro-Wilk Test of Normality
The Shapiro-Wilk Test is more appropriate for small sample sizes (< 50 samples), but can also handle sample siz... | [
{
"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 | backend/stat/normality_tests.py | Julian-Theis/stat-kiste |
import os
import time
from multiprocessing import Pool # 首字母大写
def test(name):
print("[子进程-%s]PID=%d,PPID=%d" % (name, os.getpid(), os.getppid()))
time.sleep(1)
def main():
print("[父进程]PID=%d,PPID=%d" % (os.getpid(), os.getppid()))
p = Pool(5) # 设置最多5个进程(不设置就是CPU核数)
for i in range(10):
... | [
{
"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 | python/5.concurrent/PythonProcess/1.Process_Pool_SubProcess/2.pool.py | dunitian/BaseCode |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
__copyright__ = ('Copyright Amazon.com, Inc. or its affiliates. '
'All Rights Reserved.')
__version__ = '2.6.0'
__license__ = 'MIT-0'
__author__ = 'Akihiro Nakajima'
__url__ = 'https://github.com/aws-s... | [
{
"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 | source/lambda/es_loader/siem/fileformat_csv.py | acsrujan/siem-on-amazon-opensearch-service |
import unittest
import os
import json
from app import *
class RegApiTest(unittest.TestCase):
def setUp(self):
self.app = api.app
self.client = self.app.test_client
def test_start(self):
result = self.client().post('/')
self.assertEqual(result.status_code, 200)
prin... | [
{
"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 | test_api.py | sushmaakoju/regression-api |
from unittest import TestCase
from unittest.mock import patch
from django_mock_queries.query import MockModel
from bson import ObjectId
from mlplaygrounds.datasets.serializers.models import MLModelLiteSerializer
class TestMLModelLiteSerializer(TestCase):
def setUp(self):
self.valid_instance = MockModel... | [
{
"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 | mlplaygrounds/datasets/tests/test_serializers/test_mlmodel_lite_serializer.py | rennym19/ml-playgrounds |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s:%s" % (self.id, self.name)
def __eq__(self, other):
... | [
{
"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 | model/group_data.py | AlexeyKozlov/python_training-master |
#!/usr/bin/env python
#
# Copyright (c) 2018 Alexandru Catrina <alex@codeissues.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ri... | [
{
"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 | python3/hap/log.py | lexndru/hap |
import numpy as np
import pandas as pd
import copy
import re
class PreProcess(object):
def __init__(self):
self.df = None
def _standardize_string(self, a_str):
"""Replace whitespace with underscore
remove non-alphanumeric characters
"""
if isinstance(a_str, str) or... | [
{
"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/DoorDash/src/process.py | zhouwubai/kaggle |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
author: Chris Brasnett, University of Bristol, christopher.brasnett@bristol.ac.uk
"""
import numpy as np
from QIIDderivative import derivative
def nominator(F_x, F_y, F_z, F_xx, F_xy, F_yy, F_yz, F_zz, F_xz):
m = np.array([[F_xx, F_xy, F_xz, F_x],
... | [
{
"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 | QIIDcurvature.py | csbrasnett/lipid-md |
from handler.handler import Handler
from handler.char_handler import CharHandler
from handler.dot_handler import DotHandler
from handler.star_handler import StarHandler
from handler.abstract_handler import AbstractHandler
from match import Match
def make_pattern():
head = CharHandler()
c = CharHandler()
d... | [
{
"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 | client.py | melrick8196/string-matcher |
# auth0login/auth0backend.py
from urllib import request
from jose import jwt
from social_core.backends.oauth import BaseOAuth2
from accounts.models import UserProfile
class Auth0(BaseOAuth2):
"""Auth0 OAuth authentication backend"""
name = 'auth0'
SCOPE_SEPARATOR = ' '
ACCESS_TOKEN_METHOD = 'POST'
... | [
{
"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 | auth0login/auth0backend.py | chop-dbhi/biorepo-portal |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# filters.py
#
# Authors:
# - Mamadou CISSE <mciissee.@gmail.com>
#
from django.contrib.auth import get_user_model
from django_filters import rest_framework as filters
from django.db.models import Q
User = get_user_model()
class UserFilter(filters.FilterSet):... | [
{
"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 | apps/pl_users/filters.py | PremierLangage/platon_assets |
import os
import time
from Data.parameters import Data
from filenames import file_extention
from get_dir import pwd
from reuse_func import GetData
class BlockwiseCsv():
def __init__(self, driver, year, month):
self.driver = driver
self.year = year.strip()
self.month = month.strip()
... | [
{
"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/src/Teacher_Attendance/download_blockwise_csv.py | sreenivas8084/cQube |
from more.jinja2 import Jinja2App
class App(Jinja2App):
pass
@App.path(path="persons/{name}")
class Person:
def __init__(self, name):
self.name = name
@App.template_directory()
def get_template_dir():
return "templates"
@App.html(model=Person, template="person_inherit.jinja2")
def person_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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | more/jinja2/tests/fixtures/override_template_inheritance.py | sgaist/more.jinja2 |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.ext.db import djangoforms
from google.appengine.api import users
import hfwwgDB
class SightingForm(djangoforms.M... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | hfpy_code/chapter10/page372.py | leobarros/use_cabeca_python |
# delwin 2016
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from allauth.account.signals import user_logged_in, user_signed_up
import stripe
stripe.api_key = settings.STRIPE_SECRET_KEY
# Create your models here.
class profile(models.Model):
name = models.CharF... | [
{
"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 | MODELS/sih/models.py | mladenangel/myprojects |
import pickle
def save_obj(obj, name ):
with open( name + '.pkl', 'wb') as f:
pickle.dump(obj, f, protocol=2)
def load_obj(name ):
with open( name + '.pkl', 'rb') as f:
return pickle.load(f)
acro = load_obj("acronymsDict")
# Spit out
# for a in acro.keys():
# print(a + " : " + acro[a])
ac... | [
{
"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 | models/models_code/Acronyms/Clean.py | tpsatish95/SocialTextFilter |
# Helper class that stores all relevant information of a document
class document:
def __init__(self, id, externalid=0, title="", author="", publishingYear=0, journal="", terms=[], uri="" ):
self.id = id
self.externalid = externalid
self.title = title
self.author = author
sel... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | src/DocClustering/data/document.py | jd-s/DocClustering |
#!/usr/bin/env python
# Copyright (c) 2021, Farid Rashidi Mehrabadi All rights reserved.
# ======================================================================================
# Author : Farid Rashidi Mehrabadi (farid.rashidimehrabadi@nih.gov)
# Last Update: Aug 14, 2020
# Description: cleaning
# ==============... | [
{
"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 | trisicell/commands/mcalling/z01status.py | faridrashidi/trisicell |
import torch
from mmdet3d.models.builder import build_voxel_encoder
def test_pillar_feature_net():
pillar_feature_net_cfg = dict(
type='PillarFeatureNet',
in_channels=5,
feat_channels=[64],
with_distance=False,
voxel_size=(0.2, 0.2, 8),
point_cloud_range=(-51.2, -5... | [
{
"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_voxel_encoders.py | BB88Lee/mmdetection3d |
#!/usr/bin/env python3
import sys
from collections import defaultdict
def other(pair, x): return pair[0] if x == pair[1] else pair[1]
def search(m, avail, cur):
top = 0
for choice in m[cur]:
if choice not in avail: continue
avail.remove(choice)
val = search(m, avail, other(choice, cur... | [
{
"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 | 2017/24a.py | msullivan/advent-of-code |
import sqlite3
import pandas as pd
conn = sqlite3.connect('demo_data.sqlite3')
curs = conn.cursor()
create_demo_table = """
CREATE TABLE demo (
s varchar(5),
x int,
y int
);"""
curs.execute(create_demo_table)
conn.commit()
curs.execute("""INSERT INTO demo (
s, x, y) VALUES""" + str(('g', 3, 9)))
co... | [
{
"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 | demo_data.py | krsmith/DS-Unit-3-Sprint-2-SQL-and-Databases |
from datetime import datetime
import unittest
from unittest.mock import MagicMock
import numpy as np
from pyhsi.cameras import BaslerCamera
class MockGrab:
def __init__(self, data):
self.Array = data
def GrabSucceeded(self):
return True
def Release(self):
pass
class TestBasle... | [
{
"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 | test/test_cameras.py | rddunphy/pyHSI |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The CounosH Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC commands for signing and verifying messages."""
from test_framework.test_framework import Cou... | [
{
"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/functional/rpc_signmessage.py | CounosH/cch |
class RSVPRouter(object):
"""
A router to control all database operations on models in the
rsvp application.
"""
apps = ["rsvp"]
using = "rsvp_db"
def db_for_read(self, model, **hints):
if model._meta.app_label in self.apps:
return self.using
return None
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | kyleandemily/rsvp/db_router.py | ehayne/KyleAndEmily |
import random, copy
import cv2 as cv
from .augmenter import Augmenter
class Rotator(Augmenter):
'''
Augmenter that rotates the SampleImages randomly based on
the min_angle and max_angle parameters.
'''
def __init__(
self,
min_angle,
max_angle,
**kwargs
):
super().__init__(**kwargs)
... | [
{
"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 | jakso_ml/training_data/rotator.py | JaksoSoftware/jakso-ml |
import numpy as np
import time
import cv2
import mss
def shot(height, width):
with mss.mss() as sct:
img = np.array(
sct.grab(
{'top': 0,
'left': 0,
'width': width,
'height': height}
)
)[:, :, :3]
... | [
{
"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 | utils/record_screen.py | Sindy98/spc2 |
#Perform Edge Detection using Roberts Cross Gradient & Sobel Operators over an Image
import cv2
import math
import numpy as np
def robertCrossGradient(image):
#Objective: Performing Robert Cross Gradient Edge Detection over an Image
#Input: Original Image
#Output: Resultant Image
#Robert Cross Operator
# x 0 ... | [
{
"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 | edgeDetection.py | krishna1401/Digital-Image-Processing |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.