source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from .base_trainer import BaseTrainer
from .. import accuracy_evaluator
class FineTuner(BaseTrainer):
def __init__(self, *args, **kwargs):
super(FineTuner, self).__init__(*args, **kwargs)
def single_epoch_compute(self, model, x, y, mask):
self.optimizer.zero_grad()
output = ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | nnutils/training_pipeline/trainers/finetuner.py | rexxy-sasori/nnutils |
from PyQt5.QtWidgets import QLabel
from Parents import Button, PathImage
class OsrPath(PathImage):
def __init__(self, parent):
super(OsrPath, self).__init__(parent)
self.default_x = 544
self.default_y = 165
self.default_size = 4.5
self.img = "res/OsrPath.png"
self.img_shadow = "res/OsrPath_Shadow.png"... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | HomeComponents/PathImage.py | Snake-GGJJWP/osr2mp4-app |
import invoke
from pathlib import Path
PACKAGE = "src"
REQUIRED_COVERAGE = 90
BASE_DIR = Path(__file__).resolve().parent
@invoke.task(name="format")
def format_(arg):
autoflake = "autoflake -i --recursive --remove-all-unused-imports --remove-duplicate-keys --remove-unused-variables"
arg.run(f"{autoflake} {... | [
{
"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 | tasks.py | brainfukk/fiuread |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from markup.models import *
class InlineProfile(admin.StackedInline):
model = Profile
verbose_name = 'Profile'
verbose_name_plural = 'Profiles'
can_delete = False
class InlineFolders(admin.StackedInline):
model = Al... | [
{
"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 | markup/admin.py | vmun/SkyMed_Labeling |
from python_framework import SchedulerType
from python_framework import Scheduler, SchedulerMethod, WeekDay, WeekDayConstant
@Scheduler(muteLogs=True)
class EmissionScheduler:
@SchedulerMethod(SchedulerType.INTERVAL, seconds=1, instancesUpTo=5)
def updateAllModifiedFromMemory(self) :
self.service.em... | [
{
"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 | api/src/scheduler/EmissionScheduler.py | SamuelJansen/queue-manager-api |
from __future__ import absolute_import
import ctypes
from .._base import _LIB
from .. import ndarray as _nd
def max_pooling2d(in_arr, kernel_H, kernel_W, pooled_layer, padding=0, stride=1, stream=None):
assert isinstance(in_arr, _nd.NDArray)
assert isinstance(pooled_layer, _nd.NDArray)
_LIB.DLGpuMax_Pool... | [
{
"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/hetu/gpu_links/MaxPoolLink.py | initzhang/Hetu |
from django.db import models
class Event(models.Model):
name = models.CharField(max_length=255)
date = models.DateField()
description = models.CharField(max_length=255)
class EventRepo:
@staticmethod
def list():
return Event.objects.all()
@staticmethod
def get(id):
retur... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | event/models.py | SimonCockx/entity |
import database
def load_shard_from_db(conf):
#TODO: load shard from cache if exists
shards = database.load_shard(conf)
return shards
def get_shard(shards, url):
"""
Hash function for shading scheme
returns a dict with hostname and table name
Eg: s = { 'hostname': 'node1', 'table_name'... | [
{
"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 | yama/shard.py | vitovitolo/yama |
from abc import ABCMeta, abstractmethod
import numpy as np
from typing import Callable, Dict, List
from ..core.position import Position
from .route import Route
class BaseRouter(metaclass=ABCMeta):
@abstractmethod
def map_match(self, position: Position) -> Position:
return NotImplemented
@abstrac... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | simobility/routers/base_router.py | yabirgb/simobility |
# The code here is based on the code at
# https://github.com/gpleiss/temperature_scaling/blob/master/temperature_scaling.py
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.autograd import Variable
import numpy as np
def logits_from_probs(prob_arr):
return np.log(prob_arr)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | experiments/uncertainty/temp_scaling.py | probabilisticdeeplearning/swa_gaussian |
import cherrypy
import datetime
import logging
from girder import auditLogger
from girder.models.model_base import Model
from girder.api.rest import getCurrentUser
class Record(Model):
def initialize(self):
self.name = 'audit_log_record'
def validate(self, doc):
return doc
class _AuditLogDa... | [
{
"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 | plugins/audit_logs/server/__init__.py | data-exp-lab/girder |
import asyncio
import os
from pstats import Stats
from tempfile import NamedTemporaryFile
from aiomisc.service.profiler import Profiler
async def test_profiler_start_stop():
profiler = Profiler(interval=0.1, top_results=10)
try:
await profiler.start()
await asyncio.sleep(0.5)
finally:
... | [
{
"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 | tests/test_profiler.py | MrPainter/aiomisc |
import numpy as np
import itertools
from panda3d.core import Point3, BoundingBox
from citysim3d.envs import SimpleQuadPanda3dEnv
from citysim3d.spaces import BoxSpace
class Bbox3dSimpleQuadPanda3dEnv(SimpleQuadPanda3dEnv):
def __init__(self, *args, **kwargs):
super(Bbox3dSimpleQuadPanda3dEnv, self).__init... | [
{
"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 | citysim3d/envs/bbox3d_quad_panda3d_env.py | alexlee-gk/citysim3d |
"""circle module: contains the Circle class."""
class Circle:
"""circle class"""
all_circles= []
pit= 3.14159
def __init__(self, r=1):
"""create a circle with the given radius"""
self.radius=r
self.__class__.all_circles.append(self)
def area(self):
""" determine the area of the cirle"""
return self.... | [
{
"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 | course2/session2/class.py | artopping/nyu-python |
from django.db import models
from datetime import datetime, timedelta
from Client.models import Client
class OffersHistory(models.Model):
date_time_generated = models.DateTimeField(auto_now_add=True)
date_time_expire = models.DateTimeField(null=False, blank=False)
is_expired = models.BooleanField(default=... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | MarketPlace_api/Offers/models.py | giovani-dev/Marketplace-api |
import pytest
from chapter1 import zerofy as t
def test_zerofy():
expected = [[1, 0, 1], [0, 0, 0], [1, 0, 1]]
actual = t.zerofy([[1, 1, 1], [1, 0, 1], [1, 1, 1]])
for y in range(len(expected)):
for x in range(len(expected[0])):
assert expected[y][x] == actual[y][x]
expected = [[0, 0, 0], [0, 1, 1],... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | cracking-the-coding-interview/tests/chapter1/test_zerofy.py | silphire/training-with-books |
from django.shortcuts import render, get_object_or_404
from .models import Category, Product
from cart.forms import CartAddProductForm
from django.views.generic import (
ListView,
DetailView
)
'''
class ProductListView(ListView):
template_name = 'shop/product/list.html'
queryset = Product.objects.all(... | [
{
"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 | shop/views.py | Honormmm/shop |
import logging
from .Container import Container
class MqttBrokerContainer(Container):
def __init__(self, name, vols, network, image_store, command=None):
super().__init__(name, 'mqtt-broker', vols, network, image_store, command)
def get_startup_finished_log_entry(self):
return "mosquitto vers... | [
{
"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 | docker/test/integration/minifi/core/MqttBrokerContainer.py | rustammendel/nifi-minifi-cpp |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, masonarmani38@gmail.com and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
class WorkOrder(Document):
pass... | [
{
"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 | tools_box/tools_box/doctype/work_order/work_order.py | maisonarmani/Tools-Box |
"""
function for analyzing molecules
"""
from .measure import calculate_distance
from .atom_data import atomic_weights
def build_bond_list(coordinates, max_bond=1.5, min_bond=0):
# Find the bonds in a molecule (set of coordinates) based on distance criteria.
bonds = {}
num_atoms = len(coordinates)
... | [
{
"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 | molecool/molecule.py | mmim2904/molecool |
# Copyright (c) 2019 Platform9 Systems 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 agreed ... | [
{
"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 | hamgr/hamgr/db/versions/001_add_initial_tables.py | platform9/pf9-ha |
# -*- coding: UTF-8 -*-
from pp.store import redis
from pp.search import search_url
from flask import Flask, Response, render_template, request, redirect, abort
from flask.ext.assets import Environment, Bundle
from flask.ext.misaka import Misaka
from flask.ext.cache import Cache
from htmlmin.minify import html_minify
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | app.py | bfontaine/web-pp |
import requests
from time import sleep
import random
from multiprocessing import Process
import boto3
import json
import sqlalchemy
random.seed(100)
class AWSDBConnector:
def __init__(self):
self.HOST = "pinterestdbreadonly.cq2e8zno855e.eu-west-1.rds.amazonaws.com"
self.USER =... | [
{
"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 | User_Emulation/user_posting_emulation.py | VBamgbaye/Pintrest_project |
from .... pyaz_utils import _call_az
def show(resource_group, server):
'''
Gets a server's secure connection policy.
Required Parameters:
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
- server -- Name of the Azure SQL s... | [
{
"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 | pyaz/sql/server/conn_policy/__init__.py | py-az-cli/py-az-cli |
import unittest
from .testHelpers import get_cpp_function_list
class TestCommentOptions(unittest.TestCase):
def test_function_with_comment_option_should_be_forgiven(self):
function_list = get_cpp_function_list("void foo(){/* #lizard forgives*/}")
self.assertEqual(0, len(function_list))
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 | test/testCommentOptions.py | apiiro/lizard |
#
# Copyright (c) 2018 Stefan Seefeld
# All rights reserved.
#
# This file is part of Faber. It is made available under the
# Boost Software License, Version 1.0.
# (Consult LICENSE or http://www.boost.org/LICENSE_1_0.txt)
from ..action import action
from ..feature import set
from ..tool import tool
from .xslt import ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/faber/tools/boost.py | drmoose/faber |
#!/usr/bin/env python
# Copied from fftpack.helper by Pearu Peterson, October 2005
""" Test functions for fftpack.helper module
"""
from numpy.testing import *
from numpy.fft import fftshift,ifftshift,fftfreq
from numpy import pi
def random(size):
return rand(*size)
class TestFFTShift(TestCase):
def test_de... | [
{
"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 | numpy/fft/tests/test_helper.py | enthought/numpy-refactor |
class CustomArgs(object):
pass
_args = CustomArgs()
def get_global_args():
global _args
return _args
def set_global_arg(arg, value):
global _args
setattr(_args, arg,value)
def set_global_args(args):
for k,v in args.items():
set_global_arg(k, v)
def set_dry_run():
set_global_arg(... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | lib/args_helper.py | wxw-matt/rails_on_docker |
from __future__ import annotations
from typing import Callable, Dict, TYPE_CHECKING
if TYPE_CHECKING:
# pylint: disable=cyclic-import
from tarkov.trader.models import TraderType
from tarkov.trader.trader import Trader
class TraderManager:
def __init__(self, trader_factory: Callable[..., Trader]) -> ... | [
{
"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 | tarkov/trader/manager.py | JustEmuTarkov/jet_py |
import pytest
from uzi.markers import ProSlice as Predicate
xfail = pytest.mark.xfail
parametrize = pytest.mark.parametrize
@pytest.fixture
def cls():
return Predicate
from .cases import *
_T_New = T_New[Predicate]
def test_pro_entries(new_predicate: _T_New, MockProPredicate: _T_New, MockContainer):
p... | [
{
"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 | tests/predicates/slice_predicate_tests.py | laza-toolkit/di |
# 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": "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 | apps/deploy_tflite_cpp/build_input.py | DzAvril/tvm |
from django.core.paginator import Paginator
from django.shortcuts import render
from django.http import HttpResponse
from .models import Branch, Category
from songs.models import Song
from artists.models import Artist
# Create your views here.
def category_index(request):
categories = Category.objects.all()
re... | [
{
"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 | categories/views.py | Damillora/Altessimo |
import os
import cherrypy
from girder.exceptions import ValidationException
from girder.models.assetstore import Assetstore
from girder.models.setting import Setting
from girder.models.user import User
cherrypy.config["database"]["uri"] = os.getenv("GIRDER_MONGO_URI")
ADMIN_USER = os.getenv("GIRDER_ADMIN_USER", "adm... | [
{
"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 | docker/server_setup.py | maxpark/dive |
import unittest
from facial_recog.app import *
from .test_config import test_run_count, seed, success_perc
from .test_util import *
class TestFR(unittest.TestCase):
subject_names = dict()
subject_classes = dict()
def setUp(self):
random.seed(seed)
create_app_dirs()
setup_logger(... | [
{
"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 | facial_recog/tests/test_app.py | MePsyDuck/amfr |
import pickle
from src.probabilistic_models.grammar_utils import score, update
from math import log
from decimal import Decimal
def probabilistic_model_guesses(password):
scores = pickle.load(open("scores.p", "rb"))
(cb_counter, Q) = pickle.load(open("cb_dictionary.p", "rb"))
(sb_counter, B) = pickle.load(... | [
{
"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/probabilistic_models/probabilistic_model.py | pfreifer/zxcvbn |
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.71
Contact: support@ory.sh
Generated by: htt... | [
{
"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 | clients/client/python/test/test_submit_self_service_settings_flow_with_lookup_method_body.py | sproutfi/sdk |
# !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:8/31/2021 2:50 PM
# @File:SpaceToDepthModuleConv
import torch
import torch.nn as nn
class SpaceToDepth(nn.Module):
def __init__(self, block_size=4):
super().__init__()
assert block_size == 4
self.bs = block_size
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
},... | 3 | python_developer_tools/cv/bases/input_conv/space_to_depth.py | carlsummer/python_developer_tools |
# -*- coding: utf-8 -*-
import click
from jira import JIRA, JIRAError
from jirainfo.helpers import printJiraErrorAndExit, printErrorMsg
class JiraHelper(object):
def __init__(self, host, user="", password=""):
self.host = host
self.user = user
self.password = password
try:
... | [
{
"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 | jirainfo/jirahelper.py | hypebeast/jira-info |
from os import path
from blazeutils import prependsitedir
from blazeweb.application import WSGIApp
from blazeweb.middleware import full_wsgi_stack
from minimal2.config import settings as settingsmod
from blazeweb.scripting import application_entry
# make sure our base module gets put on the path
try:
import minima... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | tests/apps/minimal2/application.py | blazelibs/blazeweb |
from graphql.schema import GraphQlFuncDescriptor
class GraphQlRootMutationObject(object):
"""The root mutation object for GraphQL.
This is the object whose fields we "query" at the root level of a
GraphQL mutation operation.
"""
# The singleton instance of GraphQlRootMutationObject, or None if w... | [
{
"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 | src/graphql/executor/root_mutation_object.py | btrekkie/graphql |
import builtins
from functools import lru_cache
from types import ModuleType, FunctionType, BuiltinFunctionType
from typing import Iterable
import torch
from .funcs import *
from .funcs import __all__ as _funcs_all
from .funcs.base import get_func_from_torch
from .size import *
from .size import __all__ as _size_all
... | [
{
"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 | treetensor/torch/__init__.py | opendilab/DI-treetensor |
import os
import shutil
import tempfile
from unittest import TestCase, mock
from collectors import brew
DEPS = b'''
a:
b: c
c: d
d:
f:
g:
'''
PACKAGE_INFO = b'''
ffmpeg: stable 3.4.2 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/3.4.2 (248 files, 51.... | [
{
"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 | tests/collectors/brew_test.py | ecleya/autodot |
import info
class subinfo(info.infoclass):
def setDependencies(self):
self.runtimeDependencies["virtual/base"] = None
self.runtimeDependencies["libs/qt5/qtbase"] = None
self.runtimeDependencies["libs/openssl"] = None
self.runtimeDependencies["libs/cyrus-sasl"] = None
def setTa... | [
{
"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 | kdesupport/qca/qca.py | KDE/craft-blueprints-kde |
import base64
import json
import falcon
import numpy as np
from io import BytesIO
from PIL import Image, ImageOps
def convert_image(image):
img = Image.open(image).convert('L')
inverted_img = ImageOps.invert(img)
data = np.asarray(inverted_img, dtype='int32')
rescaled_data = (data / 255).reshape(1, 28... | [
{
"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 | src/prediction_app/predict.py | datitran/falcon-prediction-app |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | [
{
"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 | openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tabs.py | dreamhost/horizon |
#!/usr/bin/env python
import torch
import torch.nn as nn
from colossalai.nn import CheckpointModule
from .utils.dummy_data_generator import DummyDataGenerator
from .registry import non_distributed_component_funcs
class NetWithRepeatedlyComputedLayers(CheckpointModule):
"""
This model is to test with layers w... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": f... | 3 | tests/components_to_test/repeated_computed_layer.py | RichardoLuo/ColossalAI |
from algorithms.graphs import prepare_undirect_graph, prepare_direct_graph
from algorithms.graphs.dfs import dfs_iterative
class TestDFSIterative:
def test_direct_graph(self):
edges = [(0, 1), (0, 2), (1, 2), (2, 0), (2, 3), (3, 3)]
graph = prepare_direct_graph(edges)
assert [2, 3, 0, 1] =... | [
{
"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 | tests/graph/test_dfs.py | mchao409/python-algorithms |
from chainerui.models.log import Log
def get_test_json():
return [
{
"loss": 100,
"epoch": 1,
},
{
"loss": 90,
"epoch": 2,
}
]
def test_log_serialize_numbers():
json_data = get_test_json()
logs = [Log(data) for data in j... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/models_tests/test_log.py | chainer/chainerui |
"""test utilities
(part of web.py)
"""
import unittest
import sys, os
import web
TestCase = unittest.TestCase
TestSuite = unittest.TestSuite
def load_modules(names):
return [__import__(name, None, None, "x") for name in names]
def module_suite(module, classnames=None):
"""Makes a suite from a module."""
... | [
{
"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 | webpy/src/web/test.py | minixalpha/SourceLearning |
#!/usr/bin/env python
"""
_LoadFromFilesetWorkflow_
MySQL implementation of Subscription.LoadFromFilesetWorkflow
"""
__all__ = []
from WMCore.Database.DBFormatter import DBFormatter
class LoadFromFilesetWorkflow(DBFormatter):
sql = """SELECT wmbs_subscription.id, fileset, workflow, split_algo,
... | [
{
"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 | src/python/WMCore/WMBS/MySQL/Subscriptions/LoadFromFilesetWorkflow.py | khurtado/WMCore |
def concat_multiples(num, multiples):
return int("".join([str(num*multiple) for multiple in range(1,multiples+1)]))
def is_pandigital(num):
return sorted([int(digit) for digit in str(num)]) == list(range(1,10))
def solve_p038():
# retrieve only 9 digit concatinations of multiples where n = (1,2,..n)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | p038.py | piohhmy/euler |
from http import HTTPStatus
from typing import List
from apifairy import body, other_responses, response
from flask import Blueprint, jsonify
from flask import request
from src.config import DefaultConfig
from src.dtos.user import UserDto
from src.requests.user import CreateUserRequestSchema, CreateUserRequest, Creat... | [
{
"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/routes/users.py | tombrereton/flask-api-starter-kit |
import random
from string import Template
import tinydb
from flask import Flask, redirect, url_for, abort
app = Flask(__name__)
db = tinydb.TinyDB('./db.json')
HTML = """<!DOCTYPE html>
<html>
<head>
<title>Dulux Swatch</title>
<link rel="StyleSheet" href="/static/main.css" type="text/css">
</head>
<bo... | [
{
"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 | duluxswatch/app.py | leohemsted/duluxswatch |
# coding=utf-8
from jotdx.parser.base import BaseParser
from jotdx.helper import get_datetime, get_volume, get_price
from collections import OrderedDict
import struct
import six
class GetMinuteTimeData(BaseParser):
def setParams(self, market, code):
if type(code) is six.text_type:
code = code... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | jotdx/parser/get_minute_time_data.py | jojoquant/jotdx |
from copy import deepcopy
class Movel:
"""
Super class para móveis interativos
"""
def __init__(self, name, message):
self.name = name
self.message = message
self.itens = []
self.nomes = []
def olhar(self):
"""
Método que retorna uma breve descr... | [
{
"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 | superclasses/movel.py | augusnunes/titanic-escape |
import pytest
from django.urls import resolve, reverse
from notificationsservice.users.models import User
pytestmark = pytest.mark.django_db
def test_user_detail(user: User):
assert (
reverse("api:user-detail", kwargs={"username": user.username})
== f"/api/users/{user.username}/"
)
asser... | [
{
"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 | notificationsservice/users/tests/test_drf_urls.py | saippuakauppias/test-task-django |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | kubernetes/test/test_v2beta1_horizontal_pod_autoscaler.py | scele/kubernetes-client-python |
from ..messenger import Messenger
from . import pytest
def test_send_message_should_fail():
messenger = Messenger()
with pytest.raises(Exception) as exception_info:
messenger.send("user", "message")
assert "implemented" in str(exception_info)
def test_mark_writing_on_should_do_nothing():
mes... | [
{
"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 | chatbotmaker/tests/messenger_test.py | Dominique57/ChatBotMaker |
"""
Good morning! Here's your coding interview problem for today.
This problem was asked by Coursera.
Given a 2D board of characters and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically nei... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | src/daily-coding-problem/easy/word-board/word_board.py | nwthomas/code-challenges |
import PIL
import PIL.Image
from functional import compose
import numpy as np
import argparse
lmap = compose(list, map)
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse... | [
{
"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 | util.py | eth-sri/transformation-smoothing |
from os import listdir
import os.path as osp
class AudiofileProcessor(object):
SECONDS = 60
POMADORO_LENGTH_IN_SECONDS = 25 * SECONDS
def __init__(self, directory, filter_by_ext, length_calculator):
self.directory = directory
self.filter_by_ext = filter_by_ext
self.length_calculator = length_calculator
de... | [
{
"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 | audiofile_processor.py | ChameleonTartu/audio-files-to-pomodoro-counts |
# 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | aliyun-python-sdk-hbr/aliyunsdkhbr/request/v20170908/RenewClientTokenRequest.py | yndu13/aliyun-openapi-python-sdk |
from airflow.hooks.base_hook import BaseHook
class AzureBlobStorageCredentials(BaseHook):
def __init__(self, conn_id="azure_blob_storage_default"):
self.conn_id = conn_id
def get_credentials(self):
connection_object = self.get_connection(self.conn_id)
extras = connection_object.extra_... | [
{
"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 | modules/dbnd-airflow/src/dbnd_airflow_contrib/credentials_helper_azure.py | ipattarapong/dbnd |
from builtins import range
from builtins import object
import os
import json
from collections import OrderedDict
import scipy.sparse as sp
from .inferencer import IForest, LeafComputer, Blender, IForestBlender
class Inferencer(object):
"""
Loads up a model for inferencing
"""
def __init... | [
{
"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 | FastXML/fastxml/fastxml/fastxml.py | anonymouslorem/library_identification_vulnerability_report |
import numpy as np
from sklearn.base import TransformerMixin
def format_runs(runs):
# Time invariant parameters
X = np.stack([entry['parameters'] for entry in runs])
# Outputs
y = np.stack([entry['outputs'] for entry in runs])
# Time varying parameters
period = y.shape[1]
X = np.repeat(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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/fastms/preprocessing.py | giovannic/fastms |
from django import template
from ..rocketchat import get_rc_id, get_rc_url, get_rc_ws_url
register = template.Library()
@register.inclusion_tag("rocketchat/chat.html", takes_context=True)
def chat(context):
user = getattr(context.get("request"), "user")
return {
"rocketchat_url": get_rc_url(),
... | [
{
"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 | leprikon/templatetags/rocketchat.py | leprikon-cz/leprikon |
"""Create book model
Revision ID: dc9d9a0ac820
Revises: bbb00b216d89
Create Date: 2021-12-23 05:05:26.276613
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dc9d9a0ac820'
down_revision = 'bbb00b216d89'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | api/app/alembic/versions/dc9d9a0ac820_create_book_model.py | CHSevero/ZipBank-book-api |
from gettext import find
import torch
from ezflow.utils import (
AverageMeter,
coords_grid,
endpointerror,
find_free_port,
forward_interpolate,
is_port_available,
upflow,
)
def test_endpointerror():
pred = torch.rand(4, 2, 256, 256)
target = torch.rand(4, 2, 256, 256)
_ = en... | [
{
"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 | tests/test_utils.py | neu-vig/ezflow |
"""
Author: Shreck Ye
Date: June 16, 2019
Time complexity: O(log(N))
Let's think in the mathematical way. Obviously, the recursion formula represents a linear relationship.
By viewing it as a recursion formula of a single vector F_n = (f_n, f_{n + 1})' with a transition matrix M = (0, 1; 1, 1),
which is (f_{n + 1}, f_... | [
{
"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 | leetcode/solutions/fibonacci_number/matrix_exponentiation_solution_full_implementation.py | ShreckYe/Python-learning-Chinese |
from unittest.mock import patch
import os
from chapter10 import C10
import pytest
TESTDIR = os.path.join(os.path.dirname(__file__), 'tests')
def pytest_configure():
pytest.SAMPLE = os.path.join(TESTDIR, '1.c10')
pytest.EVENTS = os.path.join(TESTDIR, 'event.c10')
pytest.ETHERNET = os.path.join(TESTDIR,... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | conftest.py | atac-bham/c10-tools |
# coding=utf-8
from sqlalchemy import Column, String
from .base import Base
class NsfHerdFederalAgency(Base):
""" map to a table name in db """
__tablename__ = "nsf_herd_federal_agencies"
""" create columns """
agency_key = Column(String(3), primary_key = True)
agency_name = Column(String(64), n... | [
{
"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 | database/nsf_herd_federal_agencies.py | jasonpcasey/public_comparative_data |
import logging
import os
import time
import pytest
from tests.test_helpers.docker_helpers import docker_compose_runner # noqa: F401
# Enable debug logging.
logging.getLogger().setLevel(logging.DEBUG)
os.putenv("DATAHUB_DEBUG", "1")
@pytest.fixture
def mock_time(monkeypatch):
def fake_time():
return 16... | [
{
"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 | metadata-ingestion/tests/conftest.py | chinmay-bhat/datahub |
#!/usr/bin/env python3
# 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
# "... | [
{
"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 | tests/scripts/simple_http_server.py | whileskies/incubator-teaclave |
import os,shutil
from SCons.Script import DefaultEnvironment
from platformio import util
try:
# PIO < 4.4
from platformio.managers.package import PackageManager
except ImportError:
# PIO >= 4.4
from platformio.package.meta import PackageSpec as PackageManager
def parse_pkg_uri(spec):
if PackageMana... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | marlin-firmware/buildroot/share/PlatformIO/scripts/copy_marlin_variant_to_framework.py | voicevon/gogame_bot |
from flask import Blueprint, jsonify, request
from flask_login import current_user
from dawdle.components.board.models import BoardPermission
from dawdle.components.board.utils import board_permissions_required
from dawdle.components.column.forms import (CreateColumnForm, DeleteColumnForm,
... | [
{
"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 | legacy/dawdle/components/column/blueprints.py | vanillaSlice/dawdle |
import datetime
import json
from flask import url_for
from flask import redirect
from flask import render_template
from flask_login import login_user
from flask_login import logout_user
from . import blueprint_auth
from .forms import RegisterForm
from .forms import LoginForm
from .utils_cms import generate_code
from .... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | app/blueprint_auth/views.py | medsci-tech/mime_analysis_flask_2017 |
"""
Project Euler Problem 7: https://projecteuler.net/problem=7
10001st prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we
can see that the 6th prime is 13.
What is the 10001st prime number?
References:
- https://en.wikipedia.org/wiki/Prime_number
"""
import itertools
import math
def pri... | [
{
"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 | project_euler/problem_007/sol3.py | NavpreetDevpuri/Python |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.http import Http404
class StaffRequiredMixin(object):
@classmethod
def as_view(self, *args, **kwargs):
view = super(Staf... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/products/mixins.py | jayesh96/ecommerce2 |
#!/usr/bin/env python3
# coding=utf8
from soco import SoCo
import socket
# http://docs.python-soco.com/en/latest/getting_started.html
class SpeakerSonos:
def __init__(self):
print("SpeakerSonos initialized!")
def do(self, params):
speaker = SoCo(socket.gethostbyname(params['host']))
p... | [
{
"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 | plugins/speaker_sonos.py | mrusme/melon |
#coding:utf-8
import flask_login
from flask import render_template
from sigda.models import db, User
from sigda.config.common import ErrorCode
import logging
login_manager = flask_login.LoginManager()
class UserDbService(object):
@staticmethod
def add(email, name, passwd):
u = UserDbService.get_u... | [
{
"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 | sigda/user/services.py | yangluoshen/sigda |
'''
Created on Nov 9, 2017
@author: khoi.ngo
'''
def generate_random_string(prefix="", suffix="", size=20):
"""
Generate random string .
:param prefix: (optional) Prefix of a string.
:param suffix: (optional) Suffix of a string.
:param length: (optional) Max length of a string (include prefix an... | [
{
"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 | indy-tests/utils/utils.py | NgoAnhKhoi/indy-testcase |
from conans import ConanFile, CMake
import os
class HelloConan(ConanFile):
name = "hello"
license = "MIT"
author = "Jay Zhang <wangyoucao577@gmail.com>"
url = "https://github.com/wangyoucao577/hello-sdk-sample"
description = "<Description of Hello here>"
topics = ("<Put some tag here>", "<here>... | [
{
"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 | conanfile.py | wangyoucao577/hello-sdk-sample |
import msgpack
def dump(obj, fp, default=None):
msgpack.pack(obj, fp, use_bin_type=True, default=default)
def dumps(obj, default=None):
return msgpack.packb(obj, use_bin_type=True, default=default)
def load(fp, object_hook=None):
return msgpack.unpack(fp, object_hook=object_hook, encoding='utf8')
de... | [
{
"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 | p2p_python/serializer.py | namuyan/p2p-python |
from typing import List
from fastapi import APIRouter
from samey.table_crud import *
from .models import *
router = APIRouter()
@router.get("/", response_model=List[Stack])
def list_stacks():
return query(tables.Stack)
@router.post("/", response_model=Stack, status_code=201)
def create_stack(stack_in: Stack... | [
{
"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 | sites/stacks/api.py | bluebirdio/improbable-sites |
"""
Module: 'ds18x20' on esp8266 v1.11
"""
# MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.11-8-g48dcbbe60 on 2019-05-29', machine='ESP module with ESP8266')
# Stubber: 1.2.0
class DS18X20:
''
def convert_temp():
pass
def read_scratch():
pass
d... | [
{
"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 | packages/micropython-official/v1.11/esp8266/stubs/ds18x20.py | TheVinhLuong102/micropy-stubs |
#!/usr/bin/env python
# Copyright 2016 Google Inc. 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 ... | [
{
"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 | python/xicore.py | regexident/xi-editor |
"""Assorted utilities shared between parts of apitools."""
import collections
import httplib
import os
import types
import urllib2
from apitools.base.py import exceptions
__all__ = [
'DetectGae',
'DetectGce',
]
def DetectGae():
"""Determine whether or not we're running on GAE.
This is based on:
ht... | [
{
"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 | .install/.backup/lib/apitools/base/py/util.py | bopopescu/google-cloud-sdk |
"""Support for the Abode Security System locks."""
import abodepy.helpers.constants as CONST
from homeassistant.components.lock import LockEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | homeassistant/components/abode/lock.py | andersop91/core |
import string
from Bio import Alphabet, Seq
from Bio.Alphabet import IUPAC
class Transcribe:
def __init__(self, dna_alphabet, rna_alphabet):
self.dna_alphabet = dna_alphabet
self.rna_alphabet = rna_alphabet
def transcribe(self, dna):
assert dna.alphabet == self.dna_alphabet, \... | [
{
"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 | ddi_search_engine/Bio/Transcribe.py | dbmi-pitt/DIKB-Evidence-analytics |
# Copyright (c) 2013, igrekus and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from dc_plc.custom.utils import add_completeness, add_query_relevance
from dc_plc.controllers.stats_query import get_procmap_stats
def execute(f... | [
{
"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 | dc_plc/dc_plc/report/dc_product_procmap_stats/dc_product_procmap_stats.py | igrekus/dc_plc |
from awssg.Client_Interface import Client_Interface
from awssg.VPC_Client import VPC_Client
import boto3
class Client(Client_Interface):
def __init__(self):
self.ec2_client = boto3.client('ec2')
def describe_security_groups(self) -> dict:
return self.ec2_client.describe_security_groups()
... | [
{
"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 | awssg/Client.py | danilocgsilva/aws-sg |
from os.path import exists
from typing import Optional
from yaml import safe_load, safe_dump
from .model import GameSettings, GameConfig
from .typing import ISettingManager, IPathProvider
from .events import publish_game_event, SETTINGS_CHANGED
class YamlSettingsManager(ISettingManager):
def get_settings(self) ... | [
{
"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 | malibu_lib/setting_manager.py | en0/codename-malibu |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import torch
from tests import utils
class SimpleFloorModule(torch.nn.Module):
def forward(self, a, b):
c = a + b
return torch.floor(c)
class TestFloor(unittest.TestCase):
def test_floor(self... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | torch_glow/tests/nodes/floor_test.py | aksingh-fb/glow |
from flask import Flask, jsonify, request
from cashman.model.expense import Expense, ExpenseSchema
from cashman.model.income import Income, IncomeSchema
from cashman.model.transaction_type import TransactionType
app = Flask(__name__)
transactions = [
Income('Salary', 5000),
Income('Dividends', 200),
Expe... | [
{
"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 | cashman/index.py | horahh/flask-restful-apis |
from direct.distributed import DistributedObjectAI
from . import Entity
from direct.directnotify import DirectNotifyGlobal
class DistributedEntityAI(DistributedObjectAI.DistributedObjectAI, Entity.Entity):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedEntityAI')
def __init__(self, level, en... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | otp/level/DistributedEntityAI.py | TheFamiliarScoot/open-toontown |
# This file is part of Moksha.
# Copyright (C) 2008-2010 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 b... | [
{
"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 | moksha.hub/moksha/hub/amqp/base.py | hroncok/moksha |
# Debug helper functions
# Author: Matej Kastak
from colors import Color
from context import Context
def debug_print(s):
if Context().debug_enabled:
Color.print(Color.GREEN, str(s))
def debug_enabled():
return Context().debug_enabled
| [
{
"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 | insrunner/debug.py | MatejKastak/insrunner |
import pytest
import graphviz
from graphviz import parameters
VERIFY_FUNCS = [parameters.verify_engine,
parameters.verify_format,
parameters.verify_renderer,
parameters.verify_formatter]
@pytest.mark.parametrize(
'cls', [graphviz.Graph, graphviz.Digraph, graphviz.... | [
{
"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 | tests/test_parameters.py | iycheng/graphviz |
def distribute_guests(n, end_command):
guests = set()
for _ in range(n):
guest = input()
guests.add(guest)
while True:
guest_arrived = input()
if guest_arrived == end_command:
break
guests.remove(guest_arrived)
return guests
def print_guests(guests):... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | Old/Python-Advanced-Preliminary-Homeworks/Tuples and Sets/05. SoftUni Party.py | MNikov/Python-Advanced-September-2020 |
from django.conf import settings
from yubico_client import Yubico
def yubikey_authenticate(yubikey_otp):
"""
Checks a YubiKey OTP
:param yubikey_otp: Yubikey OTP
:type yubikey_otp:
:return: True or False or None
:rtype: bool
"""
if settings.YUBIKEY_CLIENT_ID is None or settings.YUBIK... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | psono/restapi/utils/yubikey.py | dirigeant/psono-server |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.