source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import sys
from typing import (
Tuple,
)
import pywintypes # noqa: E402
import win32file # noqa: E402
if sys.platform != "win32":
raise ImportError("This module should not be imported on non `win32` platforms")
class NamedPipe:
def __init__(self, ipc_path: str) -> None:
try:
self.h... | [
{
"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 | web3/_utils/windows.py | bhardwajRahul/web3.py |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | examples/twisted/wamp/basic/rpc/complex/backend.py | luhn/AutobahnPython |
from torch.utils.data import DataLoader
from torchvision import transforms as T
from torchvision.datasets import CIFAR10
import pytorch_lightning as pl
class CIFAR10Data(pl.LightningDataModule):
""" returns cifar-10 examples in floats in range [0,1] """
def __init__(self, args):
super().__init__()
... | [
{
"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 | dvq/data/cifar10.py | zhangbo2008/vqvae_pytorch |
import pytest
from biserici_inlemnite.users.models import User
from biserici_inlemnite.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"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 | biserici_inlemnite/conftest.py | ck-tm/biserici-inlemnite |
#!/usr/bin/env python
import os.path as op
import fsl.data.image as fslimage
import fsleyes.plugins.tools.cropimage as cropimage
from fsleyes.tests import run_with_orthopanel, realYield
datadir = op.join(op.dirname(__file__), '..', 'testdata')
def test_cropimage():
run_with_orthopanel(_test_cropimage)
def _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 | fsleyes/tests/plugins/test_cropimage.py | pauldmccarthy/fsleyes |
"""
This file is part of nucypher.
nucypher is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
nucypher is distributed in the hope that it wil... | [
{
"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 | nucypher/tests/crypto/test_api.py | kanzeparov/NuCypher |
from typing import List, Generator
def n_gons(partial: List[int], size: int, sums: int=None) -> \
Generator[List[int], None, None]:
length = len(partial)
if length == size * 2:
yield partial
for i in range(1, size * 2 + 1):
if i in partial:
continue
partial.a... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | project_euler/solutions/problem_68.py | cryvate/project-euler |
from typing import List
from heapq import heappush, heappop
class Solution:
def minRefuelStopsDP(
self, target: int, startFuel: int, stations: List[List[int]]
) -> int:
dp = [startFuel] + [0] * len(stations)
for i in range(len(stations)):
for t in range(i + 1)[::-1]:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | p871h/min_refuel_stops.py | l33tdaima/l33tdaima |
import pytest
from PIL import Image
from yoga.image import helpers
class Test_image_have_alpha(object):
@pytest.mark.parametrize(
"image_path",
[
"test/images/image1.jpg",
"test/images/unused-alpha.png",
"test/images/indexed.png",
"test/images/grays... | [
{
"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 | test/test_image_helpers.py | vincentriche/yoga |
import unittest
import asynctest
from opsdroid.database import Database
class TestDatabaseBaseClass(unittest.TestCase):
"""Test the opsdroid database base class."""
def test_init(self):
config = {"example_item": "test"}
database = Database(config)
self.assertEqual("", database.name)
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
... | 3 | tests/test_database.py | himanshu1root/opsdroid |
#!/usr/bin/env python
#
# author: syl20bnr (2013)
# goal: Focus the nth window in the current workspace (limited to 10 firsts)
#
# Example of usage in i3 config:
#
# bindsym $mod+0 exec focus_win.py -n 0
# bindsym $mod+1 exec focus_win.py -n 1
# ... ...
# bindsym $mod+8 exec focus_win.py -n 8
# binds... | [
{
"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 | hard-gists/6623972/snippet.py | jjhenkel/dockerizeme |
"""
Ibutsu API
A system to store and query test results # noqa: E501
The version of the OpenAPI document: 1.13.4
Generated by: https://openapi-generator.tech
"""
import unittest
import ibutsu_client
from ibutsu_client.api.login_api import LoginApi # noqa: E501
class TestLoginApi(unittest.TestCa... | [
{
"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 | test/test_login_api.py | ibutsu/ibutsu-client-python |
import taichi as ti
@ti.all_archs
def test_loops():
x = ti.var(ti.f32)
y = ti.var(ti.f32)
N = 512
@ti.layout
def place():
ti.root.dense(ti.i, N).place(x)
ti.root.dense(ti.i, N).place(y)
ti.root.lazy_grad()
for i in range(N // 2, N):
y[i] = i - 300
@ti.kernel
def func():
for i i... | [
{
"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 | tests/python/test_loops.py | rezahojabr/taichi |
import os
#Define backend as tensorflow
os.environ['KERAS_BACKEND']='tensorflow'
#It is important to import keras after changing backend
import keras
from flask import Flask, render_template,request
from scipy.misc import imsave, imread, imresize
import numpy as np
#import keras.models
import re
import sys ... | [
{
"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 | app.py | animesh-007/digit-identify |
import hashlib
import signify.fingerprinter
import subprocess
NUM_PCRS = 24
PCR_SIZE = hashlib.sha1().digest_size
def to_hex(buf):
import binascii
return binascii.hexlify(buf).decode()
def hexdump(buf):
for i in range(0, len(buf), 16):
row = buf[i:i+16]
offs = "0x%08x:" % i
hexs =... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | lib/util.py | Foxboron/tpm_futurepcr |
'''
Created by auto_sdk on 2017.05.15
'''
from top.api.base import RestApi
class AlibabaAliqinFcSmsNumSendRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.extend = None
self.rec_num = None
self.sms_free_sign_name = None
self.sms_param... | [
{
"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 | XiuxiuService/AliSDK/top/api/rest/AlibabaAliqinFcSmsNumSendRequest.py | nightHearter/XiuxiuService |
from difflib import SequenceMatcher
def ratios(target: list, dictionary: list) -> list:
def ratio(word: str):
l = len(word)
return sorted(
filter(
lambda x: x[1] > 0.5,
map(lambda x: [x, SequenceMatcher(None, x, word).ratio()], filter(lambda x: len(x) in ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | seq_match_corrector/__init__.py | slntopp/seq_match_corrector |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 26 19:41:16 2016
@author: yxl
"""
from sciapp.action import Free
# from imagepy.core.manager import ImageManager, TextLogManager, \
# TableManager, WindowsManager, WTableManager
class ImageKiller(Free):
title = "Kill Image"
asyn = False
para = {"img": No... | [
{
"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 | imagepy/menus/Window/windowskiller_plg.py | Pad0y/imagepy |
import random
from xml.dom import minidom
from scrapy.utils.project import get_project_settings
class RandomUserAgentMiddleware(object):
settings = get_project_settings()
source_path = 'data/user_agents.xml'
def __init__(self, *args, **kwargs):
xmldoc = minidom.parse(self.source_path)
ite... | [
{
"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 | PythonScrapyBasicSetup/middlewares/user_agent.py | tlesick/Scraper-Boilerplate |
# coding=utf-8
import argparse
import ipaddress
import time
import logging
from lib.common import start
from lib.cli_output import start_out
from plugins.ActiveReconnaissance.active import ActiveCheck
from report import gener
def read_file(file, dbname):
hosts = []
try:
with open(file, 'rt') as f:
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | lib/options.py | papa-cmd/Vxscan |
import tkinter as tk
import pygubu
import datetime
from Bot import ChatBot as bot
class Application:
def __init__(self, master):
self.master = master
self.builder = builder = pygubu.Builder()
builder.add_from_file('chat_window.ui')
self.mainWindow = builder.get_object('mainwindow... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | Server/ChatBot/UI/ChatView.py | EylulTansoy/BBC |
#!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test generate RPC."""
from test_framework.test_framework import MAGATestFramework
from test_framework.util ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | test/functional/rpc_generate.py | hhhogannwo/bitcoin |
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
import pickle
from audio_system import *
class PollGoogle():
def __init__(self):
#sets up spreadsheet connection
self.SCOPES = 'https://www.googleapis.com/auth/spreadsheets'
s... | [
{
"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 | poll_from_google.py | killgill/SPDD |
import functools
from flask import Flask, request, make_response, jsonify
from flask_restful import Resource, Api, abort
from project.server.models import User
def login_required(method):
@functools.wraps(method)
def wrapper(self):
auth_header = request.headers.get('Authorization')
if auth_head... | [
{
"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 | project/server/auth/wrapper.py | RaihanSabique/Flask-Restful-JWT-Auth |
"""
Determine whether an integer is a palindrome. An integer is a palindrome
when it reads the same backward as forward.
Example:
Input: 121
Output: true
Example:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left,
it becomes ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | Easy/9.PalindromeNumber.py | YuriSpiridonov/LeetCode |
#
# Copyright (c) 2017 Digital Shadows Ltd.
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
from ds_model import DSModel
class InfrastructureSSL(DSModel):
def __init__(self, id, payload):
self._id = id
self._payload = payload
@property
def id(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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | Apps/phdigitalshadows/dsapi/model/infrastructure_ssl.py | mattsayar-splunk/phantom-apps |
from typing import Tuple
import yaml
class World:
world = None
"""
The first index is the Y coordinate, and the second index is the X coordinate
:type world: List[List[int]]
"""
width = None
"""
:type width: int
"""
height = None
"""
:type height: int
"""
d... | [
{
"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 | src/B2/world.py | Sidesplitter/Informatica-Olympiade-2016-2017 |
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit_page)
def test_phone_... | [
{
"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 | test/test_phones.py | OlgaZtv/python_training |
import time
import os
import requests
from threading import Timer
class TenvisTH661:
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
def pan_left(self, time=1.0):
return self.move('left', time)
def pan_right(self, time=1.0):
retur... | [
{
"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 | main.py | marcheiligers/tenvis-th661-ctrl |
from django.http import Http404
from devilry.apps.core.models import Period
from devilry.devilry_cradmin import devilry_crinstance
from devilry.devilry_student.cradminextensions import devilry_crmenu_student
from devilry.devilry_student.views.period import overview
class Menu(devilry_crmenu_student.Menu):
def ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | devilry/devilry_student/views/period/crinstance_period.py | aless80/devilry-django |
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from baby_backend.utils.utils import (
unique_cart_unique_id_generator,
unique_cart_unique_item_id_generator,
)
from ..orders.models import Order
from .models import Cart, CartItem
@receiver(pre_save, sender=Cart)
... | [
{
"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 | baby_backend/apps/carts/signals.py | mthnglac/BabyTextile-Server |
import asyncio
import uuid
from typing import Dict
from fastapi import WebSocket
class RenderWorker:
def __init__(self, ws: WebSocket):
self.tag = uuid.uuid4()
self.events = asyncio.Queue()
self.handles: Dict[str, asyncio.Future] = {}
self.ws = ws
def __eq__(sel... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | master/workers.py | Crunchy-Bot/auto-render |
"""empty message
Revision ID: 533fc09a4d32
Revises: 7793ca45b7f9
Create Date: 2016-12-13 16:14:27.123196
"""
# revision identifiers, used by Alembic.
revision = '533fc09a4d32'
down_revision = '7793ca45b7f9'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | [
{
"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 | portal/migrations/versions/533fc09a4d32_.py | ivan-c/truenth-portal |
'''
Created on 22.08.2011
@author: kca
'''
from ..ssl import HTTPSMixin
from ..wsgi import WSGIServer
from SocketServer import ThreadingMixIn, ForkingMixIn
from wsgiref.simple_server import WSGIRequestHandler
from futile import NOT_SET
class SecureWSGIServer(HTTPSMixin, WSGIServer):
def __init__(self, server_addres... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},... | 3 | eds/openmtc-gevent/futile/src/futile/net/http/server/wsgi/ssl.py | piyush82/elastest-device-emulator-service |
import pickle
import random
from simtk.unit import dalton, is_quantity
from simtk.openmm.app import element
import unittest
class TestElement(unittest.TestCase):
def test_immutable(self):
def modifyElement():
# this should not be allowed
element.sulfur.mass = 100*dalton
self... | [
{
"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 | 3rdparty/openmm/wrappers/python/tests/TestElement.py | merkys/MMB |
# -*- coding: UTF-8 -*-
import sys
import os
from torch.utils.data import DataLoader,Dataset
import torchvision.transforms as transforms
from PIL import Image
sys.path.append('../')
# print(type(sys.path), '\r\n'.join(sys.path))
import torch.nn as nn
from end2end_model.training_set_gen import gen_config
from end2end_... | [
{
"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 | back_end/imgProcess/end2end_model/model/my_dataset.py | ArkhamWJZ/SummerProject |
#!/usr/bin/env python
import oss2
class PUTCONFIGTOOSS(object):
def __init__(self,DEST,STORESIZE):
self.AK = ''
self.SK = ''
self.ENDPOINT = 'http://oss-cn-hangzhou.aliyuncs.com'
self.BUCKET = 'ali-hangzhou'
self.DEST = DEST
self.STORESIZE = STORESIZE
def INITIAL(self):
try:
A... | [
{
"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 | oss/ossimport/PUTCONFIGTOOSS.py | yibozhang/aliyunproduct |
# -*- coding: utf-8 -*-
class Command(object):
__command__ = None
__parent__ = None
@classmethod
def register(cls, subparsers=None):
if hasattr(cls, 'parser'):
return
if cls.__parent__:
if not hasattr(cls.__parent__, 'parser'):
cls.__parent__.re... | [
{
"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 | utils/command.py | minsukkahng/pokr.kr |
# -*- coding: utf-8 -*-
from pkg_resources import iter_entry_points
from sqldoc.parser.parser import Parser
from sqldoc.renderer.renderer import Renderer
from sqldoc.renderer.jinjarenderer.jinjarenderer import JinjaRenderer
class PluginConflictException(Exception):
pass
class InvalidPluginException(Exception):... | [
{
"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 | sqldoc/sqldoc.py | korhner/sqldoc |
"""
opennms-provisioner test source module
This module is the provides test sources for opennms-provisioner.
:license: MIT, see LICENSE for more details
:copyright: (c) 2018 by Michael Batz, see AUTHORS for more details
"""
import provisioner.source
import provisioner.opennms
class DummySource(provisioner.source.Sou... | [
{
"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 | provisioner/sources/test.py | srlehn/opennms-provisioner |
from turtle import Turtle
FONT = ("Courier", 20, "normal")
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.hideturtle()
self.penup()
self.level = 1
self.goto(x=-230, y=260)
self.update_scoreboard()
def update_scoreboard(self):
sel... | [
{
"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 | scoreboard.py | MdGhulamAzadAnsari/Turtle-Crossing-Game |
"""
Transcritical flow over a bump without a shock.
Ref1: Houghton & Kasahara, Nonlinear shallow fluid flow over an isolated ridge.
Comm. Pure and Applied Math. DOI:10.1002/cpa.3160210103
Ref2: Delestre et al, 2012, SWASHES: a compilation of shallow water
analytic solutions..., Int J Numer Meth Fluids, DOI:10.10... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | validation_tests/analytical_exact/transcritical_without_shock/analytical_without_shock.py | samcom12/anuga_core |
import math
from ds.graph.graph_core import GraphCore
def bellman_ford(graph, src):
"""
Complexity = O(EV)
Works for negative edges unlike Dijkstra.
"""
distances = {}
for vertex in graph.vertices:
distances[vertex] = math.inf
distances[src] = 0
for _ in range(len(graph.vertic... | [
{
"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": fal... | 3 | notes/algo-ds-practice/problems/graph/standard/bellman_ford/bellman_ford.py | Anmol-Singh-Jaggi/interview-notes |
#
# This software is licensed under the Apache 2 license, quoted below.
#
# Copyright 2019 Astraea, 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/LI... | [
{
"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 | pyrasterframes/src/main/python/tests/ExploderTests.py | jpolchlo/rasterframes |
from pcassandra import connection
class CassandraConnectionSetupWsgiMiddleware:
"""WSGI middleware, setup the Cassandra connection when receiving the first request
To use it, create a 'development version' of the 'WSGI application':
* Add to `wsgi.py`:
from pcassandra.dj18 import wsgi
a... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | pcassandra/dj18/wsgi.py | hgdeoro/pcassandra |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import unittest
import numpy as np
from art.defences.spatial_smoothing import SpatialSmoothing
logger = logging.getLogger('testLogger')
class TestLocalSpatialSmoothing(unittest.TestCase):
def test_ones(self):
... | [
{
"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 | art/defences/spatial_smoothing_unittest.py | Sunshine352/adversarial-robustness-toolbox |
from django.http import Http404
from django.shortcuts import render, get_object_or_404, redirect
from .models import Product
from .forms import ProductForm, RawProductForm
def product_create_view(request):
form = ProductForm(request.POST or None)
if form.is_valid():
form.save()
form = ProductForm()
obj ... | [
{
"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 | src/products/views.py | Chris-Ngu/DjangoEnviornment |
class PlanTopologySetIterator(APIObject,IDisposable,IEnumerator):
"""
An iterator to a set of plan topology objects.
PlanTopologySetIterator()
"""
def Dispose(self):
""" Dispose(self: PlanTopologySetIterator,A_0: bool) """
pass
def MoveNext(self):
"""
MoveNext(self: PlanTopologySetIterator)... | [
{
"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 | stubs.min/Autodesk/Revit/DB/__init___parts/PlanTopologySetIterator.py | ricardyn/ironpython-stubs |
import arrow
def __mask_day(date_str):
return date_str[:8] + "**"
def __mask_month(date_str):
return date_str[:5] + "**" + date_str[7:]
def encrypt_day(value_, params=None):
date = arrow.get(value_)
date_str = date.format('YYYY-MM-DD')
return __mask_day(date_str)
def encrypt_month(value_, pa... | [
{
"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 | watchmen/common/security/algorithm/algorithm_date.py | Insurance-Metrics-Measure-Advisory/watchman-data-connector |
from flask import Flask, render_template, Response
from processor.simple_streamer import SimpleStreamer as VideoCamera
# from processor.pedestrian_detector import PedestrianDetector as VideoCamera
# from processor.motion_detector import MotionDetector as VideoCamera
# from processor.qr_detector import QRDetector as Vid... | [
{
"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 | camera/main.py | ITogane/study-picamera-examples |
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
| [
{
"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 | src/keep_alive.py | vandal-dev/dualityBOT |
from django.http import HttpResponse
from django.shortcuts import render
import pandas_gbq
from google.oauth2 import service_account
import json
import sys
import os
# Make sure you have installed pandas-gbq at first;
# You can use the other way to query BigQuery.
# please have a look at
# https://cloud.google.com/big... | [
{
"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 | Visualization/TREND/TREND/view.py | Sapphirine/202112-43-News-Impact-on-Stock-Trend |
"""Support for the Nettigo Air Monitor service."""
from __future__ import annotations
import logging
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
f... | [
{
"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 | homeassistant/components/nam/button.py | andersop91/core |
# Overloading Methods
class Point():
def __init__(self, x=0, y=0):
self.x = x
self.y = y
self.coords = (self.x, self.y)
def move(self, x, y):
self.x += x
self.y += y
# Overload __dunder__
def __add__(self, p):
return Point(self.x + p.x, self.y + p.y)
... | [
{
"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 | ObjectOrientedProgramming/OOPpart4.py | JeffreyAsuncion/TWT_TheCompletePythonCourse |
import unittest
from client import client
class TestIt(unittest.TestCase):
#test 1,2,3 work for echo server
"""
def test_1(self):
self.assertEqual(client("LF", "Test"), "Test")
def test_2(self):
self.assertEqual(client("LF", "This is a long string test"), "This is a long string test")
def test_3(self):
... | [
{
"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 | test_servers.py | heicj/http-server |
import pickle
import string
import numpy as np
import multiprocessing
# system setup
ProcessNum=np.min((10, multiprocessing.cpu_count()))
# Used for generating the random filename
FileNameChars = list(string.letters + string.digits)
FileNameLen = 30
'''
Process the binary file
'''
def read_bin(path):
with open(path... | [
{
"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 | code/utils.py | patchloc/VulnLoc |
# agender.py
from dataset import Dataset
import audformat
import os
import glob_conf
class Agender(Dataset):
"""Class to represent the agender age and gender dataset"""
name = 'agender' # The name
def __init__(self, config):
"""Constructor setting the name"""
Dataset.__init__(self, self.n... | [
{
"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 | src/agender.py | bagustris/nkululeko |
import datetime as dt
import os
# ログファイル差分チェッカー
# ファイル名を受け取り、update()実行ごとに差分を返す
# 更新実行時の時間をもつ
# 更新にかかった総所要時間の計測はせず、上のレイヤーに任せる
# 監視対象のファイルは行を追加する形で情報が増えていくものとする
class LogReader:
# filename, last_update, tail_ix
def __init__(self, filename):
self.filename = filename
self.last_update = dt.datet... | [
{
"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 | logreader.py | trim-uec/notify |
import pytz
from django.utils import timezone
from rest_framework.serializers import DateTimeField, ModelSerializer
from .fields import DateTimeTzField as DjangoDateTimeTzField
class DateTimeTzField(DateTimeField):
def to_internal_value(self, data):
data = super(DateTimeTzField, self).to_internal_value(d... | [
{
"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 | kolibri/core/serializers.py | jonboiser/kolibri |
from tkinter import *
from tkinter import messagebox
from winreg import *
TITLE = "Alto's editor"
RESOLUTION = "200x50"
PATH = r"Software\Team Alto\The Alto Collection"
def get_coins():
key = OpenKey(HKEY_CURRENT_USER, PATH)
for i in range(0, QueryInfoKey(key)[1]):
entry = EnumValue(key, i)
i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | main.py | Tomut0/AltoCoinsEditor |
#coding=utf-8
class rearFirst:
def __init__(self): # 定義初始值等於空的List。
self.items = []
def isEmpty(self): # 定義isEmpty函數,用以查看List是否是空的,並回傳結果,達成Queue的isEmpty效果。
if len(self.items) == 0:
return True
else:
return False
def enqueue(self, value): # 定義enqueue函數,用以... | [
{
"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 | Q2/rearFirst.py | soe840Ian/DS-Assignment1 |
import time
from wraptor.decorators import timeout, TimeoutException
def test_basic():
@timeout(1)
def fn():
try:
time.sleep(2)
assert False
except TimeoutException:
pass
fn()
def test_catch_exception_outsize():
@timeout(1)
def fn():
tim... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | Contents/Libraries/Shared/wraptor/decorators/test/test_timeout.py | jippo015/Sub-Zero.bundle |
"""
Created on Thu Oct 14 14:47:38 2021
@author: cxue2
"""
from ._metric import _Metric_00
from ._misc import _fn_tpl_compare
import torch
class Recall(_Metric_00):
def from_meta(self, hmp):
_, _, fn, tp = torch.ravel(hmp['cnf'])
return tp / (tp + fn)
@_fn_tpl_compare(1)
def comp... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | xfdlfw/metric/recall.py | vkola-lab/multi-GPU |
import sqlite3
# conn = sqlite3.connect('mydb.db')
# c = conn.cursor()
# c.execute("Select * from users")
# print c.fetchone()
# conn.commit()
# conn.close()
class db():
def __init__(self):
"creating db object"
self.conn = sqlite3.connect('mydb.db')
self.c = self.conn.cursor()
def qu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": f... | 3 | code/db.py | RusseII/printer |
from tests.conftest import log_in
def test_logout_auth_user(test_client):
"""
GIVEN a flask app
WHEN an authorized user logs out
THEN check that the user was logged out successfully
"""
log_in(test_client)
response = test_client.get("auth/logout", follow_redirects=True)
assert response... | [
{
"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_auth/test_logout.py | KGB33/Wedding-Website |
# vim: set fileencoding=utf-8:
#
# GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
#
# Copyright (c) 2016-2021 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2018 Rick Ansell <rick@nbinvincible.org.uk>
# Copyright (c) 2016 Andrew Scheller <githu... | [
{
"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 | gpiozero/compat.py | codecademy-engineering/gpiozero |
import util
import json
from boto.sqs.message import Message
from aws import SQSBase
log = util.get_logger("inviso.publish")
class EventPublisher(object):
def __init__(self, **kwargs):
pass
def publish(self, events):
raise NotImplementedError("Please Implement this method")
class SQSE... | [
{
"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 | jes/inviso/publish.py | krishnachaitanyareddy/inviso |
from datetime import datetime
from django.db import models
# Create your models here.
class JD(models.Model):
appkey = models.CharField(max_length=100,verbose_name='appkey')
secret = models.CharField(max_length=100,verbose_name='secret')
add_time = models.DateTimeField(default=datetime.now,verbose_name=... | [
{
"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 | apps/jd_app/models.py | fengjinqi/linjuanbang |
# The MIT License (MIT)
#
# Copyright (c) 2017-2018 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | [
{
"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 | src/nodepy/utils/iter.py | nodepy/engine |
import os
from scrapy.http import HtmlResponse, Request
def fake_response_from_file(file_path, url=None):
"""
Create a Scrapy fake HTTP response from a HTML file
@param file_path: The relative filename from the responses directory,
but absolute paths are also accepted.
@param url... | [
{
"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 | parser/parser/test/util.py | MADE-realtime/realtime_news |
class ScoreCard:
def __init__(self, score_text: str):
score_texts = score_text.split('|')
self.normal_turns = [score_texts[i] for i in range(10)]
if len(score_texts) == 12:
self.additional_turns = [score_texts[11]]
self.all_turns = self.normal_turns + self.additional_tur... | [
{
"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 | java/my_java_dojo/cyber-dojo/bowling_game/bowling.py | kenhutaiwan/learning-practice |
from __future__ import absolute_import
from django.dispatch import Signal
from functools import wraps
class BetterSignal(Signal):
def connect(self, receiver=None, **kwargs):
"""
Support decorator syntax:
>>> @signal.connect(sender=type)
>>> def my_receiver(**kwargs):
>>> ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/sentry/signals.py | ChadKillingsworth/sentry |
import logging
import random
import re
from urllib.parse import urljoin
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
IMAGE_FILE_REGEX = re.compile(r'([-\w]+\.(?:jpg|jpeg|gif|png))',
re.IGNORECASE)
def crawl_page(p... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | simple_workflow/v1/crawl.py | code-review-doctor/orchestra |
# Copyright 2021 The KubeEdge Authors.
#
# 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... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | lib/sedna/algorithms/client_choose/client_choose.py | khalid-jobs/sedna |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Optional, Tuple, cast
from pants.backend.python.subsystems.python_tool_base import PythonToolBase
from pants.option.custom_types import file_option, shell_str
class B... | [
{
"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/python/pants/backend/python/lint/black/subsystem.py | gshuflin/pants |
class Masker():
def __init__(self):
""" This superclass of all masker objects.
"""
def __call__(self, mask=None, *args):
""" Maskers are callable objects that accept the same inputs as the model plus a binary mask.
"""
pass | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | shap/maskers/_masker.py | mathPi/shap |
def recommend_user(recommendations, user_id):
recommendations_user = recommendations[recommendations['user_id'] == user_id]
return recommendations_user
def get_popular_songs(processed_data, year):
processed_data_year = processed_data[processed_data['Release Year'] == year]
popular_songs_year = ... | [
{
"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 | rec.py | bjosep/music_recommendation_system |
from dictknife import loading
from dictknife.jsonknife import get_resolver
from dictknife import DictWalker
def run(*, filename):
def onload(d, resolver, w=DictWalker(["$include"])):
for _, sd, in w.walk(d):
subresolver, jsref = resolver.resolve(sd.pop("$include"))
sd.update(subres... | [
{
"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 | examples/jsonknife/library/customloader/loader.py | podhmo/dictknife |
class DirectionNotDetermined(BaseException):
def __init__(self, message="Hand did not move in only one direction. Direction of movement cannot be determined."):
self.message = message
super().__init__(self.message)
class ConfigError(BaseException):
def __init__(self, message="Possible err... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | modules/Exceptions.py | david-0609/OpenCV-Hand-Gesture-Control |
import argparse
import logging
import torch
import pathlib
import numpy as np
from classifier.config.defaults import cfg
from classifier.data.build import make_data_loaders
from classifier.logger import setup_logger
from classifier.trainer import Trainer
from classifier.models import build_model
from classifier.utils i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | train.py | bendikbo/SSED |
#!/usr/bin/env python
import cPickle
from functools import wraps
def redis_lru(capacity=5000, slice=slice(None)):
def decorator(func):
cache_keys = "lru:keys:%s" % (func.__name__,)
cache_vals = "lru:vals:%s" % (func.__name__,)
cache_hits = "lru:hits:%s" % (func.__name__,)
cache_miss = "lru:miss:%s" % (func.__... | [
{
"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 | redis-cache.py | voidabhi/python-scripts |
"""Implementation of ``idoit-cli search`` command.
Lists the constants.
"""
import argparse
import json
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import Terminal256Formatter
from .api import Client
def setup_argparse(parser: argparse.ArgumentParser) -> None:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | idoit/search.py | bihealth/idoit-py |
import json
from .oauth import OAuth2Test
class SlackOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.slack.SlackOAuth2'
user_data_url = 'https://slack.com/api/users.identity'
access_token_body = json.dumps({
'access_token': 'foobar',
'token_type': 'bearer'
})
user_dat... | [
{
"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 | social_core/tests/backends/test_slack.py | BenRogersNewsome/social-core |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email="admin@test.com",
... | [
{
"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 | app/core/tests/test_admin.py | anamgajith/recipe-app-api |
from ...shared.utils.restApi import RestResource
from ...shared.utils.api_utils import build_req_parser
from ..utils.charts_utils import (requests_summary, requests_hits, avg_responses, summary_table, get_issues,
get_data_from_influx)
class ReportChartsAPI(RestResource):
get_rule... | [
{
"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 | api/charts.py | carrier-io/backend_performance |
'''
Created on Oct 11, 2017
@author: seth_
'''
from .PlaygroundStandardPacketEncoder import PlaygroundStandardPacketEncoder, PacketEncoder
from .PacketFramingStream import PacketFramingStreamAdapter
class PlaygroundFramingPacketEncoder(PlaygroundStandardPacketEncoder):
def encode(self, stream, fieldType)... | [
{
"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 | Playground3/src/playground/network/packet/encoders/PlaygroundFramingPacketEncoder.py | kandarpck/networksecurity2018 |
from class_car import car
class electrical_car(car):
def __init__(self, make, model,year):
super().__init__(make, model, year)
self.battery_volume = 70 # KWh
def describe_battery(self):
description = 'This car has a '+str(self.battery_volume)+' KWh battery . '
return descripti... | [
{
"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 | Hello_Python/class_electricalcar.py | JaydenYL/Projects |
"""empty message
Revision ID: e3f9f9c13c
Revises: 52b884ded89
Create Date: 2015-11-02 13:56:17.387911
"""
# revision identifiers, used by Alembic.
revision = 'e3f9f9c13c'
down_revision = '52b884ded89'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... | [
{
"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/e3f9f9c13c_.py | getslash/scotty |
def foo_bar(a, test, test_other):
for x in range(test_other + test):
print(x, a)
def simple_function(a):
test = 1
test_other = 11
foo_bar(a, test, test_other)
| [
{
"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 | lua/refactoring/tests/refactor/106/py/simple-function/extract.expected.py | pogopaule/refactoring.nvim |
from pyplan_core.classes.wizards.BaseWizard import BaseWizard
import pandas as pd
import jsonpickle
class Wizard(BaseWizard):
def __init__(self):
self.code = "DataframeGroupby"
def generateDefinition(self, model, params):
nodeId = params["nodeId"]
if model.existNode(nodeId):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | pyplan_core/classes/wizards/DataframeGroupby.py | pyplan/pyplan-core |
import sys
import click
from .main import main
from .pretty import print_error
from ..compat import asyncio_run
from ..session import AsyncSession
@main.command()
@click.argument('task_id', metavar='TASKID')
def task_logs(task_id):
'''
Shows the output logs of a batch task.
\b
TASKID: An UUID of a ... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | src/ai/backend/client/cli/logs.py | youngjun0627/backend.ai-client-py |
import math
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
s = round(size_bytes / p, 2)
return "%s %s" % (s, size_name[i])
def get_or... | [
{
"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 | kines/util.py | parallelstream/kines |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.19.15
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitt... | [
{
"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 | kubernetes_asyncio/test/test_admissionregistration_api.py | lsst-sqre/kubernetes_asyncio |
# Copyright 2001 by Gavin E. Crooks. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unit test for Des"""
import unittest
from Bio.SCOP import Des
class DesTests(unittes... | [
{
"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 | Tests/test_SCOP_Des.py | amblina/biopython |
# Copyright 2019-2021 Darren Weber
#
# 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 writ... | [
{
"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 | tests/test_pytest_aiomoto.py | dazza-codes/pytest-aiomoto |
""" Script to define and execute a series of Salish Sea NEMO model runs.
All use the same RC4, corr4 files but include different numbers of tidal
constituents
"""
from __future__ import absolute_import
import os
import salishsea_cmd.api
def main():
run_desc = base_run_description()
runs = ('RC4_wO1S2', ... | [
{
"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 | SalishSea/tides/script_runs_RC4.py | SalishSeaCast/SS-run-sets |
from yandex_checkout.domain.models.payment_data.payment_data import PaymentData
from yandex_checkout.domain.common.payment_method_type import PaymentMethodType
class PaymentDataApplepay(PaymentData):
__payment_data = None
def __init__(self, *args, **kwargs):
super(PaymentDataApplepay, self).__init__(... | [
{
"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 | yandex_checkout/domain/models/payment_data/request/payment_data_applepay.py | tonchik-tm/yandex-checkout-sdk-python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import marshal
from math import log, exp
from ..utils.frequency import AddOneProb
class Bayes(object):
def __init__(self):
self.d = {}
self.total = 0
def save(self, fname):
d = {}
d['total'] = self.t... | [
{
"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 | snownlp/classification/bayes.py | erning/snownlp |
# ___ _ ___ ___ _ |
# / _ \ __| |_ ___| _ \/ __| | | Create 8-bit-like games!
# | (_) / _| _/ _ \ _/ (_ |_| | Author: Death_Miner
# \___/\__|\__\___/_| \___(_) | Version: 0.4.0
# |
#
# @ octopg/version.py => Version of this octopg!
octopg_ver = "0.4.0"
octop... | [
{
"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 | octopg/version.py | demaisj/OctoPG |
# INIT
data = []
numeric = []
normal = []
keyL = []
KeyL = []
key = input("Enter Key Value: ")
# File - Load Function
def load(file):
handle = open(file)
return handle.read()
# Text Format
def form(file):
format = load(file)
format = format.replace(' ', '')
format = format.replace(',', '')
f... | [
{
"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 | crypto/vigenere/crypto.py | vandewinckel/Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.