source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from gamestonk_terminal.cryptocurrency.discovery import dappradar_view
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
}
@pytest.mark.vcr
@pytest.mark.record_st... | [
{
"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 | tests/gamestonk_terminal/cryptocurrency/discovery/test_dappradar_view.py | minhhoang1023/GamestonkTerminal |
"""adding cluster control options on every level
Revision ID: a987c6ce888d
Revises: 00c5cc87408d
Create Date: 2018-08-01 18:34:00.415937
"""
import logging
from alembic import op
import sqlalchemy as sa
revision = 'a987c6ce888d'
down_revision = '8079a1cb5874'
branch_labels = None
depends_on = None
logger = logging.g... | [
{
"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 | python-news_aggregator/migrations/versions/20180830_cluster_control.py | hanakhry/Crime_Admin |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
{
"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 | gbpservice/neutron/db/migration/alembic_migrations/versions/75aa8a37a8de_reuse_bd.py | ansao-aci/group-based-policy |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
try:
import cStringIO.StringIO as BytesIO
except ImportError:
from io import BytesIO
import struct
class L21DockDetect(object):
__slots__ = ["detected"]
def __init__(self):
self.detected = False
... | [
{
"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 | lcmtype/lilylcm/L21DockDetect.py | WeirdCoder/LilyPadOS |
import os
import weather
def help1():
"""used to identify the intent help"""
pass
def hyperlink():
""" Used to identify the tag hyperlink"""
pass
async def ky_weather(message):
url = os.environ['mistsupremacyspecialurl']
weather1 = weather.weather(url=url)
await message.channel.send("Th... | [
{
"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 | misc_funcs.py | mak448a/discord-bot |
import os
from enb import icompression
from enb.config import get_options
options = get_options()
class HEVC(icompression.WrapperCodec, icompression.LosslessCodec):
def __init__(self, config_path=None, chroma_format="400"):
config_path = config_path if config_path is not None \
else os.path.j... | [
{
"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 | plugins/plugin_hevc/hevc_codec.py | G-AshwinKumar/experiment-notebook |
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.otpbase import OTPGlobals
from otp.friends.PlayerFriendsManager import PlayerFriendsManager
from pirates.friends.PCFriendPlayerInfo import PCFriendPlayerInfo
class PCP... | [
{
"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 | pirates/friends/PCPlayerFriendsManager.py | Willy5s/Pirates-Online-Rewritten |
import numpy as np
class Deriv:
"""
Calculate the derivative with given order of the function f(t) at point t.
"""
def __init__(self, f, dt, o=1):
"""
Initialize the differentiation solver.
Params:
- f the name of the function object ('def f(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | lib/nummath/deriv.py | TomLXXVI/pipe-network-sim |
import pytest
import threading
import time
from unittest.mock import Mock, call
from quickrpc.action_queue import ActionQueue
from quickrpc.promise import Promise
@pytest.fixture
def aq():
return ActionQueue()
def action():
time.sleep(0.1)
def test_aq_basic(aq):
assert not aq._running.is_set()
aq.pu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/test_actionqueue.py | loehnertj/quickrpc |
import time
from HABAppTests.test_rule._rest_patcher import RestPatcher
from HABAppTests.test_rule.test_case import TestResult, TestResultStatus
class TestCase:
def __init__(self, name: str, func: callable, args=[], kwargs={}):
self.name = name
self.func = func
self.args = args
se... | [
{
"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 | conf_testing/lib/HABAppTests/test_rule/test_case/test_case.py | DerOetzi/HABApp |
# coding: UTF-8
# Copyright 2012 Keita Kita
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
{
"point_num": 1,
"id": "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/integration-test/device.py | mikanbako/Android-Log-Matcher |
import argparse
import logging
import os
import pathlib
from typing import Any
from typing import List
from typing import Optional
import trafaret
from aiohttp import web
from trafaret_config import commandline
log = logging.getLogger(__name__)
PATH = pathlib.Path(__file__).parent.parent.parent
settings_file = os.env... | [
{
"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 | vc_buildserver/utils/common.py | ddevassy/vc-buildserver |
from django.db import models
from taggit.models import Tag
class TypedTag(models.Model):
tag = models.OneToOneField(Tag, on_delete=models.DO_NOTHING)
class Meta:
abstract = True
def __str__(self):
return self.tag.name
def create_model(name, fields=None, app_label='', module='', options... | [
{
"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 | query_view/models.py | enricobarzetti/django-query-view |
from flask import request
from flask_restplus import Resource
from app.project.auth import auth
from app.project.auth.auth_service import AuthService
from app.project.user.user_dto import UserDto
from app.project.user.user_service import UserService
api = UserDto.api
_user = UserDto.user
@api.route('/')
class UserL... | [
{
"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 | app/project/user/user_controller.py | makci97/lms_flask |
import httpx
import pytest
from fastapi import status
from tests.data import TestData
@pytest.mark.asyncio
@pytest.mark.workspace_host
class TestListTenants:
async def test_unauthorized(self, test_client_admin: httpx.AsyncClient):
response = await test_client_admin.get("/tenants/")
assert respon... | [
{
"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 | backend/tests/test_apps_admin_tenants.py | fief-dev/fief |
import pytest
from django.urls import reverse, resolve
from kuras.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{user.us... | [
{
"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 | kuras/users/tests/test_urls.py | kevotovar/kuras-backend |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_bar01.py | eddiechapman/XlsxWriter |
from machine import ADC, Pin
import time
class LDR:
"""This class read a value from a light dependent resistor (LDR)"""
def __init__(self, pin, min_value=0, max_value=100):
"""
Initializes a new instance.
:parameter pin A pin that's connected to an LDR.
:parameter min_value A ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | src/main.py | artem-smotrakov/esp32-ldr |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
class DeleteRequest(object):
def __init__(self):
self.datasets = None
self.groups = None
self.filename = None
def getDatasets(self):
return self.datasets
def setDatasets(self, datasets):
s... | [
{
"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 | dynamicserialize/dstypes/com/raytheon/uf/common/pypies/request/DeleteRequest.py | mjames-upc/python-awips |
class HomonymException(Exception):
def _init_ (self, *args):
super()._init_(args)
class Homonym():
def __init__(self):
pass
def CreateModel(self):
pass
def SgdScore(self, rounds):
pass
def FindErrors(self):
pass
| [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | homonym.py | Biatris/Homonym |
import heapq
class KthLargest(object):
def __init__(self, k, nums):
self.pool = nums
self.k = k
heapq.heapify(self.pool)
while len(self.pool) > k:
heapq.heappop(self.pool)
def add(self, val):
if len(self.pool) < self.k:
heapq.heappush(self.pool... | [
{
"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 | python/design/0703_kth_largest_element_in_a_stream.py | linshaoyong/leetcode |
from pydantic import BaseModel
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from src.database import Base
class TaskDb(Base):
__tablename__ = 'task'
id = Column(Integer, primary_key=True)
name = Column(String(120), index=True, unique=True)
points = Column(... | [
{
"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 | backend/src/models/tasks/__init__.py | michaeleliot/olympus |
import web
import json
from doc_ret_node_enhancement_term_freq import rt
urls = (
'/search/(.*)', 'search_handler',
'/(.*)', 'static_handler'
)
server = web.application(urls, globals())
class search_handler:
def GET(self, query):
return json.dumps(rt(query))
clas... | [
{
"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 | document retrieval/ret_freq.py | amudalab/concept-graphs |
from docutils.parsers.rst import roles
from docutils import nodes
from docutils.parsers.rst.states import Inliner
import docutils.parsers.rst.roles
def strike_role(role, rawtext, text, lineno, inliner: Inliner, options={}, content=[]):
"""
USAGE: :del:`your context`
:param role: my-strike
:param raw... | [
{
"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 | doc/_ext/rst_roles.py | CarsonSlovoka/image-rename |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... | [
{
"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 | data/p4VQE/R4/benchmark/startCirq766.py | UCLA-SEAL/QDiff |
from tensorflow.python.lib.io import file_io
import h5py
import numpy as np
class Dataset:
def __init__(self, path, local):
"""
Initialize the dataset
:param path: Path to the hdf5 dataset file
:param local: True if the path is to a local file, False otherwise
"""
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | trainer/dataset.py | jessica-dl/2XB3-ML-Training |
#! /usr/bin/env python
"""Generate an XML form from Canvas and Autolab csv files that can be
uploaded to Canvas.
Currently only looks at the total score.
Author: Nathan Sprague
Version: 1/18/2018
"""
import argparse
import generate_form
class AutoLabForm(generate_form.CanvasForm):
def __init__(self, canvas_csv... | [
{
"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 | generate_form_autolab.py | molloykp/Upload-Canvas-Grades |
class PalindromizationDiv2:
def getMinimumCost(self, X):
def p(n):
s = str(n)
return s == s[::-1]
return next(i for i in xrange(X+1) if p(X+i) or p(X-i))
| [
{
"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 | topCoder/srms/500s/srm509/div2/palindromizeation_div_2.py | gauravsingh58/algo |
import graphene
from apps.movie.mutators import MovieType, CreateMovie, UpdateMovie, DeleteMovie
from .models import Movie
class MovieInput(graphene.InputObjectType):
name = graphene.String(required=True)
class MovieMutations(graphene.ObjectType):
create_movie = CreateMovie.Field()
update_movie = Updat... | [
{
"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 | apps/movie/schema.py | aram2726/django_graphql |
from django.urls import reverse
from django.test.testcases import TestCase
from rest_framework.test import APIClient
from account.models import AdminType, ProblemPermission, User, UserProfile
class APITestCase(TestCase):
client_class = APIClient
def create_user(self, username, password, admin_type=AdminType... | [
{
"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 | server/utils/api/tests.py | teamscode/TeamsCodeOJ |
from django.db import models
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.db.models.signals import post_save
from lists.models import List
class Person(models.Model):
user = models.OneToOneField(User)
bio = models.TextField()
dob = models.DateField()
lo... | [
{
"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 | people/models.py | morion4000/ophion |
"""Unit tests for the configuration variables"""
from ..src import config as cf
import numpy as np
def test_backendport():
assert isinstance(cf.BACKEND_PORT, int)
def test_host():
assert isinstance(cf.HOST, str)
def test_model():
assert isinstance(cf.MODEL, str)
def test_model_url():
assert isi... | [
{
"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 | tests/test_config.py | lwang94/sem_size_analysis |
"""Role testing files using testinfra."""
import pytest
@pytest.mark.parametrize("name", [
"pcsd",
"corosync",
"pacemaker"
])
def test_cluster_services(host, name):
service = host.service(name)
# assert service.is_valid
assert service.is_enabled
assert service.is_running
def test_cluster... | [
{
"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 | molecule/common/tests/test_pacemaker.py | incubateur-pe/pacemaker |
from tensorflow.keras.models import Model
from model_compression_toolkit import FrameworkInfo
from model_compression_toolkit.common.framework_info import ChannelAxis
from model_compression_toolkit.common.model_validation import ModelValidation
from model_compression_toolkit.keras.constants import CHANNELS_FORMAT, CHAN... | [
{
"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 | model_compression_toolkit/keras/keras_model_validation.py | haihabi/model_optimization |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 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 resendwallettransactions RPC."""
from test_framework.test_framework import CompchainTestFramework... | [
{
"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 | test/functional/wallet_resendwallettransactions.py | robinsage-dev/compchain |
import torch
from colossalai.tensor import ColoTensor
from numpy import allclose
def test_tensor_indexing():
torch_t = torch.randn(2, 3)
colo_t = ColoTensor.init_from_torch_tensor(torch_t)
assert allclose(torch_t[:, 1], colo_t[:, 1].torch_tensor())
def test_lazy_init_tensor():
lazy_t = ColoTensor(2,... | [
{
"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/test_tensor/test_tensor.py | RichardoLuo/ColossalAI |
from common import SushiError, read_all_text
def parse_scxvid_keyframes(text):
return [i-3 for i,line in enumerate(text.splitlines()) if line and line[0] == 'i']
def parse_keyframes(path):
text = read_all_text(path)
if '# XviD 2pass stat file' in text:
frames = parse_scxvid_keyframes(text)
el... | [
{
"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 | keyframes.py | tp7/Sushi |
import sys
from bs4 import BeautifulSoup
def getHTML(filename):
html = open(filename, 'r')
return BeautifulSoup(html.read(), 'html.parser')
def getMusicNames(html):
musics_div = html.select('.tracklist-name')
return [music.string for music in musics_div]
def getMusicDuration(html):
musics_time ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | scrap/musics.py | talesconrado/SpotPer |
# Check weather given tree in binary search tree or not
class Node:
def __init__(self,val):
self.left = None
self.right = None
self.val = val
def validateBST(root):
return isValidBST(root,None,None)
def isValidBST(root, minvalue, maxvalue):
if root is None:
return Tr... | [
{
"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 | tree/98_validate_bst.py | Prashant47/algorithms |
import torch
from torch import nn, Tensor
class TemporalAttention(nn.Module):
def __init__(self, features_size: int = 512, hidden_size: int = 128):
super().__init__()
self.phi_x = nn.Linear(features_size, 1, bias=False)
self.phi_h = nn.Linear(hidden_size, 1, bias=False)
self.softm... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | classes/modules/submodules/attention/TemporalAttention.py | matteo-rizzo/interpretable-tcc |
from django.http.request import HttpRequest
from django.shortcuts import redirect, render, reverse
from django.contrib import messages
from authentication import admin_authentication
from database.user_models import Researcher
def login_page(request: HttpRequest):
if admin_authentication.check_is_logged_in(reques... | [
{
"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 | pages/login_pages.py | ORC-RIS/beiwe-backend |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Love Sharma <contact@lovesharma.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
{
"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 | models.py | zonito/subscribe |
from bs4 import BeautifulSoup
import requests
import re
from scraper.web_scraper import WebScraper
class NewsScraper(WebScraper):
def __init__(self, url, filter_terms, html_parser="html.parser"):
"""
Used to scrape Steam newsfeeds and get appids of free games.
:param url:
:param 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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | scraper/news_scraper.py | megaprokoli/steam_free_game_grabber |
import mock
import pytest
from openapi_core.schema.paths.models import Path
class TestPaths(object):
@pytest.fixture
def path(self):
operations = {
'get': mock.sentinel.get,
'post': mock.sentinel.post,
}
return Path('/path', operations)
@property
def ... | [
{
"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 | tests/unit/schema/test_paths.py | grktsh/openapi-core |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..petpvc import PETPVC
def test_PETPVC_inputs():
input_map = dict(
alpha=dict(
argstr="-a %.4f",
usedefault=True,
),
args=dict(
argstr="%s",
),
debug=dict(
argstr="-d"... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},... | 3 | venv/Lib/site-packages/nipype/interfaces/tests/test_auto_PETPVC.py | richung99/digitizePlots |
import unittest
from pfm.util.util import create_ordered_2d_array_from_dict
from pfm.util.util import convert_dictionary_to_2d_array
from pfm.util.util import sort_body_order
from pfm.util.util import add_headers
import sys
py_version = sys.version_info[0]
HEADERS = ['name', 'local_port', 'login_user']
JSON_DATA = {... | [
{
"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/util/test_util.py | takahi-i/pfm |
import pandas
from ds_utils.strings import append_tags_to_frame, extract_significant_terms_from_subset
def test_append_tags_to_frame():
x_train = pandas.DataFrame([{"article_name": "1", "article_tags": "ds,ml,dl"},
{"article_name": "2", "article_tags": "ds,ml"}])
x_test = pand... | [
{
"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/test_strings.py | idanmoradarthas/DataScienceUtils |
import zope.interface
class IStateStorage(zope.interface.Interface):
"""
"""
state = zope.interface.Attribute("")
def open_and_read(read_cb):
"""
"""
def close():
"""
"""
def write(write_cb):
"""
"""
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/cnstlltn/statestorage_intf.py | kshpytsya/cnstlltn |
# coding: utf-8
"""
Unofficial python library for the SmartRecruiters API
The SmartRecruiters API provides a platform to integrate services or applications, build apps and create fully customizable career sites. It exposes SmartRecruiters functionality and allows to connect and build software enhancing it.
... | [
{
"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 | test/test_job.py | roksela/smartrecruiters-python-client |
import psycopg2
import psycopg2.extras
import os
url = os.getenv('DATABASE_URL')
def connection(url):
conn = psycopg2.connect(url)
return conn
def init_db():
con = connection(url)
return con
def create_tables():
conn = connection(url)
curr = conn.cursor()
queries = tables()
for qu... | [
{
"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 | app/api/db_config.py | gatemadavid/iReporter2 |
'''
Created by auto_sdk on 2016.04.13
'''
from top.api.base import RestApi
class FenxiaoProductcatUpdateRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.agent_cost_percent = None
self.dealer_cost_percent = None
self.name = None
self.product_lin... | [
{
"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 | top/api/rest/FenxiaoProductcatUpdateRequest.py | forestsheep/middleman |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.platform.execute import execute_clear_platform_software_fed_active_acl_counters_hardware
class TestExecuteClearPlatformSoftwareFedActiveAclCountersHardware(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed =... | [
{
"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 | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/platform/execute/execute_clear_platform_software_fed_active_acl_counters_hardware/test_api_execute_clear_platform_software_fed_active_acl_counters_hardware.py | CiscoTestAutomation/genielibs |
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) Google LLC, 2020
#
# Author: Nathan Huckleberry <nhuck@google.com>
#
"""A helper routine run clang-tidy and the clang static-analyzer on
compile_commands.json.
"""
import argparse
import json
import multiprocessing
import os
import subprocess
... | [
{
"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 | scripts/clang-tools/run-clang-tools.py | jainsakshi2395/linux |
import os
import shutil
import tempfile
from unittest import TestCase
from mock import patch
from regulations.apps import RegulationsConfig
class RegulationsConfigTests(TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tmpdir)
@patch('r... | [
{
"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 | regulations/tests/apps_tests.py | PhilR8/regulations-site |
""" Test functions for limits module.
"""
from numpy.testing import *
import numpy.lib
try:
reload(numpy.lib)
except NameError:
# Py3K
import imp
imp.reload(numpy.lib)
from numpy.core import finfo, iinfo
from numpy import single,double,longdouble
import numpy as np
##################################... | [
{
"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 | numpy/core/tests/test_getlimits.py | enthought/numpy-refactor |
import os
from pathlib import Path
import matplotlib.pyplot as plt
def _handle_dirs(pathname, foldername, subfoldername):
path = Path(pathname)
if foldername is not None:
path = path / foldername
if not os.path.isdir(path):
os.mkdir(path)
if subfoldername is not None:
... | [
{
"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 | pkg/pkg/io/io.py | dlee0156/bilateral-connectome |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
{
"point_num": 1,
"id": "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 | yapftests/format_token_test.py | Anthchirp/yapf |
from pynput import mouse
class MyException(Exception):pass
X = []
Y = []
NumberOfMouseClicks = 0
print('Click Origin')
def on_click(x, y, button, pressed):
button = str(button)
global NumberOfMouseClicks
NumberOfMouseClicks = NumberOfMouseClicks + 1
if NumberOfMouseClicks==1:
print('Click To... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | docs/downloads/code/digitize-graph/digitize-data.py | Ronak1958/blog |
import tensorflow as tf
from typing import Tuple, List, Union
from .layers import GCNLayer
from .gcn_skip import GCNTwoLayersSkipConnection
class GCNSequential(tf.keras.Model):
def __init__(self, layers: List[Union[GCNLayer,GCNTwoLayersSkipConnection]]):
super(GCNSequential, self).__init__()
self... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | models/gcn.py | Rufaim/EvolveGCN |
from django.contrib.auth.models import User
from nose.tools import eq_
from kitsune.sumo.tests import TestCase
from kitsune.users.utils import suggest_username
class UtilsTestCase(TestCase):
def test_suggest_username(self):
eq_("someuser", suggest_username("someuser@test.com"))
User.objects.crea... | [
{
"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 | kitsune/users/tests/test_utils.py | 10allday-Software/kitsune |
import hashlib as hl
import json
def hash_string_256(string):
return hl.sha256(string).hexdigest()
def hash_block(block):
hashable_block = block.__dict__.copy()
hashable_block['transactions'] = [tx.to_ordered_dict() for tx in hashable_block['transactions']]
return hash_string_256(json.dumps(hashable_b... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | utils/hash_util.py | kshewani/python_blockchain |
import subprocess
COMMAND = u'systemctl'
ARGS = [u'sleep.target', u'suspend.target', u'hibernate.target', u'hybrid-sleep.target']
# https://www.man7.org/linux/man-pages/man1/systemctl.1.html
if not subprocess.check_output('pidof systemd'):
raise NotImplementedError(
"wakepy has not yet support for init pr... | [
{
"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 | wakepy/_linux.py | Mohammad-Mohsen/wakepy |
import unittest
from MusicTheory.pitch.Accidental import Accidental
import Framework.ConstMeta
"""
Degreeのテスト。
"""
class TestAccidental(unittest.TestCase):
def test_Accidentals(self):
self.assertEqual(Accidental.Accidentals, {'♯': 1, '#': 1, '+': 1, '♭': -1, 'b': -1, '-': -1})
def test_Accidentals_NotSe... | [
{
"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/tests/TestAccidental.py | ytyaru/Python.MusicTheory.Pitch.NoteNumber.201709171322 |
from .hw_6_check import has_plotting
def test_nothing():
assert not has_plotting("")
def test_plotly():
assert has_plotting("import plotly.express as px")
def test_plot_method():
assert has_plotting("df.plot()")
def test_plot_submodule():
assert has_plotting("df.plot.scatter()")
| [
{
"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 | scripts/test_hw_6_check.py | afeld/python-public-policy |
import unittest
import os, re
from pathlib import Path
class LookerSDKTestCase(unittest.TestCase):
base_url = os.environ.get('LOOKERSDK_BASE_URL')
api_id = os.environ.get('LOOKERSDK_CLIENT_ID')
api_secret = os.environ.get('LOOKERSDK_CLIENT_SECRET')
email_list = os.environ.get('THEMIS_EMAIL_RECIPIENTS'... | [
{
"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": true... | 3 | tests/test_setup.py | sourcery-ai-bot/themis-1 |
def bubblesort(l):
for i in range(len(l) - 1):
for j in range(len(l) - i - 1):
if l[j] > l[j + 1]:
l[j], l[j + 1] = l[j + 1], l[j]
def selectionsort(l):
for i in range(len(l)):
minst = i
for j in range(i, len(l)):
if l[minst] > l[j]:
minst = j
l[minst], l[i] = l[i], l[minst]
def a():
... | [
{
"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 | 18Host/TDT4110/PythonWorkspace/Oving7/Sorting.py | MarcusTL12/School |
import tensorflow as tf
from tensorflow.keras.callbacks import Callback
class ExtraValidation(Callback):
"""Log evaluation metrics of an extra validation set. This callback
is useful for model training scenarios where multiple validation sets
are used for evaluation (as Keras by default, provides function... | [
{
"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 | image_augmentation/callbacks/extra_eval.py | tanzhenyu/image_augmentation |
from b2sdk.v1 import InMemoryAccountInfo, B2Api
from b2sdk.v1 import Bucket as B2Bucket
from b2sdk.exception import InvalidAuthToken
from typing import List
info = InMemoryAccountInfo()
class Account:
def __init__(self, name: str, keys: list):
self.api = B2Api(info)
self.name = name
se... | [
{
"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 | backdriveb2/api/objects/account.py | Joffreybvn/backdriveb2 |
from django.shortcuts import render
from django.http import HttpRequest
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.generic import DetailView
from django.db.models import Count
from .models import Publication, PublicationMedia
def index(request):
publication_list = P... | [
{
"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 | applications/publications/views.py | samay-rgb/alumni |
# encoding: utf-8
"""
@author: BrikerMan
@contact: eliyar917@gmail.com
@blog: https://eliyar.biz
@version: 1.0
@license: Apache Licence
@file: __init__.py
@time: 2019-05-17 11:15
"""
import os
from distutils.version import LooseVersion
from typing import Any, Dict
os.environ["TF_KERAS"] = "1"
os.environ["TF_CPP_MIN... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | kashgari/__init__.py | xinxiangbobby/Kashgari |
from uuid import UUID
from flask import Blueprint, render_template, jsonify, flash, request, abort, redirect # noqa
from flask_login import login_required, current_user
from hive.models import User
route = Blueprint("profile", __name__)
@route.route("/me", methods=['GET', 'POST'])
@login_required
def profile():
... | [
{
"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 | hive/controllers/user_controller.py | evilinc-dev/hive |
'''
XlPy/MS1Quantitation/Extraction/core
____________________________________
Core module to extract and process MS1 scans to extracted ion
chromatograms, or XICs.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
... | [
{
"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 | xldlib/xlpy/ms1quantitation/extraction/core.py | Alexhuszagh/XLDiscoverer |
import insightconnect_plugin_runtime
from .schema import SendResolveEventInput, SendResolveEventOutput
# Custom imports below
import pypd
class SendResolveEvent(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="send_resolve_event",
... | [
{
"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 | plugins/pagerduty/komand_pagerduty/actions/send_resolve_event/action.py | lukaszlaszuk/insightconnect-plugins |
# -*- coding: utf-8 -*-
from pyramid.view import view_config
from h.notification.models import Subscriptions
@view_config(route_name='unsubscribe',
renderer='h:templates/unsubscribe.html.jinja2')
def unsubscribe(request):
token = request.matchdict['token']
payload = request.registry.notification... | [
{
"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 | h/notification/views.py | noscripter/h |
from lenstronomy.LightModel.light_model import LightModel
import numpy as np
__all__ = ['DifferentialExtinction']
class DifferentialExtinction(object):
"""
class to compute an extinction (for a specific band/wavelength). This class uses the functionality available in
the LightModel module to describe an ... | [
{
"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 | lenstronomy/ImSim/differential_extinction.py | heather999/lenstronomy |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `xpath` package."""
# firstparty
from xpath import cli
from xpath import xpath
# thirdparty
from click.testing import CliRunner
import pytest
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/... | [
{
"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_xpath.py | KGerring/xpath |
import tkinter as tk
import pyperclip
from txtcli.model import ErrMsg
from txtcli.util import send_msg
def create_window_center(title: str) -> tk.Tk:
window = tk.Tk()
window.title(title)
window.rowconfigure(0, minsize=500, weight=1)
window.columnconfigure(1, minsize=500, weight=1)
window_width =... | [
{
"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 | src/txtcli/gui.py | ahui2016/txt-cli |
# -*- coding: utf-8 -*-
import numpy as np
def kalman_transit_covariance(S, A, R):
"""
:param S: Current covariance matrix
:param A: Either transition matrix or jacobian matrix
:param R: Current noise covariance matrix
"""
state_size = S.shape[0]
assert S.shape == (state_size, state_size)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | road situation analysis/research/road/state estimation/sdc/kalman_filter.py | MikhailKitikov/DrivingMonitor |
import os
from jinja2 import Environment, PackageLoader
class Writer:
def __init__(self, path, width, height, depth=3,
database='Unknown', segmented=0):
environment = Environment(
loader=PackageLoader('pascal_voc_writer', 'templates'),
keep_trailing_newline=True)
... | [
{
"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 | pascal_voc_writer/__init__.py | yiluheihei/pascal-voc-writer |
import pytest
from django.urls import resolve, reverse
from jrweb.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{user.us... | [
{
"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 | jrweb/users/tests/test_urls.py | fingerstik/django_web_practice |
from PygFW import Event
import pygame
class EntityClickEvent(Event):
def __init__(self, scene_surface):
Event.__init__(self, scene_surface, pygame.MOUSEBUTTONDOWN)
def executor(self, scene, event):
for entity in scene.entities._list_:
if entity.clickable:
if en... | [
{
"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 | PygFW/Builtin/Events/EntityClickEvent.py | shauncameron/PygFW |
# mypy: allow-untyped-defs
import subprocess
from functools import partial
from typing import Callable
from mozlog import get_default_logger
from wptserve.utils import isomorphic_decode
logger = None
def vcs(bin_name: str) -> Callable[..., None]:
def inner(command, *args, **kwargs):
global logger
... | [
{
"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 | tools/wptrunner/wptrunner/vcs.py | BasixKOR/wpt |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
{
"point_num": 1,
"id": "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 | platform/gcutil/lib/google_compute_engine/gcutil_lib/mock_metadata.py | IsaacHuang/google-cloud-sdk |
import subprocess
import re
import os
from ajenti.api import plugin
from ajenti.api.sensors import Sensor
from ajenti.plugins.dashboard.api import ConfigurableWidget
@plugin
class SMARTSensor (Sensor):
id = 'smart'
timeout = 5
def get_variants(self):
r = []
for s in os.listdir('/dev'):
... | [
{
"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 | usr/share/pyshared/ajenti/plugins/smartctl/widget.py | lupyuen/RaspberryPiImage |
import pyxel
import math
import random
pyxel.init(255,255)
def update():
pass
def hopehely(x, y, r):
szin = 15 # fehér
s = math.sqrt(2) * r / 2
pyxel.line(x+r, y , x-r, y , szin)
pyxel.line(x , y-r, x , y+r, szin)
pyxel.line(round(x-s),
round(y-s),
round(x+s)... | [
{
"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 | ho/03_nagyon_sok_hopehely.py | cie/python |
#!/usr/bin/env python3
import argparse
import io
import sys
from urllib.request import urlopen
import urllib.error
import time
import datetime
from retrying import retry
URL = "http://unreliable.labs.crossref.org/error"
ONE_SECOND=1000
ONE_HOUR=((ONE_SECOND*60)*60)
ONE_DAY=(ONE_HOUR*24)
@retry(wait_exponential_mul... | [
{
"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 | stubborn.py | CrossRef/unreliable |
# Stack Big O complexity
# Push: O(1) - Constant Time
# Pop (remove): O(1) - Constant Time
# Top (top): O(1) - Constant Time
# Is Empty: O(1) - Constant Time
# Size: O(1) - Constant Time
class Emptiness(Exception):
pass
class Stack:
def __init__(self):
self.items = []
def push(self, item):
... | [
{
"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 | computer_science/data_structures/stack/stack.py | LeandroTk/Algorithms |
class Factor(object):
def __init__(self, factorType, variables, measurement):
"""
Initialize the factor object
factorType - the factor type (e.g. Pose3Pose3)
variables - a list of the variables affected by the factor
measurement - the distribution describing the measurement
... | [
{
"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 | graff/Factor.py | nicrip/graff_py |
from infynipy.models.group import ReferrerGroup
from .. import IntegrationTest, vcrr
class TestReferrerGroup(IntegrationTest):
@vcrr.use_cassette
def test_referrer_group_get_multiple(self):
for group in self.infynity.referrer_groups:
assert isinstance(group, ReferrerGroup)
@vcrr.use_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/integration/models/test_group.py | beanpuppy/infynipy |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_2
from i... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | isi_sdk_8_2_2/test/test_hdfs_fsimage_settings.py | mohitjain97/isilon_sdk_python |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from kelbyapp.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... | [
{
"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": true... | 3 | kelbyapp/public/forms.py | metatroid/kelbyapp |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import builderutils.parser as parser
import builderutils.renderer as renderer
import builderutils.dom as dom
@click.group()
def cli():
pass
@click.command()
@click.option("--configfile", type=click.Path(), help="Builder config", required=True)
def crea... | [
{
"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 | builder/builder.py | bdastur/builder |
import os
import pathlib
from setuptools.config import read_configuration
def get_config():
repo_path = pathlib.Path(__file__).parent.parent.absolute()
config_setup = read_configuration(os.path.join(repo_path, "setup.cfg"))
config_requirements = config_setup["options"]["install_requires"]
return con... | [
{
"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 | scripts/generate_requirements_from_setup.py | rpitonak/azure-batch-load |
import numpy as np
class Dense():
def __init__(self, units, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', input_shape=None):
self._units = units
self._activation = activation
self._use_bias = use_bias
self._kernal_initializer = kern... | [
{
"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 | CNN/Dense.py | GreatGameDota/CNN-Numpy-1D-Images |
import time
from metaflow import Run, Parameter, FlowSpec, step, profile
class ClientAPICheck(FlowSpec):
"""
Run ClientAPIFlow before this flow. Supply its run id and the nonce used parameters.
This flow uses the Client API to fetch and validate its results.
"""
nonce = Parameter('nonce')
run_... | [
{
"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 | flows/clientapi_check.py | tuulos/metaflow-datastore-tests |
# coding: utf-8
"""
Prisma Cloud Compute API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.04.439
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_impor... | [
{
"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 | test/test_cves_api.py | hi-artem/twistlock-py |
########
# PART 1
def dragon_step(a):
"""
For example, after a single step of this process,
1 becomes 100.
0 becomes 001.
11111 becomes 11111000000.
111100001010 becomes 1111000010100101011110000
"""
b = [0 if x==1 else 1 for x in a]
b.reverse()
return a + [0] + b
def check... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | aoc/event2016/day16/solve.py | rjbatista/AoC |
# coding: utf-8
import chainer
import chainer.functions as F
class Shape(chainer.Chain):
def forward(self, x):
y1 = x.shape
return list(y1)
class ShapeConcat(chainer.Chain):
def forward(self, x):
y1 = x.shape
return np.array(y1 + (42,))
class ShapeIndex(chainer.Chain):
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | elichika/tests/node/ndarray/Shape.py | disktnk/chainer-compiler |
import os
from rtxp.core import dsa
from rtxp.core import hashes
from rtxp.core import utils
_HASH_TX_SIGN = 'STX\0'
_HASH_TX_SIGN_TESTNET = 'stx\0'
def _get_signing_hash(blob, test=False):
prefix = _HASH_TX_SIGN_TESTNET if test else _HASH_TX_SIGN
return hashes.sha512half(prefix + blob)
def _sign_blob(blob, r... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | rtxp/core/signer.py | johansten/rtxp-py |
import spira.all as spira
class RouteExample(spira.Cell):
layer = spira.LayerParameter(default=spira.RDD.PLAYER.M1.METAL, doc='Layer to be used when creating the route object.')
@spira.cache()
def get_io_ports(self):
p1 = spira.Port(name='P1', midpoint=(0,0), orientation=180, process=self.la... | [
{
"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 | tests/_01_docs/_overview_routes_3.py | qedalab/spira |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.