source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Django
from django.test import TestCase
from django.test.client import RequestFactory
# Django Local
from recommendation.views import CustomRecommendationCreateView
from user.models import HealthProfessional
class CreateRecomendationCustomViewTeste(TestCase):
def setUp(self):
self.factory = RequestFact... | [
{
"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 | medical_prescription/recommendation/test/test_view_recommendation_custom.py | ristovao/2017.2-Receituario-Medico |
from jinja2 import Environment
class TestAnnotateBlockExtension(object):
def _render(self, template_string, **vars):
env = Environment(extensions=['j2exts.annotateblock'])
tmpl = env.from_string(template_string)
return tmpl.render(**vars)
def test_empty_body(self):
ou... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_annotateblock.py | ercpe/jinja2-extensions |
from Node import *
class Board:
'''
Initializes a row x col board of Nodes
'''
def __init__(self, row, col):
self.row = row
self.col = col
self.board = []
for i in range(row):
self.board.append([Node(i, x) for x in range(col)])
def getNode(sel... | [
{
"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 | board.py | AnikethP/Pathfinding-Visualizer |
def day01(digits, step=1):
n = len(digits)
s = 0
for i in range(n):
j = (i + step) % n
if digits[i] == digits[j]:
s += int(digits[i])
return s
def main():
with open("inputs/day01.txt") as file:
digits = file.readline().rstrip()
result = day01(digits, 1)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | day01.py | nikibobi/advent-of-code-2017 |
from pych.extern import Chapel
@Chapel()
def ex_sync():
"""
writeln("Starting!");
sync {
begin writeln("#1 line.");
begin writeln("#2 line.");
begin writeln("#3 line.");
begin writeln("#4 line.");
begin writeln("#5 line.");
}
writeln("DONE!");
"""
ret... | [
{
"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 | docs/source/examples/test_sync.py | safl/pychapel |
from copy import deepcopy
class NodeGroupDelta:
def __init__(self, node_group : 'NodeGroup', sign : int = 1, virtual : bool = False):
self.node_group = node_group.produce_virtual_copy() if (virtual and not node_group.virtual) else node_group
self._sign = sign
def enforce(self):
retu... | [
{
"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 | autoscalingsim/deltarepr/node_group_delta/node_group_delta.py | Remit/autoscaling-simulator |
class Scene(object):
def enter(self):
pass
class Engine(object):
def __init__(self, scene_map):
pass
def play(self):
pass
class Death(Scene):
def enter(self):
pass
class CentralCorridor(Scene):
def enter(self):
pass
class LaserWeaponArmory(Scene):
... | [
{
"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 | ex43_classes.py | Rajab322/lpthw |
from models import Supervisor
import unittest
class SupervisorTestCase(unittest.TestCase):
def setUp(self):
self.supervisor = Supervisor.login('Mohammad', '1234', '0123456')
self.sample = Supervisor.sample()
def test_all_data(self):
self.assertIsInstance(self.supervisor, Supervisor,
... | [
{
"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 | main.py | mhgzadeh/unit-testing-python |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 22 17:04:17 2020
@author: CC-SXF
"""
from pathwaysearch.input.input_meta import InputMeta
from pathwaysearch.rxndir import RxnDir
from pathwaysearch.reapropair import ReaProPair
class InputRhea():
"""
"""
def __init__(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 | sourcecode/pathwaysearch/input/input_rhea.py | CC-SXF/PyMiner |
def prime_controller(y):
for i in range(2,(y//2)+1):
if y%i==0:
return False
return True
def find_first_non_prime(x):
for i in range(len(x)):
if 0==prime_controller(x[i]):
return x[i]
return False | [
{
"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 | 3. Functions/3.20. First Non-Prime.py | ahmetutkuozkan/my_ceng240_exercises_solutions |
"""
MIT License
Copyright (c) 2017 Talha Can Havadar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publ... | [
{
"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 | planning/search.py | talhaHavadar/RobotLocalization |
from Crypto.Hash import HMAC, SHA256
def szyfruj():
haslo = input("Podaj hasło:")
bhaslo = haslo.encode()
h = HMAC.new(bhaslo, digestmod=SHA256)
return h.hexdigest()
def sprawdz(podpis):
haslo = input("Podaj hasło:")
bhaslo = haslo.encode()
h = HMAC.new(bhaslo, digestmod=SHA256)
return... | [
{
"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 | Spotkanie 7/le31_022_HMAC_spr.py | abixadamj/lekcja-enter-przyklady |
import base64
import hashlib
def encode_base64(input: bytes, charset: str = "utf-8") -> str:
file_bytes = base64.encodebytes(input)
return str(file_bytes, charset)
def calculate_md5(input: bytes) -> str:
return hashlib.md5(input).hexdigest()
| [
{
"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 | blob_upload/file_helpers.py | benchling/integration-examples |
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class OneHotEncoderTransformer(BaseEstimator, TransformerMixin):
def __init__(self, columns) -> None:
self.columns = columns
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
X = pd.... | [
{
"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 | bike-sharing-demand/one_hot_encoder_transformer.py | Bartosz-D3V/ml-dataset-analysis |
import sys
import logging
import socket
from typing import List
import telegram_log.handler
from yad_uploader.arguments import Arguments
def configure_logger(logger: logging.Logger, tg_token: str, tg_chat_ids: List[str]):
logger.setLevel(logging.DEBUG)
host_name = socket.gethostname()
log_format = '%(as... | [
{
"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 | yad_uploader/loggers.py | RuzzyRullezz/yad_uploader |
from django.shortcuts import render
from django.views.generic import ListView, DetailView,CreateView,UpdateView, DeleteView
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from .models import Site
# Create your views here.
def welcome(request):
context = {
'sites': Site.object... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer... | 3 | websites/views.py | wanguinjoka/Tech-Olympia |
from typing import NamedTuple
import aiohttp as _aiohttp
Number = int | float
class ShortLong(NamedTuple):
"""Represents shorthand and longhand of a unit."""
short: str
"""Shorthand form, eg '°C'"""
long: str
"""Longhandform, eg 'Celsius'"""
class _AutomaticClient:
client: _aiohttp.Client... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | src/owmpy/utils/_classes.py | ernieIzde8ski/open_weather_mappy |
import base64
import json
import numpy as np
from werkzeug.wrappers import Request, Response
import predict
def decode_audio(audio_bytes):
return np.frombuffer(base64.b64decode(audio_bytes), dtype="float32")
def make_app(estimate_func):
def app(environ, start_response):
inputs = json.loads(Request(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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | predict_api.py | jonashaag/CountNet |
import pytest
"""
This file include several configuration of answers to setup file.
Each configuration should be completed without errors to pass this tests.
"""
@pytest.mark.skip
def test_all_python_versions_deploy():
"""Test setup.py format correct for all Python versions support."""
pass
@pytest.mark.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 | tests/test_project_setups.py | insspb/python3-boilerplate |
from unittest import TestCase
from stubsGenerator import generator
from stubsGenerator import pasta2 as pasta
import os
path = r"C:\Projects\QuantConnect\JoeYuZhou\ironpython-stubs\release\stubs\QuantConnect"
class Test(TestCase):
def test_generate(self):
generator.generate(path, keep_partial=False, parti... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/test_generator.py | JoeYuZhou/ironpython-stubs |
import config
import json
import os
import errno
from typing import Dict
def read_mastermac() -> str:
with open(config.MASTERMAC_FILE, 'rb') as file:
key = file.read()
return key
def write_mastermac(key: str) -> None:
with open(config.MASTERMAC_FILE, 'wb') as file:
file.write(key.encode(... | [
{
"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 | filesystem.py | EduardoSaverin/password-manager |
# -*- coding: utf-8 -*-
"""
convnet-est-loss
"""
import pickle
def save_obj(obj, name):
with open(name + '.pkl', 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
def load_obj(name):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
| [
{
"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 | input_output.py | aaskov/convnet-est-loss |
import logging
from urllib.parse import urlsplit
import stripe
from django.conf import settings
from pretix.base.services.tasks import EventTask
from pretix.celery_app import app
from pretix.multidomain.urlreverse import get_event_domain
from pretix.plugins.stripe.models import RegisteredApplePayDomain
logger = logg... | [
{
"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 | src/pretix/plugins/stripe/tasks.py | NicsTr/pretix |
from .fixtures import *
from tenable.errors import *
def test_event_field_name_typeerror(api):
with pytest.raises(TypeError):
api.audit_log.events((1, 'gt', '2018-01-01'))
def test_event_filter_operator_typeerror(api):
with pytest.raises(TypeError):
api.audit_log.events(('date', 1, '2018-01-01... | [
{
"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 | tests/io/test_audit_log.py | oklymenok/pyTenable |
#!/usr/bin/env python
import asyncio
import os
import signal
import statistics
import tracemalloc
import websockets
from websockets.extensions import permessage_deflate
CLIENTS = 20
INTERVAL = 1 / 10 # seconds
WB, ML = 12, 5
MEM_SIZE = []
async def handler(ws, path):
msg = await ws.recv()
await ws.send... | [
{
"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 | experiments/compression/server.py | lewoudar/websockets |
# -*- coding: utf-8 -*-
"""
base.py
Base Alphabet class
@author: Douglas Daly
@date: 1/11/2017
"""
#
# Imports
#
from abc import ABCMeta, abstractmethod
#
# Class
#
class Alphabet(object, metaclass=ABCMeta):
"""
Base Alphabet Class
"""
@abstractmethod
def __init__(self):
""" Ab... | [
{
"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 | sphecius/alphabets/base.py | douglasdaly/sphecius |
from django.test import TestCase
from web_server.models import User
class UserTest(TestCase):
def create_user(self, github_username='Al Gore'):
return User.objects.create(github_username=github_username)
def test_user_creation(self):
o1 = self.create_user()
o2 = self.create_user(githu... | [
{
"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 | web_server/web_server/tests/test_model_user.py | vidyakanekal/project-vending-machine |
import unittest
import os
from web3 import Web3
proxy_url = os.environ.get('PROXY_URL', 'http://localhost:9090/solana')
proxy = Web3(Web3.HTTPProvider(proxy_url))
eth_account = proxy.eth.account.create('web3_clientVersion')
proxy.eth.default_account = eth_account.address
neon_revision = os.environ.get('NEON_REVISION'... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | proxy/testing/test_web3_clientVersion.py | nghiatomo/proxy-model.py |
lengths = {0: 0, 1: 1}
def sequenceLength(n: int) -> int:
global lengths
if n not in lengths:
if n % 2 == 0:
lengths[n] = sequenceLength(n//2) + 1
else:
lengths[n] = sequenceLength(3 * n + 1) + 1
return lengths[n]
def solution(n: int = 1000000) -> int:
result ... | [
{
"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 | project-euler/14/solution.py | gashev/algorithms |
import email
import os.path
import unittest
import sifter.parser
class TestEvaluateRules(unittest.TestCase):
EVAL_RESULTS = (
("evaluation_1.msg", "evaluation_1.rules",
[('redirect', 'Coyote@example.com')]),
("evaluation_1.msg", "evaluation_2.rules",
[('fileinto'... | [
{
"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 | sifter/t/test_evaluation.py | russell/sifter |
'''
sonicskye
bloomfilter.py
Requirements:
bitarray (https://github.com/ilanschnell/bitarray)
pybloof (https://github.com/jhgg/pybloof)
Pybloof library is used due to its built-in export and import features
These features are convenient for storing the bloom filter information to the smart contract
and import the... | [
{
"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 | bloomfilter.py | sonicskye/smart-stamp-duty-UI |
class TestDict():
def test_dict_1(self, return_dict):
cost = return_dict.get('банан')
assert cost == 1, 'Некорректная цена'
def test_dict_2(self, return_dict):
products = return_dict.keys()
assert 'яблоко' in products, 'Продукта нет в списке'
def test_dict_3(self, return_di... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tests/test_dict.py | MasterVisput/Python_QA_Otus |
import sage.rings.finite_rings.finite_field_constructor
from Structures.Field import Field
class FiniteFieldsWrapper(Field):
_galoisField = None
_p = None
_k = None
def __init__(self, p, k, var):
super(FiniteFieldsWrapper, self).__init__()
self._p = p
self._k = k
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | Structures/FiniteFieldsWrapper.py | Galieve/algebra_computacional |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successful(self):
"""Test create a new user with an email is successful"""
test_email = 'test@emailsender.com'
test_password = 'testpassword1234'
... | [
{
"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 | app/core/test/test_models.py | tiltgod/Email_sender |
# -*- coding: utf-8 -*-
import unittest.mock
import pytest
import pycamunda.incident
from tests.mock import raise_requests_exception_mock, not_ok_response_mock
def test_get_params(engine_url):
get_incident = pycamunda.incident.Get(url=engine_url, id_='anId')
assert get_incident.url == engine_url + '/incid... | [
{
"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/incident/test_get.py | asyncee/pycamunda |
class Constants:
"""Storing all constants of the project."""
_author = "muhammad abdullah"
_email = "iamabdullahmughal@gmail.com"
_version = "0.0.4"
@property
def author(self):
return self._author
@property
def email(self):
return self._email
@property
def vers... | [
{
"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 | espionage/constants.py | iAbdullahMughal/espionage |
import pydantic
from fhirzeug.generators.python_pydantic.templates.resource_header import (
camelcase_alias_generator,
)
def test_special_names():
assert camelcase_alias_generator("class_") == "class"
def test_camel_case():
assert camelcase_alias_generator("this_is_a_test") == "thisIsATest"
def test_c... | [
{
"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 | tests/pydantic/test_alias_generator.py | skalarsystems/fhir-zeug |
from ..extensions import db
from flask_login import UserMixin as FlaskLoginUser
from uuid import uuid4
from damgard_jurik import keygen
class Authority(db.Model, FlaskLoginUser):
""" Implements an Authority class that can be accessed by flask-login and
handled by flask-sqlalchemy. Any human has a unique A... | [
{
"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": true
... | 3 | cryptovote/cryptovote/models/authority.py | cryptovoting/cryptovote |
import logging
import pytest
import retrying
import sdk_cmd
import sdk_install
import sdk_marathon
import sdk_plan
import sdk_utils
from tests import config
log = logging.getLogger(__name__)
pytestmark = pytest.mark.skipif(
sdk_utils.is_strict_mode() and sdk_utils.dcos_version_less_than('1.11'),
reason="se... | [
{
"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 | frameworks/helloworld/tests/test_pre_reserved_sidecar.py | elezar/dcos-commons |
#!/usr/bin/env python
# -*- coding: gbk -*
# @auther:Hieda no Chiaki <forblackking@gmail.com>
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
class SendMail:
def __init__(self):
pass
def send(self):
username = "forblackking@gmail.com"
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | TicketHelper/Mail.py | forblackking/TicketHelper |
# Copyright 2021 Huawei Technologies Co., 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 agree... | [
{
"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 | built-in/PyTorch/Official/cv/image_object_detection/YoloV3_ID1790_for_PyTorch/tools/publish_model.py | Ascend/modelzoo |
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=100)
code = models.CharField(max_length=10, blank=True)
iacuc_number = models.CharField(max_length=25, blank=True)
description = models.CharField(max_length=255, blank=True)
sort_order = models.IntegerFiel... | [
{
"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 | ccdb/projects/models.py | thermokarst/ccdb-api |
def test_cursor_triggers_cursor_in_the_connection(open_connection):
open_connection.cursor()
open_connection._connection_handler.cursor.assert_called_once()
def test_cursor_returns_a_cursor_in_the_handler(open_connection, mocker):
cursor_mock = mocker.Mock()
open_connection._connection_handler.cursor.... | [
{
"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/connection/test_cursor.py | coverwallet/pysoni |
class Errors:
def __init__(self):
pass
def min_nonetype(self):
pass
| [
{
"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 | matfin/utils/utils.py | bailez/matfin |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | [
{
"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 | pythia/pyre/parsing/locators/SimpleFileLocator.py | willic3/pythia |
import numpy as np
from neupy import layers
from base import BaseTestCase
class ReshapeLayerTestCase(BaseTestCase):
def test_reshape_layer_1d_shape(self):
x = np.random.random((5, 4, 3, 2, 1))
input_layer = layers.Input((4, 3, 2, 1))
reshape_layer = layers.Reshape()
input_layer ... | [
{
"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 | tests/layers/test_reshape_layer.py | vishalbelsare/neupy |
# 进度显示 使您可以测量和打印迭代过程的进度。这可以通过可迭代的界面或使用手动API来完成。使用可迭代的接口是最常见的。
import ubelt as ub
from os.path import basename
class 缓存(ub.Cacher):
def __init__(self, 前缀='cache',
key="",
缓存目录="./cache/",
扩展名=".pkl",
启用=True,
信息级别=3,
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | pyefun/cacheUtil.py | nobodxbodon/pyefun |
import socket
import pickle
class Client:
def __init__(self, ip, port, recv_size = 1024, pickle = True):
self.ip = ip
self.port = port
self.recv_size = recv_size
self.pickle = pickle
self.destroyed = False
self.client = socket.socket(socket.AF_INET, soc... | [
{
"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 | aerics/client.py | Aermoss/Aerics |
# Time complexity: O(n)
# Approach: Save level order traversal and reverse the needed.
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def traverse(self, r... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | medium/Binary Tree Zigzag Level Order Traversal/solution.py | ashutosh1919/leetcode-problems |
from auxiliar import receberInt, receberFixo
import moeda
def receberPreco():
preco = float(input(f'\n\tDigite o preço: {md}'))
return preco
def receberPorcentagem():
preco = float(input('\n\tDigite a porcentagem (10 para 10%, 5 para 5%, etc): '))
return preco
# main
menu = f"""
\t {'=~'*20}=
\t :{... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | Desafios/Desafio109.py | Felix-xilef/Curso-de-Python |
"""
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import h1
from h1.model.container_image import ContainerImage
class TestContainerImage(unittest.TestCase):
"""ContainerImage unit test... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/test_container_image.py | hyperonecom/h1-client-python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_custom_resource_subresources.py | woqer/python |
from __future__ import print_function, division
from sympy.core import S, pi, Rational
from sympy.functions import hermite, sqrt, exp, factorial, Abs
from sympy.physics.quantum.constants import hbar
def psi_n(n, x, m, omega):
"""
Returns the wavefunction psi_{n} for the One-dimensional harmonic oscillator.
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | sympy/physics/qho_1d.py | ovolve/sympy |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | jdcloud_sdk/services/cps/apis/CreateLoadBalancerRequest.py | jdcloud-demo/jdcloud-sdk-python |
OntCversion = '2.0.0'
from ontology.interop.System.ExecutionEngine import GetExecutingScriptHash, GetCallingScriptHash, GetEntryScriptHash
from ontology.interop.System.Runtime import CheckWitness, GetTime, Notify, Serialize, Deserialize
ContractAddress = GetExecutingScriptHash()
def Main(opration, args):
if opra... | [
{
"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 | ExecutingEntryCallingScriptHash/contractB_compiler2.0.py | ONT-Avocados/python-template |
import abc
import os
from typing import Iterable
from inflection import underscore
import torch
from .extern import ExternNodeBase
from ..util.args import Args
from ..util.dirs import DATA_DIR
Dataset = Iterable
class DataNode(ExternNodeBase, metaclass=abc.ABCMeta):
def __init__(self, args: Args, **kwargs) -> ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | n3-torch/ffi/python/n3/node/data.py | kerryeon/n3-rs |
"""This module houses helpers to implement safe shutdown of consumers.
Module logic applies to all consumers executing in the current python environment,
on the main thread.
"""
import signal
import threading
from typing import Tuple
# Default signals that trigger a shutdown event.
DEFAULT_SHUTDOWN_SIGNALS = (signal... | [
{
"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 | src/musekafka/shutdown.py | dailymuse/musekafka-py |
# -*- coding: utf-8 -*-
import logging
import os
import tempfile
import xml.etree.ElementTree as ET
from collections import OrderedDict, defaultdict
from functools import lru_cache
import numpy as np
import torch
from detectron2.data import MetadataCatalog
from detectron2.utils import comm
from detectron2.utils.logge... | [
{
"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 | non_fnv/fsdet/evaluation/grocery_evaluation.py | hariharan98m/tf-grocery-object-detection |
def to_snake_case(name: str) -> str:
return name.lower().replace("-", "_")
def to_camel_case(name: str) -> str:
words = to_snake_case(name).split("_")
title_cased = map(lambda word: word.title(), words)
return "".join(title_cased)
def strip(c: str) -> str:
return c.strip()
def non_blank(c: str... | [
{
"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 | skit_pipelines/utils/normalize.py | skit-ai/skit-pipelines |
"""
File: newton.py
Project 6.9
Compute the square root of a number (uses recursive function with
default second parameter).
1. The input is a number, or enter/return to halt the
input process.
2. The outputs are the program's estimate of the square root
using Newton's method of successive approximations, and
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | Exercises/6.9.py | patcharinka/15016406 |
from django.shortcuts import render
from django.http import JsonResponse
from django.core.files.storage import FileSystemStorage
import requests
# Create your views here.
def cnn(request):
return render(request, 'CNN/cnn.html')
def change(request):
##########################################################... | [
{
"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 | CNN/views.py | suyongeum/PML |
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import torch_glow
from torch_glow import InputMeta, CompilationOptions, GlowCompileSpec
import torch
class Model(torch.nn.Module):
def __init__(self):
super(Model, self).__init__()
... | [
{
"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 | torch_glow/tests/functionality/randomize_constants_test.py | dreiss/glow |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit(
(nb.i8[:], nb.i8[:]),
cache=True,
)
def solve(
a: np.array,
b: np.array,
) -> typing.NoReturn:
mod = 998_244_353
m = 1 << 13
n = a.size
idx = np.argsort(a)
a, b = a[idx], b[idx]
dp = np.zeros(m, dtype=np.int64)
s = 0... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/atcoder/abc216/f/sol_3.py | kagemeka/competitive-programming |
import codecs
import gnupg
gpg = gnupg.GPG(gnupghome='/home/robert/.gnupg')
class Decryptor:
def __init__(self, filename='pphrase.txt'):
self.__pphrase = self.load_passphrase(filename)
def decrypt(self, data):
decrypted_data = gpg.decrypt(data, passphrase=self.__pphrase)
return decr... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | src/word-cnn/decryptGnupg.py | robrtd/ml-text-classification |
from IPython.lib.deepreload import reload as dreload
import PIL, os, numpy as np, threading, json, bcolz, scipy
import pandas as pd, pickle, string, sys, re, time, shutil, copy
import seaborn as sns, matplotlib
from abc import abstractmethod
from functools import partial
from pandas_summary import DataFrameSummary
from... | [
{
"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 | code_summarization_transfer_learning/fastai/courses/dl1/fastai/imports.py | chnsh/deep-semantic-code-search |
from faster_rcnn.rpn_msr.anchor_target_layer_2 import AnchorTargerLayer
import unittest
class AnchorTargerLayerTest(unittest.TestCase):
"""docstring for AnchorTargerLayerTest"""
def setUp(self):
self.anchor_scales = [8, 16, 32]
self.layer = AnchorTargerLayer(
[16, ], anchor_scales... | [
{
"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 | test/test_anchor_target_layer.py | anhlt/faster_rcnn |
from __future__ import annotations
from numpy import int32
from pentagram.interpret.block import interpret_block
from pentagram.interpret.test import init_test_frame_stack
from pentagram.machine import MachineExpressionStack
from pentagram.machine import MachineFrameStack
from pentagram.machine import MachineNumber
fr... | [
{
"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 | bootstrap/pentagram/interpret/block_test.py | pentagram-lang/pentagram |
import logging
from dataclasses import dataclass
async def download_web_page(url: str) -> None:
logging.info("Downloading web page: %s", url)
def _handle_web_page(web_page_url: str) -> str:
return f"✅ Processed web page: {web_page_url}"
def _process_message(update_message_text: str) -> str:
if update_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/tele_muninn/message_processor.py | namuan/tele-muninn |
from django.template.defaulttags import register
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter
def get_item_dict(dictionary, key):
return {'data': dictionary.get(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": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | course_api/templatetags/time_converter.py | dragonbone81/bobcat-courses-backend |
import random
import re
from pylatex import NoEscape, Subsection, Enumerate
simbolo_variable = '&'
class InstanciaEjercicio:
titulo = None
def __init__(self, titulo, problema, respuesta, distractores, parametros, formulas):
vars_instanciadas = {}
for nombre, parametro in parametros.items():
vars_instanci... | [
{
"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 | instancia_ejercicio.py | squiel91/FADU-PP |
import logging
import time
from functools import wraps
def logger(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
start_time = time.time()
logging.debug('About to run %s' % fn.__name__)
try:
return fn(*args, **kwargs)
except Exception as error:
raise error... | [
{
"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 | cushyPostIntegration/logger_decorator.py | Amedeo91/cushypost_integration |
from collections import defaultdict
from threading import local
import pymantic.primitives
class BaseParser(object):
"""Common base class for all parsers
Provides shared utilities for creating RDF objects, handling IRIs, and
tracking parser state.
"""
def __init__(self, environment=None):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | pymantic/parsers/base.py | machallboyd/pymantic |
from constants import *
from gateway_protocol import Gateway
from api import DiscordAPI
import bot_config as config
import logging as log
log.basicConfig(encoding='utf-8', level=log.DEBUG)
class Bot(object):
def __init__(self, token):
self.g = Gateway(token)
self.api = DiscordAPI(token)
de... | [
{
"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 | bot.py | phy1um/tmtc-discord-bot |
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("instance")
def test_iptables_filter(host):
cmd = host.run_expect(
expected=[0],
command="iptables --table filter --list-rules",
... | [
{
"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 | molecule/check-iptables-nat/tests/test_default.py | Akanoa/ansible-role-docker |
import json
from collections import OrderedDict
from keycloak.admin import KeycloakAdminBase
POLICY_TYPES = {
'role'
}
class Policies(KeycloakAdminBase):
_paths = {
'collection': '/auth/admin/realms/{realm}/clients/{'
'client_id}/authz/resource-server/policy?permission'
... | [
{
"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 | src/keycloak/admin/policies.py | syedqamar/python-keycloak-client |
from selenium import webdriver
import unittest
from page_objects import *
import subprocess
class SeleniumMixin(unittest.TestCase):
def assertElementIsPresentById(self, elem_id):
try:
self.driver.find_element_by_id(elem_id)
except NoSuchElementException as error:
self.fail(... | [
{
"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 | aps_load/load_test_file_create_tender.py | lesiavl/selenium_perfomance_tests |
from . import base
__all__ = ['SMAPE']
class SMAPE(base.MeanMetric, base.RegressionMetric):
"""Symmetric mean absolute percentage error.
Examples
--------
>>> from river import metrics
>>> y_true = [0, 0.07533, 0.07533, 0.07533, 0.07533, 0.07533, 0.07533, 0.0672, 0.0672]
>>> y_pred = [0, ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | river/metrics/smape.py | brcharron/creme |
# -*- coding: utf-8 -*-
import glob
import os
from PIL import Image
def image_size(img):
im = Image.open(img)
return im.size[0], im.size[1]
def fill_up_top_left(img, max_w, max_h):
dst = Image.new("RGB", [max_w, max_h], "black")
src = Image.open(img)
w, h = src.size[0], src.size[1]
dst.paste... | [
{
"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 | fill_up.py | X-CCS/remove-watermarks |
from qfengine.exchange.exchange import Exchange
import datetime
class SimulatedExchange(Exchange):
"""
The SimulatedExchange class is used to model a live
trading venue.
It exposes methods to inform a client class intance of
when the exchange is open to determine when orders can
be executed.
... | [
{
"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 | exchange/simulated.py | jp-quant/qfengine |
import urllib2
import json
import MySQLdb
# Function to fetch json of reddit front page
def fetch():
link = "https://www.reddit.com/.json"
# Get the text version
text = urllib2.urlopen(link).read()
# Turn it into a dictionary
data = json.loads(text)
return data
# Returns a list of tuples of ... | [
{
"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 | json_scraping_sample.py | ADSA-UIUC/DataCollection |
from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestCustomScimetaEndpoint(HSRESTTestCase):
def setUp(self):
super(TestCustomScimetaEndpoint, self).setUp()
self.rtype = 'GenericResource'
self.title = 'My Test resource'
... | [
{
"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 | hs_core/tests/api/rest/test_custom_scimeta.py | hydroshare/hydroshare |
from django.db import models
from django.test import TestCase
from django_logic.process import ProcessManager, Process
from django_logic.transition import Transition
class FirstProcess(Process):
process_name = 'first_process'
queryset = models.Manager() # fake it to pass init
transitions = [
Tra... | [
{
"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_managers.py | kishorehariram/django-logic |
from pytest_voluptuous import Partial, S
def test_retrieve_supported_tags_response_status_code_is_200(client, recipient_id):
"""
GIVEN a client
WHEN retrieving the list of supported tags
THEN the status code of the response is 200
"""
response = client.retrieve_supported_tags()
assert resp... | [
{
"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 | fbotics/tests/client/test_retrieve_supported_tags.py | pasmod/fbotics |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
DEFAULT_IP = '0.0.0.0'
DEFAULT_PORT = '5000'
def format_request(service,
locs,
ip = DEFAULT_IP,
port = DEFAULT_PORT):
req = 'http://' + ip + ':' + port + '/'
req += service + '/v1/car/'
for loc in ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/utils/osrm.py | sashakh/vroom-scripts |
from functools import lru_cache
from sqlalchemy.orm.attributes import InstrumentedAttribute
from sqlalchemy.orm.properties import ColumnProperty
from .db import db
class CRUDable(object):
@classmethod
def create(cls, fields):
instance = db.add(cls())
instance.set_fields(fields)
return... | [
{
"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 | src/crud.py | ivotkv/flapi |
# -*- coding: utf-8 -*-
try:
from StringIO import StringIO
except ImportError:
from io import StringIO # New stdlib location in 3.0
from . import _unittest as unittest
from .common import TempDirTestCase
from toron.graph import Graph
from toron._gpn_node import Node
from toron import IN_MEMORY
class TestIn... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | tests/test_graph.py | shawnbrown/toron |
import typer
from typing import Optional
from article_ripper import get_document, html_to_md
app = typer.Typer()
@app.command()
def fun(url: str, out: Optional[str] = None) -> None:
doc = get_document(url)
doc_summary = doc.summary()
if out is None:
print(doc_summary)
else:
with open(... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | src/article_ripper/cli.py | nozwock/article-ripper |
import collections
import datetime
import time
import anyio
from ralisem.base import TimeRateLimitSemaphoreBase
class FixedNewPreviousDelaySemaphore(TimeRateLimitSemaphoreBase):
def __init__(self, access_times: int, per: datetime.timedelta):
TimeRateLimitSemaphoreBase.__init__(self, access_times, per)
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | ralisem/impls.py | deknowny/rate-limit-semaphore |
# coding: utf-8
"""
convertapi
Convert API lets you effortlessly convert file formats and types. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import cloudmersive_convert_api_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | test/test_docx_set_header_request.py | Cloudmersive/Cloudmersive.APIClient.Python.Convert |
from __future__ import print_function
def str_aec(text, color):
"""Returns text wrapped by the given ansi color code"""
AEC_COLORS = {
'black': (0, 30),
'red': (0, 31),
'green': (0, 32),
'yellow': (0, 33),
'blue': (0, 34),
'purple': (0, 35),
'cyan': (0, ... | [
{
"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 | capstone/utils/aec.py | davidrobles/mlnd-capstone-code |
import unittest
from thrift.transport.TTransport import TTransportException
from sql_assurance.connectors.connection import ConnectionPool
from sql_assurance.connectors.connection import ConnectionFactory
class TestConnectionFactory(unittest.TestCase):
def setUp(self):
self.connection_factory = Connectio... | [
{
"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/sql_assurance/connectors/test_connection.py | sql-assurance/sql-assurance |
import psycopg2
from funcionario import Funcionario
class FuncionarioDAO():
def conectar(self):
banco = "dbname=flask user=postgres password=postgres host=localhost port=5432"
return psycopg2.connect(banco)
def buscarFuncionario(self, codigo):
conexao = self.conectar().cursor()
... | [
{
"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 | flask-init/database/DAOs/funcionarioDAO.py | lucasdefelippe/ds2 |
def test_movie_taglines_if_single_should_be_a_list_of_phrases(ia):
movie = ia.get_movie('0109151', info=['taglines']) # Matrix (V)
taglines = movie.get('taglines', [])
assert taglines == ["If humans don't want me... why'd they create me?"]
def test_movie_taglines_if_multiple_should_be_a_list_of_phrases(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | imdbpy-master/tests/test_http_movie_taglines.py | camillesanchez/history-movie-index2 |
class QuizBrain:
def __init__(self, questions):
self.question_no = 0
self.score = 0
self.questions = questions
self.current_question = None
def has_more_questions(self):
"""To check if the quiz has more questions"""
return self.question_no < len(self.qu... | [
{
"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 | quiz_brain.py | ashutoshkrris/GUI-Quiz-Tkinter |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import get_fullname, now
from frappe.model.document import Document
class AuthenticationLog(Document):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | frappe/core/doctype/authentication_log/authentication_log.py | lukptr/frappe-v7.2.23 |
"""
Tests for sulfur.
"""
import unittest
from armi.materials.tests.test_materials import _Material_Test
from armi.materials.sulfur import Sulfur
class Sulfur_TestCase(_Material_Test, unittest.TestCase):
MAT_CLASS = Sulfur
def setUp(self):
_Material_Test.setUp(self)
self.mat = Sulfur()
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | armi/materials/tests/test_sulfur.py | mgjarrett/armi |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
# Create your tests here.
class IndexViewsTestCase(TestCase):
def setUp(self):
self.cliente = Client()
self.url = reverse('index')
def tearDown(self):
pass
def test_status_code(self):
re... | [
{
"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 | core/tests/test_views.py | edwildson/djangosecommerce |
__all__ = ["open", "Segy", "StructuredSegy"]
from pathlib import PurePath
from typing import Optional, Union
import urlpath
import tiledb
from .structured import StructuredSegy
from .unstructured import Segy
URI = Union[str, PurePath]
def open(uri: URI, config: Optional[tiledb.Config] = None) -> Segy:
uri = ... | [
{
"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 | tiledb/segy/__init__.py | TileDB-Inc/tilesegy |
#!/usr/bin/env python
"""Limits Example
Demonstrates limits.
"""
from sympy import exp, log, Symbol, Rational, sin, limit, sqrt, oo
def sqrt3(x):
return x ** Rational(1, 3)
def show(computed, correct):
print("computed:", computed, "correct:", correct)
def main():
x = Symbol("x")
show(limit(sqr... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | examples/beginner/limits_examples.py | msgoff/sympy |
import unittest
from code import instance as i
from code import datamapping as dm
class TestProblemInstance(unittest.TestCase):
def setUp(self):
raw_data = dm.Importer()
raw_data.import_data("./tests/cvrp1.test")
data = dm.DataMapper(raw_data)
self.problem = i.ProblemInstance(dat... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/tests_instance.py | Antash696/VRP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.