source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
data = ''
with open('input.txt') as f:
data = f.read().strip()
def Reacts(a, b):
if a == b:
return False
if a.lower() == b or b.lower() == a:
return True
return False
def Collapse(polymer):
i = 1
while i < len(polymer):
... | [
{
"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 | 05/aoc05.py | uberales/aoc2018 |
import discord
import asyncio
from datetime import datetime
class Discord:
_instance = None
client = None
def __new__(class_, *args, **kwargs):
if not isinstance(class_._instance, class_):
class_._instance = object.__new__(class_, *args, **kwargs)
return class_._instance
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 | _discord.py | blairg23/discord-scheduler-bot |
from typing import Union
import numpy as np
import pandas as pd
from oolearning.converters.TwoClassConverterBase import TwoClassConverterBase
from oolearning.enums.Metric import Metric
from oolearning.evaluators.TwoClassConfusionMatrix import TwoClassConfusionMatrix
from oolearning.evaluators.ScoreActualPredictedBase... | [
{
"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 | oolearning/evaluators/FBetaScore.py | shane-kercheval/oo-learning |
from bfxhfindicators.indicator import Indicator
from bfxhfindicators.ema import EMA
class MassIndex(Indicator):
def __init__(self, period, cache_size=None):
self._smoothing = period
self._singleEMA = EMA(9, cache_size)
self._doubleEMA = EMA(9, cache_size)
self._buffer = []
super().__init__({
... | [
{
"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 | bfxhfindicators/mass_index.py | Harsh-Sanklecha/stockanalysis |
"""
@Date: 2021/08/12
@description:
"""
import torch
import torch.nn as nn
import numpy as np
from visualization.grad import get_all
class GradLoss(nn.Module):
def __init__(self):
super().__init__()
self.loss = nn.L1Loss()
self.cos = nn.CosineSimilarity(dim=-1, eps=0)
self.grad... | [
{
"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 | loss/grad_loss.py | zhigangjiang/LGT-Net |
import io
import os
import random
import textwrap
from PIL import Image, ImageDraw, ImageFont
from telethon.tl.types import InputMessagesFilterDocument
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="srgb (.*)"))
async def sticklet(event):
R = random.randint(0,256)
G = random.randint(0,256)
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | userbot/plugins/srgb.py | Fregiant16/fregiantuserbot |
import numpy as np
def solve_hazard_eqn(fn, val, minval=10.0, maxval=900.0, interval=1.0):
'''
Finds the approximate point where a function crosses a value from below.
'''
prev_val = fn(minval)
for i in np.arange(minval+interval, maxval, interval):
next_val = fn(i)
if next_val < val and val < prev_val:
r... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | survival/misc/misc.py | ryu577/survival |
import pytest
from click.testing import CliRunner
from irisvmpy import iris
class TestCLI(object):
@pytest.fixture()
def runner(self):
return CliRunner()
def test_print_help_succeeds(self, runner):
result = runner.invoke(iris.cli, ['--help'])
assert result.exit_code ... | [
{
"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 | tests/test_iris.py | vivganes/devops-machine-learning-example |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import logging
logging.basicConfig(format='%(message)s')
from fairing import builders
class Conf... | [
{
"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 | fairing/config.py | cheyang/fairing |
def Coeff_Static_Friction(Mat_on_Mat):
# Read from CSV
pass
def Coeff_Kinetic_Friction(Mat_on_Mat):
pass | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | grtoolkit/Mechanics/Friction/__init__.py | ZenosParadox/grtoolkit |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 22:07:01 2018
@author: yoelr
"""
from ._tank import MixTank
from ._hx import HXutility
class EnzymeTreatment(MixTank):
"""Create an EnzymeTreatment unit that is cost as a MixTank with a heat exchanger."""
_N_outs = 1
#: Residence time (hr)
_tau = ... | [
{
"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 | build/lib/biosteam/units/_enzyme_treatment.py | rjhanes/biosteam |
# https://leetcode.com/problems/combinations
# https://leetcode.com/problems/combinations/
class Solution:
def combine(self, n, k):
output = []
def backtrack(first=1, cur_list=[]):
if len(cur_list) == k:
output.append(cur_list[:])
else:
for i... | [
{
"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 | submissions/combinations/solution.py | Wattyyy/LeetCode |
import os
import importlib
import logging
from glob import glob
root = os.path.dirname(__file__)
logger = logging.getLogger(__name__)
INVALID_MODULES = {}
def _get_valid_datasets():
datasets = glob(os.path.join(root, '*.py'))
valid_datasets = []
for dataset in datasets:
basename = os.path.basen... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | src/dataset/__init__.py | KimythAnly/PyTorch-Voice-Conversion |
from selenium.webdriver.common.by import By
from .base_page import BasePage
from .locators import LoginPageLocators
class LoginPage(BasePage):
def should_be_login_page(self):
self.should_be_login_url()
self.should_be_login_form()
self.should_be_register_form()
def should_be_login_url... | [
{
"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 | pages/login_page.py | Parenty/PageObjectExample |
from flask import Flask, flash, redirect, render_template, request, session, abort
import os
import pymysql
pymysql.install_as_MySQLdb()
import MySQLdb
#from flask_mysqldb import MySQL
#import MySQLdb.cursors
app = Flask(__name__)
app.secret_key = 'some secret key'
db = MySQLdb.connect(host="localhost" ,user="root"... | [
{
"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 | app.py | hrishikeshmane/grep_quiz |
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
bin_path = os.path.join(... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | recipes/gflags/all/test_package/conanfile.py | balintfodor/conan-center-index |
#!/usr/bin/env python
import re
import urllib.request
import urllib.error
from pathlib import Path
from typing import Optional
from labml import lab, monit
def get_repos(filename: str):
with open(str(lab.get_data_path() / filename), 'r') as f:
content = f.read()
link_pattern = re.compile(r"""
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | download.py | NipunaRanasinghe/source_code_modelling |
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
{
"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 | python/cugraph/tests/dask/test_mg_degree.py | isVoid/cugraph |
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import numpy as np
DEFAULT_N_BINS = 10
def compute_summaries(clf, X, W, n_bins=DEFAULT_N_BINS):
proba = clf.predict_proba(X)
count, _ = np.histo... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | model/summaries.py | victor-estrade/SystGradDescent |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from .api import asex
class ParallelExec:
def __init__(self, cmd_str_lst):
self.cmd_str_lst = cmd_str_lst
self.runcmd_lst = [asex(cmd) for cmd in cmd_str_lst]
def wait(self):
for p in self.runcmd_lst:
p.wait()
return se... | [
{
"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 | shell/parallel_exec.py | houqp/shell.py |
def is_palindrome_v3(s):
""" (str) -> bool
Return True if and only if s is a palindrome.
>>> is_palindrome_v3('noon')
True
>>> is_palindrome_v3('racecar')
True
>>> is_palindrome_v3('dented')
False
>>> is_palindrome_v3('')
True
>>> is_palindrome_v3(' ')
True
"""
... | [
{
"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 | Crafting_Quality_Code_UniToronto/week1_approaches/week1_quiz.py | bounty030/Coursera |
"""
>>> set(filter(lambda t: t not in ('AFC', 'NFC'), nflteams.fullinfo.keys())) - set(team_locations.keys())
set()
>>> set(filter(lambda t: t not in ('AFC', 'NFC'), nflteams.fullinfo.keys())) == set(team_locations.keys())
True
"""
import geopy.distance
from django import template
from redditnfl.nfltools import nflteam... | [
{
"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 | templatetags/distance_filters.py | redditnfl/draft-cards |
from __future__ import absolute_import
from __future__ import unicode_literals
import six
from compose.cli import verbose_proxy
from tests import unittest
class VerboseProxyTestCase(unittest.TestCase):
def test_format_call(self):
prefix = '' if six.PY3 else 'u'
expected = "(%(p)s'arg1', True, k... | [
{
"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 | tests/unit/cli/verbose_proxy_test.py | matthieudelaro/dockernut |
import random
from enum import Enum
CarType = Enum('CarType', 'subcompact compact suv')
class Car:
pool = dict()
def __new__(cls, car_type):
obj = cls.pool.get(car_type, None)
if not obj:
obj = object.__new__(cls)
cls.pool[car_type] = obj
... | [
{
"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 | chapter08/flyweight.py | rishitc/Mastering-Python-Design-Patterns-Second-Edition |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from .....testing import assert_equal
from ..brains import BRAINSClipInferior
def test_BRAINSClipInferior_inputs():
input_map = dict(BackgroundFillValue=dict(argstr='--BackgroundFillValue %s',
),
acLowerBound=dict(argstr='--acLowerBound %f',
),
... | [
{
"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 | nipype/interfaces/semtools/utilities/tests/test_auto_BRAINSClipInferior.py | Conxz/nipype |
import graphene
from simple_api.adapters.graphql.constants import INPUT_CLASS_SUFFIX
from simple_api.utils import ClassStub, Storage
class InputClassStorage(Storage):
def get(self, cls_str, cls):
if cls_str not in self.storage:
self.storage[cls_str] = ClassStub("{}{}".format(cls.__name__, INP... | [
{
"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 | simple_api/adapters/graphql/registry.py | karlosss/simple_api |
# Django Library
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from dal import autocomplete
# Localfolder Library
from ..models import PyCurrency
from .web_father import (
FatherCreateView, Fath... | [
{
"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 | apps/base/views/currency.py | youssriaboelseod/pyerp |
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from rest_framework import serializers
class SignupSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ['username', 'first_name', 'last_name', 'em... | [
{
"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 | authentication/serializers.py | Sarwar242/crud_templete_django |
#! /usr/bin/python3
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals, print_function
import numpy as np
import theano.tensor as T
from theano import shared, config
from model import SimpleModel, Model
from layers.layer import Dense
from layers.activations import Activation
__author__ = 'fyabc'
fX ... | [
{
"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 | MyMLFramework/tests.py | fyabc/MSRAPaperProject |
from daemon import _get_app
from daemon.config import jinad_config
def test_get_app_flow(monkeypatch, common_endpoints, flow_endpoints):
monkeypatch.setattr(jinad_config, 'CONTEXT', 'flow')
routes = [(route.name, route.path) for route in _get_app().routes]
assert sorted(routes) == sorted(common_endpoints ... | [
{
"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 | tests/jinad/unit/test_main.py | NouiliKh/jina |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0_1
from i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | isi_sdk_8_0_1/test/test_hardware_tapes_devices.py | mohitjain97/isilon_sdk_python |
import os
import errno
import traceback
from six.moves import tkinter_messagebox as messagebox
from six import print_
class BrocoliError(Exception):
def __init__(self, exception):
self.exception = exception
def __str__(self):
return type(self.exception).__name__ + ': ' + str(self.exception)
... | [
{
"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 | brocoli/exceptions.py | mesocentre-mcia/brocoli |
from django.utils import timezone
from rest_framework.authtoken.models import Token
class AuthTokenHandler:
"""
Handles variations in auth token
"""
@staticmethod
def expired_token(auth_token):
"""
Checks expiry of auth token
"""
utc_now = timezone.now()
exp... | [
{
"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": true
},... | 3 | authors/utils/authentication_handlers.py | andela/ah-the-immortals-backend |
class FieldC():
def __init__(self, name, column_type, primary_key, default):
self.name = name
self.column_type = column_type
self.primary_key = primary_key
self.default = default
def __str__(self):
return '<%s, %s:%s>' % (self.__class__.__name__, self.column_type... | [
{
"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 | jupiter_orm/jupiter_orm/Field.py | dianbaer/fast |
# -*- coding: utf-8 -*-
"""
File Name: best-time-to-buy-and-sell-stock-with-transaction-fee.py
Author : jynnezhang
Date: 2020/12/17 1:40 下午
Description:
https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/
dp[i][0] 表示第 i 天交易完后手里没有股票的最大利润,
dp[i][1] 表示第 i 天交易完后手里持有一支股票的最... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | python/best-time-to-buy-and-sell-stock-with-transaction-fee.py | summer-vacation/AlgoExec |
import os
from flask import Flask
from flask import request
from flask import render_template
from flask import send_from_directory
import db
import abstractDriver
import messageAnnouncer
from api import dbAPI
from story import Story
from api import adminAPI
from api import streamAPI
from api import scrapeAPI
from dash... | [
{
"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/app.py | julienkellerhals/OverView |
import json
import time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
class AbstractWebsocketClient(object):
thread = None
stop = False
sub_params = {}
keep_alive = None
def start(self):
def _go():
self._connect()
... | [
{
"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 | services/stocks-api/app/api/clients/AbstractWebsocketClient.py | krystianbajno/stocks |
import asyncio
import random
from async_pipeline.stage import PipelineStage, pipeline_operation
class Loader(PipelineStage):
def __init__(self, conf, *args, **kwargs) -> None:
self._operation = conf["load"]
super().__init__(*args, **kwargs)
@pipeline_operation
async def print(self, messa... | [
{
"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 | async_pipeline/loader.py | zar3bski/async_pipeline_experiment |
#!/usr/bin/env python3
"""Define public exports."""
__all__ = ["OutputFileExists", "InvalidDomain", "FileWriteError", "NoDomains"]
class NoDomains(Exception):
"""Raise when no domains are passed to findcdn main."""
def __init__(self, error):
"""Instantiate super class with passed message."""
... | [
{
"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 | src/findcdn/findcdn_err.py | Pascal-0x90/findcdn |
#!/usr/bin/env python
import flask_migrate
import flask_script
from myapp.comm import send_update
from myapp.database import models
from myapp.database.adapter import db
from myapp.database.models import Update
from myapp.webserver.socketio import socketio
from myapp.webserver.webapp import webapp
manager = flask_s... | [
{
"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 | manage.py | lukeyeager/flask-sqlalchemy-socketio-demo |
import hypothesis.strategies as st
from hypothesis import given
from hypothesis.strategies import DataObject
from sqlmodel import Session, select
from fastapi_server.models.user import User
from fastapi_server.test.base_test import BaseTest
class TestDatabase(BaseTest):
def test_user_add_single(self, method_ses... | [
{
"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 | fastapi_server/test/test_database.py | BurnySc2/python-template |
import models, handlers
class Login(handlers.Handler):
"""Allows registered user to login"""
def get(self):
"""Renders login page"""
caller = handlers.sanitize(self.request.get('caller'))
self.render('login.html', caller=caller)
def post(self):
"""Accepts login info from lo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | handlers/login.py | cstieg/Multi-User-Blog |
import numpy as np
import math
_vbars = " ▁▂▃▄▅▆▇█"
def bar_graph(data):
if len(data) > 64:
data = np.interp(np.linspace(0, len(data), 64),
np.arange(0, len(data)),
np.array(data))
M = max(data)
def _bar(alpha):
if math.isnan(alpha):
... | [
{
"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 | nnutil/visual/bars.py | aroig/nnutil |
"""
merge sort
- 단어 vocabulary 정렬하기
"""
arr = ["y", "r", "a", "l", "u", "b", "a", "c", "o", "v"]
def merge_sort(arr):
if len(arr) == 1:
return arr
middle = len(arr) // 2
left_arr = merge_sort(arr[:middle])
right_arr = merge_sort(arr[middle:])
return merge(left_arr, right_arr)
def merge(a... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | week_3/06_merge_sort_2.py | khh180cm/algorithm |
# coding: utf-8
"""
CONS3RT Web API
A CONS3RT ReSTful API # noqa: E501
The version of the OpenAPI document: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import openapi_client
from openapi_client.mode... | [
{
"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 | test/test_basic_software_asset_all_of.py | cons3rt/cons3rt-python-sdk |
#!/usr/bin/env python3
import iterm2
# To install, update, or remove packages from PyPI, use Scripts > Manage > Manage Dependencies...
import subprocess
async def main(connection):
component = iterm2.StatusBarComponent(
short_description = 'k8s current context',
detailed_description = 'Dis... | [
{
"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 | k8s-context.py | bassaer/iterm2-k8s-context |
import sys
import requests
from . import settings
spotify_base = "https://api.spotify.com/v1"
def get_spotipy_token():
import spotipy.util as util
params = get_spotify_auth_params()
return util.prompt_for_user_token(**params)
def get_headers(token):
return {"Authorization": "Bearer %s" % (token)}
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | spoticly/spotify.py | onhernandes/spoticly |
from flask import render_template,redirect,url_for,flash,request
from app.models import User
from .forms import SignUpForm, LoginForm, validate_email
from .. import db
from . import auth
from flask_login import login_user,logout_user,login_required
from ..email import mail_message
from wtforms import ValidationError
... | [
{
"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/auth/views.py | ChegeDaniella/Pitches |
#!/usr/bin/env python3
import sqlite3, json, time, sys, os
from housepy import config, log, util
def db_call(f):
def wrapper(*args):
connection = sqlite3.connect(os.path.abspath(os.path.join(os.path.dirname(__file__), "data.db")))
connection.row_factory = sqlite3.Row
db = connection.cursor... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | model.py | lordhelmut/conversnitch |
"""
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... | [
{
"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 | clients/kratos/python/test/test_plugin.py | simoneromano96/sdk |
from typing import Dict, List
class Playlist:
def __init__(self):
self.__queue: Dict[int, List[Dict[str, str]]] = {}
def insert_one(self, chat_id: int, data: Dict[str, str]):
if chat_id not in self.__queue:
self.__queue[chat_id] = [data]
else:
queue = self.__qu... | [
{
"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 | core/queue.py | Kaneki1416/kenKaneki |
# -*- coding: utf-8 -*-
"""
最大公约数
"""
def gcd(a, b):
"""
需a>=b
:param a:
:param b:
:return:
"""
if a == b or a % b == 0:
return b
else:
return gcd(b, a % b)
def gcd_2(a, b):
return b if a == b or a % b == 0 else gcd_2(b, a % b)
if __name__ == "__main__":
pr... | [
{
"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 | gcd.py | konglx90/algorithm |
from typing import Any, Dict, List, Optional
from prefect import Flow, task, unmapped
from .base import Pipeline, PipelineExecutor, StageAnnotations, StageAnnotationType
def annotations_to_task_kwargs(annotations: Optional[StageAnnotations]) -> Dict[str, Any]:
if annotations is None:
return {}
task_... | [
{
"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 | pangeo_forge_recipes/executors/prefect.py | rabernat/pangeo-forge-recipes |
from collections import deque
"""
nlog(n)
"""
def merge(lList, rList):
'''
Return a merged list
'''
result=[]
left_list=deque(lList)
right_list=deque(rList)
while len(left_list)!=0 and len(right_list)!=0:
'''
Wrong idea here is trying to pop the first element at first, some ... | [
{
"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 | Sorting/mergeSort.py | pingrunhuang/CodeChallenge |
class Color:
def __init__(self, r = 0, g = 0, b = 0):
self.red = r
self.green = g
self.blue = b
def adjust_brightness(self, alpha, to_int = False):
self.red *= alpha
self.green *= alpha
self.blue *= alpha
if to_int:
self.red = int(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | RGBMatrixEmulator/graphics/color.py | ty-porter/RGBMatrixEmulator |
# -*- coding: utf-8 -*-
def test_all_unique_violation_codes(all_violations):
"""Ensures that all violations have unique violation codes."""
codes = []
for violation in all_violations:
codes.append(int(violation.code))
assert len(set(codes)) == len(all_violations)
def test_all_violations_cor... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | tests/test_violations/test_codes.py | Kvm99/wemake-python-styleguide |
from keras import layers, models
from keras import datasets
from sklearn import preprocessing
import matplotlib.pyplot as plt
def boston_housing_data():
(X_train, y_train), (X_test, y_test) = datasets.boston_housing.load_data()
scaler = preprocessing.MinMaxScaler()
X_train = scaler.fit_transform(X_train)... | [
{
"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 | my_ex2_2.py | sjang42/keraspp |
from ..models import Key
from .literals import TEST_KEY_PRIVATE_DATA, TEST_KEY_PUBLIC_FILE_PATH
class KeyAPIViewTestMixin:
def _request_test_key_create_view(self):
return self.post(
viewname='rest_api:key-list', data={
'key_data': TEST_KEY_PRIVATE_DATA
}
)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | mayan/apps/django_gpg/tests/mixins.py | wan1869/dushuhu |
# MIT License
#
# Copyright (c) 2020-2021 Parakoopa and the SkyTemple Contributors
#
# 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... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | explorerscript/ssb_converting/compiler/compile_handlers/atoms/position_marker_arg.py | dotlambda/ExplorerScript |
import socket
from cmd_functions import is_ip_valid, is_port_valid
'''
A library that allows AVA to connect to various cloud services
'''
def send_to_cloud(socket, data):
"""
Send data over the specified socket to the associated cloud
socket = any socket object
data = a string or int to be sent over t... | [
{
"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 | ava_connect_clouds.py | TotallyAProgrammer/ava |
from django.contrib import admin
from django.utils.timesince import timesince
from django.urls import include, path
class CallAdmin(admin.ModelAdmin):
list_display = ['id','app','name','stdout','started_at','finished_at','duration','timesince']
list_display_links =[]
list_filter = ['name',]
search_fiel... | [
{
"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 | django_command_admin/admin/call.py | andrewp-as-is/django-admin-commands.py |
# type: ignore
# MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# 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 rights
# to use, ... | [
{
"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 | ogr/services/gitlab/user.py | maniis/ogr |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import add_days, date_diff
from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation impor... | [
{
"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 | frappe-bench/apps/erpnext/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py | Semicheche/foa_frappe_docker |
"""Module to find real rooms in data and sum their sector IDs."""
def main():
"""Run the main function."""
with open('data/day4data.txt', 'r') as f:
dataList = f.readlines()
realRoomList = []
roomNames = []
sum = 0
for line in dataList:
data = line.strip("\n").split('-')
... | [
{
"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 | day4-2.py | SayWhat1/adventofcode2016 |
import parse
def parse_name(text: str) -> str:
patterns = (
"my name is {name}",
"i'm {name}",
"i am {name}",
"call me {name}",
"{name}",
)
for pattern in patterns:
result = parse.parse(pattern, text)
if result:
# Switch the commented out... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | examples/mypy_stubs/parse_name.py | DataDog/bazel-mypy-integration |
from .models import Character, Faction, Ship
__author__ = 'ekampf'
def initialize():
human = Character(name='Human')
human.put()
droid = Character(name='Droid')
droid.put()
rebels = Faction(id="rebels", name='Alliance to Restore the Republic', hero_key=human.key)
rebels.put()
empire =... | [
{
"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 | examples/starwars/data.py | mdornseif/graphene-gae |
from numpy import linspace
from scipy.interpolate import interp1d
class Interpolator:
"""
Базовый класс интерполятора
"""
def __init__(self, points=100):
self.points = points
def interpolate(self, x, y):
pass
class Quadratic(Interpolator):
"""
Квдратичный интерполятор
... | [
{
"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 | src/miptlabs/interpolators/interpolators.py | dimon58/miptlabs |
from zope.interface import Attribute
from zope.interface import Interface
from zope.interface import implements
class IIndexEvent(Interface):
"""
An lower level event involving the index
"""
class IIndexUpdate(Interface):
"""
An low level event involving the index
"""
class IPackag... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | cheeseprism/event.py | msabramo/CheesePrism |
import os
import pytest
from common.features import featurize_file
from common.predictions.datarobot import DataRobotV1APIPredictionService
from common.predictions.dummy import DummyPredictionService
from common.predictions.embedded import EmbeddedPredictionService
@pytest.fixture
def saved_audio_file():
return... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | backend/tests/conftest.py | YuriyGuts/dechorder |
# -*- coding: utf-8 -*-
"""Example for a list question type.
Run example by typing `python -m examples.list` in your console."""
from pprint import pprint
import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
def ask_pystyle(**kwargs):
# create the question ... | [
{
"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 | examples/select.py | fossabot/questionary |
import markdown
import bleach
from django.db.models import (
Model,
BooleanField,
CharField,
DateTimeField,
IntegerField,
TextField,
BigAutoField,
)
from django.utils.translation import gettext_lazy as _
class Announcement(Model):
"""
An announcement is a block of html text for the... | [
{
"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 | src/apps/announcements/models/announcement.py | petgo3/katago-server |
#-*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import AgglomerativeClustering as sk_AgglomerativeClustering
from sklearn.externals.joblib import Memory
from .clustering import Clustering
class AgglomerativeClustering(Clustering):
"""docstring for AgglomerativeClustering."""
def __init__(self, d... | [
{
"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 | clustering/agglomerative_clustering.py | netoaraujjo/hal |
import sys
from zeys.api.detector import Detector
class Runner:
def __init__(self):
pass;
def run(self):
detector = Detector()
stream = detector.run()
for output in stream:
print(str(output))
sys.stdout.flush()
def main():
runner = Runner()
runner.run()
| [
{
"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 | zeys/run/runner.py | alexethier/zeys |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import json
import logging
import os
import signal
from typing import List
from idb.common.constants import IDB_PID_PATH
def save_pid(pid: int) -> None:
pids = _get_pids()
pids.append(pid)
_write_pids(pids=pid... | [
{
"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 | idb/client/pid_saver.py | fakeNetflix/facebook-repo-idb |
#!/usr/bin/env python3
from os import path
import random
import textwrap
module_data = path.join(path.dirname(__file__), "data")
ascii_path = path.join(module_data, "ascii")
quotes_path = path.join(module_data, "quotes")
def build_bubble(quote=""):
wrap_limit = 50
wrap_list = textwrap.wrap(quote, wrap_limit)... | [
{
"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 | libwhatami/__init__.py | cosmo-ray/whatami |
from __future__ import division
import kdtree
from component import Component
from transform import Transform
from abc import ABCMeta, abstractmethod
class Collider2D(Component):
__metaclass__ = ABCMeta
_quadTree = kdtree.create(dimensions=2)
_rMax = None
@staticmethod
def register(newCollider):... | [
{
"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 | src/collider2d.py | ManickYoj/Phramework |
import telegram
from emoji import emojize
from .base import MenuMessageBase
class PeriodMenuMessage(MenuMessageBase):
"""
Send "Salary income period" menu.
Define set of buttons: "Year", "Month", "Day", "Hour".
"""
ITEMS = tuple(
("period{0}".format(p.capitalize()), p)
for p in (... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | src/messages/menus/period.py | rkulyn/telegram-dutch-taxbot |
import argparse
import RDT
import time
import rdt_3_0
def makePigLatin(word):
m = len(word)
vowels = "a", "e", "i", "o", "u", "y"
if m < 3 or word == "the":
return word
else:
for i in vowels:
if word.find(i) < m and word.find(i) != -1:
m = word.find(i)
... | [
{
"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 | submission_files/server_3_0.py | AlexHarry17/CSCI466Project2 |
from django.shortcuts import render
from django.http import JsonResponse
from zoogle_pb2 import Void, Query
from zoogle.zdocs.models import Zdoc
from zoogle.zmail.models import Zmail
from zoogle.contribs.clients.zmail import zmail_stub
from zoogle.contribs.clients.zdocs import zdocs_stub
def index(request):
retu... | [
{
"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 | assets/2020-01-18/zoogle/contribs/views.py | dhilipsiva/talks |
import aoc.d14
from tests.aoc.test_base import BaseTestCase
class TestAll(BaseTestCase):
def test_part_one(self):
self.run_aoc_part(14, 5902420735773, aoc.d14.p_1)
def test_part_two(self):
self.run_aoc_part(14, 3801988250775, aoc.d14.p_2)
| [
{
"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 | tests/aoc/test_d14.py | klittlepage/aoc2020 |
"""
Utilities for API Gateway response formatting
"""
import json
def format_response(data, status=200):
return {
'body': json.dumps(data),
'headers': {
'Content-Type': 'application/json'
},
'statusCode': int(status)
}
def format_error(msg, code='BadRequest', stat... | [
{
"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 | wystia/utils/response.py | rnag/wystia |
# -*- coding: utf-8 -*-
import hmac
import hashlib
import base64
"""
unit : utils
descritption: Collection of functions used in all projetcts
author : Alcindo Schleder
version : 1.0.0
package : i-City Identification Plataform
"""
def isnumber(value):
try:
float(valu... | [
{
"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 | common/helpers/utils.py | AlcindoSchleder/flaskWeb |
from django.views.generic import FormView
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse_lazy
from contact.models import Contact, Newsletter
from contact.forms import ContactForm, NewsletterForm
class TwoFormView(FormView):
template_name = 'two_form.html'
form_cla... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | payg/contact/views.py | aronysidoro/django-payasyougo |
def get_common_elements(seq1, seq2, seq3):
# return tuple(set(seq1).intersection(set(seq2).intersection(set(seq3))))
# return tuple(set(seq1).intersection(set(seq2), set(seq3)))
return tuple(set(seq1) & set(seq2) & set(seq3)) # same as above
print(get_common_elements("abcd", ['a', 'b', 'd'], ('b', 'c', '... | [
{
"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 | Day_9_tuples_and_sets/day9_uzd2.py | ValRCS/Python_TietoEvry_Sep2021 |
import json
JC_SETTINGS_FOLDER_NAME = "javascript_completions"
JC_SETTINGS_FOLDER = os.path.join(PACKAGE_PATH, JC_SETTINGS_FOLDER_NAME)
class JavaScriptCompletions():
def init(self):
self.api = {}
self.API_Setup = sublime.load_settings('JavaScript-Completions.sublime-settings').get('completion_active_list')... | [
{
"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 | javascript_completions/javascript_completions_class.py | exploitmik/JavaScript-Completions |
'''
Created on Dec 15, 2014
@author: Francois Belletti
'''
import numpy as np
def compute_regularized_obj(A, solution, o_vect, sigma):
return np.sum((np.dot(A, solution) - o_vect) ** 2) + sigma * np.sum(solution ** 2)
def compute_original_obj(A, solution, o_vect, sigma):
return np.sum((np.dot(A, solution) -... | [
{
"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 | pyDOSCP/utils.py | bellettif/DMP |
class WallPlanner:
def __init__(self, params, robot_scale=0.3302):
self.parms = params
self.robot_scale = robot_scale
def plan(self, obs):
ranges = obs['scans']
left = ranges[720]
if left > 2.1: # If you move away from the left wall, you will get closer... | [
{
"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 | examples/planner/wall_following.py | sumin963/f1tenth_gym |
from pathlib import Path
import os
def getmFlowUserHome():
home_dir = str(Path.home())
mflow_dir = os.path.join(home_dir,"mFlow")
if(not os.path.exists(mflow_dir)):
os.mkdir(mflow_dir)
return mflow_dir
def getDataDir():
mflow_dir = getmFlowUserHome()
data_dir = os.path.join(mflow... | [
{
"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 | mFlow/Utilities/utilities.py | mlds-lab/mFlow |
import re
from helpers import run
hlp = run('--help')
stdout = hlp.stdout
def test_usage():
assert stdout.startswith('Usage: ghia.py [OPTIONS] REPOSLUG')
def test_description():
assert (
'CLI tool for automatic issue assigning of GitHub issues' in stdout
)
def test_strategy():
assert re.... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_help.py | hroncok/ghia |
from adventofcode.year_2021.day_2021_01 import readable, short
def test_readable_part_one():
answer = readable.part1()
assert answer == 1616
def test_readable_part_two():
answer = readable.part2()
assert answer == 1645
def test_short_part_one():
answer = short.part1()
assert answer == 1616... | [
{
"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/year_2021/test_day_2021_01.py | gansanay/adventofcode |
#!/usr/bin/python
import sys
import os
import argparse
def get_module_path(module_name):
module_path = ''
for d in sys.path:
possible_path = os.path.join(d, module_name)
# skip current dir as this is plugin dir
if os.path.isdir(possible_path) and len(d) != 0:
module_path = ... | [
{
"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 | dali_tf_plugin/dali_compile_flags.py | ancientmooner/DALI |
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import os, sys
# From here: http://pytest.org/2.2.4/goodpractises.html
class RunTests(TestCommand):
DIRECTORY = 'test'
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_a... | [
{
"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 | setup.py | rec/streamy |
from django.core.management.base import BaseCommand
from myapp.models import Question
class Command(BaseCommand):
help = 'Unlock the levels.'
def add_arguments(self, parser):
parser.add_argument('level', type=int, help='Indicates the level of the question to be locked')
def handle(self, *args, **kwargs):
lev... | [
{
"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 | myapp/management/commands/lock_level.py | singlasahil221/HackOn |
import collections
class Solution:
ROMAN = collections.OrderedDict((
(1000, 'M'),
(900, 'CM'),
(500, 'D'),
(400, 'CD'),
(100, 'C'),
(90, 'XC'),
(50, 'L'),
(40, 'XL'),
(10, 'X'),
(9, 'IX'),
(5, 'V'),
(4, 'IV'),
... | [
{
"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 | leetcode/roman_to_integer.py | dmitrvk/solutions |
import rospy
from geometry_msgs.msg import PointStamped
from bitbots_head_behavior.actions.look_at import AbstractLookAt
class TrackPost(AbstractLookAt):
"""
This action follows the seen post so that the camera always points towards it.
We try to do this so that the post doesnt get lost as easily
"""... | [
{
"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 | bitbots_head_behavior/src/bitbots_head_behavior/actions/track_post.py | Wangxinhui-bot/bitbots_behavior |
import torch
import torch.nn as nn
import torchvision.models as models
class Siamese(nn.Module):
def __init__(self, in_channels, out_size, dropout):
super(Siamese, self).__init__()
self.dropout = dropout
self.dropout_layer = nn.Dropout(dropout)
#self.model = models.vgg16(pr... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | network.py | Devanshu-singh-VR/FaceRecognition |
# python3
class Coordinates:
class Builder:
def __init__(self):
self.obj = Coordinates()
def lat(self, lat):
self.obj.lat = lat
return self
def lon(self, lon):
self.obj.lon = lon
return self
def build(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | src/coordinates.py | felixarpa/LP-Python |
from selfdrive.car.tesla.speed_utils.movingaverage import MovingAverage
class FleetSpeed:
def __init__(self, average_speed_over_x_suggestions):
self.speed_avg = MovingAverage(average_speed_over_x_suggestions)
self.frame_last_adjustment = 0
def adjust(self, CS, max_speed_ms, frame):
if... | [
{
"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 | selfdrive/car/tesla/speed_utils/fleet_speed.py | vandreykiv/openpilot |
from cms.admin.placeholderadmin import PlaceholderAdmin
from cms.test_utils.project.placeholderapp.models import (Example1, MultilingualExample1, TwoPlaceholderExample)
from django.contrib import admin
from hvad.admin import TranslatableAdmin
class MixinAdmin(admin.ModelAdmin):
def formfield_for_dbfield(self, db_... | [
{
"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 | cms/test_utils/project/placeholderapp/admin.py | foobacca/django-cms |
"""Makers"""
from contextlib import suppress
from typing import Mapping, Iterable, TypeVar, Callable
from itertools import product
from collections import defaultdict
T = TypeVar('T')
with suppress(ModuleNotFoundError, ImportError):
from numpy.random import randint, choice
def random_graph(n_nodes=7):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | meshed/makers.py | i2mint/meshed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.