source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from pytest import fixture
from ..f9 import F9
@fixture(scope="module")
def f9() -> F9:
return F9()
def test_evaluate_solution(f9: F9, helpers):
helpers.test_evaluate_solution(f9)
def test_evaluate_population(f9: F9, helpers):
helpers.test_evaluate_population(f9)
def test_dsm(f9: F9, helpers):
... | [
{
"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 | evobench/continuous/cec2013lsgo/test/test_f9.py | piotr-rarus/evobench |
from resources import relu, learnFunc, dot
class HiddenBlock:
def __init__(self, weights, bias):
self.weights = weights
self.bias = bias
def feedForward(self, hidden_inputs):
output = [
relu(
dot(hidden_inputs, weights) + self.bias
)
for... | [
{
"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/old/hiddenBlock.py | BenOsborn/Cerci |
import pytest
import yaml
import sqlalchemy as sa
from retry import retry
@pytest.fixture(scope='session')
def docker_compose_file(tmpdir_factory, mysql_service_def, postgres_service_def, oracle_service_def):
compose_file = tmpdir_factory.mktemp('docker_files').join('docker-compose.yml')
compose_conf = {
... | [
{
"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 | tests/sql_sync/fixtures/db_fixtures_helper.py | jzcruiser/doltpy |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Iterable
def flatten(input_arr, output_arr = None):
if output_arr is None:
output_arr = []
for t in input_arr:
if isinstance(t, Iterable):
flatten(t, output_arr)
else:
output_arr.append(t)
... | [
{
"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 | algorithm/github_al/flatten.py | freedomDR/coding |
#Shows data from the first 1000 blocks
import random
import os
import subprocess
import json
#Set this to your raven-cli program
cli = "raven-cli"
#mode = "-testnet"
mode = ""
rpc_port = 8746
#Set this information in your raven.conf file (in datadir, not testnet3)
rpc_user = 'rpcuser'
rpc_pass = 'rpcpass555'
def ... | [
{
"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 | assets/tools/blockfacts.py | Clotonervo/TestCoin |
from app import db
from hashlib import md5
class User(db.Model):
""" Classe da tabela de usuários
"""
__tablename__ = "users"
user_id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String, unique=True)
password = db.Column(db.String)
email = db.Column(db.String, unique... | [
{
"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 | app/models/user.py | VitorBonella/ProjetoIntegrado1-2021-1 |
# full assembly of the sub-parts to form the complete net
import torch.nn.functional as F
from .unet_parts import *
class UNet(nn.Module):
def __init__(self, n_channels, n_classes):
super(UNet, self).__init__()
self.inc = inconv(n_channels, 64)
self.down1 = down(64, 128)
self.down... | [
{
"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 | hand_net/unet/unet_model.py | clearsky767/examples |
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.template import engines
from django.test import TestCase
from wagtail.models import PAGE_TEMPLATE_VAR, Page, Site
from wagtail.test.utils import WagtailTestUtils
class TestCoreJinja(TestCase, WagtailTestUtils):
d... | [
{
"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 | wagtail/admin/tests/test_jinja2.py | stevedya/wagtail |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: ppx
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class TagResult(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | python/ppx/TagResult.py | etalumis/ppx |
from __future__ import print_function
import sys
import string
from random import choice, randint
from perfect_hash import generate_hash
def flush_dot():
sys.stdout.write('.')
sys.stdout.flush()
def random_key():
return ''.join(choice(string.printable) for i in range(randint(1, 4)))
def main():
... | [
{
"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 | stress.py | pombredanne/perfect-hash |
#!/usr/bin/env python
import os
import re
import warnings
import selenosis
# A dict for mapping test case classes to their import paths, to allow passing
# TestCaseClass.test_function as shorthand to runtests.py
TEST_CASE_MODULE_PATHS = {
'TestAdminWidgets': 'nested_admin.tests.admin_widgets.tests',
'TestWid... | [
{
"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 | runtests.py | m4x4n0/django-nested-admin |
import hashlib
class Plugin:
def __init__(self, parser, sqlitecur):
parser.registerCommand([("hash", "Calculates all hashes", self._allHash)])
for h in hashlib.algorithms_available:
parser.registerCommand([("hash",), (h, "Calculates the %s" % h, self._hashCurry(h))])
def _allHash(... | [
{
"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 | plugins/hashit.py | Amarandus/xmppsh |
#!/usr/bin/python
# -*-coding=utf-8
from __future__ import print_function, division
import unittest
from onvif import ONVIFCamera, ONVIFError
CAM_HOST = '10.1.3.10'
CAM_PORT = 80
CAM_USER = 'root'
CAM_PASS = 'password'
DEBUG = False
def log(ret):
if DEBUG:
print(ret)
class TestDevice(unittest.TestCas... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/test.py | icetana-james/python-onvif-zeep |
class EditorBrowsableState(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies the browsable state of a property or method from within an editor.
enum EditorBrowsableState,values: Advanced (2),Always (0),Never (1)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq_... | [
{
"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": true
},
... | 3 | stubs.min/System/ComponentModel/__init___parts/EditorBrowsableState.py | ricardyn/ironpython-stubs |
import numpy as np
from PIL import Image
from copy import deepcopy
INPUT_SHAPE = (84, 84)
def init_state():
# return np.zeros((84, 84, 4))
return np.zeros((4, 84, 84))
def append_frame(state, frame):
# new_state = deepcopy(state)
# new_state[:, :, :-1] = state[:, :, 1:]
# new_state[:, :, -1] = fr... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | Pacman/processor.py | dorlivne/PoPS |
## Compiled from NodeLoads.ipynb on Sun Dec 10 12:51:11 2017
## DO NOT EDIT THIS FILE. YOUR CHANGES WILL BE LOST!!
## In [1]:
import numpy as np
from salib import extend
## In [9]:
class NodeLoad(object):
def __init__(self,fx=0.,fy=0.,mz=0.):
if np.isscalar(fx):
self.forces = np.matrix([f... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | matrix-methods/frame2d/Frame2D/NodeLoads.py | nholtz/structural-analysis |
from myqueue import CheckableQueue
def bfs(start, bases, players):
# a FIFO open_set
open_set = CheckableQueue()
# an empty set to maintain visited nodes
closed_set = set()
# a dictionary to maintain meta information (used for path formation)
meta = dict() # key -> (parent state, action to rea... | [
{
"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 | AIs/Computer-py/mysearches.py | saeidh12/razmai-server |
'''
This file is a part of Test Mile Arjuna
Copyright 2018 Test Mile Software Testing Pvt Ltd
Website: www.TestMile.com
Email: support [at] testmile.com
Creator: Rahul Verma
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 ... | [
{
"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 | arjuna-samples/workspace/arjex/tests/modules/s01unitee_engine/ep03_what_i_assert/ex02_assert_true_false.py | test-mile/arjuna |
# Copyright 2018 Mathias Burger <mathias.burger@gmail.com>
#
# SPDX-License-Identifier: MIT
from typing import Callable
import gimp
from pgimp.gimp.parameter import get_json
def open_xcf(filename):
"""
:type filename: str
:rtype: gimp.Image
"""
return gimp.pdb.gimp_xcf_load(0, filename, filenam... | [
{
"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 | pgimp/gimp/file.py | netogallo/pgimp |
"""added user is_active
Revision ID: 0502a89b8394
Revises: 8f9f223976a8
Create Date: 2021-01-27 12:30:38.668195
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0502a89b8394'
down_revision = '8f9f223976a8'
branch_labels = None
depends_on = None
def upgrade():... | [
{
"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 | API/alembic/versions/0502a89b8394_added_user_is_active.py | sourcery-ai-bot/PageMail |
#!/usr/bin/env python 3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 PanXu, Inc. All Rights Reserved
#
"""
使用 bert 的 init weights
Authors: PanXu
Date: 2021/11/08 08:44:00
"""
from torch.nn import Module
from torch import nn
from transformers import BertConfig
class BertInitWeights:
"""
bert 初始化权重
... | [
{
"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 | easytext/utils/nn/bert_init_weights.py | cjopengler/easytext |
import pytest
import re
from pycolog.log_entry import LogEntry
@pytest.mark.parametrize('chars,expected', [
(4, 'S...'),
(8, 'Short...'),
(9, 'ShortLine'),
(12, 'ShortLine'),
])
def test_truncate(chars, expected):
assert LogEntry('ShortLine').truncate(chars) == expected
def test_fields_as_attri... | [
{
"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_log_entry.py | leupibr/pycolog |
class ConfigurationError(Exception):
"""
The exception raised by any object when it's misconfigured
(e.g. missing properties, invalid properties, unknown properties).
"""
def __init__(self, message):
super().__init__()
self.message = message
def __str__(self):
return re... | [
{
"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 | torch_nlp_utils/common/checks.py | Nemexur/torch_data_utils |
import sys
# sys.path.append(
# '/home/rpl/Documents/rasmus/crazyswarm/ros_ws/src/crazyswarm/scripts/perceived-safety-study'
# )
# sys.path.append(
# '/home/rpl/Documents/rasmus/crazyswarm/ros_ws/src/crazyswarm/scripts/perceived-safety-study/utils'
# )
sys.path.append(
"/home/rpl/Documents/rasmus/crazyswa... | [
{
"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 | ros_ws/src/crazyswarm/scripts/perceived-safety-study/preStudy/main.py | rasmus-rudling/degree-thesis |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"point_num": 1,
"id": "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 | samples/openapi3/client/petstore/python-legacy/test/test_model200_response.py | JigarJoshi/openapi-generator |
import curses
from curses import wrapper, textpad
# stdscr = curses.initscr()
def messages_screen(y, x, stdscr):
# stdscr = curses.initscr()
pad = curses.newpad(8, x/3 + x+x/2-2)
# nlines
# curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_BLUE)
# pad.bkgd(' ', curses.color_pair(1))
x2 = (x+2)*2
ncols = ... | [
{
"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 | cursor.py | LowLevel96/MQTT_Chat |
import discord
from discord.ext import commands
from discord.utils import get
class c316(commands.Cog, name="c316"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Alexander_the_Impenetrable', aliases=['c316'])
async def example_embed(self, ctx):
embed = disc... | [
{
"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 | upcfcardsearch/c316.py | ProfessorSean/Kasutamaiza |
# Tai Sakuma <tai.sakuma@gmail.com>
from __future__ import print_function
import os
import errno
import logging
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl import mkdir_p
##__________________________________________________________________||
@pytest.fixture... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | tests/unit/misc/test_mkdir_p.py | shane-breeze/AlphaTwirl |
import numpy as np
from lmfit import minimize, Parameters, Parameter, report_fit
from lmfit_testutils import assert_paramval, assert_paramattr
def test_basic():
# create data to be fitted
x = np.linspace(0, 15, 301)
data = (5. * np.sin(2 * x - 0.1) * np.exp(-x*x*0.025) +
np.random.normal(size=... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | tests/test_basicfit.py | FaustinCarter/lmfit-py |
#Copyright ReportLab Europe Ltd. 2000-2018
#see license.txt for license details
__doc__="""The Reportlab PDF generation library."""
Version = "3.5.59"
__version__=Version
__date__='20210104'
import sys, os
__min_python_version__ = (3,6)
if sys.version_info[0:2]!=(2, 7) and sys.version_info< __min_python_version__:
... | [
{
"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 | venv/lib/python2.7/site-packages/reportlab/__init__.py | Christian-Castro/castro_odoo8 |
class DoublyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
def to_str(head):
# better lookup for test data :P
data = []
while head:
data.append(str(head.data))
head = head.next
return ', '.join(data)
... | [
{
"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 | data_structures__linked_lists/solution_14.py | rikkt0r/hackerrank_python |
# Copyright 2019 Alibaba Cloud 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 la... | [
{
"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 | alibabacloud/handlers/__init__.py | wallisyan/alibabacloud-python-sdk-v2 |
# based on https://ruder.io/optimizing-gradient-descent/#adam
# and https://github.com/eriklindernoren/ML-From-Scratch/blob/master/mlfromscratch/deep_learning/optimizers.py#L106
import numpy as np
class Adam:
"""Adam - Adaptive Moment Estimation
Parameters:
-----------
learning_rate: float = 0.001
... | [
{
"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 | Optimizers/adam/code/adam.py | TannerGilbert/Machine-Learning-Explained |
import requests
import sqlalchemy
import xmltodict
from sqlalchemy import create_engine, MetaData
from collections import defaultdict
import datetime
from utils import *
class Capture(object):
def __init__(self,
schema,
database='projetocurio'
):
... | [
{
"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 | bigua/API/capture.py | AliferSales/bigua |
#!/usr/bin/env python
import os
from setuptools import setup
from setuptools.command.test import test
import codecs
def root_dir():
rd = os.path.dirname(__file__)
if rd:
return rd
return '.'
class pytest_test(test):
def finalize_options(self):
test.finalize_options(self)
sel... | [
{
"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 | setup.py | kezabelle/django-treebeard |
import logging
import threading
import time
# Credits to https://gist.github.com/cypreess/5481681
class PeriodicThread(object):
"""
Python periodic Thread using Timer with instant cancellation
"""
def __init__(self, callback=None, period=1, name=None, *args, **kwargs):
self.name = name
... | [
{
"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 | pilapse/scheduler.py | yix/pilapse |
import abc
from typing import List
class IPCWrapper(abc.ABC):
"""
This public class defines the mosec IPC wrapper plugin interface.
The wrapper has to at least implement `put` and `get` method.
"""
@abc.abstractmethod
def put(self, data: List[bytes]) -> List[bytes]:
"""Put bytes to so... | [
{
"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 | mosec/ipc.py | mosecorg/mosec |
"""added purchase_date to the Stock model
Revision ID: 4f494d6d1000
Revises: df472f9e977f
Create Date: 2022-02-13 06:35:05.343296
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4f494d6d1000'
down_revision = 'df472f9e977f'
branch_labels = None
depends_on = Non... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | migrations/versions/4f494d6d1000_added_purchase_date_to_the_stock_model.py | YellowFlash2012/stock-portfolio-io |
# Big O complexity
# O(log2(n))
# works only on sorted array
# recursive
def binary_search_recursive(arr, arg, left, right):
if right >= left:
middle = left + (right - left) // 2
if arr[middle] == arg:
return middle
elif arr[middle] > arg:
return binary_search_recu... | [
{
"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 | computer_science/algoritms/search/binarysearch.py | kuzxnia/algoritms |
"""Initial Migration
Revision ID: 58556190cb24
Revises: 4a167476d5f7
Create Date: 2021-08-20 12:30:57.334610
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '58556190cb24'
down_revision = '4a167476d5f7'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | migrations/versions/58556190cb24_initial_migration.py | samwel-chege/Pitches |
from sklearn.base import BaseEstimator
from collections import defaultdict
from lcs import lat_lng
from fastdtw import fastdtw
from haversine import haversine
import numpy as np
class KNN(BaseEstimator):
def __init__(self, n_neighbors=5):
self.n_neighbors = n_neighbors
def fit(self,data,tar... | [
{
"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 | Data_Visualization-TimeSeries_Classification/KNN.py | wyolland/DataMining |
import os
import datetime
import pytest
from smart_getenv import getenv
from kirby.api.queue import Queue
def test_it_can_create_a_queue():
q = Queue("my-queue", testing=True)
q.append("hello")
assert q.last() == "hello"
@pytest.mark.integration
@pytest.mark.skipif(
not os.getenv("KAFKA_BOOTSTRAP_S... | [
{
"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 | tests/tests_api/test_api_queue.py | minh-adimian/kirby |
# -*- coding: utf-8 -*-
"""
Created on Tue May 4 13:36:39 2021
@author: MorganaGiorgio
"""
from Learner import *
class Greedy_Learner(Learner):
def __init__(self, n_arms):
super().__init__(n_arms)
self.expected_rewards = np.zeros(n_arms)
def pull_arm(self):
#all'inizio pulo ... | [
{
"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 | PricingAdvertising/pricingEnviroment/Greedy_Learner.py | rossigiorgio/DIAProject |
import torch.nn as nn
from utils import StochasticDepth
from layers import FeedForward
from CvT import ConvAttention
class CvTBlock(nn.Module):
def __init__(self, embed_dim: int, out_dim: int,
num_heads: int, mlp_ratio: int = 4,
qkv_bias: bool = False, drop: float = 0.,
... | [
{
"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 | CvT/transformer_block.py | Justin900429/vision-transformer |
# Complete the function below calculate your age after different numbers of years.
def age_now(x):
# My age now
print(f"I am currently {x} years old.\n")
def age_1(y):
# My age next year
print(f"Next year I'll be {y+1} years old.\n")
def age_10(z):
# My age in 10 years
print(f"In 10 years, 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | my_code.py | Athenian-ComputerScience-Fall2020/my-age-Jackypop101 |
#!/usr/bin/env python
# Copyright 2012 La Honda Research Center, 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 ap... | [
{
"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 | tools/clean_file_locks.py | bopopescu/extra-specs-1 |
class Task(object):
def __init__(self,name):
self.name = name
pass
def run(self):
pass
| [
{
"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 | python/GtBurst/Task.py | fermi-lat/pyBurstAnalysisGUI |
import pandas as pd
import json
class Element:
def __init__(self, name, abrivation, atomic_number,
atomic_mass, period, group):
self.name = name
self.abrivation = abrivation
self.atomic_number = atomic_number
self.atomic_mass = atomic_mass
self.period = period #row
self.gro... | [
{
"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 | periodic_table.py | mkirby1995/PyISRU |
"""Definitions for the primitive `array_scan`."""
import numpy as np
from . import primitives as P
def pyimpl_array_scan(fn, init, array, axis):
"""Implement `array_scan`."""
# This is inclusive scan because it's easier to implement
# We will have to discuss what semantics we want later
def f(ary):
... | [
{
"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 | myia/operations/prim_array_scan.py | strint/myia |
# *- coding: utf-8 -*
# Created by: ZhaoDongshuang
# Created on: 2018/1/27
import unittest
from others.survey import AnonymousSurvey
class TestAnonymousSurvey(unittest.TestCase):
def setUp(self):
question = "What language did you first learn to speak?"
self.my_survey = AnonymousSurvey(question)
... | [
{
"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 | others/test_survey.py | imtoby/LearnPythonRecord |
from flask import render_template,url_for,flash,redirect,request
from . import auth
from flask_login import login_user,login_required,logout_user
from .forms import RegForm,LoginForm
from ..models import User
from .. import db
from ..email import mail_message
@auth.route('/login', methods = ['GET','POST'])
def login()... | [
{
"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 | app/auth/views.py | clarametto/Salb-Blog |
"""Collection of Jax network layers, wrapped to fit Ivy syntax and
signature.
"""
# global
import jax.numpy as jnp
import jax.lax as jlax
# local
from ivy.functional.backends.jax import JaxArray
def conv1d(
x: JaxArray,
filters: JaxArray,
strides: int,
padding: str,
data_format: str = "NWC",
... | [
{
"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 | ivy/functional/backends/jax/layers.py | thatguuyG/ivy |
import os
import sys
import time
import datetime
import locale
import getpass
import platform
import subprocess
class Gk:
def __init__(self):
self.os = os.name
self.sys_lang = locale.getdefaultlocale()
self.python_ver = sys.version.split()[0]
self.user_name = getpass.get... | [
{
"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 | gk.py | kerem3338/Gk |
from getpass import getuser
from os.path import abspath, join, exists
from uuid import uuid4
from seisflows.tools import unix
from seisflows.tools.config import ParameterError, SeisflowsParameters, SeisflowsPaths, custom_import
PAR = SeisflowsParameters()
PATH = SeisflowsPaths()
class tiger_md(custom_import('syste... | [
{
"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": true
}... | 3 | seisflows/system/tiger_md.py | chukren/seisflows |
from . import *
import os
class TestConfigCommand(TestBase):
def test_dump(self):
dump = self._arduino.config.dump()["result"]
self.assertIsInstance(dump, dict)
self.assertIn("directories", dump)
def test_init(self):
config_path = self._arduino.config.init(".")["result"].spli... | [
{
"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 | Renaud11232/pyduinocli |
from __future__ import absolute_import, division, print_function
import torch
from torch.autograd import Variable
from pyro.distributions import MultivariateNormal, SparseMultivariateNormal
from tests.common import assert_equal
def test_scale_tril():
loc = Variable(torch.Tensor([1, 2, 1, 2, 0]))
D = Variab... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/distributions/test_sparse_multivariate_normal.py | cnheider/pyro |
from madmom.io.audio import load_audio_file
import numpy
import librosa
def load_wav(wav_in, stereo=False):
x, fs = load_audio_file(wav_in, sample_rate=44100)
if not stereo:
# stereo to mono if necessary
if len(x.shape) > 1 and x.shape[1] == 2:
x = x.sum(axis=1) / 2
# cast to... | [
{
"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 | headbang/util.py | sevagh/headbang.py |
from pysnmp.proto.secmod.rfc3414.priv import base
from pysnmp.proto import errind, error
class NoPriv(base.AbstractEncryptionService):
serviceID = (1, 3, 6, 1, 6, 3, 10, 1, 2, 1) # usmNoPrivProtocol
def hashPassphrase(self, authProtocol, privKey):
return
def localizeKey(self, authProtocol, pri... | [
{
"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 | scalyr_agent/third_party/pysnmp/proto/secmod/rfc3414/priv/nopriv.py | code-sauce/scalyr-agent-2 |
"""wiki版本追踪
Revision ID: ac28bef87cb9
Revises: c5d936a18918
Create Date: 2020-09-05 15:09:30.698554
"""
import ormtypes
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'ac28bef87cb9'
down_revision = 'c5d936a18918'
branch_labels ... | [
{
"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 | migrations/versions/ac28bef87cb9_wiki版本追踪.py | Officeyutong/HelloJudge2 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiSalesKbassetStuffProduceqrcodeBatchqueryModel(object):
def __init__(self):
self._batch_id = None
self._page_size = None
self._produce_order_id = None
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | alipay/aop/api/domain/KoubeiSalesKbassetStuffProduceqrcodeBatchqueryModel.py | articuly/alipay-sdk-python-all |
""" Closuers
Free variables and closures
Remember: Functions defined inside another function can access the outer (nonLocal) variables
"""
def outer():
x = 'python'
def inner():
print("{0} rocks!".format(x))
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | .history/my_classes/ScopesClosuresAndDecorators/Closures_20210711165644.py | minefarmer/deep-Dive-1 |
from ..typecheck import *
from .import adapter
import sublime
import re
class PHP(adapter.AdapterConfiguration):
type = 'php'
docs = 'https://github.com/xdebug/vscode-php-debug#installation'
async def start(self, log, configuration):
node = await adapter.get_and_warn_require_node(self.type, log)
install_pat... | [
{
"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 | modules/adapters/php.py | mateka/sublime_debugger |
#!/usr/bin/env python3
# 2018 Luther Thompson
# This code is public domain under CC0. See the file COPYING for details.
import unittest
import newtuple
class TupleTest:
def testSetItem(self):
self.assertEqual(self.call('setItem', (0, 1, 2), 1, 666), (0, 666, 2))
def testSetItemSlice(self):
self.asser... | [
{
"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.py | luther9/newtuple-py |
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string
class TudoGostoso(AbstractScraper):
@classmethod
def host(cls):
return 'tudogostoso.com.br'
def title(self):
return normalize_string(self.soup.find('h1').get_text())
def total_time(self):
... | [
{
"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 | recipe_scrapers/tudogostoso.py | jerjou/recipe-scrapers |
"""Test timestamp."""
# --- import -------------------------------------------------------------------------------------
import WrightTools as wt
# --- test ---------------------------------------------------------------------------------------
def test_now():
wt.kit.TimeStamp() # exception will be raised ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | tests/kit/timestamp.py | untzag/WrightTools |
import pytest
import urllib.parse
from helper import chromedriver
from browsermobproxy import Server, Client
from selenium import webdriver
@pytest.fixture
def proxy_server(request):
server = Server("browsermob-proxy/bin/browsermob-proxy")
server.start()
client = Client("localhost:8080")
server.creat... | [
{
"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 | 4_proxy/test_proxy_example.py | pavlovprojects/python_qa_logging |
from __future__ import absolute_import
from typing import Callable, TypeVar
from returns.future import FutureResult
from returns.interfaces.specific.future_result import FutureResultLikeN
from returns.primitives.hkt import Kinded, KindN, kinded
_FirstType = TypeVar(u'_FirstType')
_SecondType = TypeVar(u'_SecondType')... | [
{
"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 | returns/pointfree/bind_future_result.py | internetimagery/returns |
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for the 'grit newgrd' tool.'''
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": fals... | 3 | src/tools/grit/grit/tool/newgrd_unittest.py | Mr-Sheep/naiveproxy |
from bson import ObjectId
from mini_gplus.models import Post
from mini_gplus.utils.profiling import timer
from .cache import r
RPost = "post"
def set_in_post_cache(post: Post):
r.hset(RPost, str(post.id), post.to_json())
@timer
def get_in_post_cache(oid: ObjectId):
r_post = r.hget(RPost, str(oid))
if n... | [
{
"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 | mini_gplus/daos/post_cache.py | KTachibanaM/pill-city |
import random
import torch
from torch.utils.tensorboard import SummaryWriter
from flowtron_plotting_utils import plot_alignment_to_numpy
from flowtron_plotting_utils import plot_gate_outputs_to_numpy
class FlowtronLogger(SummaryWriter):
def __init__(self, logdir):
super(FlowtronLogger, self).__init__(logd... | [
{
"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 | flowtron_logger.py | hit-thusz-RookieCJ/flowtron |
class Busca:
def __init__(self, sequencia, elemento):
self.sequencia = sequencia
self.elemento = elemento
def busca_indice_elemento(self):
"""
Retorna o indíce do elemento caso o mesmo se encontre na lista,
caso o elemento não seja encontrado, o retorno será -1
... | [
{
"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 | busca.py | carlos-moreno/algorithms |
"""
This class models the redirect page i.e the view buses page of the redBus Main Page
URL: selenium-tutorial-redirect
The page consists of a header, footer and some text
"""
from .Base_Page import Base_Page
from .redBus_header_object import redBus_Header_Object
from .redBus_footer_object import redBus_Footer_Object
... | [
{
"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 | page_objects/redBus_view_buses_page.py | PreedhiVivek/qxf2-page-object-model |
import numpy as np
class LDA:
def __init__(self, n_components):
self.n_components = n_components
self.linear_discriminants = None
def fit(self, X, y):
n_features = X.shape[1]
class_labels = np.unique(y)
# Within class scatter matrix:
# SW = sum((X_c - mean_X_c... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | mlfromscratch/lda.py | Guangrui-best/ML_from_scratch |
"""
Convert characters (chr) to integer (int) labels and vice versa.
REVIEW: index 0 bug, also see:
https://github.com/baidu-research/warp-ctc/tree/master/tensorflow_binding
`ctc_loss`_ maps labels from 0=<unused>, 1=<space>, 2=a, ..., 27=z, 28=<blank>
See: https://www.tensorflow.org/api_docs/python/tf/nn/ctc_loss
"... | [
{
"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 | asr/labels.py | aflyingwolf/ctc-asr |
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
from multiprocessing import cpu_count
class ThisRecipe(CompiledComponentsPythonRecipe):
site_packages_name = 'scikit-learn'
version = '0.23.2'
url = f'https://github.com/{site_packages_name}/{site_packages_name}/archive/{version}.... | [
{
"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 | pythonforandroid/recipes/scikit-learn/__init__.py | adin234/python-for-android |
import os
import unittest
from time import sleep
from cache_gs import CacheGS
from cache_gs.utils.filesystem import remove_tree
class TestRealSQLiteCache(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.cache_file = '.cache'
if not os.path.isdir(cls.cache_file):
os.mkdir... | [
{
"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/real_tests/test_real_sqlite_cache.py | guionardo/py-cache-guiosoft |
import uuid
from sqlalchemy import BigInteger, Column, Text
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class TestRdsTable(Base): # pylint: disable=too-few-public-methods
"""Class representing a model of database for ORM"""
__tablename__ = str(uuid.uuid4())
id = ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | csm_test_utils/rds_backup/generation/sqla/db_model.py | opentelekomcloud-infra/csm-test-utils |
from django.db import models
from aziende.models import *
# Create your models here.
class Anagrafica(models.Model):
nome = models.CharField(null=False, max_length=128)
cognome = models.CharField(null=False, max_length=128)
codice_fiscale = models.CharField(null=False, max_length=16)
azienda = models... | [
{
"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 | personale/models.py | luca772005/studio |
from github.interfaces import Type
class LicenseRule(Type):
"""
Represents a license rule.
"""
__slots__ = ()
_repr_fields = [
"key",
]
_graphql_fields = [
"description",
"key",
"label",
]
@property
def description(self):
"""
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | github/content/licenserule.py | ShineyDev/github |
import cv2
import numpy as np
from sklearn.cluster import DBSCAN as skDBSCAN
def DBSCAN(src, eps, min_samples):
arr = cv2.cvtColor(src, cv2.COLOR_BGR2LAB).reshape(-1, src.shape[2])
clustering = skDBSCAN(eps=eps, min_samples=min_samples).fit(arr)
labels = clustering.labels_ + 1
maps = labels.reshape(sr... | [
{
"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 | cv2u/core/cluster.py | 076923/cv2-utils |
import abc
from collections import OrderedDict
class ControlArchitecture(abc.ABC):
def __init__(self, robot):
self._robot = robot
self._state = 0
self._prev_state = 0
self._state_machine = OrderedDict()
self._trajectory_managers = OrderedDict()
self._hierarchy_manan... | [
{
"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 | pnc/control_architecture.py | junhyeokahn/ASE389 |
"""Converts Jupyter Notebooks to Jekyll compliant blog posts"""
from datetime import datetime
import re, os, logging
from nbdev import export2html
from nbdev.export2html import Config, Path, _re_digits, _to_html, _re_block_notes
from fast_template import rename_for_jekyll
warnings = set()
# Modify the naming proc... | [
{
"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 | _action_files/nb2post.py | inc0/fastpages |
from unittest import TestCase
from rockaway.models import Track
class TestTrackBasics(TestCase):
def test_track_create_no_args(self):
track = Track()
self.assertFalse(track.hasDbEntry())
self.assertFalse(track.hasFile())
def test_track_create(self):
args = {"Title": "Rockaw... | [
{
"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 | test/test_tracks.py | dpitch40/rockawayplayer |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides values which would be available from /proc which
are not fulfilled by other modules.
"""
from __future__ import print_function
from __future__ import unicode_literals
import functools
import sys
from types import ModuleType
import gdb
import pwndbg.memoize
im... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | pwndbg/proc.py | jakuta-tech/pwndbg |
## Copyright 2015-2019 Ilgar Lunin, Pedro Cabrera
## 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... | [
{
"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 | PyFlow/Packages/PyFlowBase/Nodes/cliexit.py | liaokongVFX/PyFlow |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
"""Serializes a name field for testing our ApiView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Serializes a user profile o... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | profiles_api/serializers.py | MariyaShalju/profiles-rest-api |
import pytest
from tyfbaf import constants
@pytest.fixture
def ugly_hack():
"""Ugly hack to disable autouse fixture in conftest.py..."""
constants.SERVER_NAME = ""
def test_server_name_default(ugly_hack):
assert constants.SERVER_NAME == ""
def test_port_default():
assert constants.PORT == 6405
... | [
{
"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 | tests/test_constants.py | yveso/tyfbaf |
import logging
import discord
from discord.ext import commands
# from util.logger import Logger
log = logging.getLogger("discordbot")
def delete_original():
"""
Decorator that deletes the original
Discord message upon command execution.
:return: boolean
"""
async def predicate(ctx):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | util/decorators.py | MiningMark48/Discord-Bot-Template |
import sys
import re
from mrjob.job import MRJob
class MR32B(MRJob):
SORT_VALUES = True
def mapper(self, _, line):
issue = line.strip().split(',')[3]
words = re.findall(r'[a-z]+', issue.lower())
for word in words:
sys.stderr.write("reporter:counter:Issue,word,1\n")
... | [
{
"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 | HW3/mrjob3_2B.py | maynard242/Machine-Learning-At-Scale |
# lógica para o usuário fazer apostas
import sys
class UserAccount:
def __init__(self, name, balance=0.0):
self.name = name
self.balance = balance
def get_balance(self):
return self.balance
def insert_credits(self, amount):
self.balance += amount
def check_credits(... | [
{
"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 | Betting.py | viniciusbenite/FootballBets |
#!/usr/bin/env python
#
# 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, s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | cliff/tests/test_formatters_value.py | serrollc/cliff |
from datetime import datetime
from dagster import Out, job, op
from dagster.utils import script_relative_path
from dagster_pandas import PandasColumn, create_dagster_pandas_dataframe_type
from dagster_pandas.constraints import (
ColumnConstraint,
ColumnConstraintViolationException,
ColumnDTypeInSetConstrai... | [
{
"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 | examples/docs_snippets/docs_snippets/legacy/dagster_pandas_guide/custom_column_constraint.py | rpatil524/dagster |
from settings import settings
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.caml_query import CamlQuery
from office365.sharepoint.client_context import ClientContext
list_title = "Survey"
view_title = "All Responses"
def print_list_views(ctx):
"""Read l... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | examples/sharepoint/view_operations.py | andebor/Office365-REST-Python-Client |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Debug signal handler: prints a stack trace and enters interpreter.
``register_interrupt_handler()`` enables a ctrl-C h... | [
{
"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 | lib/spack/spack/util/timer.py | player1537-forks/spack |
"""
Test cast_class in tagulous.models.tagged
"""
import inspect
import pickle
from pytest import fixture
from tagulous.models.cast import cast_instance, get_cast_class
from tests.tagulous_tests_app.cast import NewBase, OldBase, Target
EXPECTED_CAST_NAME = "TagulousCastTaggedTarget"
@fixture
def Cast():
# Cr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | tests/test_models_cast.py | jdolter/django-tagulous |
from configparser import ConfigParser, NoOptionError
from io import StringIO
from typing import List
from ochrona.const import TOX_LINKED_REQUIREMENTS, INVALID_TOX_LINES, TOX_INI
from ochrona.parser.requirements import RequirementsFile
class ToxFile:
@staticmethod
def parse(file_path: str) -> List[str]:
... | [
{
"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 | ochrona/parser/tox.py | ttw225/ochrona-cli |
import torch
import torch.nn as nn
from .decoder import Decoder
from .encoder import Encoder
from .phrase_encoder import PhraseModel
from .refiner import Refiner
from graph.weights_initializer import weights_init
class Model(nn.Module):
def __init__(self):
super().__init__()
self.encoder = Encod... | [
{
"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 | graph/model.py | KMU-AELAB-MusicProject/MusicGeneration_VAE-torch |
from AlbotOnline.Snake import SnakeGame
import AlbotOnline.JsonProtocol as Prot
import random as rand
game = SnakeGame.SnakeGame(Port=int(input("Port:"))) #Connects you to the Client
maxDepth = 2
def stateToScore(state):
if(state == Prot.STATES.ongoing):
return 0.5
if(state == Prot.STATES.... | [
{
"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 | AlbotOnline/Tests/SnakeTest.py | Albot-Online/Albot-Python-Library |
from metadata.metadata import METRIC_PERIOD
class ModelHolder:
def __init__(self, model_name, model_config=None, model_data=None, period=METRIC_PERIOD.HISTORICAL.value, id=''):
if model_config is None:
model_config = {}
if model_data is None:
model_data = {}
self._... | [
{
"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/models/modelclass.py | bowbahdoe/foremast-brain |
from my_app import db
class Console(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100))
year = db.Column(db.Integer)
price = db.Column(db.Float(asdecimal=True))
status = db.Column(db.String(100))
numberGames = db.Column(db.Integer)
def __init__(sel... | [
{
"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 | IntegracaoFlask_Android/consoles_app/my_app/console/models.py | Luis-Gritz/ExercicioApiFlask |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.