source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
Copyright 2022 RPANBot
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
distrib... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | web/helpers/globals.py | t0m0094/RPANBot |
import functools
class SnareDrum: pass
class Cymbal: pass
class Stick: pass
class Brushes: pass
@functools.singledispatch
def play(instrument, accessory):
raise NotImplementedError('Cannot play these')
@play.register(SnareDrum)
def _(instrument, accessory):
if isinstance(accessory, Stick):
return '... | [
{
"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 | PythonHackerGuideBook/13/singledispatch_sample1.py | t2y/python-study |
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destination_blob_name):
storage_client = storage.Client('liquid-force-295404')
"""Uploads a file to the bucket. https://cloud.google.com/storage/docs/ """
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(d... | [
{
"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 | misc/google_cloud.py | Jason-George/irn |
#!/usr/bin/env python
# Copyright 2019-2020 The University of Manchester, UK
# Copyright 2020 Vlaams Instituut voor Biotechnologie (VIB), BE
# Copyright 2020 Barcelona Supercomputing Center (BSC), ES
# Copyright 2020 Center for Advanced Studies, Research and Development in Sardinia (CRS4), IT
#
# Licensed under the Ap... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | rocrate/model/data_entity.py | sourav0220/ro-crate-py |
"""add username to LoadTbl
Revision ID: 7fb7364b821a
Revises: 090128c02529
Create Date: 2018-10-24 17:10:03.781293
"""
# revision identifiers, used by Alembic.
revision = '7fb7364b821a'
down_revision = '090128c02529'
import sqlalchemy as sa
from alembic import op
def upgrade():
op.add_column('LoadTbl', sa.Col... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | alembic_dvc/versions/7fb7364b821a_add_username_to_loadtbl.py | ASUPychron/pychron |
import torch
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2seq_encoders.gated_cnn_encoder import GatedCnnEncoder
class TestGatedCnnEncoder(AllenNlpTestCase):
def test_gated_cnn_encoder(self):
cnn_encoder = GatedCnnEncoder(
input_dim=32,
layers=[[[4... | [
{
"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/modules/seq2seq_encoders/gated_cnn_encoder_test.py | MSLars/allennlp |
from conans import ConanFile, tools
required_conan_version = ">=1.33.0"
class CpppeglibConan(ConanFile):
name = "cpp-peglib"
description = "A single file C++11 header-only PEG (Parsing Expression Grammars) library."
license = "MIT"
topics = ("conan", "cpp-peglib", "peg", "parser", "header-only")
... | [
{
"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 | recipes/cpp-peglib/0.x.x/conanfile.py | rockandsalt/conan-center-index |
from crawler import *
class mobileapkworld_crawler(crawler):
def __init__(self):
super().__init__('https://mobileapkworld.com/',
'https://mobileapkworld.com/page/')
self.urlBase = 'https://mobileapkworld.com/'
self.folder_name = 'mobileapkworld/'
if not os.p... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | mobileapkworld.py | anatolikalysch/APKCrawler |
# -*- coding: utf-8 -*-
'''
Tests for salt.utils.jid
'''
# Import Python libs
from __future__ import absolute_import
import datetime
import os
# Import Salt libs
import salt.utils.jid
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
patch,
NO_MOCK,
NO_MOCK_REASON
)
class ... | [
{
"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 | tests/unit/utils/test_jid.py | yuanbaopapa/salt |
from typing import List
from blspy import AugSchemeMPL, G2Element, PrivateKey
from chives.types.blockchain_format.sized_bytes import bytes32
from chives.types.coin_spend import CoinSpend
from chives.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict
from tests.cor... | [
{
"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 | tests/util/key_tool.py | HiveProject2021/chives-light-wallet |
import logging
import logging.config
import sys
from click.testing import CliRunner
from narq.cli import cli
from narq.worker import WorkerSettings
async def foobar(ctx):
return 42
def worker_pre_init():
log_level = "DEBUG"
logging.config.dictConfig(
{
'version': 1,
'dis... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_cli.py | inactivist/larq |
#!/usr/bin/env python
from mi.core.log import get_logger
from mi.dataset.driver.flord_l_wfp.sio.resource import RESOURCE_PATH
import unittest
import os
from mi.dataset.driver.dosta_ln.wfp_sio.dosta_ln_wfp_sio_telemetered_driver import parse
from mi.dataset.dataset_driver import ParticleDataHandler
__author__ = 'mwor... | [
{
"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 | mi/dataset/driver/dosta_ln/wfp_sio/test/test_dosta_ln_wfp_sio_telemetered_driver.py | cdobs/mi-instrument |
import markdown
import pinax.boxes.hooks
import pinax.pages.hooks
def markup_renderer(content):
return markdown.markdown(content)
class PinaxBoxesHookSet(pinax.boxes.hooks.DefaultHookSet):
def parse_content(self, content):
return markup_renderer(content)
class PinaxPagesHookSet(pinax.pages.hooks... | [
{
"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 | pinaxcon/hooks.py | n6151h/pyconau2017 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Google Chrome Preferences file event formatter."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import chrome_preferences
from tests.formatters import test_lib
class ChromeContentSettingsExceptionsFormatter(
test_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | tests/formatters/chrome_preferences.py | nflexfo/plaso |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_table05.py | totdiao/XlsxWriter |
from algo_battle.domain.algorithmus import Algorithmus
from algo_battle.domain import FeldZustand, Richtung
class MeinAlgorithmus(Algorithmus):
def __init__(self):
super().__init__("Alexander")
self.meine_richtung = Richtung.Rechts
self.zeahler = 10
def _gib_richtung(self,... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | submitted_algorithms/teilnehmer/alexander.py | coderdojoka/algo-battle |
import graphene
from graphene_django import DjangoObjectType
from users.models import User
from django.contrib.auth import authenticate
class UserType(DjangoObjectType):
class Meta:
model = User
def get_user(info):
token = info.context.session.get('token') or info.context.META.get('HTTP_AUTHORIZAT... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | users/schema.py | ashe-sparcs/hackernews_api |
import pytest
def pytest_addoption(parser):
parser.addoption(
"--integration", action="store_true", default=False, help="run integration tests (hits N2EX endpoint)"
)
def pytest_configure(config):
config.addinivalue_line("markers", "integration: mark test as slow to run")
def pytest_collection... | [
{
"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/conftest.py | MaxBird300/NordPoolAPI |
from django.contrib import auth
from django.shortcuts import render
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class Cre... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{
... | 3 | app/user/views.py | xemperforya/recipe-app-api |
from run import db
from flask_login import UserMixin
class Post(db.Model):
__tablename__ = "posts"
id = db.Column(db.Integer, primary_key=True)
image = db.Column(db.Text)
location = db.Column(db.String(255))
title = db.Column(db.String(255))
description = db.Column(db.String)
price = db.Co... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than cl... | 3 | models.py | Joshua-Barawa/MyHome |
import os
import pytest
from anchore_engine.subsys import logger
from test.integration.services.policy_engine.utils import LocalTestDataEnvironment
from anchore_engine.services.policy_engine.engine.tasks import ImageLoadTask
from anchore_engine.db import end_session
from test.fixtures import anchore_db, cls_anchore_db... | [
{
"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 | test/integration/services/policy_engine/conftest.py | marojor/anchore-engine |
import xml.etree.ElementTree as ET
from tkinter.filedialog import askopenfilename
import os
import csv
def readFile(filename):
if not os.path.exists(filename): return
tree = ET.parse(filename)
root = tree.getroot()
#############################################
dict_keys = []
dict_keys = [item for item in input... | [
{
"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 | Python/xml2csv.py | lonelycoder2004/hacktoberfest2020-3 |
import local_search as ls
import record_process as rp
import max_cut_instance as m_instance
import random as rd
import math
T = 10000 # ๆธฉๅบฆ
T_min = pow(10,-5) # ๅทๅดๆธฉๅบฆ
Max_iters = 10000 # ๆๅคง่ฟญไปฃๆฌกๆฐ
r = 0.99 # ้็ซ
def E_evaluation(delta, T):
"""
่ฟๅๅคๅคงๅฏ่ฝๆฅๅๆฐ่งฃ
:param obj:
:param new_obj:
:return: ๆฆ็
... | [
{
"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 | max-cut/code/simulated_annealing.py | minasora/- |
from ..registry import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module
class VoxelNet(SingleStageDetector):
def __init__(
self,
reader,
backbone,
neck,
bbox_head,
train_cfg=None,
test_cfg=None,
pretrained=None,
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | det3d/models/detectors/voxelnet.py | hrrauf/Structure-Aware-Det-3D |
import pygraphviz as pgv
from .printer import Printer
class GraphPrinter(Printer):
"""
Exports flows to graphviz
"""
def __init__(self, *args, **kwargs):
super(GraphPrinter, self).__init__(*args, **kwargs)
def new_obj(self):
return pgv.AGraph(strict=False, directed=True, rankdir='... | [
{
"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 | psqlflow/printers/graph_printer.py | liuhenry/psqlflow |
from enum import Enum
class PassportType(Enum):
USER = 1
PHONE = 2
EMAIL = 3
@staticmethod
def get_string(x):
return ['user', 'phone', 'email'][x.value - 1]
@staticmethod
def get_passport_type(x: str):
return {'user': PassportType.USER, 'phone': PassportType.PHONE, 'emai... | [
{
"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 | common/passport.py | ciaranchen/Sreg |
# wrap the requests library
import requests
from requests.sessions import HTTPAdapter
class FDSRequest:
def __init__(self, timeout, max_retries):
self._max_retries = max_retries
self._timeout = timeout
def request(self, method, url, kwargs):
'''
Constructs a specified session and sends quest.
... | [
{
"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 | fds/fds_request.py | XiaoMi/galaxy-fds-sdk-python |
# coding=utf-8
from django.core.management import call_command
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient, APITestCase
from rest_framework import status
class ApiTest(APITestCase):
def setUp(self):
"""Setup test http client"""
self.client = APIClient()
... | [
{
"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 | api/tests.py | banbanchs/leda |
from datetime import datetime
from flask import Flask
from . import db
from .post import Post
def db_init(app: Flask):
with app.app_context():
if app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///:memory:':
db.create_all()
if app.debug and not app.testing:
# pylint: disable = no-member
... | [
{
"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 | neko/models/db_init.py | airt/neko-api |
import logging
from logging.handlers import RotatingFileHandler
import contextlib
import datetime
class LogFilter(logging.Filter):
def __init__(self):
super().__init__(name="discord.state")
def filter(self, r):
if r.levelname == "WARNING" and "referencing an unknown" in r.msg:
... | [
{
"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 | src/log_setup.py | EzZz1337/automod |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the MacOS application usage event formatter."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import appusage
from tests.formatters import test_lib
class ApplicationUsageFormatterTest(test_lib.EventFormatterTestCase):
""... | [
{
"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 | tests/formatters/appusage.py | berggren/plaso |
from hypno import inject_py
import sys
import shutil
from pathlib import Path
class Injector:
def __init__(self,pid,code_path):
self.pid=pid
self.code=code_path
def __pre_run(self):
pass
def __check_env(self):
pass
def do_inject(self):
inject_code="""import sys;sy... | [
{
"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 | pyinpy/inject.py | leegohi/pyinpy |
#!/usr/bin/env python3
# author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2020.12.16
import os
import telebot
TOKEN = os.getenv('TELEGRAM_TOKEN')
bot = telebot.TeleBot(TOKEN)
users_id = [1079414868]
@bot.message_handler(commands=['authorize'])
def start_command(message):
print(message.chat.id... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | telegram/main-pytelebot.py | whitmans-max/python-examples |
def deal_day1(src, dest):
n = len(src)
for i in range(n):
dest[n-i-1] = src[i]
def deal_one(src_pos, stack_size):
return stack_size-src_pos-1
def inv_deal_one(src_pos=None, deck_size=None):
# well, that's easy to invert...
return deck_size-src_pos-1
def inv_deal_all(src, dest):
de... | [
{
"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 | aoc2019/day22/dealit.py | shoreofwonder/adventofcode |
import pytest
from arroyo.utils.metrics import Gauge, configure_metrics, get_metrics
from tests.metrics import Gauge as GaugeCall
from tests.metrics import TestingMetricsBackend
def test_gauge_simple() -> None:
backend = TestingMetricsBackend
name = "name"
tags = {"tag": "value"}
gauge = Gauge(backe... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | tests/utils/test_metrics.py | horpto/arroyo |
# Copyright (c) 2016 Intel, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"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 | valence/api/controllers/v1/storages.py | mshubian/valence |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Created By : Vรญtor Pereira
# Created Date: 01-09-2021
# version ='0.0.1'
# ---------------------------------------------------------------------------
"""Defines an interface for supervised learning models"""
# ---... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/si/supervised/model.py | DiogoM1/si |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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 l... | [
{
"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 | test/test_sync_reports_rotate.py | Atomicology/isilon_sdk_python |
import asyncio
import logging
log = logging.getLogger(__name__)
class Inbound:
def __init__(self, loop, settings):
self.loop = loop
self.settings = settings
self.inbox = asyncio.Queue(loop=self.loop)
self.stop_event = asyncio.Event()
def stop(self):
self.stop_event.se... | [
{
"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 | xwing/network/inbound.py | victorpoluceno/xwing |
from Sensors import Sensor
import cv2
class CVSensor(Sensor):
stream = None
def __init__(self, videoSource):
self.stream = cv2.VideoCapture(videoSource)
def __del__(self):
self.stream.release()
def getFrame(self):
if not self.stream.isOpened():
return None
... | [
{
"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 | VideoSensors/Sensors/CVSensor.py | CommName/WildeLifeWatcher |
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING
import pytest
from quart_events.pytest_plugin import EventsCatcher
from testapp import create_app
if TYPE_CHECKING:
from _pytest.fixtures import SubRequest
from quart.typing import Quart, TestClientProtocol
from typing 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | test/conftest.py | smithk86/quart-events |
# -*- coding: utf-8 -*-
# This repo is licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | [
{
"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 | megengine_release/configs/fcos_res18_coco_3x_800size.py | megvii-research/ICD |
from graphviz import Digraph
def buildGraph(node, graph = None, mainBranch = False):
"""
Creates a graph for the current node
Arguments:
node {Node} -- Father node
graph {Digraph}
mainBranch {bool} -- If display only the main branch or all of the tree
... | [
{
"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 | analysis/rendering.py | Jeanselme/FeatureAnalysis |
"""
Django Linked Items Models
"""
from django.db import models
from ..tools import relations
#pylint: disable=no-member
class Item(models.Model):
"The base item to be linked."
name = models.CharField(max_length=128)
def get_linked(self, upwards=False):
"Return relations."
# The return com... | [
{
"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 | django_linked_items/models/__init__.py | martinphellwig/django-linked-items |
# src: https://github.com/facebookresearch/DrQA/blob/master/drqa/reader/data.py
import numpy as np
from torch.utils.data import Dataset
from torch.utils.data.sampler import Sampler
from .vector import vectorize
# ------------------------------------------------------------------------------
# PyTorch datase... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | neuroir/inputters/ranker/data.py | niazangels/context_attentive_ir |
"""
Select widget for MonthField. Copied and modified from
https://docs.djangoproject.com/en/1.8/ref/forms/widgets/#base-widget-classes
"""
from datetime import date
from django.forms import widgets
from django.utils.dates import MONTHS
from month.util import string_type
class MonthSelectorWidget(widgets.MultiWidget... | [
{
"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 | month/widgets.py | th-thomas/django-monthfield |
# https://stackoverflow.com/questions/16974047/efficient-way-to-find-missing-elements-in-an-integer-sequence/16974075#16974075
from itertools import islice, chain
def window(seq, n=2):
"Returns a sliding window (of width n) over data from the iterable"
" s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/popoto/utils/list_search.py | yudame/portfolio |
# ไธ่ฝฝ้ๆไปฃ็
import re
import os
from ac.pre import get_yaml
from ac.pre import get_html
from selenium import webdriver
from urllib.request import quote
from selenium.webdriver.firefox.options import Options
config = get_yaml()
contest_url = str(config['oj_url'])+'/contest/'+str(config['contest_id'])
options = Options(... | [
{
"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 | v2/user.py | Llf0703/Anti-Cheating |
import numpy as np
def compute_anomaly_corrs(out_true, out_pred):
anomaly_corrs = np.zeros(out_pred.shape[1])
for i in range(anomaly_corrs.size):
anomaly_corrs[i] = np.corrcoef(out_pred[:,i], out_true[:,i])[0,1]
return anomaly_corrs
def split_train_data(train_months, test_months, tra... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | predictability_utils/utils/helpers.py | marpyr/forecast_predictability |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"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 | kubernetes/test/test_v1_secret_key_selector.py | dix000p/kubernetes-client-python |
# MIT License
#
# Copyright (c) 2018 Alexey Nikitin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | [
{
"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 | meerk/calendar/LoggableCalendar.py | nikialeksey/meeker |
from django.contrib import admin
from django import forms
from .models import Contact
class ContactForm(forms.ModelForm):
# name = forms.CharField(widget=CustomWidget())
class Meta:
model = Contact
@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
readonly_fields = ('created_at', '... | [
{
"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 | starter_app/contact/admin.py | reorx/django_starter_pack |
from threading import Lock
from six import with_metaclass
from ploceidae.utilities.singleton_implementer import SingletonImplementer
from ploceidae.dependency.garbage_collection.scheduler import Scheduler
class GarbageCollectionObserver(with_metaclass(SingletonImplementer)):
"""
Handles freeing of dependenci... | [
{
"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 | ploceidae/dependency/garbage_collection/garbage_collection_observer.py | MATTHEWFRAZER/pygmy |
from .base_exercice import BaseExercice
from LeFramework.common.objs import *
from LeFramework.common.regulators import Timer
from rlbot.utils.structures.game_data_struct import GameTickPacket
class NormalGameExercice(BaseExercice):
def vars(self):
self.timer.set_stop()
def reward(self, packet):
"""
:retu... | [
{
"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 | exercices/ml_exercice.py | inXS212/LeFramework |
import weakref
import Queue
from walky.serializer import SystemMessage
ms_count = 0
def id_next():
global ms_count
ms_count += 1
return ms_count
class MessengerSubscriber(object):
_messenger = None
def __init__(self,messenger,filter_op):
self.messenger(messenger)
self.queue = Que... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | walky/messenger.py | tallynerdy/walky |
import asynctest
from asynctest.mock import patch
class TestHelloWorld(asynctest.TestCase):
def setUp(self):
patcher1 = patch('charlesbot_hello_world.helloworld.HelloWorld.load_config') # NOQA
self.addCleanup(patcher1.stop)
self.mock_load_config = patcher1.start()
from charlesbo... | [
{
"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/test_helloworld.py | havardgulldahl/charlesbot-suldalholoi |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
from prjxray.util import OpenSafeFil... | [
{
"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 | prjxray/bitfilter.py | marzoul/prjxray |
# Copyright 2021-xx iiPython
# Modules
import sys
from rich.console import Console
# Logging class
rcon = Console()
class Logging(object):
def __init__(self) -> None:
self._color_map = {"success": "green", "info": "cyan", "warn": "yellow", "error": "red", "crash": "red"}
def log(self, log_type: str, ... | [
{
"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 | prism/logging.py | ii-Python/Prism-v3 |
"""
A test for items
"""
from dork.items import Item
def test_init_method():
"""
Testing the constructor
"""
name = 'Donut'
description = {'This is an old fasion donut'}
properties = {'eatable'}
item = Item(name, description, properties)
assert item.name == name
assert item.descrip... | [
{
"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_items.py | JoshMcKinstry/Dork_Game_team_octosquad |
import pandas as pd
import pytest
from reco_utils.evaluation.parameter_sweep import generate_param_grid
@pytest.fixture(scope="module")
def parameter_dictionary():
params = {
"param1": [1, 2, 3],
"param2": [4, 5, 6],
"param3": 1
}
return params
def test_param_sweep(parameter_di... | [
{
"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/test_sweep.py | ilanreiter/Recommenders |
# coding: utf-8
"""
Quay Frontend
This API allows you to perform many of the operations required to work with Quay repositories, users, and organizations. You can find out more at <a href=\"https://quay.io\">Quay</a>. # noqa: E501
OpenAPI spec version: v1
Contact: support@quay.io
Generated by: h... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | test/test_team_api.py | angeiv/python-quay |
from typing import Union
import numpy as np
from copulae.copula.abstract import AbstractCopula as Copula
from copulae.core import create_cov_matrix, near_psd, tri_indices
from copulae.stats import kendall_tau, spearman_rho
InitialParam = Union[float, np.ndarray]
def is_elliptical(copula: Copula):
return copula... | [
{
"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 | copulae/copula/utils.py | Wittgensteen/copulae |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
_B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
_E16 = list(enumerate(["0", "1", "2", "3", "4", "5", "6", "7", "8", ... | [
{
"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 | antlir/bzl/sha256.bzl | SaurabhAgarwala/antlir |
import json
class FileUtil:
@classmethod
def read_as_dict(cls, file) -> dict:
string = cls.read_as_str(file)
return json.loads(string)
@classmethod
def read_as_str(cls, file) -> str:
with open(file, mode="r", encoding="utf-8") as f:
return f.read()
| [
{
"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 | HttpMessageParser/http1/utils/FileUtil.py | Patr1ck97/HttpMessageParser |
import logipar
import json, os
with open(os.path.dirname(os.path.realpath(__file__)) + os.sep + 'cats.json') as json_file:
data = json.load(json_file)
print("-- Welcome to the cat library --")
s = input("Please enter an input string: ")
l = logipar.Logipar()
l.overwrite(logipar.Token.AND, "et")
l.caseSensitive = F... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python/sample.py | altef/logipar |
"""Test OdT reading and writing."""
from io import StringIO
import pytest
import gio
def test_read_odt():
"""Test the basics.
"""
ds = gio.read_odt('data/OdT/3d_horizon/Segment_ILXL_Single-line-header.dat')
assert ds['twt'].shape == (54, 57)
assert ds['twt'].mean() - 661.88136 < 1e-5
ds = 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_odt.py | agilescientific/gio |
## module polyFit
''' c = polyFit(xData,yData,m).
Returns coefficients of the polynomial
p(x) = c[0] + c[1]x + c[2]x^2 +...+ c[m]x^m
that fits the specified data in the least
squares sense.
sigma = stdDev(c,xData,yData).
Computes the std. deviation between p(x)
and the data.
''' ... | [
{
"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 | src/book/polyFit.py | krontzo/nume.py |
import re
from dnload.glsl_block import GlslBlock
########################################
# GlslBlock ############################
########################################
class GlslBlockPreprocessor(GlslBlock):
"""Preprocessor block."""
def __init__(self, source):
"""Constructor."""
GlslBl... | [
{
"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 | dnload/glsl_block_preprocessor.py | Konsonanz/dnload |
from CyberSource import *
import os
import json
from importlib.machinery import SourceFileLoader
config_file = os.path.join(os.getcwd(), "data", "Configuration.py")
configuration = SourceFileLoader("module.name", config_file).load_module()
# To delete None values in Input Request Json body
def del_none(d):
for ke... | [
{
"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 | samples/Reporting/ReportDefinitions/get-report-definition.py | snavinch/cybersource-rest-samples-python |
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree import ElementTree
from xml.dom import minidom
import urllib.request
import argparse
import time
import sys
import json
def prettify(elem):
rough_string = ElementTree.tostring(elem)
reparsed = minidom.parseString(rough_str... | [
{
"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 | status.py | sekavatar/fireboard-api |
import functools
def dict_cmp(x, y, key):
if str(x[key]) > str(y[key]):
return 1
elif str(x[key]) < str(y[key]):
return -1
else:
return 0
def sort_dict(dictionary, cmp_func):
arr = []
for key in dictionary:
arr.append((key, dictionary[key]))
arr.sort(key=fu... | [
{
"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 | src/utils.py | CarlSchader/poker-api |
#!/usr/bin/python3
"""
Defines a class TestFileStorage.
"""
from models.engine.file_storage import FileStorage
import unittest
import models
import os
class TestFileStorage(unittest.TestCase):
"""Represent a TestFileStorage."""
def setUp(self):
"""SetUp method"""
self.file_storage = F... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_models/test_engine/test_file_storage.py | arvicrin/AirBnB_clone |
# -*- coding: utf-8 -*-
"""
pygments.styles
~~~~~~~~~~~~~~~
Contains built-in styles.
:copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.plugin import find_plugin_styles
from pygments.util import ClassNotFound
#: Maps sty... | [
{
"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 | pygments/styles/__init__.py | tizenorg/platform.upstream.python-pygments |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KbdishDetailInfo(object):
def __init__(self):
self._out_dish_id = None
self._out_sku_id_list = None
@property
def out_dish_id(self):
return self._out_dish_id
... | [
{
"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 | alipay/aop/api/domain/KbdishDetailInfo.py | antopen/alipay-sdk-python-all |
import qsort
from nose import tools
fixture_lsts = [
[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 2, 3],
[4, 2, 3, 1], [1, 4, 3, 2], [3, 2, 1, 4], [3, 2, 2, 4],
[3, 1, 1, 3], [1, 1, 1, 1], [1, 2, 1, 1], [1, 2, 3],
[1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1],
[3, 2, 3], [3, 1, 1], [], ... | [
{
"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 | algorithms/python/test_qsort.py | rik0/rk-exempla |
import numpy as np
from skimage.feature import blob_log
from joblib import Parallel, delayed
###############################
# Loop for parallelization #
###############################
def task(image, i, n_patches_x, n_patches_y):
###LoG step
blobs_log = blob_log(image, min_sigma=1.43, max_sigma=1.43, ... | [
{
"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 | LaplacianOfGaussian.py | FiorenSt/AutoSourceID-Light |
# Python 3.3.3 and 2.7.6
# python fo.py
from threading import Thread
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global")
i = 0
def incrementingFunction():
glob... | [
{
"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 | Part4/python/foo.py | HaavardM/Exercise1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import boto3
import csv
import json
import logging
from budget_retrieval import get_budget
from budget_placement import place_budget
def respond(err, res=None):
return {
'statusCode': '400' if err else '200',
'body': err.message if err else json.dumps... | [
{
"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 | lambdas/budget-handler/lambda_handler.py | weAllWeGot/personal_financial_engine |
import math
class MinStack:
def __init__(self):
"""
initialize your data structure here.
"""
self.stack = []
self.min = math.inf
def push(self, x: int) -> None:
self.x = x
self.stack.append(x)
if x < self.min:
self.min = x
def p... | [
{
"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 | notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/Interview-Problems/LeetCode/MinStack.py | side-projects-42/INTERVIEW-PREP-COMPLETE |
from tri import tri,minimum
def test_tri():
tableau=[10,1,7,9,8]
tableau_attendu=[1,7,8,9,10]
assert tableau_attendu == tri(tableau)
def test_min():
tableau=[10,1,7,9,8]
minimum_attendu=1
assert minimum_attendu==minimum(tableau) | [
{
"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 | erri/python/lesson_10/tri_test.py | TGITS/programming-workouts |
import libvirt, xmltodict, json, random, uuid
import logging
from libvirt import *
from virtapi.controller.host_ctrl import VirtHost
from virtapi.model.template import Templates
from virtapi.model.plan import Plans
from virtapi.model.host import Hosts
from virtapi import settings
from virtapi.utilities import create_c... | [
{
"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 | virtapi/api.py | spiperac/virtapi |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayCommerceEducateFacefeatureReportUploadResponse(AlipayResponse):
def __init__(self):
super(AlipayCommerceEducateFacefeatureReportUploadResponse, self).__init__()
... | [
{
"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 | alipay/aop/api/response/AlipayCommerceEducateFacefeatureReportUploadResponse.py | snowxmas/alipay-sdk-python-all |
import torch
import torch.nn as nn
class CustomModel(nn.Module):
def __init__(self):
super().__init__()
self.stage1_block = nn.Sequential(
nn.Conv2d(
in_channels=3,
out_channels=64,
kernel_size=3,
stride=1,
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | machine-learning/ml-projects/test-transforms/models/models/model_bn.py | olaals/masteroppgave2 |
# Contains all component struct contstructors
def Animation():
return {
"base":{"x":0, "y":0}
}
def Controllable():
return {}
def Debug():
return {"name":"%NO NAME%"}
def Position():
return {"x":0, "y":0}
def Velocity():
return { # The current velocity of the entity in question
"x":0,
"y":0
}
def Syst... | [
{
"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 | components/Components.py | hey-waffles/dungeon-crawler |
"""Utilities that depend on Tensorflow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
# adapts batch size in response to ResourceExhaustedErrors
class RobustPredictor(object):
"""A wrapper for predictor fun... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | magenta/models/coconet/lib_tfutil.py | undeadinu/magenta |
'''
This module has all relevant functions to make predictions using a previously
trained model.
'''
import os
import numpy as np
import tensorflow.keras as keras
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model
import cv2
model = load_model('../models/app_ban_ora_selftra... | [
{
"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/predict.py | DariusTorabian/image-classifier |
import numpy as np
import random
import pickle
num_train = 60000
num_val = 10000
num_test = 10000
step_num = 4
elem_num = 26 + 10 + 1
x_train = np.zeros([num_train, step_num * 2 + 3, elem_num], dtype=np.float32)
x_val = np.zeros([num_val, step_num * 2 + 3, elem_num], dtype=np.float32)
x_test = np.zeros([num_test, st... | [
{
"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 | generator.py | Victorwz/fast-weights-pytorch |
import sys
from unittest import mock
flash = bytearray(8 * 1024 * 1024)
def read_data(addr, amount):
return flash[addr : addr + amount]
def write_data(addr, data):
flash[addr : addr + len(data)] = data
if "flash" not in sys.modules:
sys.modules["flash"] = mock.MagicMock(read=read_data, write=write_da... | [
{
"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 | simulator/kruxsim/mocks/flash.py | odudex/krux |
import unittest
from entschema.schema import Schema
from entschema.field import (TextField,
PositiveIntegerField,
RelationField)
from entschema.field.field_types import (RelationFieldType)
class TestFieldPositiveInteger(unittest.TestCase):
def test_field_... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | tests/tests_fields/tests_fields_types/tests_field_positive_integer.py | kimgea/ontosqlson |
from SceneObjects import *
def ambiant(material, scene):
return material.Ka * scene.ambiant_light
def emittance(material):
return material.Ke
def direct(material):
return material.Kd
def diffuse(normal, posHit, lightPos, material=Material(Kd=Vec3(1)), uv=Vec2(0, 0)):
lightDirection = (lightPos -... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | Shaders.py | noahiscool13/Python_raytracer |
import numpy as np
from numpy import abs, sum, exp, log, copy, repeat, min, max, dot, mean, diag, ones
from scipy.sparse import eye
def backend_init():
pass
def graph_dropout(M, _):
return M
def separate_cols(x):
return [x[:, col_num] for col_num in range(x.shape[1])]
def combine_cols(cols):
ret... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | pygrank/core/backend/numpy.py | MKLab-ITI/pygrank |
#! /usr/bin/env python
import logging
import time
from kafka import KafkaConsumer
log = logging.getLogger(__name__)
class Listener:
def __init__(self, config: dict, process_message):
self.config = config if config else dict()
self.pm_callback = process_message
log.info('Loading Kafka')
... | [
{
"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 | src/sqapi/messaging/brokers/kafka.py | mabruras/sqapi |
import pytest
from schemapi import SchemaBase, SchemaModuleGenerator
@pytest.fixture
def schema():
return {
'definitions': {
'Person': {
'properties': {
'name': {'type': 'string'},
'age': {'type': 'integer'},
}
... | [
{
"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 | schemapi/tests/test_codegen.py | CDyWeb/schemapi |
import tensorflow as tf
def make_chatspace_training_dataset(
lookup_table: tf.lookup.StaticHashTable,
space_skip_prob: float,
):
"""
Chatspace ๋ชจ๋ธ์ ๋ฃ์ Input์ ๋ง๋๋ ํจ์๋ฅผ ๋ฐํํฉ๋๋ค.
์ ์ ๋ฌธ์ฅ์ ์
๋ ฅ์ผ๋ก ๋ฐ์ ๋๋คํ๊ฒ ๋์ด์ฐ๊ธฐ๋ฅผ ์ง์๋๋ค.
:param lookup_table: Vocab ์ ๋ณด๋ก ์ด๊ธฐํ๋ ``tf.lookup.StaticHashTable``
:param space_skip_p... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer... | 3 | chatspace/dataset.py | bestend/chatspace |
from threading import Thread
import socket
import utils
import time
import sys
import os
class BasicAPI:
inbound = 54123
served = []
start = 0.0
def __init__(self):
self.start = time.time()
self.actions = {'UPTIME': self.uptime}
self.run()
def run(self):
running = True
start_day, start_time = utils.... | [
{
"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 | code/Serving/serve.py | 0ptik41/Tools |
from multiprocessing import Process, Value
def increment(num):
for _ in range(1000):
num.value = num.value + 1
def decrement(num):
for _ in range(1000):
num.value = num.value - 1
if __name__ == "__main__":
num = Value('i', 0)
print(num.value)
p1 = Process(target=increment, args... | [
{
"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 | Concurrent and Distributed Computing with Python - Section 3/3.2-2.py | PacktPublishing/Concurrent-and-Distributed-Computing-with-Python |
# -*- coding: utf-8 -*-
from collections.abc import Iterable
from dadmatools.models.flair.parser.utils.common import unk
class Vocab(object):
def __init__(self, counter, min_freq=1, specials=[]):
self.itos = specials
self.stoi = {token: i for i, token in enumerate(self.itos)}
self.exten... | [
{
"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 | dadmatools/models/flair/parser/utils/vocab.py | njzr/DadmaTools |
#!/usr/bin/env python3
import sys
from PyQt5.QtCore import QBasicTimer, Qt
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QApplication, QLabel
class Marquee(QLabel):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.right_to_left_direction = True
self.initUI()
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | Task/Animation/Python/animation-1.py | mullikine/RosettaCodeData |
import logging
import numpy as np
import PIL
import openpifpaf
from openpifpaf.transforms.scale import _scale
LOG = logging.getLogger(__name__)
class ScaleMix(openpifpaf.transforms.Preprocess):
def __init__(self, scale_threshold, *,
upscale_factor=2.0,
downscale_factor=0.5,
... | [
{
"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 | openpifpaf_posetrack/transforms/scale.py | vita-epfl/openpifpaf_posetrack |
#!/usr/bin/env python3.4
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask.ext.login import login_user, logout_user, login_required
from ..models import User
from ..forms import LoginForm
auth = Blueprint('auth', __name__)
@auth.route('/login', methods=['GET', 'POST'])
def... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"a... | 3 | backend/app/api/auth.py | dasdachs/flask-blog |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.