source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
def adder(y):
def addsome(x):
return x +y
return addsome
add1 = adder(1)
add2 = adder(2)
| [
{
"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 | win_max_path_error/example.py | stefano-m/pip_issue_2892 |
import pandas as pd
import numpy as np
from time import time
import sys
class StateBasedBucketer(object):
def __init__(self, encoder):
self.encoder = encoder
self.dt_states = None
self.n_states = 0
def fit(self, X, y=None):
dt_encoded = 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | bucketers/StateBasedBucketer.py | pagun12/predictive-monitoring-benchmark |
from enum import Enum
import pandas as pd
from typing import Dict
import json
class SupportedDataTypes(Enum):
number_type = 1
string_type = 2
list_type = 3
bool_type = 4
def is_bool(value) -> bool:
return str(value).lower() in ["true", "false"]
def is_number(value) -> bool:
try:
fl... | [
{
"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/dashify/visualization/controllers/cell_data_types.py | SofiaTraba/dashifyML |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Rachid and Kimia
"""
import numpy as np
def gammatone_function(resolution, fc, center, fs=16000, n=4, b=1.019):
"""Define a single gammatone function"""
t = np.linspace(0, resolution-(center+1), resolution-center)/fs
g = np.zeros((resolution,))... | [
{
"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 | gammatone_utils.py | iriproff/AuditoryCoding |
from turtle import Turtle
import random
class Food(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.penup()
self.shapesize(stretch_len=0.5, stretch_wid=0.5)
self.color("blue")
self.speed("fastest")
self.refresh()
def refresh(se... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | snake_game/food.py | ProsperousRF/100DaysOfPython |
def main():
with open('in.txt') as file:
card_pubkey, door_pubkey = map(lambda n: int(n), file.read().splitlines())
print('card public key:', card_pubkey)
print('door public key:', door_pubkey)
print('card loop size:', card_loop_size := get_loop_size(card_pubkey))
print('door loop size:', ... | [
{
"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 | 2020/day25/day25.py | ChrisCh7/advent-of-code |
import typing
from marshmallow.base import SchemaABC
if typing.TYPE_CHECKING:
from commercetools.client import Client
class AbstractService:
def __init__(self, client: "Client") -> None:
self._client = client
self._schemas: typing.Dict[str, SchemaABC] = {}
def _serialize_params(self, pa... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | src/commercetools/services/abstract.py | labd/commercetools-python-sdk |
#!/usr/bin/env python3
# Copyright (c) 2012-2021 The PIVX developers
# Copyright (c) 2020-2021 The PENGOLINCOIN developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Simple test checking chain movement after v5 enforcement.... | [
{
"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 | test/functional/mining_v5_upgrade.py | pengolincoin/PengolinCoin-Core |
import toml
from os.path import join, abspath, dirname
import sys
import re
root = abspath(join(dirname(__file__), ".."))
def update_cargo(ver):
path = join(root, "Cargo.toml")
raw = toml.load(path)
raw['package']['version'] = ver
with open(path, "w") as f:
toml.dump(raw, f)
def update_pypr... | [
{
"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 | scripts/release.py | npapapietro/liesym |
import asyncio
from smbus2_asyncio import SMBus2Asyncio
from brick.device import Device, register_device
from brick.hardware.i2c import i2c_manager
@register_device()
class I2CDetect(Device):
def __init__(self, i2c_bus=0, **kwargs):
super().__init__(**kwargs)
self.bus = i2c_manager.get_bus(i2c_bus... | [
{
"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 | brick/device/i2c.py | madron/brick-iot |
import datetime
import aiohttp
import os
import time
import math
from download_from_url import get_size, time_formatter
async def progress(current, total, event, start):
"""Generic progress_callback for both
upload.py and download.py"""
now = time.time()
diff = now - start
if round(diff % 1.00) == ... | [
{
"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 | file_handler.py | oktest145/heroku-Transfer.shUploader |
# Link for the problem : https://leetcode.com/problems/next-permutation/
class Solution(object):
def nextPermutation(self, nums):
found = False
i = len(nums)-2
while i >=0:
if nums[i] < nums[i+1]:
found =True
break
i-=1
if not found:
... | [
{
"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 | DSA 450 GFG/next_permutation.py | siddhi-244/CompetitiveProgrammingQuestionBank |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | src/solutions/common/migrations/re_generate_loyalty_exports.py | goubertbrent/oca-backend |
import pdb
import numpy as np
import nose
import cudamat as cm
import learn as cl
def setup():
cm.cublas_init()
def teardown():
cm.cublas_shutdown()
def test_mult_by_sigmoid_deriv():
m = 256
n = 128
c_targets = np.array(np.random.randn(m, n)*10, dtype=np.float32, order='F')
c_acts = np.array(... | [
{
"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 | test_learn.py | qipeng/cudamat |
import math
import numpy as np
def change_sample_rate(buffer: np.ndarray, current, target) -> np.ndarray:
shape = [0, 0]
shape[0] = buffer.shape[0]
# RATEo = SAMPLESo
# RATEm = (SAMPLESo / RATEo) * RATEm
extend = target / current
shape[1] = int(math.ceil(buffer.shape[1] * extend))
convert... | [
{
"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 | formats/sound/sample_transform.py | C3RV1/LaytonEditor |
def check_kwargs(input_kwargs, allowed_kwargs, raise_error=True):
"""Tests if the input `**kwargs` are allowed.
Parameters
----------
input_kwargs : `dict`, `list`
Dictionary or list with the input values.
allowed_kwargs : `list`
List with the allowed keys.
raise_error : `bool... | [
{
"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": fals... | 3 | sora/config/input_tests.py | rcboufleur/SORA |
from typing import Dict
import json
import pickle
from os.path import isabs, abspath, exists
import sys
from pathlib import Path
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def read_json(path: str) -> Dict:
absolute_path = path if isabs(path) else abspath(path)
absolute_path = abs... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | qubot/utils/io.py | anthonykrivonos/qubot |
# -*- coding: utf-8 -*-
# --------------------------
# Copyright © 2014 - Qentinel Group.
#
# 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/LIC... | [
{
"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 | QWeb/internal/user.py | kivipe/qweb |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..utils import (
get_cart_data_for_checkout, get_taxes_for_cart,
update_delivery_address_in_anonymous_cart, update_delivery_address_in_cart)
def anonymous_user_delivery_address_view(request, cart):
"""Display... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | remote_works/checkout/views/delivery.py | tetyanaloskutova/saleor |
from test.integration.base import DBTIntegrationTest
class SourceSchemaTest(DBTIntegrationTest):
def test_dependencies(self):
self.run_dbt(["run"])
results = self.run_dbthelper(["show_upstream", "d"])
self.assertTrue(len(results) == 5)
results = self.run_dbthelper(["show_downstream... | [
{
"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 | test/integration/006_source_schema_test/test_source_schemas.py | bastienboutonnet/dbt-helper |
import pytest
from .factories import PhoneNumberFactory, ReceivedMessageFactory
from .utils import FakeTwilioClient
from apps.twilio_integration.models import PhoneNumber, ReceivedMessage
from apps.users.tests.factories import UserFactory
MODULE_TO_TEST = "apps.twilio_integration.models"
@pytest.fixture
def Patched... | [
{
"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 | streetteam/apps/twilio_integration/tests/models_test.py | alysivji/street-team |
class Mammal:
__kingdom = "animals"
def __init__(self, name, type, sound):
self.name = name
self.type = type
self.sound = sound
def make_sound(self):
return f"{self.name} makes {self.sound}"
def get_kingdom(self):
return Mammal.__kingdom
def info(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | Encapsulation - Lab/Mammal.py | DiyanKalaydzhiev23/OOP---Python |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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
#
# U... | [
{
"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 | qiskit/extensions/standard/x.py | NickyBar/QIP |
import unittest
import numpy as np
from pyinterpolate.transform.prepare_kriging_data import prepare_kriging_data
class TestPrepareKrigingData(unittest.TestCase):
def test_prepare_kriging_data(self):
EXPECTED_NUMBER_OF_NEIGHBORS = 1
EXPECTED_OUTPUT = np.array([[13, 10, 9, 3]])
unknown_pos ... | [
{
"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 | pyinterpolate/test/transform/test_prepare_kriging_data.py | DataverseLabs/pyinterpolate |
r"""
Check for phitigra
"""
from . import PythonModule
class Phitigra(PythonModule):
r"""
A :class:`sage.features.Feature` describing the presence of phitigra.
Phitigra is provided by an optional package in the Sage distribution.
EXAMPLES::
sage: from sage.features.phitigra import Phitigra
... | [
{
"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 | src/sage/features/phitigra.py | LaisRast/sage |
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import pgettext_lazy
from ...error_codes import PaymentErrorCode
from ...interface import PaymentData
class BraintreePaymentForm(forms.Form):
amount = forms.DecimalField()
# Unique transaction identifie... | [
{
"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 | saleor/payment/gateways/braintree/forms.py | cck197/saleor |
import opentracing
from signalfx_tracing import utils
from wrapt import wrap_function_wrapper
from aioredis_opentracing import tracing
config = utils.Config(
tracer=None,
)
def instrument(tracer=None):
aioredis = utils.get_module('aioredis')
if utils.is_instrumented(aioredis):
return
tracin... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | aioredis_opentracing/instrument.py | Creativelair/AIORedis-Opentracing |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenPublicAccountResetResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenPublicAccountResetResponse, self).__init__()
self._agreement_id = None
... | [
{
"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 | alipay/aop/api/response/AlipayOpenPublicAccountResetResponse.py | snowxmas/alipay-sdk-python-all |
import re
from collections import defaultdict
from openpyxl import load_workbook
class TargetScanDB :
def __init__(self):
self.elems = []
self.gene2mirnas = defaultdict(list)
def make_dictionary(self):
for elem in self.elems:
self.gene2mirnas[elem[0]].append(elem)
... | [
{
"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": false... | 3 | python/analysis/TargetScanDB.py | mjoppich/miRExplore |
import os
import sys
import logging
logging.basicConfig(format='%(asctime)s %(levelname)-8s [%(process)d] %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
from sklearn import preprocessing
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import accuracy_score
_c... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | examples/spam_trainer.py | havanagrawal/ml-from-scratch |
import threading
import logging
import socket
import random
import time
from ..config import Config
from .peer import Peer
logger = logging.getLogger('tezpie')
class PeerPool:
def __init__(self, identity):
self.identity = identity
self.socket_listen = None
self.peers = {}
self.discoveredNodes = []
def loo... | [
{
"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 | tezpie/p2p/peer_pool.py | dakk/tezpie |
import irc3
from irc3.plugins.command import command
@irc3.plugin
class Plugin:
def __init__(self, bot):
self.bot = bot
print("yt loaded")
@irc3.event('^(@(?P<tags>\S+) )?:(?P<nick>\S+)(?P<mask>!\S+@\S+) PRIVMSG (?P<channel>\S+) :\.yt\s+(?P<target>.*?)$')
def yt(self, nick=None, mask=None, channel=None,... | [
{
"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 | plugins/yt.py | ctburley/akesho-irc3 |
import json
f = open('./db/dictionary_alpha_arrays.json')
data = json.load(f)
"""
Trie: https://leetcode.com/problems/implement-trie-prefix-tree/
"""
class TNode(object):
def __init__(self, val=None):
self.val = val
self.children = {}
self.is_word = False
class Trie(object... | [
{
"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 | dictionary.py | maximmai/wordle-helper |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test p2p mempool message.
Test that nodes are disconnected if they send mempool messages when bloom
fi... | [
{
"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 | test/functional/p2p_mempool.py | BramandUn/PALLY1 |
from django.apps import AppConfig
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from pretix import __version__ as version
class BankTransferApp(AppConfig):
name = 'pretix.plugins.banktransfer'
verbose_name = _("Bank transfer")
class PretixPlu... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | src/pretix/plugins/banktransfer/__init__.py | upsidedownpancake/pretix |
from typing import List
import pandas as pd
def tagmap(word: str) -> str:
if word in [".", ";", "!"]:
return "PERIOD"
if word == "?":
return "QUESTION"
if word in [",", ":", '-']:
return "COMMA"
else:
return "O"
def replacing(sentence: str) -> str:
return sentenc... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | punctuator/utils.py | hayata-yamamoto/punctuator-pytorch |
# -*- coding: utf-8 -*-
"""Document engine here.
Copyright (C) 2020, Auto Trader UK
Created 15. Dec 2020 14:45
"""
from pathlib import Path
from typing import List, Union
import olivertwist
from olivertwist.config.model import Config, Severity
from olivertwist.manifest import Manifest
from olivertwist.ruleengine.dis... | [
{
"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 | olivertwist/ruleengine/engine.py | octoenergy/oliver-twist |
from abc import ABC, abstractmethod
class MinhaABC(ABC):
@abstractmethod
def meu_metodo_de_exemplo(self):
...
@classmethod
@abstractmethod
def meu_metodo_de_classe(self):
...
@staticmethod
@abstractmethod
def meu_metodo_estático(self):
...
@abstractmetho... | [
{
"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 | codigo/Live69/exemplo_1.py | cassiasamp/live-de-python |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from conte... | [
{
"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/python/pants_test/tasks/test_roots.py | WamBamBoozle/pants |
import time
import os
import sys
import urllib
import urllib.request
print('Start')
sys.stdout.flush()
os.chdir('/usr/share/horovod')
def get_init():
ftp_flag = False
while not ftp_flag:
try:
urllib.request.urlretrieve('http://172.18.29.81/ftp/script/local_init.py', '/usr/share/horovod/loc... | [
{
"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/start.py | ReyRen/k8sMLer-client-go |
from django.conf.urls import url
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from django.urls import include, path, re_path
from .. import views
def repath_view(request):
return HttpRes... | [
{
"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 | tests/contrib/django/django_app/urls.py | uniq10/dd-trace-py |
import json
import base64
from tests import TestBase
class TestAuth(TestBase):
def setUp(self):
super(TestAuth, self).setUp()
self.data_user = {
'username': 'nicolas',
'password': 'password',
}
def test_auth(self):
self.app.post(
... | [
{
"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 | encargo-backend/app/encargoapi/auth/tests/test_auth.py | coonprogrammer/encargoexpress |
from __future__ import print_function
import os
import re
import sys
from one_off_runner import run
def get_files(folder, pattern):
return (os.path.abspath(os.path.join(dirpath, filename))
for (dirpath, dirnames, filenames) in os.walk(folder)
for filename in filenames
if re.sea... | [
{
"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 | dispatcher.py | velazq/kubernetes-runner |
from rest_framework import serializers
import markdown2
from .models import Content
from omaralbeik import server_variables as sv
class ContentSerializer(serializers.ModelSerializer):
tags = serializers.SerializerMethodField()
html_text = serializers.SerializerMethodField()
website_url = serializers.Seria... | [
{
"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 | contents/serializers.py | omaralbeik/omaralbeik.com-api |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py | data-experts/openapi-generator |
"""Python setup.py for allin_hotels package"""
import io
import os
from setuptools import find_packages, setup
def read(*paths, **kwargs):
"""Read the contents of a text file safely.
>>> read("allin_hotels", "VERSION")
'0.1.0'
>>> read("README.md")
...
"""
content = ""
with io.open(
... | [
{
"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 | setup.py | zhou322/allin-hotels |
import django.http
import unittest.mock
from .. import middleware
def get_response(req):
# dummy get_response, just return an empty response
return django.http.HttpResponse()
def test_leaves_remote_addr_alone_if_no_real_ip():
remote_addr = object()
request = unittest.mock.MagicMock()
request.M... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | spongeauth/core/tests/test_x_real_ip_middleware.py | felixoi/SpongeAuth |
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check
strongCiphers = ["TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA... | [
{
"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 | checkov/kubernetes/checks/resource/k8s/KubeletCryptographicCiphers.py | vangundy-jason-pfg/checkov |
import numpy as np
class FORMULAS:
@staticmethod
def vinf(eninf):
return np.sqrt(2. * eninf)
@staticmethod
def vinf_bern(eninf, enthalpy):
return np.sqrt(2.*(enthalpy*(eninf + 1.) - 1.))
@staticmethod
def vel(w_lorentz):
return np.sqrt(1. - 1. / (w_lorentz**2))
... | [
{
"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 | module_ejecta/ejecta_formulas.py | PartumSomnia/bns_ppr_tools |
import numpy as np
class FeatureProxy:
def __init__(self, num_features, num_states, is_tabular):
self.num_features = num_features
self.num_states = num_states
self.is_tabular = is_tabular
def get_num_features(self):
if self.is_tabular:
return self.num_states * sel... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | active16/src/baselines/feature_proxy.py | adiojha629/JIRP_LRM |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Readercoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running... | [
{
"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 | test/functional/create_cache.py | cho2559/readercoin |
from aiogram.types import Message
from loader import dp, db
from .menu import delivery_status
from filters import IsUser
@dp.message_handler(IsUser(), text=delivery_status)
async def process_delivery_status(message: Message):
orders = db.fetchall('SELECT * FROM orders WHERE cid=?', (message.chat.id,))
... | [
{
"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 | handlers/user/delivery_status.py | ndoubleu/telegram |
import torch.nn as nn
import torch.nn.functional as F
class Factor1d(nn.Module):
"""Similar to masked attention
"""
def __init__(self, in_features, in_dim, out_features, out_dim, adj_mat=None, bias=True):
super(Factor1d, self).__init__()
self.linear1 = nn.Linear(in_dim, out_dim, bias) # based on intu... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | dl/models/factor_graph.py | BeautyOfWeb/VIN |
#!/usr/bin/env python3
""" Calculate Fibonacci """
import argparse
from typing import NamedTuple
class Args(NamedTuple):
""" Command-line arguments """
generations: int
litter: int
# --------------------------------------------------
def get_args() -> Args:
""" Get command-line arguments """
p... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | 04_fib/solution3_recursion.py | ilaydabozan/biofx_python |
from app import create_app
def test_config():
assert not create_app().testing
def test_index(client):
response = client.get('/')
assert response.status_code == 200
def test_admin(client):
response = client.get('/admin/')
assert response.status_code == 200
| [
{
"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 | test/test_factory.py | onsimini/onsimini-website |
# coding: utf-8
"""
Decision Lens API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... | [
{
"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 | python/test/test_project_attachment_removed_message_payload.py | dlens/dlxapi |
from . import verb
from .. import entities
import textwrap
class Who(verb.Verb):
"""Show a list of connected players"""
command = _('who')
verbtype = verb.VERSATILE
def process(self, message):
out_message = self.get_player_list()
self.session.send_to_client(out_message)
self.f... | [
{
"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 | server/architext/verbs/who.py | OliverLSanz/architext |
"""
Author: Sigve Rokenes
Date: February, 2019
Utility functions for variational autoencoder
"""
import skimage as sk
from skimage import io
import tensorflow as tf
import numpy as np
# ===================================== #
# #
# Utility Functions #
# ... | [
{
"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 | util.py | evgiz/variational-autoencoder |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 16 00:14:59 2017
@author: davidpvilaca
"""
import matplotlib.pyplot as plt
import cv2
import numpy as np
import scipy
from scipy import ndimage
from skimage import measure
def showImg(img, gray=False):
plt.figure()
cmap = None
if (gra... | [
{
"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 | aula13/tarefa.py | davidpvilaca/TEP |
import particle as p
import detector as dct
import particle_source as ps
import cross_sections as xs
import numpy as np
import matplotlib.pyplot as plt
import random
class Simulation(object):
"""docstring for ."""
def __init__(self, T, dt, detector, particle_source):
self.T = T
self.dt = dt
... | [
{
"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/simulation.py | NonAbelianCapu/PyCompton |
import app.constants as const
class Config:
def __init__(self, shape=const.DEFAULT_CONFIG_SHAPE,
size=const.DEFAULT_CONFIG_SIZE,
max_thick=const.MAXIMUM_CONFIG_THICKNESS,
min_thick=const.MINIMUM_CONFIG_THICKNESS,
use_border=const.DEFAULT_CONFIG_B... | [
{
"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 | app/config.py | calemolech/lithophanes |
from dued.artefactos import artefacto
@artefacto
def miartefacto(c):
pass
@artefacto
def arg_basico(c, arg="val"):
pass
@artefacto
def args_multiples(c, arg1="val1", otroarg="val2"):
pass
@artefacto
def bool_basico(c, mibool=True):
pass
| [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | pruebas/_soporte/foo.py | dued/dued |
class No:
def __init__(self, valor):
self.valor = valor
self.proximo = None
def mostra_no(self):
print(self.valor)
class ListaEncadeada:
def __init__(self):
self.primeiro = None
def insere_inicio(self, valor):
novo = No(valor)
novo.proximo = self.primeiro
self.primeiro = novo
d... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | data_structure/lista_encadeada_simples.py | uadson/data-structure |
"""Find recomendations based on user's latest activities."""
from Bagpipe.importer import pre_analyzed_importer
from itertools import chain
from datetime import datetime, timedelta
from operator import itemgetter
from Rexy.Logging import logger
from heapq import nlargest
class LatestActivities:
def __init__(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | Rexy/Profile/Accurate/latest_activities.py | kasramvd/Rexy |
# -*- coding: utf-8 -*-
"""
@Author: lyzhang
@Date: 2018.5.23
@Description:
"""
from config import *
from parser_model.parser import Parser
from utils.file_util import *
from parser_model.form_data import form_data
from nltk.draw.util import CanvasFrame, TextWidget
from nltk.draw import TreeWidget
from nl... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | utils/draw.py | NLP-Discourse-SoochowU/rst_dp2019Bottom2Up |
from tinypy.runtime.testing import UnitTest
class MyTest(UnitTest):
def test_lessthan(self):
assert [1, 2] < [2]
assert [1, 2] <= [2]
assert [1] < [2]
assert [1] <= [2]
assert [] < [1]
def test_greaterthan(self):
assert [2] > [1]
assert [1, 2] > [1]
... | [
{
"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_list.py | turbocat2001/tinypy |
from unittest import TestCase
from unittest.mock import Mock, patch
from rdtwt.runner import PostgresDiscoverRunner
class SettingsStub:
DATABASES = {"default": {"HOST": "127.0.0.1", "PORT": "5432"}}
RDTWT_POSTGRESQL_IMAGE = "postgres:latest"
def get_host_ip(self):
return self.DATABASES["default... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | tests/test_postgres_discover_runner.py | wonkybream/django-rdtwt |
from pathlib import Path
from typing import NamedTuple
from datasetops.loaders import Loader
import numpy as np
class DatasetPaths(NamedTuple):
FOLDER_DATA: str = "folder_dataset_class_data/amazon/back_pack"
FOLDER_CLASS_DATA: str = "folder_dataset_class_data/amazon"
FOLDER_DATASET_CLASS_DATA: str = "fold... | [
{
"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 | tests/datasetops/testing_utils.py | LukasHedegaard/domain-adaptation-datasets |
from flask_restful import Resource,reqparse
import pymysql
from models.Account import Account
from storage_security import StorageSecurity
class AccountListResource(Resource):
def get(self):
try:
SS = StorageSecurity()
parser = reqparse.RequestParser()
parser.add_ar... | [
{
"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 | resources/AccountResource.py | kckotcherlakota/workindia_passwordkeeper |
import numpy as np
class Demo(object):
def __init__(self, observations, random_seed=None):
self._observations = observations
self.random_seed = random_seed
def __len__(self):
return len(self._observations)
def __getitem__(self, i):
return self._observations[i]
def r... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | rlbench/demo.py | Nicolinho/RLBench |
from fuzzconfig import FuzzConfig
import nonrouting
import nets
import pytrellis
import re
import fuzzloops
jobs = [
{
"cfg": FuzzConfig(job="BANKREF8", family="ECP5", device="LFE5U-45F", ncl="empty.ncl",
tiles=["MIB_R71C3:BANKREF8"]),
"side": "B",
"pin": "R1"
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | fuzzers/ECP5/143-bankref8/fuzzer.py | Keno/prjtrellis |
import komand
from .schema import DnsInput, DnsOutput
# Custom imports below
from komand_mxtoolbox_dns.util import utils
class Dns(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="dns", description="Run a DNS query", input=DnsInput(), output=DnsOutput()
... | [
{
"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 | plugins/mxtoolbox_dns/komand_mxtoolbox_dns/actions/dns/action.py | lukaszlaszuk/insightconnect-plugins |
from django.core.exceptions import ValidationError
from django.db import transaction
from django.utils import timezone
def time_check(order_date):
date_now = timezone.now()
delta = timezone.timedelta(minutes=5)
if (date_now - order_date) <= delta:
return True
else:
return False
def... | [
{
"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 | django_project/user_profile/services.py | aliyaandabekova/DJANGO_PROJECT |
import logging
class Logger(object):
Initialized = False
@staticmethod
def initialize(path_to_log_file):
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
... | [
{
"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 | logger.py | xmacex/easy-faster-rcnn.pytorch |
from rest_framework import serializers
from app_book.models import Novel, NovelFork, NovelChapter
class NovelSerializer(serializers.ModelSerializer):
forks = serializers.SerializerMethodField()
new = serializers.SerializerMethodField()
class Meta:
model = Novel
fields = ('id', 'title', '... | [
{
"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 | app_book/serializer.py | visoon0012/plover.cloud |
from django.core.exceptions import ImproperlyConfigured
from actstream.registry import register, registry
from actstream.tests.base import ActivityBaseTestCase
from testapp_nested.models import my_model
class TestAppNestedTests(ActivityBaseTestCase):
def test_registration(self):
self.assertIn(my_model.... | [
{
"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 | runtests/testapp_nested/tests.py | slated/django-activity-stream |
from flask import Flask, request, jsonify, send_from_directory
import engine
app = Flask(__name__)
@app.route('/api/texts')
def texts():
return send_from_directory('i18n', 'ui.de.json');
@app.route('/api/codenames')
def codenames():
return jsonify(engine.codenames())
@app.route('/api/ready')
def ready():
... | [
{
"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 | server/server.py | alimfeld/codenames |
"""
MIT License
Copyright (c) 2017 int3ll3ct.ly@gmail.com
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,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | sr700api/utils.py | AlexGS74/sr700api |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from onmt.utils.logging import init_logger
from onmt.utils.misc import split_corpus
from onmt.translate.translator import build_translator
import onmt.opts as opts
from onmt.utils.parse import ArgumentParser
def translate(opt):
... | [
{
"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 | onmt/bin/translate.py | ftakanashi/OpenNMT-py-flat |
import re
from core.cli_helpers import CLIHelper
from core.plugins.system import SystemChecksBase
YAML_PRIORITY = 0
class SystemGeneral(SystemChecksBase):
def get_system_info(self):
self._output["hostname"] = self.hostname
if self.os_release_name:
self._output["os"] = self.os_releas... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | plugins/system/pyparts/general.py | dosaboy/hotsos |
import socket
LOCALHOST = 'localhost'
Socket = None
Connection = None
def send(data):
Connection.sendall(('%s\n' % data).encode())
def send_list(data):
send(','.join(list(map(str, data))))
def get():
data = ''
while (byte := Connection.recv(1)) != b'\n':
data += byte.decode()
return data
def get_lis... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/ipc.py | plug-ml/engine |
import psycopg2
class Database():
def __init__(self):
self.params = {
"host": "localhost",
"database": "postgres",
"user": "postgres",
"password": "123456"
}
self.conn = None
self.cursor = None
self.open()
def open(self):... | [
{
"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 | db/postgres.py | mRiloB/python-backend-challenge |
from copy import copy
from typing import Tuple
from hypothesis import given
from dendroid.hints import Item
from tests.utils import (Map,
is_left_subtree_less_than_right_subtree,
to_height,
to_max_binary_tree_height,
t... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | tests/maps_tests/test_setitem.py | lycantropos/dendroid |
import os
from cloudify_cli.cli import cfy
from cloudify_cli.table import print_data
from cloudify_cli.exceptions import CloudifyValidationError
LICENSE_COLUMN = ['customer_id', 'expiration_date', 'license_edition', 'trial',
'cloudify_version', 'capabilities', 'expired']
@cfy.group(name='license')... | [
{
"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 | cloudify_cli/commands/license.py | Ilanad/cloudify-cli |
"""
https://leetcode.com/problems/combination-sum-iii/
Tags: Practice; Concepts; Algorithms; Recursion/BackTracking; Medium
"""
from typing import List
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
# Create a list of nums to choose fromx
return self.combi... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | leetcode/combination_sum_III.py | sci-c0/python-misc-problems |
def estrai_classico(lista, lettera):
output = []
for l in lista:
if l[0] == lettera:
output.append(l)
return output
def quadrati(val_massimo):
output = []
for v in range(val_massimo):
output.append(v ** 2)
return output
def quadrato(numero):
return numero ** 2
def costruisci_pari(i):
return "{} è p... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | Linguaggio Python/03 - Strutture Dati/b_list_comprehension.py | anhelus/informatica-dm-uniba-ex |
import re
import networkx as nx
import numpy as np
from aocd.models import Puzzle
pattern = re.compile(r'((\d)?\s?(\w*\s\w+)\s(bags?))')
def solve_puzzle_one(graph):
print(len(nx.ancestors(graph, 'shiny gold')))
def solve_puzzle_two(graph):
print(count_bags(graph, 'shiny gold'))
def count_bags(graph, no... | [
{
"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 | src/day7-graph.py | KraProgrammer/AdventOfCode2020 |
"""
Sage Intacct custom reports
"""
from typing import Dict
from .api_base import ApiBase
class CustomReports(ApiBase):
"""Class for Expense Reports APIs."""
def __init__(self):
super().__init__(dimension='custom_reports') #post_legacy_method='create_invoice')
# def update_attachment(self, key: ... | [
{
"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 | cbcintacctsdk/apis/custom_reports.py | Cold-Bore-Capital/sageintacct-sdk-py |
# This code is heavily inspired from https://github.com/fangwei123456/PixelUnshuffle-pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
def pixel_unshuffle(input, downscale_factor):
'''
input: batchSize * c * k*w * k*h
downscale_factor: k
batchSize * c * k*w * k*h -> batchSize ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | src/model/PixelUnShuffle.py | laowng/GISR |
import logging
logger = logging.getLogger('spacel.provision.app.alarm.endpoint.factory')
class AlarmEndpointFactory(object):
def __init__(self, factories):
self._factories = factories
def add_endpoints(self, template, endpoints):
endpoint_resources = {}
logger.debug('Injecting %d en... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | src/spacel/provision/app/alarm/endpoint/factory.py | mycloudandme/spacel-provision |
from typing import Dict
from typing import Optional
from typing import TYPE_CHECKING
from typing import Type
import dataclasses
from winter.core import ComponentMethod
from winter.core import annotate
if TYPE_CHECKING:
from .handlers import ExceptionHandler # noqa: F401
@dataclasses.dataclass
class ExceptionA... | [
{
"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 | winter/web/exceptions/throws.py | DmitryKhursevich/winter |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | kubernetes/test/test_v1_stateful_set_status.py | iamneha/python |
from django.db import models
from django.contrib.auth.models import AbstractUser
import json
# Create your models here.
class User(AbstractUser):
USERTYPE_CHOICES = (
('buyer', 'Buyer'),
('seller', 'Seller')
)
userType = models.CharField(choices=USERTYPE_CHOICES, default='buyer', max_length=9)
profile_... | [
{
"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 | userAuthentication/models.py | Jeremiahjacinth13/tradex |
import os
import datetime
from performance.driver.core.classes import Reporter
from performance.driver.core.events import LogLineEvent, TickEvent
class LogReporter(Reporter):
"""
The **Log Lines Reporter** is writing the contents of every ``LogLineEvent``
into a file stream.
::
reporters:
- class... | [
{
"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 | performance/driver/classes/reporter/log.py | mesosphere/dcos-perf-test-driver |
import psycopg2
from getpass import getpass
class DatabaseConection(object):
"""
"""
def __init__(self, host: str, database: str, user: str):
self._con = None
self._host = host
self._database = database
self._user = user
self.connected = False
try:
... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | scripts/utils/connection.py | CostaDiego/product-complaint-classification |
from biothings.web.options import ReqArgs
def test_01():
assert str(ReqArgs(
query={
"format": "yaml",
"size": "1002"},
json_={
"q": "cdk2",
"scopes": ["ensembl", "entrez"],
"format": "json"}
)).replace(" ", "") == """
ReqArgs... | [
{
"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 | tests/web/options/test_reqargs.py | ravila4/biothings.api |
# -*- coding: utf-8 -*-
from typing import Text
from zerver.lib.test_classes import WebhookTestCase
class DropboxHookTests(WebhookTestCase):
STREAM_NAME = 'test'
URL_TEMPLATE = "/api/v1/external/dropbox?&api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'dropbox'
def test_file_updated(self) -> No... | [
{
"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 | zerver/webhooks/dropbox/tests.py | gnprice/zulip |
# coding=utf-8
from zentropi import (
Agent,
on_event,
on_message,
on_state,
run_agents
)
from zentropi.shell import ZentropiShell
class Relay(Agent):
@on_event('*** started')
def setup(self, event):
# Define custom states.
self.states.power = False
@on_message('switch... | [
{
"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 | examples/_attic/raspberrypi_gpio/relay_agent.py | hiway/python-zentropi |
from sys import maxsize
class User:
def __init__(self, firstname=None, lastname=None, address=None, email=None, email2=None, email3=None, user_id=None,
homephone=None, workphone=None, mobilephone=None, additionalphone=None,
all_phones_from_home_page=None, all_emails_from_home_pa... | [
{
"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": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheri... | 3 | model/user.py | VanillaPupa/python_training |
import pickle
from revscoring.datasources.datasource import Datasource
from revscoring.datasources.meta import dicts
from revscoring.dependencies import solve
my_dict = Datasource("my_dict")
my_keys = dicts.keys(my_dict)
my_values = dicts.values(my_dict)
def test_dict_keys():
cache = {my_dict: {"foo": 1, "bar"... | [
{
"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 | tests/datasources/meta/tests/test_dicts.py | kevinbazira/revscoring |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.