source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import pathlib
import argparse
usage_string = '''Welcome to Olymptester!
Usage:
> olymptester run|test|init [-d dirname] [-p path/to/app] [-t path/to/tests]'''
def path(s):
return pathlib.Path(s).absolute()
def validate_paths(d):
if d['mode'] in ['run', 'test']:
workdir = path(d['workdir'... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/olymptester/arg_parser.py | jrojer/easy-stdio-tester |
from core.advbase import *
from slot.a import *
from slot.d import *
def module():
return Ramona
class Ramona(Adv):
a1 = ('primed_att',0.10)
a3 = ('bc',0.13)
conf = {}
conf['slots.a'] = Summer_Paladyns()+Primal_Crisis()
conf['slots.burn.a'] = Resounding_Rendition()+Me_and_My_Bestie()
conf[... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | adv/ramona.py | slushiedee/dl |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_persistentkv
----------------------------------
Tests for `persistentkv` module.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
import os
import common
from wikipediabase import persistentkv as pkv
DATABASE = "/tmp/remove-me.... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/test_persistentkv.py | fakedrake/WikipediaBase |
import datetime
import json
from twilio.base import values
def iso8601_date(d):
"""
Return a string representation of a date that the Twilio API understands
Format is YYYY-MM-DD. Returns None if d is not a string, datetime, or date
"""
if d == values.unset:
return d
elif isinstance(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": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | whatsapp-bot-venv/Lib/site-packages/twilio/base/serialize.py | RedaMastouri/ConversationalPythonicChatBot |
import numpy as np
import sys
#define a function that returns a value
def expo(x):
return np.exp(x) #return the np e^x function
#define a subroutine that does not return a value
def show_expo(n):
for i in range(n):
print(expo(float(i))) #call the expo funtion
#define a main function
def main():
n = 10 #provi... | [
{
"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 | functions.py | vbautista379/astr-119-session-3 |
class Userinfo:
'''
class generates the users info.That is the username and password.
'''
userinfo_list = []
def save_userinfo(self):
'''
This method saves userinfo into the userinfo_list
'''
Userinfo.userinfo_list.append(self)
def delete_userinfo(self):
'''
T... | [
{
"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 | userinfo.py | kenmutuma001/Password-Locker |
import post_office
def get_email_template(name, default=None):
"""Get an email template, or fall back to use the default template object (if provided)"""
try:
return post_office.models.EmailTemplate.objects.get(name=name)
except post_office.models.EmailTemplate.DoesNotExist:
return default... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | tracker/mailutil.py | TreZc0/donation-tracker |
from logging import getLogger
import gokart
import luigi
import swifter # noqa
from dajare_detector.utils.base_task import DajareTask
from dajare_detector.preprocessing.make_kana_pattern import MakeKanaPattern
from dajare_detector.preprocessing.make_splited_pattern import MakeSplitedPattern
from dajare_detector.prep... | [
{
"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 | dajare_detector/featurize/make_decide_kana_feature.py | vaaaaanquish/dajare-detector |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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/cls)?",... | 3 | profiles_api/permissions.py | ndenisj/profiles-rest-api |
"""
Decouples SocialApp client credentials from the database
"""
from django.conf import settings
class SocialAppMixin:
class Meta:
abstract = True
# Get credentials to be used by OAuth2Client
def get_app(self, request):
app = settings.SOCIAL_APPS.get(self.id)
from allauth.social... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | oauth2/socialapp.py | DemocracyLab/DemocracyLab-CivicTechExchange |
import time
import util.testing
from modern_paste import db
class User(db.Model):
__tablename__ = 'user'
user_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
is_active = db.Column(db.Boolean)
signup_time = db.Column(db.Integer)
signup_ip = db.Column(db.Text)
username = db.Co... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | app/models/user.py | postmodern-paste/postmodern-paste |
import time
from collections import OrderedDict
class Speedometer(object):
def __init__(self, num_ema=10):
self.num_ema = num_ema
self.reset()
def reset(self):
self.total = 0
self.start = time.time()
self.last = -1
self.ema = -1
def __call__(self, count):
... | [
{
"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 | deeploader/util/speedmeter.py | cnzeki/DeepLoader |
from flask import request
from src.atm_session.atm_session import ATMSession
ATM_SESSION_HEADER = 'X-Api-ATM-Key'
def session_required(f):
def wrapped_function(*args, **kwargs):
if ATM_SESSION_HEADER not in request.headers:
return 'Unauthorized', 401
session_key = request.headers[AT... | [
{
"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 | src/api/decorators.py | josephmcgovern-wf/isu-atm-backend |
# standard
from importlib import import_module
# internal
import settings
def core_func(*args, **kwargs):
print('core_func executed with args={} + kwargs={}'.format(args, kwargs))
def set_middlewares(func):
for middleware in reversed(settings.MIDDLEWARES):
p, m = middleware.rsplit('.', 1)
mod = import_modul... | [
{
"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 | index.py | kavehkm/MiddleWareSystem |
from django.shortcuts import redirect
from django.http import HttpResponseRedirect
from django.urls import reverse
def get_post_response(view_name: str):
return HttpResponseRedirect(reverse(viewname=view_name))
def redirect_view(request):
return redirect("/hangman/")
| [
{
"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 | hangman_project/hangman_game/views/main.py | aurum86/hangman-game-py-project |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Downloads the necessary NLTK corpora for TextBlob.
Usage: ::
$ python -m textblob.download_corpora
If you only intend to use TextBlob's default models, you can use the "lite"
option: ::
$ python -m textblob.download_corpora lite
"""
import sys
from textblob.... | [
{
"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 | textblob/download_corpora.py | thachp/TextBlob |
from threading import Timer
class DeskTimer(object):
current_timer = None
def start(self, time, callback, *args):
self.current_timer = Timer(time, callback, args)
self.current_timer.start()
def stop(self):
if self.current_timer != None:
self.current_timer.cancel()
| [
{
"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 | raspi/deskTimer.py | Itera/ariot2018 |
#!/usr/bin/python3
"""Create class"""
class Square:
"""Square class"""
def __init__(self, size=0, position=(0, 0)):
"""Initialize Square"""
self.__size = size
self.position = position
"""if type(size) is not int:
raise TypeError("size must be an integer")
if... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | 0x06-python-classes/6-square.py | ricardo1470/holbertonschool-higher_level_programming |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from threading import Thread
import functools
_thread_by_func = {}
class TimeoutException(Exception):
"""
Raised when a function runtime exceeds the limit set.
"""
pass
class ThreadMethod(Thre... | [
{
"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 | utils/timeout.py | trilogy-group/kayako-dd-agent |
#!/usr/bin/env python3
import pytest
from tools import Cell
class Sample:
def __init__(self, serial, x, y, target):
self.serial = serial
self.x = x
self.y = y
self.target = target
def __str__(self):
return f'Cell at {self.x}x{self.y}, ' \
f'grid seri... | [
{
"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 | 11/test_cells.py | euribates/advent_of_code_2018 |
# -*- coding: utf-8 -*-
import pytest
from resources.models import Equipment, ResourceEquipment, EquipmentCategory
from django.urls import reverse
from .utils import check_disallowed_methods, UNSAFE_METHODS
@pytest.fixture
def list_url():
return reverse('equipmentcategory-list')
@pytest.mark.django_db
@pytest.... | [
{
"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 | resources/tests/test_equipment_category_api.py | HotStew/respa |
import torch
from torch import nn, Tensor
import math
class LearnedPositionEncoder(nn.Module):
"""
Learned Position Encoder. Takes tensor of positional indicies and converts to learned embeddings
"""
def __init__(self, n_timesteps, d_model):
super().__init__()
self.embeddor = nn.E... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
... | 3 | src/modules/position_encoder.py | JulianoLagana/MT3 |
from django.db.models import Transform
from django.db.models.lookups import PostgresOperatorLookup
from .search import SearchVector, SearchVectorExact, SearchVectorField
class DataContains(PostgresOperatorLookup):
lookup_name = 'contains'
postgres_operator = '@>'
class ContainedBy(PostgresOperatorLookup):
... | [
{
"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 | django/contrib/postgres/lookups.py | KaushikSathvara/django |
"""
Prim's Algorithm.
Determines the minimum spanning tree(MST) of a graph using the Prim's Algorithm
Create a list to store x the vertices.
G = [vertex(n) for n in range(x)]
For each vertex in G, add the neighbors:
G[x].addNeighbor(G[y])
G[y].addNeighbor(G[x])
For each vertex in G, add the edges:
G[x].addEdge(G[y]... | [
{
"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 | graphs/prim.py | KirilBangachev/Python |
"""
This module provide utilities for sms
"""
import math
def sms_is_limited(msg):
"""
:param msg: <str>
:return: <bool> True if msj contain special characters else False
"""
for i in msg:
if ord(i) > 127:
return True
return False
def sms_length(msg):
"""
:param m... | [
{
"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 | smsc/utils.py | nicoCalvo/smsc-python |
def aumentar(preco = 0, taxa = 0, format=False):
'''
:param preco:
:param taxa:
:param format:
:return:
'''
res = preco + (preco * taxa/100) # 20% do preco
return res if format is False else moeda(res)
def dimimuir(preco = 0, taxa = 0, format=False):
res = preco - (preco * taxa/100... | [
{
"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 | Mundo 3/Ex112/Utilidadescev/moeda/__init__.py | legna7/Python |
#!/usr/bin/env python
import rospy
from nav_msgs.msg import Path, Odometry
from geometry_msgs.msg import Pose, PoseStamped
from visualization_msgs.msg import Marker
class TrajectoryDrawer():
def __init__(self):
rospy.init_node('trajectory_drawer')
frequency = rospy.get_param(
'/traje... | [
{
"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 | scripts/show_trajectory.py | luruiwu/PurePursuitControllerROS |
"""For-Else, Any."""
from typing import Iterable
def tiene_pares_basico(numeros: Iterable[int]) -> bool:
"""Toma una lista y devuelve un booleano en función si tiene al menos un
número par."""
for numero in numeros:
if numero % 2 == 0:
return True
return False
# NO MODIFICAR - I... | [
{
"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 | practico_01/ejercicio_10.py | pablobots/frro-python-2021-00 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class KeyHitTestCasesPage(page_module.Page):
def _... | [
{
"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 | tools/perf/page_sets/key_hit_test_cases.py | kjthegod/chromium |
def int_hex(v):
v = hex(v)
v = v[2:]
return v
def main(v):
v = v.upper()
print(v)
main(int_hex(int(input()))) | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | 1957.py | FahimFBA/URI-Problem-Solve |
# qubit number=4
# total number=10
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(1) # number=2
pr... | [
{
"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 | data/p4VQE/R4/benchmark/startPyquil330.py | UCLA-SEAL/QDiff |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
{
"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 | decrypt_oracle/test/unit/key_providers/test_u_counting.py | seebees/aws-encryption-sdk-python |
from trecs.models.recommender import SystemStateModule
from trecs.components import PredictedUserProfiles
import numpy as np
class TestComponents:
def test_system_state(self):
profiles = PredictedUserProfiles(np.zeros((5, 5)))
sys = SystemStateModule()
sys.add_state_variable(profiles)
... | [
{
"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 | trecs/tests/test_components.py | claramaine/t-recs |
import datetime
import freezegun
from zeep import cache
def test_sqlite_cache(tmpdir):
c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
result = c.get("http://tests.python-zeep.org/example.wsdl")
assert result == b"con... | [
{
"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 | tests/test_cache.py | yvdlima/python-zeep |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...styles import Styles
class TestWriteStyleXf(unittest.TestCase):
"""
Test th... | [
{
"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 | xlsxwriter/test/styles/test_write_style_xf.py | shareablee/XlsxWriter |
# launcher for various helpful functions found in the settings.xml area
import sys
import xbmc
import xbmcgui
import xbmcvfs
import resources.lib.utils as utils
from resources.lib.authorizers import DropboxAuthorizer
from resources.lib.advanced_editor import AdvancedBackupEditor
def authorize_cloud(cloudProvider):
... | [
{
"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 | launcher.py | oldium/xbmcbackup |
import sys
import os
import boto3
import datetime
import argparse
def cleanup_s3db(args):
s3 = boto3.resource('s3', aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'], aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'], region_name=os.environ['AWS_S3_REGION_NAME'], endpoint_url=os.environ['AWS_S3_ENDPOINT_UR... | [
{
"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 | scripts/backup/s3cleanup.py | MTES-MCT/biocarburants |
"""
Exact same as gym env, except that the gear ratio is 30 rather than 150.
"""
import numpy as np
from gym.envs.mujoco import MujocoEnv
from rlkit.envs.env_utils import get_asset_full_path
class AntEnv(MujocoEnv):
def __init__(self, use_low_gear_ratio=True):
if use_low_gear_ratio:
xml_path... | [
{
"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 | rlkit/envs/mujoco/ant.py | Asap7772/railrl_evalsawyer |
def rotcir(ns):
lista = [ns]
for i in range(len(ns) - 1):
a = ns[0]
ns = ns[1:len(ns)+1]
ns += a
lista.append(ns)
return(lista)
def cyclic_number(ns):
rotaciones = rotcir(ns)
for n in range(1, len(ns)):
Ns = str(n*int(ns))
while len(Ns) != len(ns):
Ns = '0' + Ns
if Ns not in rotaciones:
ret... | [
{
"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 | pj_358.py | luisalvaradoar/pj_euler |
from merc import errors
from merc import feature
from merc import message
from merc import util
class PassFeature(feature.Feature):
NAME = __name__
install = PassFeature.install
@PassFeature.register_server_command
class Pass(message.Command):
NAME = "PASS"
MIN_ARITY = 4
def __init__(self, password, ts, ... | [
{
"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 | merc/features/ts6/pass.py | merc-devel/merc |
class RequestHandler:
def __init__(self):
pass
def preview_request(
self,
region: str,
endpoint_name: str,
method_name: str,
url: str,
query_params: dict,
):
"""
called before a request is processed.
:param string region: the ... | [
{
"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 | src/riotwatcher/Handlers/RequestHandler.py | acgandhi/Riot-Watcher |
from pyadlml.dataset._representations.raw import create_raw
from pyadlml.dataset._representations.changepoint import create_changepoint
from pyadlml.dataset.activities import check_activities
class Data():
def __init__(self, activities, devices, activity_list, device_list):
#assert check_activities(activit... | [
{
"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 | pyadlml/dataset/obj.py | tcsvn/pyadlml |
from django.shortcuts import get_object_or_404
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.views import APIView
from dualtext_api.models import Project
from dualtext_api.serializers import ProjectSerializer
from dualtext_api.permissions import MembersRead... | [
{
"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 | dualtext_server/dualtext_api/views/project_views.py | mathislucka/dualtext |
"""Utilities
Some functions were taken from
https://github.com/SimpleJWT/django-rest-framework-simplejwt/blob/master/rest_framework_simplejwt/utils.py
"""
from calendar import timegm
from datetime import datetime
from django.conf import settings
from django.utils.timezone import is_naive, make_aware, utc
from django... | [
{
"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 | rest_framework_jwk/utils.py | Maronato/django-rest-framework-jwk |
from pynput import keyboard
import time
def on_press(key):
try:
print('alphanumeric key {0} pressed'.format(
key.char))
except AttributeError:
print('special key {0} pressed'.format(
key))
def on_release(key):
print('{0} released'.format(
key))
if key == keyboard.Key.esc:
# Stop listener
return Fa... | [
{
"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 | src/temptest.py | ASH1998/SuZu |
from block_viewer.utils import decode_uint64
from block_viewer.utils import decode_varint
from block_viewer.script import Script
from binascii import b2a_hex
class Output(object):
def __init__(self,
value=None,
txout_script_length=None,
script_pubkey=None):
... | [
{
"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 | src/block_viewer/outputs.py | richarddennis/block_viewer |
# coding: utf-8
import types
class Person(object):
# 用 __slots__ 限制了动态添加属性,只能调用定义的属性
# __slots__ = {'name', 'age'}
def __init__(self, name, age):
self.name = name
self.age = age
def eat(self):
print('---eating---')
def run(self):
print('---running---')
@staticmethod
def test():
print('---static meth... | [
{
"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 | kYPython/FluentPython/BasicLearn/OOP/Dynamic.py | kyaing/KDYSample |
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.set... | [
{
"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 | Cursos/Alura/Python3_Avancando_na_orientacao_a_objetos/models_polimorfismo3.py | ramonvaleriano/python- |
import os
import secrets
from PIL import Image
from flask_blog import mail
from flask_mail import Message
from flask import current_app, url_for
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
picture_fn = random_hex + f_ext
picture_... | [
{
"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 | flask_blog/users/utils.py | dungnv2602/flask_blog_showcase |
class Value:
def __init__(self, _foo_bar):
self._foo_bar = _foo_bar
@property
def foo_bar(self):
return self._foo_bar
@staticmethod
def decode(data):
f_foo_bar = data["FooBar"]
if not isinstance(f_foo_bar, unicode):
raise Exception("not a string")
return Value(f_foo_bar)
def e... | [
{
"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 | it/structures/python2/default_naming-default/upper_camel.py | reproto/reproto |
import json
class Struct(object):
def __init__(self, data):
for name, value in data.items():
setattr(self, name, self._wrap(value))
def _wrap(self, value):
if isinstance(value, (tuple, list, set, frozenset)):
return type(value)([self._wrap(v) for v in value... | [
{
"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 | config_parser.py | benkelaci/qrcode_medicinedispenser |
import logging
import logging.config
import json
import csv
from os import write
from sqlalchemy import engine
import psycopg2
from config import *
from decouple import config
logging.config.fileConfig(logs.get('file_config'))
logger = logging.getLogger('root')
#def get_columns_from_csv_file():
# """
# Fu... | [
{
"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": tru... | 3 | Python/etl/src/functions.py | wendrewdevelop/Estudos |
# Time: O(n)
# Space: O(h), h is height of binary tree
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
# @param root, a tree node
# @return an integer
def maxDepth(self, root):
if root is None:
... | [
{
"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 | Algo and DSA/LeetCode-Solutions-master/Python/maximum-depth-of-binary-tree.py | Sourav692/FAANG-Interview-Preparation |
"""
Linear SVM
==========
This script fits a linear support vector machine classifier to random data. It
illustrates how a function defined purely by NumPy operations can be minimized
directly with a gradient-based solver.
"""
import numpy as np
from autodiff.optimize import fmin_l_bfgs_b
def test_svm():
rng =... | [
{
"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 | autodiff/examples/svm.py | gwtaylor/pyautodiff |
import os
import sys
import pytest
import shlex
import subprocess
from os_fast_reservoir.cmdline import execute
def call(cmdline, env=None, **kwargs):
if env is None:
env = os.environ.copy()
if env.get('COVERAGE', None) is not None:
env['COVERAGE_PROCESS_START'] = os.path.abspath('.coveragerc'... | [
{
"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 | tests/test_cmdline.py | cfhamlet/os-fast-reservoir |
from urllib.parse import urljoin
import requests
from ansible.plugins.action import ActionBase
NS = "lilatomic_api_http"
class ConnectionInfo(object):
def __init__(self, base):
self.base = base
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
super().run(tmp=tmp, task_vars=task_vars)... | [
{
"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 | _includes/resources/ansible_plugins/better_httpapi/1_multimethod.py | lilatomic/lilatomic.ca |
from heapq import nlargest
from typing import List
Scores = List[int]
def latest(scores: Scores) -> int:
"""The last added score."""
return scores[-1]
def personal_best(scores: Scores) -> int:
"""The highest score."""
return max(scores)
def personal_top_three(scores: Scores) -> Scores:
"""The... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | python/high-scores/high_scores.py | parkerbxyz/exercism |
from typing import Callable
import unittest
# test
from .pipe import pipe
class TestPipe(unittest.TestCase):
def test_pipe_should_return_a_function(self) -> None:
# given
def echo(x: str) -> str:
return f"echo {x}"
# when
output = pipe(echo)
# then
s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/unshell/utils/test_pipe.py | romainPrignon/unshellPy |
from PyQt4 import QtCore, QtGui
class MessageCompose(QtGui.QTextEdit):
def __init__(self, parent = 0):
super(MessageCompose, self).__init__(parent)
self.setAcceptRichText(False) # we'll deal with this later when we have a new message format
self.defaultFontPointSize = self.currentFont(... | [
{
"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 | src/bitmessageqt/messagecompose.py | coffeedogs/PyBitmessage |
import intcode
INPUT_FILE = 'day005.in'
def part1(filename):
source = intcode.load_from_file(filename)
i, o = [], []
# AC Unit input value
i.append(1)
modified = intcode.run_intcode(source, i, o)
return modified[0], i, o
def part2(filename):
source = intcode.load_from_file(filename)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python/day005.py | jrrickerson/adventofcode2019 |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, SelectField
from wtforms.validators import DataRequired, Email, Length, EqualTo
from app.models.Model import Category
def get_categories():
categories_query = Category.query.all()
categories = []
for category in c... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | app/forms/user.py | mofilamamra/APP-WILAYA |
# Copyright 2013 OpenStack Foundation
# 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 requ... | [
{
"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 | tempest/api/compute/servers/test_virtual_interfaces_negative.py | BeenzSyed/tempest |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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": "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 | mars/dataframe/reduction/custom_reduction.py | BoxFishLab/mars |
import ckan.lib.base as base
import ckan.lib.helpers as helpers
render = base.render
class MyExtController(base.BaseController):
def config_one(self):
'''Render the config template with the first custom title.'''
return render('admin/myext_config.html',
extra_vars={'title'... | [
{
"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 | ckanext/example_iconfigurer/controller.py | florianm/ckan |
"""
运算符重载 - 自定义分数类
Version: 0.1
Author: BDFD
Date: 2018-03-12
"""
from math import gcd
class Rational(object):
def __init__(self, num, den=1):
if den == 0:
raise ValueError('分母不能为0')
self._num = num
self._den = den
self.normalize()
def simplify(self):
x ... | [
{
"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 | Day01-15/code/Day09/rational.py | bdfd/Python_Zero2Hero_DS |
#!/usr/bin/env python
from __future__ import print_function
from itertools import count
import torch
import torch.nn.functional as F
POLY_DEGREE = 4
W_target = torch.randn(POLY_DEGREE, 1) * 5
b_target = torch.randn(1) * 5
def make_features(x):
"""Builds features i.e. a matrix with columns [x, x^2, x^3, x^4]."""... | [
{
"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 | regression/main.py | vinnamkim/examples |
from importlib import import_module
from inspect import isclass
import os
from os import walk
from os.path import abspath, basename, dirname, join
from sys import modules
from src.data_generator.extractors.base_extractor import BaseExtractor
__all__ = ('load_extractors',)
PROJ_DIR = abspath(join(dirname(abspath(__f... | [
{
"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_generator/extractors/utils/extractors_loader.py | BlooAM/Day-ahead-prices |
class Queue():
# Queue Initialization
def __init__(self):
self.MAX = 5
self.queue = []
# OVERFLOW CONDITION
def OVERFLOW(self):
if len(self.queue) == self.MAX:
return True
else:
return False
# UNDERFLOW CONDITION
def UNDERFLOW(self):
if len(self.queue) == 0:
return True
else:
return Fals... | [
{
"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 | Python/Data Structure/Queue/Circular Queue.py | DeWill404/Data-Structure-and-Algorithm |
class jinja:
def __init__(self):
self.name = "jinja"
self.exec = True
self.download = False
def payload_test(self):
return ["(347*21)","{{ 347*21 }}"]
def execu(self,cmd,index=-1):
payload = [
"{{ self.__init__.__globals__.__builtins__.__import__('os').popen... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | Tools/Templatemap/jinja.py | evilcater/H4cX |
import pomdp_py
class Observation(pomdp_py.Observation):
"""Defines the Observation for the continuous light-dark domain;
Observation space:
:math:`\Omega\subseteq\mathbb{R}^2` the observation of the robot is
an estimate of the robot position :math:`g(x_t)\in\Omega`.
"""
# the n... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | pomdp_problems/light_dark/domain/observation.py | VladislavHrosinkov/pomdp-py |
# Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .cascade_rcnn import CascadeRCNN
@DETECTORS.register_module()
class HybridTaskCascade(CascadeRCNN):
"""Implementation of `HTC <https://arxiv.org/abs/1901.07518>`_"""
def __init__(self, **kwargs):
super(HybridTaskCasc... | [
{
"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 | mmdet/models/detectors/htc.py | Brym-Gyimah/mmdetection |
from digsandpaper.sandpaper_utils import load_json_file
__name__ = "TypeIndexMapping"
name = __name__
class TypeIndexMapping(object):
name = "TypeIndexMapping"
component_type = __name__
def __init__(self, config):
self.config = config
self._configure()
def _configure(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | digsandpaper/coarse/generate/type_index_mapping_component.py | usc-isi-i2/dig-sandpaper |
from rest_framework import permissions
class IsAuthenticated(permissions.BasePermission):
def has_permission(self, request, view):
return (
request.user
and request.user.is_authenticated
and request.user.is_email_verified
)
class IsAuthenticatedOrReadOnly(perm... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | src/utils/api/permissions.py | jsmesami/naovoce |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Ampel-plot/ampel-plot-browse/ampel/plot/T2SVGQuery.py
# License: BSD-3-Clause
# Author: valery brinnel <firstname.lastname@gmail.com>
# Date: 15.06.2019
# Last Modified Date: 19.11.2021
# Last Modified By: v... | [
{
"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 | ampel-plot-browse/ampel/plot/T2SVGQuery.py | AmpelProject/Ampel-plot |
from typing import NoReturn
from src.contexts.photostore.photo.domain.PhotoRepository import PhotoRepository
from src.contexts.photostore.photo.domain.entities.Photo import Photo
from src.contexts.photostore.photo.domain.errors.PhotoAlreadyExistsError import PhotoAlreadyExistsError
from src.contexts.shared.Infrastruct... | [
{
"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 | src/contexts/photostore/photo/infrastructure/persistence/MinioPhotoStorePhotoRepository.py | parada3desu/python-ddd-template |
class tumblr():
scheme = 'https'
url = 'tumblr.com'
# use a text browser to avoid annoying/blocking javascript
headers = {'user-agent': 'Lynx/2.8.9dev.16 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/3.5.17'}
def getHandleUrl(self, handle):
return "{}://{}.{}".format(tumblr.scheme, handle, tumblr.url... | [
{
"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 | plugins/tumblr.py | whiteroot/SUS |
# -*- coding:utf-8 -*-
class TabSetup(object):
def __init__(self, url_name='', click_css_selector='', pause_time=1, x_offset=8, y_offset=8, try_times=20):
"""
爬虫标签页设置
:param url_name:
:param click_css_selector:
:param pause_time:暂停时间
:param x_offset:x轴方向页面偏移
... | [
{
"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 | spider/driver/base/tabsetup.py | mannuan/dspider |
from __future__ import absolute_import
import operator
from celery.concurrency import solo
from celery.utils.functional import noop
from celery.tests.case import AppCase
class test_solo_TaskPool(AppCase):
def test_on_start(self):
x = solo.TaskPool()
x.on_start()
def test_on_apply(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | venv/Lib/site-packages/celery/tests/concurrency/test_solo.py | Verckolf/MyInterfaceTest |
import os
from datetime import datetime
from pytz import timezone
from django.test import TestCase
from calendars.parsing import read_feed, get_events
class FeedTests(TestCase):
"""
When provided with an ICS feed URL, the app should be able to request the
feed content, parse the events from the feed, ch... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | tests/test_feed.py | rva-data/connector-calendars |
import tensorflow as tf
import model3 as M
import numpy as np
import resnet
import cv2
class FaceResNet(M.Model):
def initialize(self):
self.resnet = resnet.ResNet([64,64,128,256,512], [3, 4, 14, 3], 512)
def forward(self, x):
feat = self.resnet(x)
return feat
tf.keras.backend.set_learning_phase(True)
mo... | [
{
"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 | example/FaceResNet/evaluation.py | ddddwee1/SULT |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
CREDENTIALS = "credentials"
URL = "url"
USE_AUTHENTICATION = "use_authentication"
class ConnectionSchema(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"c... | [
{
"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 | elasticsearch/komand_elasticsearch/connection/schema.py | killstrelok/insightconnect-plugins |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_chart_blank04.py | Rippling/XlsxWriter-1 |
#Reyes, Kerwiwn & Navarro, Jeric
#CS - 302
import math
import numpy as np
import pandas as pd
import scipy.optimize as optim
import matplotlib.pyplot as plt
#import the data
data = pd.read_csv('Philippine_data_logistic.csv', sep=';')
data = data['total_cases']
data = data.reset_index(drop=False)
data.columns = ['Time... | [
{
"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 | logistic.py | kerwinreyes/logisticgrowthmodel |
#
# checkmatches.py
# A non-spoiler top prowrestling match finder
# list from http://www.profightdb.com/top-rated-matches.html
# For copyright see LICENSE.md
# Author: Soren Rasmussen github: scrasmussen
#
INTERWEBZ=False
from urllib.request import urlopen
from bs4 import BeautifulSoup
from random import randint
from... | [
{
"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 | wse/checkmatches.py | scrasmussen/euler-enigma |
from ui import View,Label,delay
from keyboard import get_input_context,set_view,get_selected_text
from math import *
# Python accessible eval from pythonista's PyKeys
class Out_View(View):
def __init__(self):
# Grap all the methods of View
super().__init__(self)
# Label for outputs
self.label=Label(frame=self... | [
{
"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 | Pythonista/KB_shortcuts/eval.py | walogo/Pythonista-scripts |
# -*- coding: utf-8 -*-
import numpy as np
from ctp.indexing.base import Index
class NPSearchIndex(Index):
def __init__(self):
super().__init__()
self.data = None
def build(self,
data: np.ndarray):
self.data = data
def query(self,
data: np.ndarray,
... | [
{
"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 | ctp/indexing/np.py | Vikicsizmadia/ctp |
import sys
from adafruit_mcp3xxx.analog_in import AnalogIn
from logger.Logger import Logger, LOG_LEVEL
from sensors.mcp3xxx.sensor import Sensor
# Tested using Sun3Drucker Model SX239
# Wet Water = 287
# Dry Air = 584
AirBounds = 43700
WaterBounds = 13000
intervals = int((AirBounds - WaterBounds) / 3)
class Soi... | [
{
"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 | mudpi/sensors/mcp3xxx/soil_sensor.py | icyspace/mudpi-core |
import unittest
import sys
sys.path.insert(1, '..')
import easy_gui
class GUI(easy_gui.EasyGUI):
def __init__(self, **kwargs):
self.add_widget(type='button', text='Button1', command_func=lambda e: print('Button1 working!'))
self.test_lbl = self.add_widget(type='label', text='Here\'s an awesome la... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/test_wm_attributes.py | zachbateman/easy_gui |
from flask import Flask, redirect, url_for, request, render_template
app = Flask(__name__)
@app.route('/success/<name>')
def success(name):
return 'welcome %s' % name
@app.route('/login', methods=['POST', 'GET'])
def login():
if request.method == 'POST':
user = request.form['nm']
return redire... | [
{
"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 | loginTest.py | bryanprichard13/FlaskTesting21 |
from zope.interface.common.mapping import IMapping
class ISessionDataObject(IMapping):
""" Supports a mapping interface plus expiration- and container-related
methods """
def getId():
"""
Returns a meaningful unique id for the object. Note that this id
need not the key under whic... | [
{
"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 | Products/BeakerSessionDataManager/interfaces.py | affinitic/Products.BeakerSessionDataManager |
import pymysql
import datetime
from flask import Flask, render_template, request
from cal import calday
def datepick(db_password, zone, infra, id):
conn = pymysql.connect(
host='127.0.0.1',
port=3306,
user='root',
password=db_password,
db=zone)
curs = conn.cursor()
m_... | [
{
"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 | datepick.py | manzino0705/flask |
import socket
import threading
# Connection Data
host = '127.0.0.1'
port = 3415
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((host, port))
server.listen()
clients = []
nicknames = []
def broadcast(message):
for client in clients:
client.send(message)
def handle(client):
... | [
{
"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 | server.py | mrfrosk/tcpmessanger |
from helpers import assert_equality
def plot():
import numpy as np
from matplotlib import pyplot as plt
def f(t):
s1 = np.cos(2 * np.pi * t)
e1 = np.exp(-t)
return np.multiply(s1, e1)
fig = plt.figure()
t1 = np.arange(0.0, 5.0, 0.4)
t2 = np.arange(0.0, 5.0, 0.1)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | test/test_subplots.py | dajuno/tikzplotlib |
from django.http.response import HttpResponse
from django.http import JsonResponse
from rest_framework import mixins, viewsets
import os
class NoReadModelViewSet(
# fmt: off
mixins.CreateModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
viewsets.GenericViewSet
):
"""
Only allo... | [
{
"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": true
},
... | 3 | code/backend/project_noe/views.py | rollethu/noe |
import smbl
import snakemake
import os
from ._program import *
PICARD = get_bin_file_path("picard.jar")
##########################################
##########################################
class Picard(Program):
@classmethod
def get_installation_files(cls):
return [
PICARD,
]
@cl... | [
{
"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 | smbl/prog/plugins/picard.py | karel-brinda/snakemake-lib |
import itertools
import pandas as pd
import datetime as dt
from xirr.math import xirr
import goldenowl.asset.asset
from goldenowl.portfolio.holding import Holding
class SimplePut(Holding):
def __init__(self, aName, aAsset, aStrike, aExpiry, aOTMCostFactor):
Holding.__init__(self, aName, aAsset);
se... | [
{
"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 | goldenowl/portfolio/simplePut.py | nishanth-/goldenowl |
import unittest
from unittest.mock import patch
from unittest.mock import MagicMock
from hw_diag.utilities.gcs_shipper import generate_hash
from hw_diag.utilities.gcs_shipper import upload_diagnostics
class OKResponse(object):
status_code = 200
class ErrorResponse(object):
status_code = 500
text = 'In... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | hw_diag/tests/test_gcs_shipper.py | ganey/hm-diag |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | [
{
"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 | st2common/st2common/metrics/utils.py | kkkanil/st2 |
# -*- coding: utf-8 -*-
"""Defines fixtures available to all tests."""
import pytest
from webtest import TestApp
from mall.app import create_app
from mall.database import db as _db
from mall.settings import TestConfig
from .factories import UserFactory
@pytest.fixture
def app():
"""An application for the tests... | [
{
"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 | tests/conftest.py | anngle/mall |
import functools
import inspect
import warnings
string_types = (type(b''), type(u''))
def warn_deprecation(text):
warnings.simplefilter('always', DeprecationWarning)
warnings.warn(
text,
category=DeprecationWarning,
stacklevel=2
)
warnings.simplefilter('default', DeprecationWa... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": t... | 3 | myvenv/Lib/site-packages/graphene/utils/deprecated.py | Fa67/saleor-shop |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.