source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.db import models
from django.contrib.auth.models import (
AbstractBaseUser,
PermissionsMixin,
BaseUserManager
)
class UserProfileManager(BaseUserManager):
'''Manager for user profiles'''
def create_user(self, email, name, password=None): # password = none means that if you don't s... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | profiles_api/models.py | steve-carey/profiles-rest-api |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | aliyun-python-sdk-drds/aliyunsdkdrds/request/v20190123/DescribeDrdsSqlAuditStatusRequest.py | yndu13/aliyun-openapi-python-sdk |
import wx
class MyPanel(wx.Panel):
def __init__(self, *args, **kw):
super(MyPanel, self).__init__(*args, **kw)
self.Bind(wx.EVT_BUTTON, self.OnButtonClicked)
def OnButtonClicked(self, e):
print('Evénement est déclanché de la classe Button')
# e.Skip()
class... | [
{
"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 | wxPython/wxPython examples/eventpropagate.py | otmanabdoun/IHM-Python |
from ... import options as opts
from ...charts.chart import Chart
from ...commons.types import Numeric, Optional, Sequence, Union
from ...globals import ChartType
class Map(Chart):
"""
<<< Map >>>
Map are mainly used for visualization of geographic area data.
"""
def __init__(self, ... | [
{
"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 | data analysis/pyecharts/pyecharts/charts/basic_charts/map.py | mrxgavin/Coursework |
from functools import wraps
def double_return(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
result = fn(*args, **kwargs)
return [result, result]
return wrapper
@double_return
def add(x, y):
return x + y
print(add(1, 2))
@double_return
def greet(name):
return "Hi, I'm " +... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | Python3/Exercises/DoubleReturn/double_return.py | norbertosanchezdichi/TIL |
class Verifications(object):
def __init__(self):
pass
def correct_functionality(self, user_input, keywords, functionalities):
for functionality in functionalities:
functionality['keywords_found'] = []
for keyword in keywords:
if keyword['value'] in user_input:
... | [
{
"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 | app/modules/verifications.py | PaulloClara/cav |
import DistributedElevator
import DistributedBossElevator
from ElevatorConstants import *
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer
class DistributedBBElevator(DistributedBossElevator.DistributedBossElevator):
def __init__(self, cr):
DistributedBossElevat... | [
{
"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 | toontown/building/DistributedBBElevator.py | AnonymousDeveloper65535/open-toontown |
from locust import HttpUser, task, events
from locust_plugins import jmeter_listener
class DemoBlazeUser(HttpUser):
host = "https://www.demoblaze.com"
@task
def t(self):
self.client.get("/")
@events.init.add_listener
def on_locust_init(environment, **kwargs):
jmeter_listener.JmeterListener(... | [
{
"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 | examples/jmeter_listener_example.py | Maffey/locust-plugins |
def binary_search(a,k, low, high):
mid = (low+high)//2
if len(a[low:high+1]) <=1:
# print(a[low:high+1], a[0])
if a[mid] == k:
return mid
else:
return -1
if a[mid] == k:
return mid
elif a[mid] >= k:
return binary_search(a,k,low, mid... | [
{
"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 | code-everyday-challenge/n196_repeat.py | ved93/deliberate-practice-challenges |
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization.
https://arxiv.org/abs/1607.06450
"""
def __init__(self, hidden_size, eps=1e-6):
super(LayerNorm, self).__init__()
self.eps = eps
self.gamma = nn.Parameter(torch.ones(hidden_size))
... | [
{
"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 | uer/layers/layer_norm.py | krevas/ET-BERT |
from collections import UserDict
from miniworld.model.network.connections.JSONEncoder import JSONStrMixin
# TODO: REMOVE
class NodeDictMixin:
"""
"""
#########################################
# Structure Converting
#########################################
def to_ids(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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | miniworld/model/network/connections/NodeDictMixin.py | miniworld-project/miniworld_core |
import unittest
from letter_n_gram_list import letter_n_gram_list
from inc_freq import inc_freq
class TestLetterNGramList(unittest.TestCase):
def test_letter_n_gram_list(self):
ss = [
"今日は",
"今日は",
"今日は",
"今日は",
"abcd",
"abcd",
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/pre3/test.py | shimech/higashi |
import yaml
import os
# 获取当前文件路径
filePath = os.path.dirname(__file__)
# 获取当前文件的Realpath
fileNamePath = os.path.split(os.path.realpath(__file__))[0]
# 获取配置文件的路径
yamlPath = os.path.join(fileNamePath, 'config.yml')
# 加上 ,encoding='utf-8',处理配置文件中含中文出现乱码的情况
yml_read = yaml.load(open(yamlPath, 'r', encoding='utf-8').read(),... | [
{
"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 | config.py | retroxz/bilidm |
from linptech.crc8 import crc8
import logging
class Packet(object):
'''
Base class for Packet.
Mainly used for for packet generation and
Packet.parse_msg(buf) for parsing message.
parse_msg() returns subclass, if one is defined for the data type.
'''
def __init__(self, data=None, optional="00"*7):
if data i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | linptech/packet.py | yangguozhanzhao/linptech |
def tipleft():
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
forward = 18
backward = 17
GPIO.setup(forward,GPIO.OUT)
GPIO.setup(backward,GPIO.OUT)
GPIO.output(forward,1)
sleep(0.3)
GPIO.output(forward,0)
sleep(1)
GPI... | [
{
"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 | models(RaspberryPI)/research/object_detection/motortest2.py | Caitmaire/EcoBinTesting |
# -*- coding: utf-8 -*-
"""
Copyright 2020 Giuliano Franca
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 agree... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | scripts/maya/gfToolsLauncher.py | giulianofranca/gfTools |
#! /opt/stack/bin/python
# @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
import crypt
import os
import random
import time
import string
class Password:
def get_rand(self, num_bytes=16, choi... | [
{
"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 | common/src/stack/pylib/stack/password.py | sammeidinger/stack |
# -*- coding: utf-8 -*-
import irc3
from irc3.plugins.command import command
from random import choice
@irc3.plugin
class Plugin(object):
def __init__(self, bot):
self.bot = bot
@command(permission=None)
def flip(self, mask, target, args):
"""Flip a coin
%%flip
"""
... | [
{
"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 | bangbot/plugins/flip.py | Asara/bangbot3 |
class Ant(object):
last_position = None
tour = []
"""docstring for Ant"""
def __init__(self, name, initial_position):
super(Ant, self).__init__()
self.name = name
self.__position = initial_position
@property
def position(self):
return self.__position
@pos... | [
{
"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/ant.py | andaviaco/aco |
from datetime import datetime, timedelta
class Report():
def __init__(self, dbm, data):
self.now = datetime.now()
self.today = self.now.strftime('%Y-%m-%d')
self.dbm = dbm
self.report_type = data['reportType']
self.pe_id = data['peId']
self.date_from = None
i... | [
{
"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 | backend/lost/logic/report.py | Avni-Hirpara/lost |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
import solutions.day5.solver as solver
def test_solver1():
# act
output = solver.solver1([0, 3, 0, 1, -3])
# assert
assert output == 5
def test_solver1_jumps():
# arrange
jumps = [0, 3, 0, 1, -3]
# act
solver.solver1(ju... | [
{
"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 | solutions/day5/test_solver.py | NunoMCSilva/My-Advent-of-Code-2017-Solutions |
from .labels import LabelsPlugin
from electrum_blk.plugin import hook
class Plugin(LabelsPlugin):
@hook
def load_wallet(self, wallet, window):
self.start_wallet(wallet)
def on_pulled(self, wallet):
self.logger.info('labels pulled from server')
| [
{
"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 | electrum_blk/plugins/labels/cmdline.py | nedcloud-blackchain/electrum-blk |
import time
import thriftpy2
from thriftpy2.utils import serialize, deserialize
from thriftpy2.protocol import TBinaryProtocolFactory, TCyBinaryProtocolFactory
addressbook = thriftpy2.load("addressbook.thrift")
def make_addressbook():
phone1 = addressbook.PhoneNumber()
phone1.type = addressbook.PhoneType.MO... | [
{
"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 | benchmark/benchmark_struct.py | JonnoFTW/thriftpy2 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | aliyun-python-sdk-workbench-ide/aliyunsdkworkbench_ide/request/v20210121/SetAppEnvConfigRequest.py | yndu13/aliyun-openapi-python-sdk |
"""probing statistics as dict
Revision ID: 03ddf61b5b3c
Revises: 8b783114dc9a
Create Date: 2022-01-11 19:00:16.273260
"""
import sqlmodel.sql.sqltypes
# revision identifiers, used by Alembic.
from sqlalchemy.dialects.postgresql import JSON
from alembic import op
revision = "03ddf61b5b3c"
down_revision = "8b783114d... | [
{
"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 | alembic/versions/03ddf61b5b3c_probing_statistics_as_dict.py | dioptra-io/iris |
import requests
from bs4 import BeautifulSoup
def main():
url = 'http://blog.castman.net/web-crawler-tutorial/ch1/connect.html'
print(get_elem_text(url, 'p'))
print(get_elem_text(url, 'title'))
print(get_elem_text(url, 'not_exist'))
def get_elem_text(url, elem):
try:
resp = requests.get(ur... | [
{
"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 | ch1/hw_main.py | x24870/web-crawler |
import tensorflow as tf
import os
def _get_training_data(FLAGS):
''' Buildind the input pipeline for training and inference using TFRecords files.
@return data only for the training
@return data for the inference
'''
filenames=[FLAGS.tf_records_train_path+'/'+f for f in os.listdir(FLAGS.tf_... | [
{
"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/data/dataset.py | artem-oppermann/Deep-Autoencoders-For-Collaborative-Filtering |
#!/usr/bin/env python3
# Copyright (c) 2017 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test digibyte-cli"""
from test_framework.test_framework import DigiByteTestFramework
from test_framework.ut... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | test/functional/digibyte_cli.py | zejii/digibyte |
# -*- coding: utf-8 -*-
#
# This file is part of Flask-CLI
# Copyright (C) 2015 CERN.
#
# Flask-AppFactory is free software; you can redistribute it and/or
# modify it under the terms of the Revised BSD License; see LICENSE
# file for more details.
"""Flask extension to enable CLI."""
import types
from . import AppG... | [
{
"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 | env/lib/python3.8/site-packages/flask_cli/ext.py | thenack/sneaky |
from typing import Any
from ..envs.complex_simplify import ComplexSimplify
from ..types import MathyEnvDifficulty, MathyEnvProblemArgs
from .mathy_gym_env import MathyGymEnv, safe_register
class GymComplexTerms(MathyGymEnv):
def __init__(self, difficulty: MathyEnvDifficulty, **kwargs: Any):
super(GymComp... | [
{
"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": false... | 3 | mathy_envs/gym/gym_complex_simplify.py | mathy/mathy_envs |
"""empty message
Revision ID: 4432129ea292
Revises:
Create Date: 2020-05-13 18:27:44.141674
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4432129ea292'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"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 | migrations/versions/4432129ea292_.py | Brenda-M/food-booth |
from __future__ import annotations
from json import dumps, loads
from typing import Any
import attr
from ..abc import Serializer
from ..marshalling import marshal_object, unmarshal_object
@attr.define(kw_only=True, eq=False)
class JSONSerializer(Serializer):
magic_key: str = '_apscheduler_json'
dump_option... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/apscheduler/serializers/json.py | axuy/apscheduler |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTest(TestCase):
def test_wait_for_db_ready(self):
"""test waiting for db when db is available"""
with patch('django.db.utils.... | [
{
"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 | app/core/tests/test_commands.py | jingr1986/recipie-app-api |
"""This superclass represents our get_value abstract class"""
from abc import abstractmethod
from typing import List
from utils.setting import Setting
class SettingSFA(Setting):
"""Each setting (topology) has to implements methods to obtain
the bounds"""
@abstractmethod
def sfa_arr_bound(self, param... | [
{
"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 | src/utils/setting_sfa.py | paulnikolaus/python-mgf-calculator |
import discord
import config
import requests
client = discord.Client()
@client.event
async def on_ready():
for guild_id in client.guilds:
if guild_id.name == config.DISCORD_GUILD_NAME:
break
print(
f'{client.user} is connected to {guild_id.name}(id: {guild_id.id})'
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | bot.py | ijoosong/pycascadediscordbot |
from typing import List
from functools import reduce
mapping = {"F": 0, "B": 1, "L": 0, "R": 1}
def read_input(in_file: str) -> List[str]:
try:
f_desc = open(in_file, "r")
return [line.replace("\n", "") for line in f_desc.readlines()]
except IOError:
f_desc.close()
return []
... | [
{
"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 | day5/day5-part2.py | GeorgianBadita/advent-of-code-2020 |
#!/bin/python
from deap import tools
from deap import base
import promoterz
import statistics
class Locale():
def __init__(self, World, name, position, loop):
self.World = World
self.name = name
self.EPOCH = 0
self.position = position
self.EvolutionStatistics = []
... | [
{
"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 | promoterz/locale.py | caux/japonicus |
from ..core import maxsum
from ..cli import argparse
class Main:
def __init__(self):
self.args = None
def setArgs(self,args):
self.args = args
def run(self):
parser = argparse.MaxSumArgparse()
args = parser.parse(self.args)
p = maxsum.MaxSum()
p.setInteger... | [
{
"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 | maxsum/main/main.py | arunstiwari/python-docker-demo |
# -*- coding: utf-8 -*-
from sqlalchemy import event, exc, select
from sqlalchemy.engine import Connection, Engine
def pessimistic_connection_handling(some_engine: Engine) -> None:
@event.listens_for(some_engine, 'engine_connect')
def ping_connection(
connection: Connection, branch: bool
) -> Non... | [
{
"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 | raven/utils/core.py | dantin/raven |
"""Djinni manager tool"""
import os
import ezored.functions as fn
import ezored.logging as log
from ezored import constants as const
# -----------------------------------------------------------------------------
def run(params={}):
args = params['args']
if len(args) > 0:
action = args[0]
... | [
{
"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 | files/commands/djinni/djinni.py | uilianries/ezored |
#!/usr/bin/env python
import rospy,copy
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.msg import LightSensorValues
class WallStop():
def __init__(self):
self.cmd_vel = rospy.Publisher('/cmd_vel',Twist,queue_size=1)
self.sensor_values = Light... | [
{
"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 | scripts/wall_stop.py | kenjiinukai/pimouse_run_corridor |
class Animal(object):
pass
class Duck(Animal):
pass
class Snake(Animal):
pass
class Platypus(Animal):
pass
def can_quack(animal):
if isinstance(animal, Duck):
return True
elif isinstance(animal, Snake):
return False
else:
raise RuntimeError('Unknown animal!')
... | [
{
"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 | solid/3-bad-lsp.py | CtrlWebInc/montreal-django-tests |
from aleph.tests.util import TestCase
class StreamApiTestCase(TestCase):
def setUp(self):
super(StreamApiTestCase, self).setUp()
def test_entities(self):
self.load_fixtures()
res = self.client.get('/api/2/entities/_stream')
assert res.status_code == 403, res
_, heade... | [
{
"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 | aleph/tests/test_stream_api.py | jalmquist/aleph |
import numpy as np
from typing import Optional
from oneflow import Tensor
from oneflow.utils.data import Dataset
from ....types import arr_type
from ....types import arrays_type
from ....misc.toolkit import to_flow
class TensorDataset(Dataset):
def __init__(
self,
x: arr_type,
y: Optiona... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | cflow/api/cv/data/core.py | carefree0910/carefree-flow |
from quark_core_api.core import QuarkApplication
from quark_core_api.context import ApplicationContext
from quark_core_api.common import ContextInitializer
import json
import os
app_dir = os.path.expanduser("~\\")
app = QuarkApplication(ApplicationContext(app_dir, ContextInitializer.application))
location = "D:\\qua... | [
{
"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 | _test_.py | arcticle/Quark |
"""implements splash screen
taken from http://code.activestate.com/recipes/534124-elegant-tkinter-splash-screen/
"""
import time
try:
import tkinter.tix as Tix
except ImportError: # Python 2
import Tix
class SplashScreen( object ):
def __init__( self, tkRoot, imageFilename, minSplashTime=0 ):
self._r... | [
{
"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 | splash.py | migrate2iaas/free-s3drive |
#!/usr/bin/env python
import asyncio
import sys
import stream
async def process_in_term():
process = await asyncio.create_subprocess_exec(*["xterm", "-e", "./example.sh"])
print("Create called")
return await process.wait()
async def interact():
read = await stream.ainput(prompt="Koi", loop=loop),
... | [
{
"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 | async_proto.py | KoolChain/Grisou |
from django.db import models
class StatusQuerySet(models.QuerySet):
def approved(self):
return self.filter(status="approved")
def waiting(self):
return self.filter(status="waiting")
def rejected(self):
return self.filter(status="rejected")
class CommitManager(models.Manager):
... | [
{
"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 | core/cooggerapp/models/managers/commit.py | bisguzar/coogger |
import sys
from types import ModuleType
from typing import Dict
__all__ = ["MonkeyJail"]
_sys_modules: Dict[str, ModuleType] = {}
class MonkeyJail:
def __init__(self):
self.saved = {}
def __enter__(self):
from gevent import monkey
for key in list(monkey.saved) + ["selectors"]:
... | [
{
"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 | asyncio_gevent/gevent_loop/monkey_jail.py | gfmio/asyncio-gevent |
# -*- coding=utf-8 -*-
r"""
"""
def showinfo(title: str, message: str):
pass
def showwarning(title: str, message: str):
pass
def showerror(title: str, message: str):
pass
def askquestion(title: str, message: str):
pass
def askokcancel(title: str, message: str):
pass
def askyesno(title: ... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | docs/newplatform.py | PlayerG9/PyMessageBox |
class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if(len(nums)==1): return nums[0] # 1的时候不work 两个dp,一个从第一位开始,一个从倒数第二位结束
last, now = 0, 0
last1, now1 = 0, 0
for i, n in enumerate(nums):
if i<len(nums... | [
{
"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 | Dynamic Programming/213. House Robber II.py | beckswu/Leetcode |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, tools
import os
class DoctestConan(ConanFile):
name = "doctest"
version = "1.2.6"
url = "https://github.com/bincrafters/conan-doctest"
description = "C++98/C++11 single header testing framework"
license = "MIT"
export... | [
{
"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 | conanfile.py | franc0is/conan-doctest |
from manim import *
class SquareToCircle(Scene):
def construct(self):
square = Square()
circle = Circle()
self.play(Transform(square, circle))
class SceneWithMultipleCalls(Scene):
def construct(self):
number = Integer(0)
self.add(number)
for i in range(10):
... | [
{
"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 | tests/test_scene_rendering/simple_scenes.py | fargetan/manim |
from django import template
from ..forms import PlanForm
register = template.Library()
@register.inclusion_tag("drfstripe/_change_plan_form.html", takes_context=True)
def change_plan_form(context):
context.update({
"form": PlanForm(initial={
"plan": context["request"].user.customer.current_... | [
{
"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 | drfstripe/templatetags/payments_tags.py | brandon-fox/django-rest-framework-stripe |
"""xy-tag."""
import io
import os
import re
from setuptools import find_packages, setup
VERSION_RE = re.compile(r"""__version__ = ['"]([0-9b.]+)['"]""")
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*args):
"""Read complete file contents."""
return io.open(os.path.join(HERE, *args), encoding="u... | [
{
"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 | setup.py | mattsb42/xy-tag |
# coding: utf-8
from __future__ import unicode_literals
import re
from ..utils import unsmuggle_url
from .common import InfoExtractor
class JWPlatformIE(InfoExtractor):
_VALID_URL = r"(?:https?://(?:content\.jwplatform|cdn\.jwplayer)\.com/(?:(?:feed|player|thumb|preview)s|jw6|v2/media)/|jwplatform:)(?P<id>[a-zA... | [
{
"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 | nextdl/extractor/jwplatform.py | devenu85/nextdl |
import unittest
import os
from simpleh5.utilities.search_utilities import _build_search_string
class TestBuildString(unittest.TestCase):
def test_string_single(self):
query = ['strs', '==', 'abc']
match_string, uservars = _build_search_string(query)
self.assertEqual(match_string, "(n0=... | [
{
"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 | simpleh5/tests/test_simpleh5_search_util.py | ssolari/simpleh5 |
import discord
from discord.ext import commands
from x86 import helpers
class Ping:
"""Ping command"""
@commands.command()
@commands.cooldown(6,12)
async def ping(self, ctx):
"""Ping the bot"""
#heartbeat latency (i'll be honest, dont really understand how it works)
... | [
{
"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 | cogs/utils/ping.py | zz-xx/robox86 |
from PIL import Image
import matplotlib.pyplot as plt
from .annotator import Annotator
class BoxAnnotator(Annotator):
def __init__(self, annotations_limit=None, window_timeout=0):
super().__init__(annotations_limit, window_timeout)
def run(self, img_absolute_path : str):
raise NotImplemented... | [
{
"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 | annotation/annotators/box_annotator.py | mtszkw/pointpicker |
from watchmen_boot.guid.snowflake import get_surrogate_key
from watchmen.pipeline.core.dependency.graph.label import Label
from watchmen.pipeline.core.dependency.graph.node import Node
from watchmen.pipeline.core.dependency.graph.property import Property
def buildPipelineNode(pipeline):
labels = buildPipelineLabe... | [
{
"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 | watchmen/pipeline/core/dependency/model/pipeline.py | Insurance-Metrics-Measure-Advisory/watchman-data-connector |
#import PyPDF2 # PyPDF2 extracts texts from PDF markup. We found that it worked relatively poor with CVPR papers. Spaces between words are often omitted in the outputs.
import textract # textract uses external OCR command "tesseract" to extract texts. The workflow is to first convert pdf files to ppm images and then ap... | [
{
"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 | crawler/pdf.py | mental689/paddict |
import ConfigParser
import os
import sys
def irida_config():
try:
config=read_config()
confdict = {section: dict(config.items(section)) for section in config.sections()}
return confdict
except Exception as e :
print(str(e),' Could not read configuration file')
def read_config():... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | src/Config/irida_con.py | Public-Health-Bioinformatics/sequdas-upload |
"""Define the command line iterface."""
import os
import glob
def _file_path():
"""Determine the file path."""
return os.environ.get("EFI_MONITOR_FILE_PATH", "/sys/firmware/efi/efivars/dump*")
def _files():
"""Find the dump_files."""
return glob.glob(_file_path())
def check():
"""Check for efi... | [
{
"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 | efi_monitor/_cli.py | ambauma/efi-monitor |
from seminars.seminar_oop.employee import Employee
class HRRegistry:
def __init__(self, name: str, location: str):
self.name = name
self.location = location
self.registry = {}
self.counter = 1
def add_employee(self, employee: Employee):
self.registry[self.counter] = em... | [
{
"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 | seminars/seminar_oop/hr_registry.py | dmitry-uraev/programming-2021-19fpl |
import numpy as np
from scipy.io import wavfile
def normalize(data):
temp = np.float32(data) - np.min(data)
out = (temp / np.max(temp) - 0.5) * 2
return out
def make_batch(path):
data = wavfile.read(path)[1][:, 0]
return get_wavenet_data(data)
def get_wavenet_data(data, resolution=256):
d... | [
{
"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 | lib/fast-wavenet/wavenet/utils.py | rpp0/em-operation-extraction |
import unittest
from crypto_tools.stats import letter_frequency
class TestLetterFrequency(unittest.TestCase):
def test_count_empty(self):
counter = letter_frequency.LetterFrequency("")
self.assertEqual(counter.calculate(), {})
def test_count_text(self):
text = "The quick brown fox jum... | [
{
"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/test_letter_frequency.py | roccobarbi/crypto_tools |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import os... | [
{
"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 | sdk/communication/azure-communication-sms/tests/test_sms_client_e2e_async.py | vbarbaresi/azure-sdk-for-python |
# Copyright (c) 2016 SwiftStack, 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 to in w... | [
{
"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 | meta_middleware/meta_middleware/middleware.py | kevin-wyx/ProxyFS |
#
# Copyright (c) Ionplus AG and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for details.
#
from legacy import calculation_sets, routines, targets, results
class Generator(object):
def __init__(self, db_session, source_schema, target_schema, ... | [
{
"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 | legacy/generator.py | eclissi91/brahma |
class Color(object):
def __init__(self, r=255, g=255, b=255, a=255):
self.r = r
self.g = g
self.b = b
self.a = a
@property
def hex(self):
return '%0.2X%0.2X%0.2X%0.2X' % (self.a, self.r, self.g, self.b)
def __hash__(self):
return (self.a << 24) + (self.r << 16) + (self.g << 8) + (self.b)
def __eq... | [
{
"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 | pyexcelerate/Color.py | AlexHill/PyExcelerate |
from GeneralUtils import flatten
def collatz(n):
while n > 1:
yield n
if n % 2 == 0:
n = n//2
else:
n = 3*n+1
yield n
def collatz_inv(n):
if n % 6 == 4:
return 2*n, (n-1)//3
return 2*n
def collatz_inv_graph(n,levels):
S = [n]
for i in ra... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | Computation/Collatz.py | SymmetricChaos/FiniteFields |
import numpy as np
import skimage
from skimage import io, transform, exposure, data, color
from skimage.color import *
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
def unmix_purple_img(purp_img, loud=False):
"""
Accepts a purple image object as a parameter
and returns the image wi... | [
{
"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 | functions/colors.py | broadinstitute/segmentation_experiments |
import simple
class Simple2:
def __init__(self):
self.info = "SimpleClass2"
class Simple3(simple.Simple):
def __init__(self):
simple.Simple.__init__(self)
text = "text in simple"
assert simple.text == text
_s = simple.Simple()
_s3 = Simple3()
assert _s.info == _s3.info
import recursive_i... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | www/tests/test_import.py | sejalseth/brython |
import komand
from .schema import LabelIssueInput, LabelIssueOutput
# Custom imports below
class LabelIssue(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='label_issue',
description='Label Issue',
input=LabelIssueInput(),
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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | jira/komand_jira/actions/label_issue/action.py | xhennessy-r7/insightconnect-plugins |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 29 11:46:26 2022
@author: Pedro
"""
def search(lista, target) -> int:
for i in range(len(lista)):
if lista [i] == target:
return i
return -1
def search2(lista, target) -> int:
for i, element in enumerate(lista):
if element == targ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | teoria/clase 29-03/algoritmos.py | pgentil/PC |
import base64
import os
from typing import Iterator, List, Tuple
from lms.extractors.base import Extractor, File
from lms.models.errors import BadUploadFile
from lms.utils.files import ALLOWED_IMAGES_EXTENSIONS
class Imagefile(Extractor):
def __init__(self, **kwargs):
super().__init__(**kwargs)
s... | [
{
"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 | lms/extractors/imagefile.py | PureDreamer/lms |
from flask import abort, jsonify
from flask_restful import Resource
from flask_simplelogin import login_required
from test.models import Product
class ProductResource(Resource):
def get(self):
products = Product.query.all() or abort(204)
return jsonify(
{"products": [product.to_dict()... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | test/ext/restapi/resources.py | YakovBoiev/test |
from abc import ABCMeta, abstractmethod
class TemplateEngine(object):
"""
An abstract class of TemplateEngine
"""
__metaclass__ = ABCMeta
def __init__(self):
pass
def __str__(self):
return 'Abstract Engine class with file path {0}'.format(self._inputTemplatePath)
class Tem... | [
{
"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 | mkconfig/core/engine.py | mcfongtw/MkConfig |
"""Qtextedit module."""
# -*- coding: utf-8 -*-
from PyQt6 import QtWidgets # type: ignore[import]
from pineboolib.core import decorators
from typing import Optional
class QTextEdit(QtWidgets.QTextEdit):
"""QTextEdit class."""
LogText: int = 0
RichText: int = 1
def __init__(self, parent: Optional[... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | pineboolib/q3widgets/qtextedit.py | Aulla/pineboo |
from django import forms
class OAuthValidationError(Exception):
"""
Exception to throw inside :class:`OAuthForm` if any OAuth2 related errors
are encountered such as invalid grant type, invalid client, etc.
:attr:`OAuthValidationError` expects a dictionary outlining the OAuth error
as its first a... | [
{
"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 | provider/forms.py | basilfx/django-oauth2-provider |
import unittest
import atomic_neu.atomic as atomic
import numpy as np
class TestElectronCooling(unittest.TestCase):
def setUp(self):
ad = atomic.element('li')
eq = atomic.CollRadEquilibrium(ad)
self.temperature = np.logspace(0, 3, 50)
self.electron_density = 1e19
# y is a F... | [
{
"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 | atomic/tests/test_electron_cooling.py | ezekial4/atomic_neu |
#! python3
# aoc_01.py
# Advent of code:
# https://adventofcode.com/2021/day/1
# https://adventofcode.com/2021/day/1#part2
# download input data (optional, for future use)
# Count depth increase (if current num is > last: ++)
# return number of depth increases
def aoc_count_depth_increase(aoc_input):
prev_depth ... | [
{
"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 | aoc_01.py | ForestRupicolous/advent_of_code |
# Copyright 2017 Robert Csordas. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
{
"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 | Utils/lockfile.py | RobertCsordas/dnc |
import json
import pytest
from tests import async_mock
from ariespython import did
@pytest.mark.parametrize(
'mocked_method, method_to_test, before_dict, after_dict',
[
('indy.did.create_and_store_my_did', did.create_and_store_my_did, [], []),
('indy.did.create_key', did.create_key, [], []),... | [
{
"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 | tests/did/test_did.py | dbluhm/aries-sdk-python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
- author: Lkeme
- contact: Useri@live.cn
- file: AsyncioLoop
- time: 2019/9/18 12:54
- desc: 兼容不同系统的协程逻辑
"""
import asyncio
import platform
# 自动判断类型生成loop
def switch_sys_loop():
sys_type = platform.system()
if sys_type == "Windows":
loop = asyncio.Proa... | [
{
"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 | AsyncioLoop.py | lkeme/py-common-code |
from functools import wraps
from os import environ
from backends.exceptions import ErrorException
def wrap_exception(exception_type, error_message):
def _typed_exception_wrapper(func):
@wraps(func)
def _adapt_exception_types(*args, **kwargs):
try:
return func(*args, **... | [
{
"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 | backends/utils.py | DaKnOb/TorPaste |
import unittest
import utils
# O(n) time. O(n) space. Iteration.
class Solution:
def addStrings(self, num1: str, num2: str) -> str:
if len(num1) < len(num2):
num1, num2 = num2, num1
result = []
carry = 0
for i in range(len(num1)):
a = ord(num1[len(num1) -... | [
{
"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 | problems/test_0415_iteration.py | chrisxue815/leetcode_python |
import os
import sys
sys.path.append(os.path.abspath('.'))
def install():
from context_menu import menus
import modules
pyLoc = sys.executable # .replace('python.exe', 'pythonw.exe')
scriptLoc = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'main.py') # Location of ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | output/freshen/reginstall.py | saleguas/freshen-file-sorter |
from sqlalchemy import Column, create_engine, DateTime, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
Base = declarative_base()
class Pet(Base):
__tablename__ = "pets"
id = Column(String(20), primary_key=True)
name = Column(String(1... | [
{
"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 | examples/swagger2/sqlalchemy/orm.py | athenianco/especifico |
import sys
from weasyprint import HTML
def get_file_names():
if len(sys.argv) < 2:
print('HTML file name not provided')
exit
HTML_file_name = sys.argv[1]
pdf_file_name = HTML_file_name + '.pdf'
if len(sys.argv) >= 3:
pdf_file_name = sys.argv[2]
return (HTML_file_name, pdf_file_name)
def generat... | [
{
"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 | html_to_pdf.py | Shawn-Xinhai/html_to_pdf |
"""
The Program receives from the USER an INTEGER
and displays if it’s an ODD or EVEN number.
"""
# START Definition of FUNCTIONS
def valutaIntPositive(numero):
if numero.isdigit():
if numero != "0":
return True
return False
def evenOrOdd(number):
if number % 2 == 0:
return... | [
{
"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 | chap_02/exe_035_even_odd.py | aleattene/python-workbook |
import graphene
from graphene_django.types import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from graphql_relay.node.node import from_global_id
from . import models
class TransactionNode(DjangoObjectType):
class Meta:
model = models.Transaction
filter_fields = ... | [
{
"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 | backend/transaction/schema.py | elielagmay/react-budgeteer |
from models.todo import Todo
from repositories.todo_repository import todo_repository as default_todo_repository
class TodoService:
def __init__(self, todo_repository=default_todo_repository):
self._todo_repository = todo_repository
def create_todo(self, content, done=False):
return self._tod... | [
{
"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/services/todo_service.py | ohjelmistotuotanto-hy/todo-web |
from heapq import heappush, nsmallest
import numpy as np
class NearestNeighbor():
def __init__(self, embeddings, encodings, config):
self.embeddings = embeddings
self.encodings = encodings
self.config = config
def euclidian_distance(self, e1, e2):
'''
https://stackoverf... | [
{
"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 | Word2Vec/NearestNeighbor.py | bi3mer/Word2Vec |
import distutils.command.bdist_rpm as orig
class bdist_rpm(orig.bdist_rpm):
"""
Override the default bdist_rpm behavior to do the following:
1. Run egg_info to ensure the name and version are properly calculated.
2. Always run 'install' using --single-version-externally-managed to
disable eggs... | [
{
"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 | python3-virtualenv/lib/python3.8/site-packages/setuptools/command/bdist_rpm.py | bbalkaransingh23888/OrientationHack |
from typing import Iterable
__all__ = ['in_', 'not_in', 'exists', 'not_exists', 'equal', 'not_equal']
class Operator:
def __init__(self, op_name: str, op: str, value=None):
self.op = op
self.value = value
self.op_name = op_name
def encode(self, key):
return f"{key}{self.op}{s... | [
{
"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": true
},
{
... | 3 | lightkube/operators.py | addyess/lightkube |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import subprocess
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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_task.py | areitz/pants |
import pickle as plk
from sklearn import svm
from wsicolorfilter.filter import Filter
class SvmFilter(Filter):
"""Filter which assign each pixel to the nearest centroid of the model."""
def create_model(self):
return svm.LinearSVC()
def train_model(self, x, y):
# train model
se... | [
{
"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 | wsicolorfilter/svm_filter.py | mjirik/wsicolorfilter |
#
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
import numba
import numpy as np
import argparse
import time
@numba.njit()
def linear_regression(Y, X, w, iterations, alphaN):
for i in range(iterations):
w -= alphaN * np.dot(X.T, np.dot(X,w)-Y)
return w
def main():
... | [
{
"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 | examples/linear_regression/linear_regression_numba.py | uw-ipd/numba |
import pytest
from unittest import TestCase
from unittest.mock import patch
from web_crawler.utils.singleton import Singleton
from web_crawler.utils.web_crawler_logger import WebCrawlerLogger
@pytest.mark.unit_tests
@patch('web_crawler.utils.web_crawler_logger.logging')
class TestWebCrawlerLogger(TestCase):
de... | [
{
"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 | tests/unit/utils/test_web_crawler_logger.py | tul1/py-webcrawler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.