source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import fileinput
import os
def to_sclite_line(trans):
with open(trans, "r") as fd:
hyp = fd.read()
_id, _ = os.path.splitext(os.path.basename(trans))
return f"{hyp} ({_id})"
def main():
with fileinput.input() as finput:
for ln in finput:
print(to_sclite_line(ln.strip())... | [
{
"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 | transcription_folder_to_sclite_hyp.py | c0louri/kaldi-grpc-server |
import paho.mqtt.client as mqtt #import the client1
import time
import sys
import threading
import unittest
import Pub_Sub_client as pubsub
class TestClient(unittest.TestCase):
def setUp(self):
pubsub.message="check_name;1;F;check_procedure"
pass
def test_subscriber(self):
t1=... | [
{
"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 | Python_client/test_client.py | Engin-Boot/sync-devices-s1b2 |
def func():
print("func")
def func_interna():
print("func_interna")
func_interna()
func() | [
{
"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 | excript/aulas/aula96_funcao_aninhada.py | victorers1/anotacoes_curso_python |
#!/usr/bin/env python
"""These are processes memory dump related flows."""
from grr.client.client_actions import standard as standard_actions
from grr.client.client_actions import tempfiles as tempfiles_actions
from grr.lib import flow
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import... | [
{
"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 | grr/lib/flows/general/dump_process_memory.py | StanislavParovoy/GRR |
"""empty message
Revision ID: 276ef161b610
Revises:
Create Date: 2017-10-24 19:30:22.200973
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '276ef161b610'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"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 | migrations/versions/276ef161b610_.py | Jc2k/microauth |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Artyk Basarov and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
# import erpnext_furniture_to_go.erpnext_furniture_to_go.doctype.furniture_to_go_settings.furniture_to_go_methods as f2g
from frappe.model... | [
{
"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 | erpnext_furniture_to_go/erpnext_furniture_to_go/doctype/furniture_to_go_settings/furniture_to_go_settings.py | artykbasar/erpnext_furniture_to_go |
from tests.common import *
def test_silhouette(adata_pca):
score = scIB.me.silhouette(
adata_pca,
group_key='celltype',
embed='X_pca',
scale=True
)
LOGGER.info(f"score: {score}")
assert 0 <= score <= 1
def test_silhouette_batch(adata_pca):
_, sil = scIB.me.silhoue... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/metrics/test_silhouette_metrics.py | gokceneraslan/scib |
class Node():
def __init__(self, data=None, next=None):
self.data = data
self.next = next
class LinkedList():
def __init__(self):
self.head = None
def insert_at_beginning(self, data):
node = Node(data = data, next = self.head)
self.head = node
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | experiments/exercise_linked_list.py | shruti-bt/data-structure-python |
import sys
from flaky import flaky
from .tools import SRC_ROOT, AutomaticBaseTest, ExplicitBaseTest, NO_FILE, NO_LINK_FILE
sys.path.append(SRC_ROOT)
import webdrivermanager # noqa: E402 I001
class GeckoDriverManagerTestsWithAutomaticLocations(AutomaticBaseTest):
DRIVER_MANAGER = webdrivermanager.GeckoDriverMan... | [
{
"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 | test/acceptance/test_gecko.py | ronymesquita/webdrivermanager |
import json
import time
import MySQLdb
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
# replace mysql.server with "localhost" if you are running via your own server!
# server MySQL username MySQL pass Database name.
... | [
{
"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 | Streaming Tweets from Twitter to Database.py | 224alpha/Python |
class Solution:
def __init__(self):
self.combs = []
def _backtrack(self, candidates, cur, target, k):
if len(cur) == k and sum(cur) == target:
self.combs.append(cur[:])
return
if sum(cur) > target:
return
elif len(cur) < k:
... | [
{
"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 | backtracking/0216_combination_sum_3.py | MartinMa28/Algorithms_review |
import os
import yaml
import hashlib
from .util import json_dumps
class PhishingTrackerFile:
def __init__(self, __logger=None):
global logger
logger = __logger
def load_config(self, filename=None):
config = {}
try:
with open(filename, 'r') as f:
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | PhishingTracker/file.py | ndejong/phishing-tracker |
# Third-Party
import pytest
from rest_framework.test import APIClient
# from rest_framework.test import RequestsClient
# Django
from django.test.client import Client
# First-Party
from .factories import AwardFactory
from .factories import ChartFactory
from .factories import ConventionFactory
from .factories import ... | [
{
"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 | project/apps/core/tests/conftest.py | barberscore/archive-api |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""Metaclasses module"""
from lib import decorator, exception, constants
c... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",... | 3 | test/selenium/src/lib/meta.py | Smotko/ggrc-core |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
from pathlib import Path
# TODO: fix to not need this (in Windows, MacOS and Linux)
if os.path.isdir(os.path.join(".", "src")) and os.path.isfile(os.path.join(".", "setup.py")):
sys.path.append(os.path.realpath("src"))
sys.path.append(os.path.real... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_ags.py | ericoporto/agstoolbox |
import asyncio
from aiovk.longpoll import BotsLongPoll
import os
from aiovk import TokenSession, API
from dotenv import load_dotenv
from utils.message import Message
from vk_bot.bot import VkBot
load_dotenv()
ses = TokenSession(access_token=str(os.getenv('BOT_VK_KEY')))
api = API(ses)
lp = BotsLongPoll(api, int(os.... | [
{
"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 | vk_bot/__init__.py | AndreyKaBelka/Resender |
#!/usr/bin/env python
# Author: Alex Tereschenko <alext.mkrs@gmail.com>
# Copyright (c) 2016 Alex Tereschenko.
#
# 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, includin... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/mock/spi_checks_lsbmode.py | nazeer22/mraa |
import tensorflow as tf
from current_net_conf import *
class RnnDropoutPlaceholders:
probability = tf.placeholder(tf.float32, [])
@staticmethod
def feed(prob=1.0):
return {RnnDropoutPlaceholders.probability: prob}
class MultiRnnWithDropout(tf.nn.rnn_cell.DropoutWrapper):
def __init__(self,... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | model/rnn_with_dropout.py | Saloed/PythonGenerator |
import unittest
from unittest.mock import Mock
from data_repo_client import RepositoryApi
from dagster_utils.contrib.data_repo.jobs import poll_job, JobFailureException, JobTimeoutException
from dagster_utils.contrib.data_repo.typing import JobId
class PollJobTestCase(unittest.TestCase):
def setUp(self):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | dagster_utils/tests/contrib/data_repo/test_poll_job.py | broadinstitute/dagster-utils |
import numpy as np
import structures as st
#return a data object containing an entire frame
def decomposeFrame(frame,frameNum):
channelList = []
if len(frame.shape)==3:
for i in range(frame.shape[2]):
channelList.append(decomposeMatrix(frame[:,:,i]))
else:
channelList.append(decomposeMatrix(frame))
return(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | VideoUtils/codec.py | epmcj/nextflix |
# -*- coding: utf-8 -*-
from .myqt import QT, DebugDecorator
import pyqtgraph as pg
class ControlPanel(QT.QWidget):
def __init__(self, conf, parent=None):
QT.QWidget.__init__(self, parent=parent)
self.conf = conf
layout = QT.QVBoxLayout()
self.setLayout(layout)
... | [
{
"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 | idephyx/controlpanel.py | samuelgarcia/idephyx |
import tempfile
import os
import requests
from tqdm import tqdm
from rich import print as rprint
from felicette.constants import band_tag_map
workdir = os.path.join(os.path.expanduser("~"), "felicette-data")
def check_sat_path(id):
data_path = os.path.join(workdir, id)
if not os.path.exists(data_path):
... | [
{
"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 | felicette/utils/file_manager.py | plant999/felicette |
import sys
import numpy as np
def main():
p = [30, 35, 15, 5, 10, 20, 25]
m, s = matrixChainOrder(p)
print('m')
for i in m:
print(i)
print('s')
for i in s:
print(i)
def matrixMultiply(A, B):
if A.shape[1] != B.shape[0]:
print('incompatible dimensions')
... | [
{
"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 | DynamicProgramming/matrixChainMultiplication.py | ZPAVelocity/DataStructureExercise |
from abc import ABC, abstractmethod
from metadata_extractor.connection.connection_abstract import RDBMSConnection
from metadata_extractor.builders.rdbms.rdbms_builder_abstract import RDBMSBuilder
from metadata_extractor.models.atlas_model.rdbms.database_schema import DatabaseSchema
from metadata_extractor.models.atlas_... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstr... | 3 | metadata_extractor/extractor/rdbms/rdbms_extractor_abstract.py | pongthep/apache-atlas-external-tools |
"""Furniture Creator global utility functions."""
from __future__ import annotations
from typing import List, Dict
from furniturecreator.dataclasses import Part
def filter_parts_list_by_size(
parts: List[Part],
size: str) -> List[Part]:
"""Filter a list of parts by size."""
if size != 'S' an... | [
{
"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 | furniturecreator/utilities.py | ruudwelten/furniture-creator |
# coding: utf-8
"""
Hydrogen Proton API
Financial engineering module of Hydrogen Atom # noqa: E501
OpenAPI spec version: 1.9.2
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | atom/proton/python/test/test_mortgage_calculator_home_price_request.py | AbhiGupta03/SDK |
import cv2
import numpy as np
def BGRGRAY(_img):
img = np.zeros((_img.shape[0], _img.shape[1]), dtype=np.float32)
img = _img[:,:,2].copy() * 0.2126 + _img[:,:,1].copy() * 0.7152 + _img[:,:,0].copy() * 0.0722
return img.astype(np.uint8)
def EmbossFilter(img, K_size=3):
Hol, Ver = img.shape
pad =... | [
{
"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 | Question_11_20/myans/myans_18.py | OverHall27/Gasyori100knock |
from .exceptions import PSAWException
def requires_private_key(method):
def wrapper(self, *args, **kwargs):
if not self.private_key:
raise PSAWException(
'The {} method requires a private key'.format(method.__name__))
return method(self, *args, **kwargs)
return wrapp... | [
{
"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 | psaw/decorators.py | LeartS/PSAW |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... | [
{
"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 | isi_sdk_8_2_1/test/test_healthcheck_parameter_extended.py | mohitjain97/isilon_sdk_python |
# Bruce Maxwell
# Fall 2020
# CS 5001 Project 7
# First L-system project
# Some test code
import turtle
import turtle_interpreter as ti
# useful goto function
def goto(x, y):
turtle.up()
turtle.goto(x, y)
turtle.down()
# main function that makes a small tree in a pot
def makeTree():
# set up the win... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},... | 3 | test7-2.py | carolninganga/week7project |
import app.controllers.interfaces as interfaces
class MessageHolder(interfaces.MessageHolder):
def __init__(self, event):
self.items = []
self.event = event
@property
def isEmpty(self):
return self.items == []
is_empty = isEmpty
def put(self, item):
self.items.ins... | [
{
"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 | cmp_command_acceptor/app/controllers/implementations/MessageHolder.py | andrii-z4i/xmind-telegram |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
{
"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 | paddlespeech/t2s/modules/transformer/repeat.py | xuesu/PaddleSpeech |
class SortedList:
"""
This is a list object which is sorted. Actually
this is not sorted now. Because this is a parent
class.
"""
_list = list()
def __init__(self, arg: list or tuple) -> None:
try:
if type(arg) == list:
self._list = arg
elif ... | [
{
"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/SortedList/SortedList.py | berkayaslan/Sorting_Simulation |
from stockmarket.models import StockNameCodeMap
from tradeaccounts.models import TradeAccount, Positions
from investors.models import TradeStrategy
def get_stockinfo_for_chart(stock_symbol='sh',):
stock_info_list = []
if not stock_symbol.isdigit():
# 默认上证指数,如果不指定股票编号
show_code = '1A0001'
... | [
{
"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 | stocktrade/utils.py | bizeasy17/investtrack |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bull Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test a node with the -disablewallet option.
- Test that ... | [
{
"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/disablewallet.py | BullCoin-Project/BullCoin |
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from toontown.battle.BattleProps import *
from direct.directnotify import DirectNotifyGlobal
from toontown.suit import DistributedGoon
from toontown.toonbase import ToontownGlobals
from toontown.coghq import MovingPlatform
class Distributed... | [
{
"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 | toontown/suit/DistributedGridGoon.py | LittleNed/toontown-stride |
def main(x):
matrix = []
exit_path = []
for i in range(0, x):
j = list(input())
if 'e' in j:
y = j.index("e")
exit_path.append(i)
exit_path.append(y)
j[y] = "-"
matrix.append(j)
row, col = 0, 0
matrix[row][col] = "S"
path =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | Recursion/labyrinth.py | borislavstoychev/Algorithms |
#!/usr/bin/python3
import os,base64,sqlite3,time,datetime
import hashlib as md5
from flask import Flask,g,url_for,send_from_directory, request,Response, jsonify,render_template,redirect
from werkzeug import secure_filename
ALLOWED_EXTENSIONS = set(['zip'])
# Displayed on web frontend, might be included in REST?
PRO... | [
{
"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 | build-server/src/server_base.py | hbirchtree/coffeecutie-build-daemon |
from torch import nn
class ConvolutionalBlock(nn.Module):
def __init__(self, in_channels=128, out_channels=256, kernel_size=3, padding=1, stride=1, padding_mode='zeros'):
super().__init__()
self.conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, stride=stride,
... | [
{
"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 | src/models/conv_block.py | plutasnyy/mgr |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 23:53:58 2019
@author: yanyanyu
"""
from spark import start_spark
from pyspark import SparkConf
from pyspark import SparkFiles
from pyspark.sql import Row
def main():
spark,conf=start_spark()
steps_per_floor_=conf['steps_per_floor']
... | [
{
"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 | examples_pyspark/pyspark_small_project/etl_job.py | nancyyanyu/mini_projects |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Simulador de dado simple
# ┌────────-┬-─────┬────────-┬──────┬─────────┬──────┐
# │ Unicode │ Char │ Unicode │ Char │ Unicode │ Char │
# └─────────┴──────┴─────────┴──────┴─────────┴──────┘
# u+2680 ⚀ u+2681 ⚁ u+2682 ⚂
# ... | [
{
"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 | soluciones/simulador_dado.py | carlosviveros/Soluciones |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras import backend as K
import numpy as np
class TripletReluLoss(object):
def __init__(self, p_norm, eps=0.):
self.p_norm = p_norm
self.eps = eps
def _... | [
{
"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 | functions/losses.py | saralajew/robustNPCs |
"""Support for controlling GPIO pins of a Beaglebone Black."""
from Adafruit_BBIO import GPIO # pylint: disable=import-error
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
DOMAIN = "bbb_gpio"
def setup(hass, config):
"""Set up the BeagleBone Black GPIO component."""
de... | [
{
"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 | homeassistant/components/bbb_gpio/__init__.py | tbarbette/core |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from bes.testing.unit_test import unit_test
from bes.git.git_head_info import git_head_info
class test_git_head_info(unit_test):
def test_parse_head_info(self):
f = git_head_info.parse_head_info
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/lib/bes/git/test_git_head_info.py | reconstruir/bes |
import numpy as np
import torch
import torch.nn as nn
import random
import torch.distributions as D
class GenerativeFlow(nn.Module):
"""
Generative flow base class
For models performing density estimation and matching
"""
def __init__(self, args):
super(GenerativeFlow, self).__init__()
... | [
{
"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 | models/generative_flow.py | robert-giaquinto/gradient-boosted-normalizing-flows |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse, HttpResponseRedirect
from django.views import View
from django.shortcuts import render
from django.urls import reverse
from django.contrib import messages
from suite.forms import ClubCreateForm
class ClubCreate(LoginRequir... | [
{
"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": true
},
... | 3 | clubsuite/suite/views/view_club_create.py | fsxfreak/club-suite |
import telnetlib
import time
OK = 0
ERROR = 1
RESPONSE_DELAY_MS = 100
class AMXNMX(object):
def __init__(self, host, port=50002, response_delay_ms=RESPONSE_DELAY_MS):
self.conn = telnetlib.Telnet(host, port=port)
self.response_delay_sec = response_delay_ms / 1000.
self._initialize()
... | [
{
"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 | amx_control.py | jack-h/amx_control |
#!/usr/bin/env python3
# Copyright (c) 2018 The Zcash developers
# Copyright (c) 20202 The groom developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import groomTestFramework
from test_fra... | [
{
"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 | test/functional/sapling_wallet_persistence.py | nhoussay/groom |
#Project Euler Problem-78
#Author Tushar Gayan
#Multinomial Theorem
import math
import numpy as np
def mod_list(pow,terms):
m = []
for i in range(terms):
if i%pow == 0:
m.append(1)
else:
m.append(0)
return m[::-1]
def partition(n):
num_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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | prob-78.py | tushargayan2324/Project_Euler |
import os
from xua import helpers
from xua.constants import CLI, BUILD
from xua.exceptions import UserError
from xua.builders.doc import htmlOld
def getBuildEngine(project, config):
if project == CLI.PROJECT_SERVER_PHP:
# @TODO
return None
elif project == CLI.PROJECT_MARSHAL_DART:
# @T... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | xua/build_tools.py | kmirzavaziri/xua-cli |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='get_first_char')
def get_first_char(value):
"""
Returns the first char of the given string
:param value:
:return:
"""
return value[:1]
@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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | ai/templatetags/ai_string_tags.py | TransWebT/ai-django-core |
"""
Alex Levenson
alex@isnotinvain.com | www.isnotinvain.com
(c) Reya Group | http://www.reyagroup.com
Friday July 23rd 2010
"""
import networkx as nx
import csv
import igraph
def writeDict(dict,file,headerRow=None):
"""
Writes dict to file in CSV format
file: a file object or a filepath
headerRow: a list 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | util.py | reyagroup/networkx_additional_algorithms |
#!/usr/bin/env python
from django.utils import simplejson
from tastypie.fields import ApiField
class GeometryApiField(ApiField):
"""
Custom ApiField for dealing with data from GeometryFields (by serializing them as GeoJSON) .
"""
dehydrated_type = 'geometry'
help_text = 'Geometry data.'
... | [
{
"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 | activecalls/fields.py | hacktyler/hacktyler_crime |
class Node:
def __init__(self, key):
self.left = None
self.right = None
self.val = key
# Traverse preorder
def traversePreOrder(self):
print(self.val, end=' ')
if self.left:
self.left.traversePreOrder()
if self.right:
self.right.traver... | [
{
"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 | Python/BinaryTree.py | Rohit01-pro/All_Program_helper |
from geth import LoggingMixin
from geth.process import BaseGethProcess, DevGethProcess
class RinkebyGethProcess(BaseGethProcess):
def __init__(self, geth_kwargs=None):
if geth_kwargs is None:
geth_kwargs = {}
if 'network_id' in geth_kwargs:
raise ValueError(
... | [
{
"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 | ethereum_stats/process.py | carlesperezj/ethereum-analysis-tool |
import numpy as np
from manimlib.mobject.mobject import Mobject
class ValueTracker(Mobject):
"""
Note meant to be displayed. Instead the position encodes some
number, often one which another animation or continual_animation
uses for its update function, and by treating it as a mobject it can
sti... | [
{
"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 | manimlib/mobject/value_tracker.py | unAlpha/AgManim |
# Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/Python/Utility/file.py
from os import listdir, makedirs
from os.path import exists, isfile, join, splitext
import shutil
import re
def sorted_alphanum(file_list_ordered):
convert = lambda text: int... | [
{
"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 | examples/Python/Utility/file.py | martinruenz/Open3D |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Intel Corporation
#
# 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 applicab... | [
{
"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 | lpot/ux/utils/expiring_dict.py | intelkevinputnam/lpot-docs |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | isi_sdk_9_0_0/test/test_cluster_node_hardware.py | mohitjain97/isilon_sdk_python |
from flask import jsonify, json
from flask_restful import Resource
from injector import inject
from webargs import fields
from webargs.flaskparser import use_kwargs
from backend_application.service import HealthIndicatorService
class HealthIndicator(Resource):
@inject
def __init__(self, service: HealthIndica... | [
{
"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 | visualization/backend/backend_application/resource/health_indicator.py | INSO-TUWien/portfoliometrix |
from flask import Flask
from flask import render_template, jsonify, make_response, request
from celery.result import AsyncResult
from celery import Celery
from example.conf import REDIS_ADDRESS, REDIS_PORT
app = Flask(__name__, template_folder="./templates")
celery_app = Celery(
backend=f'redis://{REDIS_ADDRESS}... | [
{
"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 | example/app.py | arruda/example-flask-background-task |
import os
import numpy as np
from skimage.metrics import structural_similarity as ssim
from skimage.metrics import mean_squared_error as mse
from skimage.metrics import peak_signal_noise_ratio as psnr
def compare_image(metric, ref, target):
if metric == 'ssim':
return ssim(ref, target, multichannel=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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | mon-estimator/run/utils/fonctions.py | prise-3d/figures-generator |
import logging
import sys
import numpy as np
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
# Perform prediction on the deserialized object, with the loaded model
def predict_fn(input_object, model):
logger.info("predict_fn")
logger.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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | scikit_learn_script_mode_local_serving_no_model_artifact/code/inference.py | aws-samples/amazon-sagemaker-local-mode |
import os
def get_dirs():
cwd = os.path.dirname(os.path.realpath(__file__))
local_savedir = cwd
local_datadir = cwd
local_wandbdir = cwd
return local_savedir, local_datadir, local_wandbdir
def configure_logging(config, name, model):
if config['wandb_on']:
import wandb
wandb... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | tvae/utils/logging.py | ReallyAnonNeurips2021/TopographicVAE |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
from ...tests.helper import pytest
from ..compat import gzip
pytestmark = pytest.mark.skipif(str("sys.version_info < (3,0)"))
def t... | [
{
"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 | astropy/utils/tests/test_gzip.py | xiaomi1122/astropy |
import streamlit as st
from .api.client import ApiClient
from .authentication import get_jwt_from_browser
from .interactors import Job, Run
def get_api_client(st_element: st = st) -> ApiClient:
client = ApiClient()
client.jwt_token = get_jwt_from_browser()
if client.jwt_token is None:
client.api_... | [
{
"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 | pollination_streamlit/selectors.py | mostaphaRoudsari/pollination-streamlit |
"""
Copyright 2019 Twitter, Inc.
Licensed under the Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0
"""
import numpy as np
import tensorflow as tf
def softmax_cross_entropy(targets, logits):
"""
Implements a simple softmax cross entropy.
$$-\sum_i t_{ni} \cdot (l_{ni} - \ln \sum_j \exp ... | [
{
"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 | logistic_lda/utils.py | sam-cts/logistic_lda |
import mlrose
from mlrose.algorithms.decorators import short_name
from mlrose.runners._runner_base import _RunnerBase
"""
Example usage:
experiment_name = 'example_experiment'
problem = TSPGenerator.generate(seed=SEED, number_of_cities=22)
ga = GARunner(problem=problem,
experiment_name=... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | mlrose/runners/ga_runner.py | tadmorgan/mlrose |
import logging
import time
from rcon.recorded_commands import RecordedRcon
from rcon.extended_commands import CommandFailedError
from rcon.user_config import AutoVoteKickConfig
from rcon.audit import online_mods, ingame_mods
from rcon.map_recorder import MapsRecorder
logger = logging.getLogger(__name__)
def toggle_v... | [
{
"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 | rcon/routines.py | charlesLoiseau/hll_rcon_tool |
"""
Author: CAI JINGYONG @ BeatCraft, Inc & Tokyo University of Agriculture and Technology
placeholder
input: numpy array
output: numpy array
"""
import numpy
class LogQuant:
def __init__(self,layer,bitwidth):
self.layer_data = layer
self.width = bitwidth
self.maxima = numpy.amax(layer)
... | [
{
"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 | utils/logquant_v1.py | listato/Logarithmic-Quantization-of-Parameters-in-Neural-Networks |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
from app.models import User
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
passw... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | TUTORIAIS-FLASK/AULA_1/Chapter_5/app/forms.py | rodrigo-schmidt-lucchesi-85/FLASK |
import threading
import warnings
from functools import wraps, update_wrapper
from pyramid.response import Response
class cache_forever:
def __init__(self, wrapped):
self.wrapped = wrapped
self.saved = None
update_wrapper(self, wrapped)
def __call__(self, request, *args, **kwargs):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | kinto/core/decorators.py | taus-semmle/kinto |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | [
{
"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 | Latest/venv/Lib/site-packages/pyface/resource/resource_factory.py | adamcvj/SatelliteTracker |
def _encode_int(value: int) -> bytes:
return value.to_bytes(length=4, byteorder="little")
def _decode_int(data: bytes) -> int:
return int.from_bytes(data, byteorder="little", signed=True)
class Message:
def __init__(self, *, packet_id: int, message_type: int, body: str) -> None:
self.message_typ... | [
{
"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 | rcon/message.py | kaylynn234/rcon |
gestures = ["wink", "double blink", "close your eyes", "jump"]
def handshake(s):
s = list(sanitize(s))
s.reverse()
seq = []
lim = len(s) if len(s) <= len(gestures) else len(gestures)
for i1 in range(lim):
if s[i1] == "1":
seq.append(gestures[i1])
if len(s) == 5:
seq... | [
{
"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 | cryptography/secret_handshake/__init__.py | BrianLusina/PyCharm |
class Human:
def __init__(self,myname,myage):
self.myname = myname
self.myage = myage
def mydisplay(self):
print("The name is: ", self.myname)
print("The age is: ", self.myage)
class Mystudent(Human):
def __init__(self,myname,myage, mycity, myhobby):
... | [
{
"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 | Chapter 08/Chap08_Example8.71.py | bpbpublications/Programming-Techniques-using-Python |
# -*- coding: utf-8 -*-
from clint.textui import puts, indent
from clint.textui import colored
from HTMLParser import HTMLParser
class Bunch(dict):
def __init__(self, **kw):
dict.__init__(self, kw)
self.__dict__ = self
def __getstate__(self):
return self
def __setstate__(self, 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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | will/utils.py | Mhysa/will-master-2 |
import itertools as it
from .dump import get_offset_to_term_id_dict
def term_id_to_tokens(nafobj, term_id):
term = nafobj.get_term(term_id)
if term is None:
raise ValueError("No term with that ID: {!r}".format(term_id))
return [
(ID, nafobj.get_token(ID).get_text())
for ID in term.... | [
{
"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 | multisieve_coreference/util.py | mpvharmelen/coref_draft |
# encoding: utf-8
import pytest
from osf_tests.factories import (
RegistrationFactory,
RegistrationProviderFactory
)
from osf.models import (
RegistrationSchema,
)
from osf.management.commands.move_egap_regs_to_provider import (
main as move_egap_regs
)
from django.conf import settings
@pytest.mar... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | osf_tests/management_commands/test_move_egap_regs_to_provider.py | tsukaeru/RDM-osf.io |
import unittest
from trulioo_sdk.model.address import Address
from trulioo_sdk.exceptions import ApiAttributeError, ApiTypeError
from trulioo_sdk.configuration import Configuration
class TestAddress(unittest.TestCase):
def test_address(self):
address = Address(
unit_number="123",
... | [
{
"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 | test/model/test_address.py | Trulioo/sdk-python |
import numpy as np # import numpy
with open("data/day4.txt") as f:
drawing_numbers = f.readline()
board_lst = []
board_line = []
counter = 0
for line in f:
if line != '\n':
board_line.append(line.strip())
if len(board_line) == 5:
board_lst.append(board_li... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | 2021/day4_part1.py | rogall-e/advent_of_code |
# Copyright 2014 James Strassburg
#
# 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 agree... | [
{
"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 | SolrRepository.py | jstrassburg/evolving-search-relevancy |
# Copyright (c) 2021 Oleg Polakow. All rights reserved.
# This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details)
"""Utilities for requests."""
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from urllib.parse imp... | [
{
"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 | vectorbt/utils/requests.py | alexis-rodriguez/vectorbt |
from models import OfficeModel
from flask_sqlalchemy import sqlalchemy
from config import db
import uuid
class OfficeActions():
# Table actions:
@classmethod
def create(cls, usa_state: str, office_code: str):
new_office = OfficeModel(usa_state=usa_state, office_code=office_code)
db.session.add(... | [
{
"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 | OfficeActions.py | rkaufman13/us-congress-pizza-flag-tracker |
from datetime import datetime, timezone
class ScanResult:
def __init__(self, target_data, config):
self.result = {
"ip": target_data['target'],
"scan_reason": target_data["scan_reason"],
"tags": target_data["tags"],
"scan_id": target_data["scan_id"],
"agent_version": config.NATLAS_VERSION,
"agen... | [
{
"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 | natlas-agent/natlas/scanresult.py | m4rcu5/natlas |
from rest_framework.permissions import BasePermission
class IsDeviceOwnerOnly(BasePermission):
def has_permission(self, request, view):
return request.user.is_superuser
def has_object_permission(self, request, view, obj):
return request.user.is_superuser
| [
{
"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 | kolibri/tasks/permissions.py | rtibbles/kolibri |
from opsvalidator.base import BaseValidator
from opsvalidator import error
from opsvalidator.error import ValidationError
from opsrest.utils.utils import get_column_data_from_row
class VlanValidator(BaseValidator):
resource = "vlan"
def validate_deletion(self, validation_args):
vlan_row = validation_... | [
{
"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 | opsplugins/vlan.py | OpenSwitchNOS/openswitch-ops-vland |
from kube_hunter.conf import Config, set_config
set_config(Config())
from kube_hunter.modules.discovery.kubernetes_client import list_all_k8s_cluster_nodes
from unittest.mock import MagicMock, patch
def test_client_yields_ips():
client = MagicMock()
response = MagicMock()
client.list_node.return_value ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/discovery/test_k8s.py | snsnlou/kube-hunter |
from drawy import *
class Button:
def __init__(self, text, click_handler, point, width, height, *, hide=False, do_highlight=True, background_color='gray', highlight_color='lightgray', text_color='black', border_color='black'):
self.text = text
self.click_handler = click_handler
self.p... | [
{
"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 | examples/button.py | NextLight/drawy |
import json
from .connection import db, manager
from peewee import *
class Video(Model):
channelid = CharField()
link = CharField()
class Meta:
db_table = "videos"
database = db
primary_key = False
async def save(channelid, link):
links = list(await manager.execute(... | [
{
"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 | bot/database/video.py | TupaBan-Dev/jdan734-bot |
import nltk.stem.wordnet as wordnet
import nltk
import os
import re
# set the nltk data path to local dir
nltk.data.path.append(os.path.dirname(os.path.abspath(__file__)) + os.sep + "nltk_data")
class Tokenizer(object):
"""Used to extract tokens (words) from documents"""
@staticmethod
def get_word_tokens(text)... | [
{
"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 | langprocess.py | xdrop/lsa-document-clustering |
from __future__ import absolute_import, division, print_function
import k8spackage
from k8spackage.commands.command_base import CommandBase
class VersionCmd(CommandBase):
name = 'version'
help_message = "show version"
def __init__(self, options):
super(VersionCmd, self).__init__(options)
... | [
{
"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 | k8spackage/commands/version.py | ant31/k8spackage-crd |
#
# GridCoordinates.py
#
# @author Alain Rinder
# @date 2017.06.02
# @version 0.1
#
from lib.graphics import *
from src.interface.IDrawable import *
from src.interface.Color import *
class Square(IDrawable):
def __init__(self, board, coord):
self.board = board
self.coo... | [
{
"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 | src/interface/Square.py | jniestroy/quoridor_bot |
"""
Text Parsers to find url from content.
Every url item should contain:
- url
- location(`filepath:row:column`)
"""
from abc import abstractmethod
from typing import List
class Link:
def __init__(self, url: str, path: str, row: int, column: int):
"""init link object
:param str url: link's hre... | [
{
"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 | checklink/parse/__init__.py | zombie110year/find_dead_link |
from flask import render_template,redirect,url_for,flash,request
from . import auth
from flask_login import login_user,logout_user,login_required
from ..models import User
from .forms import LoginForm,RegistrationForm
from .. import db
from ..email import mail_message
@auth.route('/login',methods=['GET','POST'])
def... | [
{
"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 | app/auth/views.py | Bchizi/Pitch-app |
from typing import Protocol
from tvsched.application.interfaces import ILogger
from tvsched.application.models.episode import EpisodeUpdate
class IUpdateEpisodeUseCaseRepo(Protocol):
""""""
async def update(self, episode: EpisodeUpdate) -> None:
"""Updates episode in repo.
Args:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | tvsched/application/use_cases/episode/update_episode_use_case.py | astsu-dev/tv-schedule |
def _get_duration(cls):
if hasattr(cls, 'estimate'):
return cls.estimate
else:
return 0
class Task:
def __init__(task, cls):
task.cls = cls
task.name = cls.__qualname__
task.duration = _get_duration(cls)
task.children = set() # set of task.name
task... | [
{
"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 | modules/qplan/task.py | fifoforlifo/pyqplan |
##
# Copyright 2021 IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
##
from lnn import Model, Proposition, Not, TRUE, FALSE, UNKNOWN
def test_upward():
GTs = [TRUE, FALSE, UNKNOWN]
inputs = [FALSE, TRUE, UNKNOWN]
for i in range(3):
model = Model()
model["not"] = Not... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/reasoning/logic/propositional/test_not_1.py | mikulatomas/LNN |
"""
Copyright (c) 2018 Intel Corporation
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 wri... | [
{
"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 | model-optimizer/extensions/middle/UselessMerge.py | undeadinu/dldt |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
""" Wrapper for ngram_repeat_block cuda extension """
from torch import nn
from torch.autograd import Function
import ngram_repeat_block_cuda
class NGramRepeatBlockFunction(Function):
"""
forward inputs to ngram_repeat_block cuda extensi... | [
{
"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 | fastseq/ops/ngram_repeat_block.py | nttcs-ds/fastseq |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.