source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# coding: utf-8
"""
validateapi
The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API. # noqa: E501
OpenAPI spec version: v1
Ge... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | test/test_get_gender_response.py | doc22940/cloudmersive.apiclient.python |
"""
Functionalities related to optimization (minimization, inversion), such as the
misfit function and its gradient.
DEPRECATED, will be removed from v1.4.0 onwards.
"""
# Copyright 2018-2021 The emsig community.
#
# This file is part of emg3d.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you ma... | [
{
"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 | emg3d/optimize.py | emsig/emg3d |
"""
The intensity measurement scale has changed, and might change again
Therefore, I need this module to translate between numeric intensity scores
and casualty numbers
"""
from typing import Optional
from datetime import date
import pydantic
class CasualtyRange(pydantic.BaseModel):
lower: int
upper: Optional[... | [
{
"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 | cc_backend_lib/models/scales.py | prio-data/cc_backend_lib |
# Test utils
class TestTools():
DIVIDER_LENGTH = 60
def __init__(self):
self.total_run_tests = 0
self.num_success = 0
self.test_msg = ''
self.test_result = ''
self.show_obtained = False
def __del__(self):
print('\n' + self.show_result_division())
... | [
{
"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 | UnitaryTest/test_tools.py | dayvr/udacity-practices-intro |
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class LiskSignedTx(p.MessageType):
MESSAGE_WIRE_TYPE = 117
de... | [
{
"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 | monero_glue/messages/LiskSignedTx.py | ph4r05/monero-agent |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"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 | aliyun-python-sdk-cms/aliyunsdkcms/request/v20180308/QueryCustomMetricListRequest.py | DataDog/aliyun-openapi-python-sdk |
from fastapi.testclient import TestClient
from app.main import app
from unittest import mock
from tests.helper import mock_api
import json
client = TestClient(app)
@mock.patch('app.analyzer.analyzer.TorreAPI.search_jobs', return_value=mock_api('torre_jobs'))
def test_post_jobs(mock):
response = client.post(
... | [
{
"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 | tests/unit/test_endpoints.py | kennylajara/job-skills-analyzer |
# coding:utf-8
from PySide2.QtWidgets import *
import constants as const
class PublishChecker(QWidget):
def __init__(self):
QWidget.__init__(self)
self.setWindowTitle("Publish Cleaner")
self.setMinimumSize(500, 400)
self.init()
self.setStyleSheet(open(const.BARAKA_STYLESHEETS_PATH + "/brkStyle.css").read... | [
{
"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 | ui/widgets/publish_clean.py | Noorth34/barakaTools |
#
# Solution to Project Euler problem 34
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import math
def compute():
# As stated in the problem, 1 = 1! and 2 = 2! are excluded.
# If a number has at 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | solutions/p034.py | xianlinfeng/project_euler_python3 |
import insightconnect_plugin_runtime
from .schema import GetScansInput, GetScansOutput, Input, Output
# Custom imports below
from komand_rapid7_insightappsec.util.endpoints import Scans
from komand_rapid7_insightappsec.util.resource_helper import ResourceHelper
import json
class GetScans(insightconnect_plugin_runtim... | [
{
"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 | plugins/rapid7_insightappsec/komand_rapid7_insightappsec/actions/get_scans/action.py | lukaszlaszuk/insightconnect-plugins |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def traversal(self, node):
if not node:
return
self._dict[node.val] = 1
self.traversal(node.right)
se... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | Python/two-sum-bsts.py | kuanhungchen/leetcode-practice |
from model.Range import Range
class __ConstMeta(type):
def __setattr__(self, name, value):
if name in self.__dict__:
raise TypeError(f'Can\'t rebind const ({name})')
else:
self.__setattr__(name, value)
class Constant(metaclass=__ConstMeta):
CHARACTER_IMAGE_HEIGHT = 10... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | result-analyzer/main/src/constant/Constant.py | yoshi8102-p/smalysis-register |
import time
from collections import deque
import gym
class RecordEpisodeStatistics(gym.Wrapper):
def __init__(self, env, deque_size=100):
super().__init__(env)
self.t0 = time.perf_counter()
self.episode_return = 0.0
self.episode_horizon = 0
self.return_queue = deque(maxlen... | [
{
"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 | lagom/envs/record_episode_statistics.py | zuoxingdong/lagom |
def create_sequence(count):
sequence = [0, 1, 1]
for n in range(3, count):
next_n = sequence[n - 1] + sequence[n - 2]
sequence.append(next_n)
print(' '.join([str(x) for x in sequence]))
def locate_number(number):
x, y = 0, 1
index = 0
while x < number:
x, y = y, x + y
... | [
{
"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 | Modules/fibonacci_05/fib_fn.py | MihailMarkovski/Python-Advanced-2020 |
#!/usr/bin/env python
"""
Unit tests for M2Crypto.BN.
Copyright (c) 2005 Open Source Applications Foundation. All rights reserved.
"""
import re
import warnings
from M2Crypto import BN, Rand
from tests import unittest
loops = 16
class BNTestCase(unittest.TestCase):
def test_rand(self):
# defaults
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_bn.py | runapp/M2Crypto |
# -*- coding:utf-8 -*-
def rotation(step, a_list):
"""
TestCase for rotation
>>> rotation(1, [1,2,3,4,5])
[5, 1, 2, 3, 4]
>>> rotation(2, [1,2,3,4,5])
[4, 5, 1, 2, 3]
>>> rotation(7, [1,2,3,4,5])
[4, 5, 1, 2, 3]
"""
step %= len(a_list)
res(a_list, 0, len(a_list)-1)
res(a_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | rotation_2.py | konglx90/algorithm |
from ..db import Database
from .models import UserModel
class UserGateway:
def __init__(self):
self.model = UserModel
self.db = Database()
def create(self, *, email, password):
self.model.validate(email, password)
self.db.cursor.execute() # TODO: create user query
#... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | week10/CinemaReservation/hack_cinema/users/users_gateway.py | HackBulgaria/Programming-101-Python-2020-Spring |
from s3fs.utils import read_block, seek_delimiter, tmpfile
import io
import os
def test_tempfile():
with tmpfile() as fn:
with open(fn, 'w'):
pass
assert os.path.exists(fn)
assert not os.path.exists(fn)
def test_read_block():
delimiter = b'\n'
data = delimiter.join([b'123... | [
{
"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 | s3fs/tests/test_utils.py | bsync/s3fs |
from tempfile import NamedTemporaryFile
from subprocess import Popen, PIPE
import logging
logger = logging.getLogger(__name__)
logger.propagate = True # passes up to parent logger
def db_to_fna(db, collection, seqtype="CDS"):
"""Takes records of ``"type":seqtype` (like "CDS" or "16s"), writes them to file
Ar... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | kvasir/make_blast_db.py | DuttonLab/kvasir |
#!/usr/bin/env python3
import sys
from autograde import NotebookTest
nbt = NotebookTest('demo notebook test', cell_timeout=1., test_timeout=.1)
@nbt.register(target='square', label='t1')
def test_square(square):
for i in range(-5, 5):
assert i ** 2 == square(i)
@nbt.register(target='factorial', label=... | [
{
"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 | tests/examples/test_2.py | wanLo/autograde |
from .base_page import BasePage
from .locators import BasketPageLocators
class BasketPage(BasePage):
def should_be_empty(self):
self.no_items_in_basket()
self.message_no_items_is_present()
def no_items_in_basket(self):
assert self.is_not_element_present(*BasketPageLocators.BASKET_FOR... | [
{
"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 | pages/basket_page.py | vas-se/final-selenuim-edu |
# Class
# "The best material model of a cat is another, or preferably the same, cat."
#
# You probably won't define your own in this class, but you will have to know how to use someone else's.
#
# Stanley H.I. Lio
# hlio@hawaii.edu
# OCN318, S18
# this defines a CLASS (indentation matters! a lot!):
class Mordor:
... | [
{
"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 | F18/week5/jabuticaba4.py | stanleylio/OCN418 |
"""
Open Orchestrator Cloud Radio Access Network
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | oocran/django/images/forms.py | howls90/oocran |
from dataclasses import dataclass
from typing import List
from salvia.types.blockchain_format.sized_bytes import bytes32
from salvia.types.blockchain_format.program import Program
from salvia.util.ints import uint64
# This class is supposed to correspond to a CREATE_COIN condition
@dataclass(frozen=True)
class Paym... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | salvia/wallet/payment.py | Salvia-Network/salvia-blockchain |
import os
import unittest
from pulsar import send
from pulsar.apps.test import ActorTestMixin
from pulsar.utils.tools import Pidfile
from pulsar.utils.system import platform
@unittest.skipUnless(platform.type != 'win', 'This fails in windows')
class TestPidfile(ActorTestMixin, unittest.TestCase):
concurrency = '... | [
{
"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 | tests/utils/test_pid.py | goodboy/pulsar |
# @author: vinay
import subprocess
import sys
# execution of c program
def c_calling():
try:
with open(sys.argv[1], encoding="utf8") as file:
for line in file:
word_list = line.split()
for word in word_list:
word = alphabet_numbers(wo... | [
{
"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 | lab6/lab6q2.py | VinayFaria/CS571 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import IMode, IModuleData, Mode, ModuleData
from txircd.utils import ModeType
from zope.interface import implements
class LimitMode(ModuleData, Mode):
implements(IPlugin, IModuleData, IMode)
name = "LimitMode"
... | [
{
"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 | txircd/modules/rfc/cmode_l.py | guyguy2001/txircd |
# ### Problem 6
# Example Output:
# ```
# There are currently 4 club members in the list!
# Club President: Alfred
# Club Vice President: Troy
# Club Secretary: Albert
# Club Treasurer: Bob
# ```
# Create a class called ClubMember
# Each club member has a name and a role
class ClubMember:
def __init__(self, name,... | [
{
"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 | q6.py | cs-fullstack-2019-fall/codeassessment2-insideoutzombie |
ply_header = '''ply
format ascii 1.0
element vertex %(vert_num)d
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
'''
class PLY_Manip:
def __init__(self, results_dir):
self.dir = results_dir
def insert_header(self, point_cl... | [
{
"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 | modeler/PLY_Manip.py | sahan1996/Dummy |
import glob
import json
import os
import xml.etree.ElementTree as ET
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, tsv, is_platform_windows
def get_settingsSecure(files_found, report_folder, seeker):
slash = '\\' if is_platform_windows() else '/'
# Filter for ... | [
{
"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 | scripts/artifacts/settingsSecure.py | mastenp/ALEAPP |
from django import forms
from django.forms import fields, widgets
from.models import Register
from django.contrib.auth.models import User
from .models import Profile
class LoginForm(forms.Form):
username = forms.CharField(label="Kullanıcı Adı")
password = forms.CharField(label="Şifre",widget=forms.PasswordInpu... | [
{
"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 | MiAmor Vet/miamorvet/user/forms.py | p0zn/MiAmorVet-App |
import argparse
import boto3
"""Helper module to assist in AWS deployments"""
def get_lambda_client(
aws_access_key_id: str, aws_secret_access_key: str, aws_region: str
) -> boto3.client:
return boto3.client(
"lambda",
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_se... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | deploy/aws.py | Austin-Schmidli/Image-Metadata-API |
import json
import pytest
from mythx_models.exceptions import ValidationError
from mythx_models.request import DetectedIssuesRequest
from . import common as testdata
def test_analysis_issues_request_from_valid_json():
req = DetectedIssuesRequest.from_json(
json.dumps(testdata.DETECTED_ISSUES_REQUEST_DI... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_detected_issues_request.py | s0b0lev/mythx-models |
# https://adventofcode.com/2020/day/14
import itertools
import re
SAMPLE_PATH = "../../input/2020-14-sample.txt"
INPUT_PATH = "../../input/2020-14-input.txt"
def get_data(filename):
with open(filename) as file:
data = file.read().split("\n\n")
data = [block.splitlines() for block in data]
if 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python/2020/day14.py | BastiHz/Advent_of_Code |
import datetime
import logging
import traceback
from dis_snek.models import ComponentContext
from dis_snek.models import InteractionContext
from ElevatorBot.misc.formating import embed_message
def get_now_with_tz() -> datetime.datetime:
"""Returns the current datetime (timezone aware)"""
return datetime.da... | [
{
"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 | ElevatorBot/misc/helperFunctions.py | LukasSchmid97/destinyBloodoakStats |
import asyncio
import logging
from common import utils
from common import command_parser
log = logging.getLogger("eris.command_parser")
class CommandParser(command_parser.CommandParser):
def __init__(self, eris, signals, engine, metadata):
super().__init__(eris.loop)
self.eris = eris
self.signals = signals
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | eris/command_parser.py | Feriority/lrrbot |
class TSException(Exception):
"""Exception related to tsbot"""
class TSResponseError(TSException):
"""Raised when response from server has error_id set to other than 0."""
def __init__(self, message: str, error_id: int) -> None:
self.message = message
self.error_id = error_id
def __s... | [
{
"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": false
}... | 3 | tsbot/exceptions.py | 0x4aK/TSBot |
import os
from enum import Enum
def chunk_it(seq, num):
avg = len(seq) / float(num)
out = []
last = 0.0
while last < len(seq):
out.append(seq[int(last):int(last + avg)])
last += avg
return out
def mul_all(x):
out = 1
for v in x:
out *= v
return out
def get... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | util.py | MichalOp/StarTrain |
#!/usr/bin/env python
import argparse
import pickle
from tqdm import tqdm
from redis import Redis
from catalyst import utils
def build_args(parser):
parser.add_argument("--host", type=str, default="127.0.0.1")
parser.add_argument("--port", type=int, default=12000)
parser.add_argument("--out-pkl", type=st... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | catalyst/rl/scripts/dump_redis.py | Felix-neko/catalyst |
import unittest
from clayful.exception import ClayfulException
class ClayfulExceptionTest(unittest.TestCase):
def test_clayful_error_constructor(self):
error = ClayfulException(
'Brand',
'get',
400,
{},
'g-no-model',
'my message',
{}
)
self.assertEqual(error.is_clayful, True)
self.asse... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test_exception.py | Clayful/clayful-python |
from django.test import TestCase
from chatterbox.models import Service
class FacebookApiTestCase(TestCase):
fixtures = ("project/apps/chatterbox/fixtures/users.json",
"project/apps/chatterbox/fixtures/dump.json")
def setUp(self):
self.service = Service.objects.get(key="tumblr")
... | [
{
"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 | chatterbox/tests/test_api_tumblr.py | blitzagency/django-chatterbox |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
"""
test_txttk
----------------------------------
Tests for `txttk` module.
"""
import unittest
class TestTxttk(unittest.TestCase):
... | [
{
"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_txttk.py | jeroyang/txttk |
import vaex
import numpy as np
def test_evaluate_function_filtered_df():
# Custom function to be applied to a filtered DataFrame
def custom_func(x):
assert 4 not in x; return x**2
df = vaex.from_arrays(x=np.arange(10))
df_filtered = df[df.x!=4]
df_filtered.add_function('custom_function', 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 | tests/evaluate_test.py | yetyetanotherusername/vaex |
from gbdxtools.images.base import RDABaseImage
from gbdxtools.images.drivers import RDADaskImageDriver
from gbdxtools.rda.util import reproject_params
from gbdxtools.rda.interface import RDA
rda = RDA()
from shapely.geometry import box
class DemDriver(RDADaskImageDriver):
image_option_support = ["proj", "bbox"]
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | gbdxtools/images/dem_image.py | mail4y/gbdxtools |
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/leaderboard")
def leaderboard():
return render_template('leaderboard.html')
@app.route("/profile")
def profile():
return render_template('profile.html')
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 | code.py | abhi6083/Codeforces_Site |
from conqueror.app import app
from conqueror.cassandra import session
from conqueror.utils import as_json
@app.route('/v1/view-businesses/<string:sector>')
@as_json
def get_businesses(sector: str):
"""
Get a list of Russian businesses to post reviews for
---
parameters:
- in: path
name: sect... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | conqueror/endpoints/view_business.py | piotrmaslanka/yandex-conqueror |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin,BaseUserManager
# Create your models here.
class UserProfileManager(BaseUserManager):
"""Manager for user profiles """
def create_user(self,email,name,password=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 | profiles_api/models.py | nafis-badar/profiles-rest-api |
"""deny tests"""
from django.urls import reverse
from authentik.core.tests.utils import create_test_admin_user, create_test_flow
from authentik.flows.markers import StageMarker
from authentik.flows.models import FlowDesignation, FlowStageBinding
from authentik.flows.planner import FlowPlan
from authentik.flows.tests i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | authentik/stages/deny/tests.py | BeryJu/passbook |
import multiprocessing
pool = None
def initPool():
global pool
pool = multiprocessing.Pool(int(multiprocessing.cpu_count()))
def execInPool(func, params):
return pool.map(func, params)
| [
{
"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 | foe_pool.py | QwerTech/foe-automation |
import serial
import time
serialPort = 0
# List of what each bin contains. As we find new bolts, we allocate new bins for them.
# Obviously, the physical device has finite bins, but the arduino handles having the
# "overflow" bin. Though, because we send bytes, we have an effective limit of 256.
bins = []
def in... | [
{
"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 | python/arduino.py | karagenit/material-sorter |
import os
import tempfile
import json
import pytest
from app import app
@pytest.fixture
def client():
db_fd, app.config['DATABASE'] = tempfile.mkstemp()
app.config['TESTING'] = True
client = app.test_client()
# with app.app_context():
# app.init_db()
yield client
os.close(db_fd)
... | [
{
"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_app.py | ScriptingWithPython/my_frotz |
# -*- coding: utf-8 -*-
from django.db import models
from django.shortcuts import render,redirect
from django.views import View
from django.contrib.auth import authenticate, login , logout as django_logout
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.http imp... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | TBS/b2b/views.py | v1ct0r5u3n/TBS |
import torch.nn as nn
from fairseq import utils
class LearnedPositionalEmbedding(nn.Embedding):
"""This module learns positional embeddings up to a fixed maximum size.
Padding symbols are ignored, but it is necessary to specify whether padding
is added on the left side (left_pad=True) or right side (lef... | [
{
"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 | machine_translation/fairseq/modules/learned_positional_embedding.py | wangjksjtu/autoassist-exp |
from cloudify import ctx
from cloudify.state import ctx_parameters as inputs
from cloudify.decorators import operation
from cloudify.exceptions import *
from plugin.nodes.utils import *
def build_radl_flavour(config):
ctx.logger.debug('{0} Infrastructure Manager deployment info:'.format(get_log_indentation()))
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | plugin/nodes/flavour.py | MSO4SC/cloudify-im-plugin |
import os
from pytest import fixture
@fixture(scope='function')
def environ(request):
origin = dict(os.environ)
@request.addfinalizer
def restore_environ():
os.environ.clear()
os.environ.update(origin)
return os.environ
| [
{
"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/conftest.py | tonyseek/python-envcfg |
from django import forms
from django.conf import settings
from django.utils.encoding import force_text
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from .models import AnyLink
class AnyLinkAdminForm(forms.ModelForm):
confirmation = forms.BooleanField(
... | [
{
"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 | anylink/forms.py | moccu/django-anylink |
from .version import __version__
from .handlers import SyncHandler, UIHandler, LegacyInteractRedirectHandler, LegacyGitSyncRedirectHandler
from .pull import GitPuller
from notebook.utils import url_path_join
from tornado.web import StaticFileHandler
import os
def _jupyter_server_extension_paths():
return [{
... | [
{
"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 | nbgitpuller/__init__.py | yuvipanda/nbgitpuller |
from __future__ import print_function
import json
from argh import ArghParser, arg
from ghtools import cli
from ghtools.api import GithubAPIClient
parser = ArghParser(description="Browse the GitHub API")
@arg('github', nargs='?', help='GitHub instance nickname (e.g "enterprise")')
@arg('url', help='URL to browse')... | [
{
"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 | ghtools/command/browse.py | alphagov/ghtools |
class Progression:
def __init__(self, start=0):
self._current = start
def _advance(self):
self.current += 1
def __next__(self):
if self.current is None:
raise StopIteration()
else:
answer = self._current
self._advance()
return... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | Ch7/numericProgressions.py | mtrdazzo/data-structures-python |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.sources.tas.api import _load_data, process_csv
def test_load_data():
data = _load_data()
assert len(data) > 100, len(data)
def test_processor():
tp = process_csv(affinity_class_limit=10)
... | [
{
"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 | indra/tests/test_tas.py | djinnome/indra |
from pytest import mark, fixture
from qmriddle import solve
@mark.parametrize('riddle', [
'?',
'?b',
'??',
'???',
'abc',
'a?',
'ab?',
'?a',
'??a',
'??b',
'??c',
'a?a',
'a?b',
'a?c',
'a?a?a',
'a?a?b',
'a?b?b',
'a?b?c',
'?a?b??c???d????',
'... | [
{
"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 | python/coin/microsoft/qmriddle/qmriddle_test.py | eDyablo/handicraft |
# -----------------------------------------------------------
# Functions to generate JSON files in a desired format
# from the functions inside functions.py
# -----------------------------------------------------------
def question_json_maker(question_id, question, answer, answer_index=1, question_type='MC', difficu... | [
{
"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 | jsonify.py | SalarHoushvand/discrete-math-restfulAPI |
import os
import subprocess
import sys
from GpdbBuildBase import GpdbBuildBase
class GpBuild(GpdbBuildBase):
def __init__(self, mode):
self.mode = 'on' if mode == 'orca' else 'off'
def configure(self):
return subprocess.call(["./configure",
"--enable-orca",
... | [
{
"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 | concourse/scripts/builds/GpBuild.py | sridhargoudrangu/gpdb |
from boltons.strutils import slugify
from django.db import models
from quiggler.constants import QUILT_TYPES, QUILT_TYPES_DEFAULT
class SlugModel(models.Model):
slug = models.SlugField(primary_key=True, unique=True, editable=False)
name = models.CharField(max_length=255)
class Meta:
abstract = T... | [
{
"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 | src/quiggler/models.py | nalch/quiggler |
"""Base word embedding"""
import torch
import torch.nn as nn
import os
from bootleg.utils import logging_utils
class BaseWordEmbedding(nn.Module):
"""
Base word embedding class. We split the word embedding from the sentence encoder, similar to BERT.
Attributes:
pad_id: id of the pad word index
... | [
{
"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 | bootleg/embeddings/word_embeddings/base_word_emb.py | mleszczy/bootleg |
'''
(c) University of Liverpool 2020
All rights reserved.
@author: neilswainston
'''
# pylint: disable=invalid-name
# pylint: disable=no-member
# pylint: disable=wrong-import-order
from rdkit import Chem
import scipy
from gae.tf import train_single
import numpy as np
import pandas as pd
def _load_data(filename):
... | [
{
"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 | gae/chem/sparse/chem_train_single.py | neilswainston/gae |
from typing import Optional
class Stack:
"""
Stack data structure implementation.
"""
def __init__(self):
self.items = []
def push(self, item) -> None:
"""
Accepts an item as a parameter and appends it to the end of the list.
The runtime of this meth... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | src/stack.py | aram2726/ExampleLinter |
import numpy as np
from env import Env
def fill(image,x_idx,y_idx,bound,value):
if (x_idx<0) or (x_idx>=900):
return image
elif (y_idx<0) or (y_idx>=110):
return image
elif image[x_idx][y_idx]>=bound:
return image
else:
image[x_idx][y_idx]=value
return image
... | [
{
"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 | Plateau/preprocess_image.py | RichardLeeK/CNM |
import unittest
import time
import os
from datetime import datetime, timedelta
from unittest.mock import patch
from spaceone.core.unittest.result import print_data
from spaceone.core.unittest.runner import RichTestRunner
from spaceone.core import config
from spaceone.core.transaction import Transaction
from spaceone.co... | [
{
"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 | test/manager/test_vmss_manager.py | spaceone-dev/plugin-azure-state-inven-collector |
# coding=utf-8
"""Dependency data object."""
import json
class Dependency:
"""Dependency data object.
Use to specify dependencies between PBs, workflow stages, and SBIs?
"""
def __init__(self, config_dict: dict):
"""Create a dependency object from a DB dependency dict."""
self._confi... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | sip/execution_control/configuration_db/sip_config_db/scheduling/dependency.py | SKA-ScienceDataProcessor/integration-prototype |
import webbrowser
def open_term(home_url, term):
'''Open a search term in the home_url'''
if ' ' in term:
new_term=term.replace(' ', '%20')
webbrowser.open_new_tab('%s/search?q=%s' % (home_url, new_term))
else:
webbrowser.open_new_tab('%s/search?q=%s' % (home_url, term))
def wbsxcred... | [
{
"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 | WBSX.py | ProgrammerTheUnique/Webbrowser-Sidekick |
from base_sss import SubsetSelectionStrategy
import base_sss
import random
import torch
class BALDDropoutStrategy(SubsetSelectionStrategy):
def __init__(self, size, Y_vec, n_drop=10, previous_s=None):
self.previous_s = previous_s
self.n_drop = n_drop
super(BALDDropoutStrategy, self).__init_... | [
{
"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 | mexmi/subset_selection_strategy/bayesian_disagreement_dropout_sss.py | mexmi2021/mexmi-project |
from flask import render_template,redirect,url_for, flash,request
from .import auth
from ..models import User
from .forms import LoginForm,RegistrationForm
from .. import db
from flask_login import login_user,logout_user,login_required
from ..email import mail_message
@auth.route('/login',methods=['GET','POST'])
def lo... | [
{
"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 | app/auth/views.py | Jn-mic/blog |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models.fields import BooleanField
from django.db.models.fields.related import ForeignKey, ManyToManyField
class User(AbstractUser):
pass
class Category(models.Model):
class Meta:
verbose_name_plural = "cate... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | auctions/models.py | CptCaveira/commerce |
# django
from django.core.urlresolvers import reverse
from django.test import TestCase, RequestFactory, Client
# own modules
from .factories import UserFactory
from .utils import url_with_querystring
from django.contrib.auth.models import User
class HomePageTest(TestCase):
"""
Tests for home page
"""
... | [
{
"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 | amos/tests.py | chuckoy/grabyaya |
# Natlink recognition logger.
# (c) 2005 Daniel J. Rocco
#
# Logs NaturallySpeaking's recognition history to the specified file.
# Format:
# timestamp current_user current_module window_title (recognized word list | '*REJECT*')
#
# modeled on Joel Gould's "repeat that" grammar.
#
... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | MiscScripts/_voiceLogger.py | mrob95/natlink |
import copy
import json
from abc import ABC
from datetime import datetime
from typing import Any
from cyber_sdk.util.converter import to_isoformat
def to_data(x: Any) -> Any:
if "to_data" in dir(x):
return x.to_data()
if isinstance(x, list):
return [to_data(g) for g in x]
if isinstance(x,... | [
{
"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 | cyber_sdk/util/json.py | SaveTheAles/cyber.py |
import numpy as np
class uncertainty:
def __init__(self):
pass
class uncertainties:
def __init__(self):
self.uncertainty_collection = {}
self.uncertainty_count = {}
self.norm_func = {'MinMax' : lambda x: (x-np.min(x)) / (np.max(x)-np.min(x)),
'Zscor... | [
{
"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 | chemprop/utils/uclass.py | wangdingyan/hybridUQ |
class BinHeap:
def __init__(self):
self.heapList = [0]
self.currentSize = 0
def percUp(self,i):
while i // 2 > 0:
if self.heapList[i] < self.heapList[i // 2]:
tmp = self.heapList[i // 2]
self.heapList[i // 2] = self.heapList[i]
self.heap... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | binary_heap.py | sbugrov/biutils |
# KEEP IN MIND: Attributes with no Default Values must come first
from dataclasses import dataclass, field
import random
def getDiscount():
return float(random.randrange(20, 40))
@dataclass
class Book:
pages: int
title: str = "No Title"
author: str = "No Author"
price: float = field(defa... | [
{
"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 | 3.Object.Oriented.Programming/13.defineDafultValues.py | bhattvishal/programming-learning-python |
"""
Tests for utilities.py
"""
import unittest
from src import constants as c
from src import data_loader as dload
class TestDataLoader(unittest.TestCase):
"""Test utilities"""
# ------------------------------ io ------------------------------------------------------------
def test_dropbox_connecto... | [
{
"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 | test/test_data_loader.py | villoro/expensor_personal |
from talon import Context, actions
ctx = Context()
ctx.matches = r"""
os: windows
app: firefox
"""
@ctx.action_class('app')
class AppActions:
def tab_next(): actions.key('ctrl-pageup')
def tab_previous(): actions.key('ctrl-pagedown')
@ctx.action_class('browser')
class BrowserActions:
def bookmark():
... | [
{
"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": true... | 3 | apps/firefox/win.py | avexs/knausj_talon |
# This file is part of Neotest.
# See http://www.neotest.io for more information.
# This program is published under the MIT license.
import multiprocessing
import threading
import neotest
class ProcessBase(multiprocessing.Process, neotest.logging.LogClientBase):
def __init__(self, name=None):
multiproce... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | neotest/bases.py | neotest-io/neotest |
from alpha_vantage.timeseries import TimeSeries
from fin_apis.utils import multicall
from fin_apis.auth import AuthKeys
class AVTimeSeries(TimeSeries):
def __init__(self, key=None, output_format='pandas', treat_info_as_error=True, indexing_type='date', proxy=None,
rapidapi=False):
if ke... | [
{
"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 | fin_apis/alphavantage/ts.py | humdings/fin_apis |
import pandas as pd
import numpy as np
import pickle
from flask import Flask, request
import flasgger
from flasgger import Swagger
app = Flask(__name__)
Swagger(app)
pickle_in = open('classifier.pkl', 'rb')
classifier = pickle.load(pickle_in)
@app.route('/')
def welcome():
return 'Welcome'
@app... | [
{
"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 | app.py | devangi2000/money-authenticator |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...comments import Comments
class TestInitialisation(unittest.TestCase):
"""
T... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
... | 3 | xlsxwriter/test/comments/test_initialisation.py | shareablee/XlsxWriter |
def leiaint(msg):
while True:
try:
n = int(input(msg))
except(ValueError, TypeError):
print("\033[31mERRO: Por favor, digite um numero inteiro valido.\033[m")
except KeyboardInterrupt:
print("\n\033[31mO usuario preferiu não digitar esse numero.")
... | [
{
"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 | ex001 a ex114/ex113.py | kesia-barros/exercicios-python |
import sys
import os
from loguru import logger
from ..vars import BASE_DIR, LOGGING_FILE
ROTATION = "10 MB"
class Logger(object):
def __init__(self):
self.logger = logger
self.logger.remove()
self._console = None
self._file = None
self._log_to_file()
self._log_to_... | [
{
"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 | zairachem/utils/logging.py | ersilia-os/ersilia-automl-chem |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class KoubeiRetailKbcodeCreateResponse(AlipayResponse):
def __init__(self):
super(KoubeiRetailKbcodeCreateResponse, self).__init__()
self._batch_id = None
@property
... | [
{
"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 | alipay/aop/api/response/KoubeiRetailKbcodeCreateResponse.py | snowxmas/alipay-sdk-python-all |
#%%
import pandas as pd
import numpy as np
import glob
import os
import re
import pickle
from multiprocessing import Pool
def entropy(exp): # both are dfs with two columsn, Barcode,cluster
# calc H_tot
entropy = (exp
.groupby("labels")
.count()
.reset_index(drop=True)
... | [
{
"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 | clustereval/stability.py | vinay-swamy/clustereval |
from __future__ import absolute_import
import pyflann
import numpy
import sklearn.preprocessing
from ann_benchmarks.algorithms.base import BaseANN
class FLANN(BaseANN):
def __init__(self, metric, target_precision):
self._target_precision = target_precision
self.name = 'FLANN(target_precision=%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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | ann_benchmarks/algorithms/flann.py | maumueller/ann-benchmarks-reproducibility |
from abc import ABC, abstractmethod
from typing import Tuple, Any, Optional
class AbstractMessageProtocol(ABC):
@abstractmethod
def unpack(self, message: Any) -> Tuple[str, Any]:
pass
@abstractmethod
def pack(self, target: Optional[str], message: Any) -> Any:
pass
class SimpleDictPr... | [
{
"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": true... | 3 | src/webmesh/message_protocols.py | BinarSkugga/webmesh |
from rest_framework import serializers
import statistics
from foundation.models import TimeSeriesDatum, Sensor, Instrument
class DashboardSerializer(serializers.BaseSerializer):
def get_values(self,sensor_name, insturments):
sensor = Sensor.objects.get(
name = sensor_name,
instrume... | [
{
"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 | indoorair_back/api/serializers/dashboard/dashboard_serializers.py | ydang5/indoorair-back |
import pymysql.cursors
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self,host,name,user,password):
self.host=host
self.name=name
self.user=user
self.password=password
self.connection=pymysql.connect(host=host ,database=name,... | [
{
"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 | fixture/db.py | AnastasiiaAndronova/python_training |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
{
"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 | tests/st/control/test_tensor_in_list.py | PowerOlive/mindspore |
import random
from player import Player
from hand import Hand
class CPU(Player):
def __init__(self, name: str):
super().__init__(name)
self.hand = Hand()
def discard(self):
if(self.hand == None or len(self.hand) <= 0):
raise RuntimeError('No cards to discard')
retur... | [
{
"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 | cpu.py | SudoSpartanDan/CribbagePythonGame |
import pandas as pd
from math import exp, log,sqrt
from numpy import cumsum,std,sum, mean
def outData(ts,actionHist,indx,startIndex=0):
out=pd.DataFrame(ts,index=indx,columns=['ts']).applymap(lambda x: x/100)
out=out[startIndex:]
out['cum_log_ts']=cumsum([log(1+i) for i in out['ts']])
out['Action_Hist'... | [
{
"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 | pybrain/rl/environments/timeseries/performanceEvaluation.py | samstern/MSc-Project |
from django.db import models
# Create your models here.
class Owner(models.Model):
name = models.CharField(max_length=30)
surname = models.CharField(max_length=30)
birth_date = models.DateField()
def __str__(self):
return self.name
def __str__(self):
return self.su... | [
{
"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 | students/k3342/practical_works/kiselev/django_project_kiselev/project_first_app/models.py | Ru1z99/ITMO_ICT_WebProgramming_2020 |
""" The CNN Encoder Model """
import torch.nn as nn
from torchvision.models import resnet18
class CNN(nn.Module):
""" The CNN Model """
def __init__(self, encoder_output_dim):
super().__init__()
self.cnn = resnet18(pretrained=True)
self.cnn = nn.Sequential(*list(self.cnn.children())[... | [
{
"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 | cnn.py | nishprabhu/image_captioning |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
from flexget.entry import Entry
from flexget.utils.tools import group_entries
log = logging.getLogger('best_quality')
entry_actions = {
'accept': Entry.accept,
'reject'... | [
{
"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 | flexget/plugins/filter/best_quality.py | fotile96/Flexget |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.