source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from twindb_backup.configuration import TwinDBBackupConfig
def test_azure(config_file):
tbc = TwinDBBackupConfig(config_file=str(config_file))
assert tbc.azure.azure_access_key == 'XXXXX'
assert tbc.azure.azure_account == 'YYYYY'
assert tbc.azure.endpoint == 'core.windows.net'
assert tbc.azure.buc... | [
{
"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 | tests/unit/configuration/twindb_backup_config/test_azure.py | howard0su/backup |
from subprocess import STDOUT, run, PIPE
def align(x, al):
""" return <x> aligned to <al> """
return ((x+(al-1))//al)*al
class CompilationError(Exception):
def __init__(self, code, output) -> None:
super().__init__(f'compilation failed')
self.code = code
self.output = output
... | [
{
"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 | packer5/utils.py | nnnewb/learning-packer |
class Employee:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
# self.email = f"{fname}.{lname}@sandy.com"
def explain(self):
return f"This employee is {self.fname} {self.lname}"
def email(self):
return f"{self.fname}.{self.lname} @parker.com... | [
{
"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 | 47 Setters_Property Decorators/main1.py | codewithsandy/Python-Basic-Exp |
import concurrent.futures
import logging
logger = logging.getLogger(__name__)
def ThreadPoolExecutor(max_workers=None, thread_name_prefix=''):
return concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)
#thread_name_prefix=thread_name_prefix)
def Process... | [
{
"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 | parsl/app/executors.py | monicadlewis97/parsl |
from typing import List, Dict, Callable, Any, NamedTuple, TYPE_CHECKING
from pyri.plugins import util as plugin_util
if TYPE_CHECKING:
from .. import PyriWebUIBrowser
class PyriWebUIBrowserPanelInfo(NamedTuple):
title: str
panel_type: str
priority: int
class PyriWebUIBrowserPanelBase:
pass
class... | [
{
"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 | src/pyri/webui_browser/plugins/panel.py | pyri-project/pyri-webui-browser |
import pandas as pd
from IPython.core.display import display
def bordered_table(hide_headers=[], color='#ddd'):
return [
{'selector': 'th', 'props': [('text-align', 'center'), ('border', f'1px solid {color}')]},
{'selector': 'td', 'props': [('border', f'1px solid {color}')]},
*[
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | jupyter_helpers/table.py | krassowski/jupyter-helpers |
from deuce.drivers.storage.metadata import MetadataStorageDriver
from deuce.drivers.storage.metadata.cassandra import CassandraStorageDriver
from deuce.tests.test_sqlite_storage_driver import SqliteStorageDriverTest
# Explanation:
# - The SqliteStorageDriver is the reference metadata driver. All
# other drivers sho... | [
{
"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 | deuce/tests/test_cassandra_storage_driver.py | TheSriram/deuce |
# 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 inorder(self, node: TreeNode) -> None:
if not node:
return
self.inorder(node.left)
... | [
{
"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 | Tree/Easy/530. Minimum Absolute Difference in BST/solution.py | tintindas/leetcode-solutions |
# Copyright (c) 2021 Leonardo Uieda.
# Distributed under the terms of the MIT License.
# SPDX-License-Identifier: MIT
"""
Fixtures for pytest
"""
from pathlib import Path
import pytest
@pytest.fixture()
def setup_cfg():
"The text contents of the test file."
return str(Path(__file__).parent / "data" / "sample... | [
{
"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 | dependente/tests/conftest.py | leouieda/dependente |
from litex.soc.cores import uart
from litex.soc.cores.uart import UARTWishboneBridge
from litedram.frontend.bist import LiteDRAMBISTGenerator, LiteDRAMBISTChecker
from litescope import LiteScopeAnalyzer
from litescope import LiteScopeIO
from gateware.memtest import LiteDRAMBISTCheckerScope
from targets.utils import... | [
{
"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 | targets/mimasv2/scope.py | auscompgeek/litex-buildenv |
from systems.plugins.index import BaseProvider
from utility.filesystem import remove_dir
import pathlib
import os
class Provider(BaseProvider('module', 'local')):
def initialize_instance(self, instance, created):
instance.remote = None
instance.reference = 'development'
def store_related(s... | [
{
"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 | app/plugins/module/local.py | venturiscm/hcp |
import math
limit = int(input('n = '))
facs = {}
def fac(n):
if n not in facs:
facs[n] = math.factorial(n)
return facs[n]
def nOfR(n, r):
return fac(n) / (fac(r) * fac(n - r))
count = 0
for n in range(1, limit + 1):
for r in range(1, n + 1):
if nOfR(n, r) > 1000000:
count... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | 053/53.py | dkaisers/Project-Euler |
import webbrowser
from tornado import ioloop, web
from minotor.api.projection_handler import ProjectionHandler
from minotor.api.data_handler import DataHandler
from minotor.api.training_data_handler import TrainingDataHandler
from minotor.constants import PACKAGE_PATH
# Defining constants
REACT_BUILD_PATH = PACKAGE... | [
{
"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 | minotor/run.py | datarmada/minotor |
from django.db import models
from usuarios.models import Usuario
from corporaciones.models import Corporacion
class Votante(models.Model):
usuario = models.ForeignKey(Usuario)
codigo = models.BigIntegerField(unique=True, primary_key=True)
plan = models.ForeignKey(Corporacion)
is_active = models.BooleanField(defaul... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | votantes/models.py | marthalilianamd/SIVORE |
#!/usr/bin/env python
#
# Copyright 2015-2016 Flavio Garcia
#
# 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... | [
{
"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 | podship/storage/components/user/services.py | candango/podship-storage |
from typing import (
Type,
)
from lahja import (
BaseEvent,
BaseRequestResponseEvent,
)
class NetworkIdResponse(BaseEvent):
def __init__(self, network_id: int) -> None:
self.network_id = network_id
class NetworkIdRequest(BaseRequestResponseEvent[NetworkIdResponse]):
@staticmethod
... | [
{
"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 | trinity/nodes/events.py | C4Coin/py-fhm-evm |
import unittest
import os
import sys
from fortranformat._input import input as _input
from fortranformat._lexer import lexer as _lexer
from fortranformat._parser import parser as _parser
from fortranformat._exceptions import InvalidFormat
import fortranformat.config as config
class HEditDescriptorTests(unit... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/handwritten/h-ed/h-ed-input-tests.py | michaelackermannaiub/py-fortranformat |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from six.moves import zip
import ijson
from django.core.management.base import BaseCommand, CommandParser
class Command(BaseCommand):
help = """
Render messages to a file.
Usage: python manage.py render_... | [
{
"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 | zilencer/management/commands/compare_messages.py | dehnert/zulip |
import paddle.fluid as fluid
import paddle
import paddorch.cuda
import paddorch.nn
import os
import paddorch.nn.functional
from paddle.fluid import dygraph
import numpy as np
def constant_(x, val):
x=fluid.layers.fill_constant(x.shape,x.dtype,val,out=x)
return x
def normal_(x,m=0,std=1):
y=paddle.randn(x... | [
{
"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 | paddorch/nn/init/__init__.py | GT-AcerZhang/paddle_torch |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from enum import auto, Enum
from typing import NamedTuple, Optional
class Parameter(NamedTuple):
class Kind(Enum):
ARG = auto(... | [
{
"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 | tools/generate_taint_models/parameter.py | sthagen/facebook-pyre-check |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site do... | [
{
"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 | hacktj_live/contrib/sites/migrations/0003_set_site_domain_and_name.py | HackTJ/live |
#!/usr/bin/env python3
# Day 2: Design HashSet
#
# Design a HashSet without using any built-in hash table libraries.
#
# To be specific, your design should include these functions:
# - add(value): Insert a value into the HashSet.
# - contains(value) : Return whether the value exists in the HashSet or not.
# - remove(... | [
{
"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 | 2020-08-month-long-challenge/day02.py | jkbockstael/leetcode |
def setup():
size(500,500)
smooth()
background(235)
strokeWeight(30)
noLoop()
def draw():
for i in range(1,8):
stroke(20)
line(i*50,200,150+(i-1)*50,300)
| [
{
"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 | sketch_17/sketch_17.pyde | Minindosyan/2019-fall-polytech-cs |
"""empty message
Revision ID: 2615e2b854
Revises: None
Create Date: 2015-05-22 00:10:14.590147
"""
# revision identifiers, used by Alembic.
revision = '2615e2b854'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | [
{
"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 | migrations/versions/2615e2b854_.py | eugeneandrienko/PyArtistsGallery |
from sklearn.feature_extraction.text import CountVectorizer;
class BagOfWords(object):
def __init__(self, data, options):
self.data = data;
self.options = options;
try:
self.options['vector'];
except KeyError:
self.options['vector'] = count_vector = CountVectorizer(token_pattern='(?u)\\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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | classifiers/strategies/bagOfWords.py | drodeur/spam |
import argparse
from defusedxml.ElementTree import parse
from automaton.builder.common import allow_local_module_if_requested
from automaton.builder.XmlBuilder import AutomatonXmlBuilder
from automaton.runner.Runner import Runner
from automaton.runner.ErrorHandler import ErrorHandlerXmlBuilder
from automaton.... | [
{
"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 | lib/Main.py | delbio/py-automata-cli-runner |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.5.0-beta.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "Lice... | [
{
"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 | kubernetes/test/test_v1_secret.py | SEJeff/client-python |
import numpy as np
import pandas as pd
def plot_ci(x, y, ax, label='', alpha=0.7, zorder=-10):
cols = ['#EE7550', '#F19463', '#F6B176']
ci = bin_by(x, y)
# plot the 3rd stdv
ax.fill_between(ci.x, ci['5th'], ci['95th'], alpha=alpha, color=cols[2], zorder=zorder - 3)
ax.fill_between(ci.x, ci['10th']... | [
{
"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 | deep_gw_pe_followup/plotting/ci.py | avivajpeyi/gw_pe_judge |
class MyQueue:
def __init__(self):
""" Uses two stacks to implement a Queue. Storage holds elements
pushed right before the first pop.
"""
self.storage, self.tmp = [], []
def push(self, x: int) -> None:
""" Unconditionally add to storage. Equivalent to stack.push."""
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | Python/Algorithms/232.py | DimitrisJim/leetcode_solutions |
import requests
from bs4 import BeautifulSoup
class API:
def __init__(self, auth):
self.auth = auth
self.api = 'https://api.playr.gg/api/enter'
self.headers = {
'Accept': "application/json, text/plain, */*",
'Accept-Encoding': "gzip, deflate, br",
'Accept... | [
{
"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 | playrcc/src/base/http/api.py | Gloryness/playrcc |
import requests # Used to make HTTP requests
import json # Used to parse JSON
import os # Used to infer environment variables
API_TAGO = os.environ.get('TAGOIO_API') or 'https://api.tago.io'
REALTIME = os.environ.get('TAGOIO_REALTIME') or 'https://realtime.tago.io'
class Plan:
def __init__(self, acc_token):
... | [
{
"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 | tago/account/plan.py | tago-io/tago-sdk-python |
from team29.analizer.abstract.expression import Expression, TYPE
from team29.analizer.abstract import expression
from team29.analizer.reports import Nodo
from team29.analizer.statement.expressions.primitive import Primitive
class InRelationalOperation(Expression):
def __init__(self, colData, optNot, subquery, row... | [
{
"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 | bases_2021_1S/Grupo 09/Tytus/Query Tool/team29/analizer/statement/operations/unary/inRelational.py | dadu0699/tytus |
# Copyright (c) OpenMMLab. All rights reserved.
import logging
from mmcv.utils import collect_env as collect_base_env
from mmcv.utils import get_git_hash
import mmdeploy
def collect_env():
"""Collect the information of the running environments."""
env_info = collect_base_env()
env_info['MMDeployment'] =... | [
{
"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 | tools/check_env.py | hanrui1sensetime/mmdeploy |
from abc import ABC, abstractmethod
import numpy as np
from .constants import EPSILON
import torch
class Loss(ABC):
def __init__(self, expected_output, predict_output):
self._expected_output = expected_output
self._predict_output = predict_output
@abstractmethod
def get_loss(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_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | exit/losses.py | exitudio/neural-network-pytorch |
#!/usr/bin/env python
from flask import Flask, request
app = Flask(__name__)
# Shared storage for our list of tasks
tasks = ["GenCS 1"]
form = ("<form action='/' method='POST'>"
"<input autofocus type='text' name='task' />"
"<input type='submit' />"
"</form>")
def delete_form(idx):
retur... | [
{
"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 | my-third-web-app.py | thunderboltsid/snake-taming-101 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def convertBST(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
def traverse(node):
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answe... | 3 | solutions/python3/538.py | sm2774us/amazon_interview_prep_2021 |
"""Setup standard unit test class for NodeSequences."""
from unittest import TestCase
from ensmallen import Graph # pylint: disable=no-name-in-module
class TestNodeSequences(TestCase):
def setUp(self):
self._graph = Graph.from_csv(
edge_path="tests/data/small_ppi.tsv",
sources_co... | [
{
"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 | tests/test_node_sequences.py | monarch-initiative/embiggen |
import pigpio
from datetime import datetime
from rackio import Rackio, RackioStateMachine, State, GroupBinding
app = Rackio()
@app.define_machine('SmartHome', 60)
class SmartHome(RackioStateMachine):
# State Definitions
starting = State('start', initial=True)
running = State('on')
idle = State('off'... | [
{
"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 | state_machines/control.py | carrasquel/SmartHomeApp |
import easygopigo3 as go
def move_forward_seconds(t):
myRobot.forward()
time.sleep(t)
myRobot.stop()
def move_backward_seconds(t):
myRobot.backward()
time.sleep(t)
myRobot.stop()
# Import time
import time
#Create an instance of the robot with a constructor from the easygopigo3 module that... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | lab01/task2.py | chinesefirewall/Robotics |
# Subscribes to Data Published to AWS Cloud
import paho.mqtt.client as mqtt
import os
import socket
import ssl
def on_connect(client, userdata, flags, rc):
print("Connection returned result: " + str(rc) )
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then sub... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | Publisher and Subscriber/AWS_IoT_Sub.py | anujdutt9/AWS_IoT_Python |
import os
from psutil import Process
from pathlib import Path
import pytest
import tempfile
import os
import logging
import time
import cellpy.readers.core
import cellpy.utils.helpers
from cellpy import log
from cellpy import prms
from cellpy.readers.core import humanize_bytes
f_in = Path("../testdata/data/20160805_... | [
{
"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 | dev_utils/helpers/check_memory.py | streamengineer/cellpy |
from abc import ABCMeta, abstractmethod
from copy import deepcopy
class Prototype(metaclass=ABCMeta):
@abstractmethod
def clone(self):
pass
class Concrete(Prototype):
def clone(self):
return deepcopy(self)
prototype = Concrete()
foo = prototype.clone()
bar = prototype.clone()
print(... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | design_patterns/prototype.py | CrazyMath/pywander |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"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/image-gallery/azext_image_gallery/_client_factory.py | haroonf/azure-cli-extensions |
import os
import shutil
import sys
import tempfile
from pathlib import Path
import django
# Path to the temp mezzanine project folder
TMP_PATH = Path(tempfile.mkdtemp()) / "project_template"
TEST_SETTINGS = """
from . import settings
globals().update(i for i in settings.__dict__.items() if i[0].isupper())
# Add ou... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/conftest.py | kevinlai219/Mezzanine-Django |
import matplotlib.pyplot as plt
import matplotlib.dates as d
from numpy import linspace
from .analysis import polyfit
def plot_water_levels(station, dates, levels):
""" Plots the station water level history against time """
# Return early if data is invalid
if len(dates) != len(levels):
print("fl... | [
{
"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 | floodsystem/plot.py | AJB363/PartIA-Flood-Warning-System |
import os
from glob import glob
import cv2
import h5py
import torch
from torch.utils.data import Dataset
class ImageH5Dataset(Dataset):
def __init__(self, dataset_path, img_dim):
self.dataset_path = dataset_path
self.img_dim = (img_dim, img_dim) if type(img_dim) == int else img_dim
self.... | [
{
"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 | nvae/dataset.py | Mario-Kart-Felix/nvae |
from typing import Any, Callable
# from starlette.concurrency import iterate_in_threadpool as iterate_in_threadpool # noqa
# from starlette.concurrency import run_in_threadpool as run_in_threadpool # noqa
# from starlette.concurrency import ( # noqa
# run_until_first_complete as run_until_first_complete,
# )
fr... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?"... | 3 | django_mini_fastapi/fastapi/concurrency.py | hanyichiu/django-mini-fastapi |
class CacheHeaderMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
response['Cache-Control'] = (
'no-cache="Set-Cookie, Set-Cookie2", no-store, must-revalidate'
)... | [
{
"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 | common/middleware.py | red-and-black/gossipgoat |
# selectionsort() method
def selectionSort(arr):
arraySize = len(arr)
for i in range(arraySize):
min = i
for j in range(i+1, arraySize):
if arr[j] < arr[min]:
min = j
#swap values
arr[i], arr[min] = arr[min], arr[i]
# method to print an array
def printList(arr):
for i in rang... | [
{
"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 | basicsortings/SelectionSort.py | ankushdecoded123/basicalgorithms |
import tensorflow as tf
class F1Metric(tf.keras.metrics.Metric):
def __init__(self, name=None, dtype=None):
super(F1Metric, self).__init__(name=name, dtype=dtype)
self.tp_ = tf.keras.metrics.TruePositives()
self.fp_ = tf.keras.metrics.FalsePositives()
self.fn_ = tf.keras.metrics.Fal... | [
{
"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 | model/F1Metric.py | adfoucart/deephisto |
"""
@brief test log(time=10s)
"""
import os
import sys
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__... | [
{
"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 | _unittests/ut_helpers/test_image_helper.py | mohamedelkansouli/Ensae_py |
import logging
from mmcv.runner import Runner as _Runner
class Runner(_Runner):
def __init__(self,
model,
batch_processor,
optimizer=None,
work_dir=None,
log_level=logging.INFO,
logger=None,
iter... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | dsgcn/runner/runner.py | LLLjun/learn-to-cluster |
import discord
from discord.ext import commands
import json
#vamos abrir o setup json para pegar as informaçoes
with open('bot_setup.json') as vagner:
bot_settings =json.load(vagner)
#lista de comandos
# cmds.info o cmds que dizer o nome da pastar e o info o nome do arquivo
#pode fazer tbm cmds.adm.ban caso qu... | [
{
"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 | Discord 1.0.0a - REWRITE/EstruturaBots/CogsSharding/main.py | Algueem/Discord-Bot-Python-Tutoriais |
import argparse
import os
from spread_classification.utils import Followers
import shutil
import random
def transfer(from_dataset, to_dataset, ratio):
all_keys = from_dataset.keys()
sampled_keys = random.sample(all_keys, int(ratio * len(all_keys)))
for key in sampled_keys:
to_dataset[key] = from_da... | [
{
"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 | fetch/tweets/trim_followers.py | aounleonardo/Spread-Classification |
#!/usr/bin/env python3
"""
Author : cory
Date : 2020-03-03
Purpose: Rock the Casbah
"""
import argparse
import os
import sys
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Rock the Casbah',
... | [
{
"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 | assignments/05_hamming/hamming.py | cvk1988/biosystems-analytics-2020 |
# -*- coding: utf-8 -*-
"""
Solution to Project Euler problem 35
Author: Jaime Liew
https://github.com/jaimeliew1/Project_Euler_Solutions
"""
from EulerFunctions import is_prime, primelist, numDigits
def CircPerms(x):
perms = [str(x)]
for j in range(numDigits(x) - 1):
perms.append(perms[-1][1:] + pe... | [
{
"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 | Python/035.py | jaimeliew1/Project_Euler_Solutions |
#!/usr/bin/env python
# Usar Python3
# Rascunho do parser de planilhas de horários do Ensino Superior do IFBA
# Rafael F S Requião, Abril/Maio de 2018
# Importar bibliotecas de sempre
import os, sys, io, time, datetime, string
from datetime import date
# Usar interface gráfica com npyscreen
# > http://npyscreen.re... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | teste01.py | requeijaum/simulador_matricula_ifba_2018 |
import unittest
from collections import defaultdict
class Solution:
def findTargetSumWays(self, nums: list[int], target: int) -> int:
dps = []
dp = defaultdict(int, {nums[0]: 1})
dp[-nums[0]] += 1
dps.append(dp)
for i in range(1, len(nums)):
dp = defaultdict(i... | [
{
"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 | solutions/0494/0494.py | abawchen/leetcode |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
{
"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 | recognition/arcface_paddle/deploy/pdserving/web_service.py | qaz734913414/insightface |
import copy
import pytest
from pyconcepticon.models import *
@pytest.fixture
def sun1991(tmprepos):
return tmprepos / 'concepticondata' / 'conceptlists' / 'Sun-1991-1004.tsv'
def test_Conceptlist(sun1991, api):
kw = dict(
api=sun1991,
id='Abc-1234-12',
author='Some One',
ye... | [
{
"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 | tests/test_models.py | armendk/pyconcepticon |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | pipeline/contrib/external_plugins/tests/models/base/test_base.py | gangh/bk-sops |
class ToolStripItemAlignment(Enum,IComparable,IFormattable,IConvertible):
"""
Determines the alignment of a System.Windows.Forms.ToolStripItem in a System.Windows.Forms.ToolStrip.
enum ToolStripItemAlignment,values: Left (0),Right (1)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <=... | [
{
"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 | stubs.min/System/Windows/Forms/__init___parts/ToolStripItemAlignment.py | ricardyn/ironpython-stubs |
from typing import Tuple, List
from flask import jsonify
from flask.wrappers import Response
def wrapped_response(data: dict = None, status: int = 200, message: str = "") -> Tuple[Response, int]:
"""
Create a wrapped response to have uniform json response objects
"""
if type(data) is not dict and da... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstr... | 3 | server/utils/view_utils.py | Jordonkopp/Flask-Vue |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
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 | test/test_v1alpha1_data_volume_source_pvc.py | gabriel-samfira/client-python |
import contextlib
import click
from snafu import metadata, versions
from snafu.operations.common import get_active_names
from snafu.operations.link import activate
def get_version_or_none(name):
force_32 = not metadata.can_install_64bit()
with contextlib.suppress(versions.VersionNotFoundError):
retu... | [
{
"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 | installers/lib/setup/activation.py | uranusjr/snafu |
import numpy as np
class Perceptron(object):
def __init__(self, input_num, activator):
self.activator = activator
self.weights = np.zeros((input_num))
self.bias = 0.0
def __str__(self):
return 'weights\t:%s\nbias\t:%f\n' % (self.weights, self.bias)
def predict(self, 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | perceptron_np.py | oustar/scipylearn |
from typing import Optional, cast
from ..apps import AbstractApp
from ..handlers import HandlerFunction
from ..requests import Request
from ..resolvers import Resolver
from ..responses import StreamResponse
__all__ = ("AbstractMiddleware",)
class AbstractMiddleware:
def __init__(self, resolver: Optional[Resolve... | [
{
"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 | jj/middlewares/_abstract_middleware.py | TeoDV/jj |
from datetime import datetime
from is_number import is_number
def test_is_number():
assert is_number(1)
def test_is_not_number():
assert not is_number("Hello world")
assert not is_number({"Hello": "world"})
assert not is_number(datetime.now())
assert not is_number(lambda foo: foo)
| [
{
"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 | is_number/tests/test_is_number.py | jacobtomlinson/is-number |
import sqlite3
from os import path
import sys
import logging
app_logger = logging.getLogger("api_logic_server_app")
def log(msg: any) -> None:
app_logger.info(msg)
# print("TIL==> " + msg)
def connection() -> sqlite3.Connection:
ROOT: str = path.dirname(path.realpath(__file__))
log(ROOT)
_connec... | [
{
"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 | api_logic_server_cli/project_prototype/util.py | valhuber/ApiLogicServer |
# coding=utf-8
import unittest
from ecs_pipeline_deploy import cli
class TestImageParsing(unittest.TestCase):
IMAGES = {
'alpine': (None, 'alpine', 'latest'),
'alpine:3.7': (None, 'alpine', '3.7'),
'docker.aweber.io/_/alpine:3.7':
('docker.aweber.io', '_/alpine', '3.7'),
... | [
{
"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 | tests.py | gmr/ecs-pipeline-deploy |
#!/usr/bin/python
################################################################################
# 23ae8758-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"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 | pcat2py/class/23ae8758-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.consistency import (
IncorrectYieldFromTargetViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
GeneratorKeywordsVisitor,
)
yield_from_template = """
def wrapper():
yield from {0}
"""
@pytest.mark.para... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_visitors/test_ast/test_keywords/test_generator_keywords/test_yield_from_type.py | n1kolasM/wemake-python-styleguide |
from datastructures.stack import Stack
def test_isEmpty_empty_stack():
myStack = Stack()
assert myStack.isEmpty()
def test_isEmpty_non_empty_stack():
myStack = Stack()
myStack.push(1)
assert not myStack.isEmpty()
def test_pop():
myStack = Stack()
myStack.push(2)
assert myStack.pop(... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/test_stack.py | maxotar/datastructures |
def drift_rectangles(rectangles):
output_rectangle_list = []
for rectangle in rectangles["rectangles"]:
output_rectangle_list.append(drift_rectangle(rectangle))
return {
"rectangles": output_rectangle_list
}
def drift_rectangle(rectangle):
return rectangle
| [
{
"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 | driftingrectangles.py | mungojelly/DriftingRectangles |
import torch
import torch.nn.functional as F
from torch_geometric.utils import degree
from torch_geometric.transforms import BaseTransform
class OneHotDegree(BaseTransform):
r"""Adds the node degree as one hot encodings to the node features.
Args:
max_degree (int): Maximum degree.
in_degree ... | [
{
"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 | torch_geometric/transforms/one_hot_degree.py | itamblyn/pytorch_geometric |
import os
from time import sleep
from unittest import TestCase
from datadog import ThreadStats
from microengine_utils.constants import SCAN_TIME, SCAN_VERDICT
from microengine_utils.datadog import configure_metrics
DATADOG_API_KEY = 'my_api_key'
DATADOG_APP_KEY = 'my_app_key'
# Configure Datadog metric keys for use ... | [
{
"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 | tests/test_datadog.py | polyswarm/microengine-utils |
from adapters.base_adapter import Adapter
from devices.switch.selector_switch import SelectorSwitch
class GiraLightLink(Adapter):
def __init__(self, devices):
super().__init__(devices)
self.switch = SelectorSwitch(devices, 'switch', 'action')
self.switch.add_level('Off', 'off')
se... | [
{
"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 | adapters/gira/light_link.py | cocooma/domoticz-zigbee2mqtt-plugin |
import unittest
from paddle.v2.fluid.op import Operator
import paddle.v2.fluid.core as core
import numpy
class TestUniformRandomOp(unittest.TestCase):
def test_uniform_random_cpu(self):
self.uniform_random_test(place=core.CPUPlace())
def test_uniform_random_gpu(self):
if core.is_compile_gpu()... | [
{
"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 | python/paddle/v2/fluid/tests/test_uniform_random_op.py | QingshuChen/Paddle |
import torch
import torch.nn as nn
from .model import Model
class SampleCNNXL(Model):
def __init__(self, strides, supervised, out_dim):
super(SampleCNN, self).__init__()
self.strides = strides
self.supervised = supervised
self.sequential = [
nn.Sequential(
... | [
{
"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 | clmr/models/sample_cnn_xl.py | heraclex12/CLMR |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from .managers import TopicPrivateQuerySet
class TopicPrivate(models.Model):
user = models.For... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | spirit/topic/private/models.py | StepanBakshayev/Spirit |
import pytest
import requests
@pytest.fixture(autouse=True)
def disable_network_calls(monkeypatch):
def stunted_get():
raise RuntimeError("Network access not allowed during testing!")
monkeypatch.setattr(requests, "get", lambda *args, **kwargs: stunted_get())
| [
{
"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 | tests/conftest.py | fratambot/api-template |
from django.contrib import admin
class CdCategoryAdmin(admin.ModelAdmin):
pass
class CdAdmin(admin.ModelAdmin):
pass
class UserCdAdmin(admin.ModelAdmin):
def get_queryset(self, request):
"""
Show only current user's objects.
"""
qs = super(UserCdAdmin, self).queryset(r... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | test_project/apps/cds/admin.py | int-y1/dmoj-wpadmin |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | [
{
"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/opflow/evolutions/trotterizations/trotterization_base.py | Roshan-Thomas/qiskit-terra |
from parcels import FieldSet, ParticleSet, ScipyParticle, JITParticle, AdvectionRK4
from datetime import timedelta as delta
import pytest
from os import path
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def set_ofam_fieldset(full_load=False):
filenames = {'U': path.join(path.dirname(__file__), 'OFAM_exa... | [
{
"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 | parcels/examples/example_ofam.py | rabernat/parcels |
from math import ceil, floor
from collections import Counter
def mean(numLS):
"""
Finds the sum of a list of numbers and divided by the
length of the list leaving the mean.
"""
return sum(numLS) / float(len(numLS))
def median(numLS):
"""
The middle value of a set of ordered data.
"""
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | Maths/src/mmmr.py | joshturge/year12 |
import copy
from datetime import datetime
class LifeGame:
def __init__(self, width, height):
self.__width = width
self.__height = height
self.__cells = [[False for x in range(0, width)] for y in range(0, height)]
self.__fps = 2
self._next_ts = datetime.now().timesta... | [
{
"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 | lifegame.py | cuboktahedron/Rascon |
# Copyright (c) 2022 Andreas Törnkvist | MIT License
import math
class worldfile:
def __init__(self, filename):
wFile = open(filename)
w = wFile.readlines()
w = [line.rstrip() for line in w]
self.A = float(w[0])
self.D = float(w[1])
self.B = float(w[2])
sel... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | py/worldfiles.py | Andreto/ga-utsikt |
from django.shortcuts import render
class GeneralRoutes:
@staticmethod
def home(request):
return render(request, 'home.html')
@staticmethod
def privacy(request):
return render(request, 'privacy.html')
| [
{
"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 | authors/pages/general.py | andela/ah-code-titans |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | tensorflow/python/grappler/arithmetic_optimizer_test.py | yage99/tensorflow |
from django.contrib.auth.models import User
from django.test import TestCase
from ...models import Profile
class TestProfileModel(TestCase):
def setUp(self):
self.user_test = User.objects.create(username='borko')
def test_create_profile(self):
pr = Profile.objects.create(user=self.user_test,... | [
{
"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 | config/auth_and_login/tests/models/test_profile_models.py | borko81/mymdb |
# UnitTest Module
import unittest
from YaseeReportFile import YaseeReportFile
class YaseeReportFileTest(unittest.TestCase):
def setUp(self):
self.report_file = YaseeReportFile("test/report.xlsx")
def test_canInstantiate(self):
pass
def test_getitem(self):
self.assertEqual("Cours... | [
{
"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 | test_YaseeReportFile.py | nealight/yasee |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
l, p = [self.val], self.next
while (p != None):
l.append(p.val)
p = p.next
return str(l)
class Solution:
def removeN... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | 19_remove_nth_node.py | solarknight/leetcode_solutions_python |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
""" Serializers a name field for testing our APIView"""
name = serializers.CharField(max_length=10)
# serializer for proiles API
class UserProfileSerializer(serializers.ModelSerializer):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | profiles_api/serializers.py | harshitksrivastava/profile-rest-api |
from common.person import Person
from random import randint
class PersonTest(Person):
def __init__(self, position: list = [0, 0], color: list = [255, 255, 255], size: int = 20, default_position_range=None) -> None:
self.color2 = [randint(2, 50), randint(100, 200), randint(10,50)]
self.color3 = [ra... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | test_1_lineral/personTest.py | NoOneZero/Neuro |
import requests
from datetime import datetime
import psycopg2
import time
def setup():
# Create database connection
conn = psycopg2.connect(database="postgres", user="postgres",
password="password", host="127.0.0.1", port="5432")
return conn
def call_api():
URL = "https://api... | [
{
"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 | server/models/bitcoin_price_API.py | johnjdailey/JS-Realtime-Dashboard |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2014 Tobias Weber <tobi-weber@gmx.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
{
"point_num": 1,
"id": "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 | src/levitas/middleware/appMiddleware.py | tobi-weber/levitas |
"""Tools for summarizing lightcurve data into statistics"""
import numpy as np
import scipy.optimize as spo
from tensorflow.contrib.framework import nest
from justice import lightcurve
from justice import xform
def opt_alignment(
lca: lightcurve._LC,
lcb: lightcurve._LC,
ivals=None,
constraints=None... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 4 | justice/summarize.py | aimalz/justice |
from __future__ import print_function
class MigrationStatusPrinter(object):
"""
Print migration status in an attractive way during a Django migration run.
In particular, you get output that looks like this
Running migrations:
Applying users.0005_set_initial_contrib_email_flag...
... | [
{
"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 | kitsune/sumo/migrations/__init__.py | rlr/kitsune |
import os
from transly.seq2seq.config import SConfig
from transly.seq2seq.version1 import Seq2Seq
"""
word boundary example
"""
filepath = os.path.dirname(os.path.abspath(__file__))
def train(
model_path="./trained_model/",
model_file_name="model.h5",
training_data_path="./train.csv",
):
"""
tr... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | transly/seq2seq/seq2seq.py | nikgit17/transly |
import tensorflow as tf
def init_wb(shape, name):
"""
Function initialize one matrix of weights and one bias vector.
:type shape: tuple
:type name: str
:rtype: dictionary
"""
Winit = tf.truncated_normal(shape, mean=0, stddev=0.1)
binit = tf.zeros(shape[-1])
layer = {}
layer["w... | [
{
"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 | src/tftools/basic_functions.py | jfacoustic/MyTwitterBot |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.