source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# In-Process
# Imports
import discord
import random
from discord.ext import commands
#Config
from config import *
class VoteMsg(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.vote_tracking_bot_id = 702134514637340702
self.vote_scraping_channel_id = VOTE_SCRAPING_CHANNEL
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | commands/vote_msg.py | Nirlep5252/Denzven-Graphing-Api-Bot |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | aliyun-python-sdk-waf-openapi/aliyunsdkwaf_openapi/request/v20180117/DescribeDomainConfigRequest.py | silent-beaters/aliyun-openapi-python-sdk |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: flatbuf
import flatbuffers
class Interval(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsInterval(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Interval... | [
{
"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 | thirdparty/org/apache/arrow/flatbuf/Interval.py | mrocklin/pygdf |
import tkinter as tk
import tkinter.font as Font
from .content import EditorContent
from ...breadcrumbs import BreadCrumbs
class Editor(tk.Frame):
def __init__(self, master, path=None, exists=True, *args, **kwargs):
super().__init__(master, *args, **kwargs)
self.base = master.base
self.ma... | [
{
"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/lib/components/editor_types/editor/__init__.py | billyeatcookies/Biscuit |
import re
from dateparser.search import search_dates
from dateparser import parse
MIN_DATE_STRING = 6
DIGITS_MODIFIER_PATTERN = r'\d{1,2}st|\d{1,2}nd|\d{1,2}rd|\d{1,2}th'
DIGITS_PATTERN = r'\d{1,4}'
MONTHS_PATTERN = 'january|february|march|april|may|june|july|august|september|october|november|december|' \
... | [
{
"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 | cpdb/search/date_util.py | invinst/CPDBv2_backend |
#!/usr/bin/env python2.7
from __future__ import print_function
import os
from pddlstream.algorithms.search import solve_from_pddl
from pddlstream.algorithms.focused import solve_focused
from pddlstream.algorithms.incremental import solve_incremental
from pddlstream.utils import print_solution, read
def read_pddl(... | [
{
"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 | examples/blocksworld/run.py | suddhu/pddlstream |
class JacobianError(ArithmeticError):
def __init__(self,value=None):
self.value = value
def __str__(self):
if self.value is None:
self.value = 'Jacobian of mapping is close to zero'
return repr(self.value)
class IllConditionedError(ArithmeticError):
def __init__(self,... | [
{
"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 | Florence/Base/FlorenceExceptions.py | jdlaubrie/florence |
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class DescribeRecordRequest(Request):
def __init__(self):
super(DescribeRecordRequest, self).__init__(
'live', 'qcloudcliV1', 'DescribeRecord', 'live.api.qcloud.com')
def get_channelId(self):
return self.get_params... | [
{
"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 | qcloudsdklive/DescribeRecordRequest.py | f3n9/qcloudcli |
"""
"""
class IterationStatistics:
def __init__(self):
self._cells_counter = {}
@property
def cells_counter(self):
return self._cells_counter
def update(self, cell_id):
"""
Updates cell counter.
:param cell_id: CellId enum (id).
:return: None.
"... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | generix/core/data/statistics.py | K9173A/Generix |
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from models import Base, MyParentModel, MyChildModel
import pytest
@pytest.fixture(scope='session')
def engine():
return create_engine('sqlite://')
@pytest.fixture(scope='session')
def tables(engine):
Base.metadata.create_all(engine)
... | [
{
"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 | tests/conftest.py | ocurero/sqlalchemy-querybuilder |
# test_349.py
import unittest
from intersection_349 import intersect
class intersectTest(unittest.TestCase):
def test_intersect_1(self):
self.assertEqual(intersect([1,2,2,1], [2,2]), [2])
# @unittest.skip("demonstrating skipping")
def test_intersect_2(self):
res = intersect([4,4,9,5],... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | ltcd/test_349.py | ValentynaGorbachenko/cd2 |
import subprocess
from typer.testing import CliRunner
from docs_src.commands.name import tutorial001 as mod
app = mod.app
runner = CliRunner()
def test_help():
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0
assert "Commands:" in result.output
assert "create" in result.output
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/test_tutorial/test_commands/test_name/test_tutorial001.py | madkinsz/typer |
import pygame
class MenuGame:
def __init__(self):
self.menu_font = pygame.font.Font("game/fonts/menu_font.ttf", 24)
self.name_font = pygame.font.Font("game/fonts/name_font.ttf", 30)
self.cre_by = pygame.font.Font("game/fonts/menu_font.ttf", 14)
self.score_font = pygame.font.Font("g... | [
{
"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 | game/models/menu.py | jonpas/EMGProc |
import sublime
import sublime_plugin
import os
from hyperhelpcore.common import log
from hyperhelpcore.core import help_index_list
###----------------------------------------------------------------------------
class HyperhelpAuthorReloadIndexCommand(sublime_plugin.TextCommand):
"""
If the current view is... | [
{
"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 | src/commands/reload_index.py | OdatNurd/HyperHelpAuthor |
# modified from https://github.com/tkipf/gae/blob/master/gae/layers.py
import torch
import torch.nn as nn
class InnerProductDecoder(nn.Module):
"""Decoder model layer for link prediction."""
def __init__(self, input_dim, act=nn.functional.sigmoid):
super(InnerProductDecoder, self).__init__()
s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | openchem/layers/ipd.py | YNYuan/OpenChem |
"""Added description requirement config
Revision ID: e4b5bd2a05cc
Revises: 56a1480bb7cc
Create Date: 2020-02-04 03:04:27.899172
"""
# revision identifiers, used by Alembic.
revision = "e4b5bd2a05cc"
down_revision = "56a1480bb7cc"
from alembic import op
from sqlalchemy import orm
from oh_queue.models import *
def ... | [
{
"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 | oh/migrations/prev_versions/e4b5bd2a05cc_added_description_requirement_config.py | akshitdewan/cs61a-apps |
"""hellodjango URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | hellodjango/urls.py | Alonski/HelloDjango |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : test_gnn.py
@Author : yyhaker
@Contact : 572176750@qq.com
@Time : 2020/04/22 15:19:24
'''
# here put the import lib
import torch
from torch_geometric.data import Data
import torch.nn.functional as F
from torch_geometric.nn import GCNConv
edge... | [
{
"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 | EKMRC/src/test_gnn.py | yyHaker/EKMRC-is-your-need |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v2.model_utils import (
ApiTypeError,
ModelSimple,
... | [
{
"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 | code/venv/lib/python3.8/site-packages/datadog_api_client/v2/model/security_monitoring_rule_type_create.py | Valisback/hiring-engineers |
"""Password generator allows you to generate a random password of length N."""
from random import choice
from string import ascii_letters, digits, punctuation
def password_generator(length=8):
"""
>>> len(password_generator())
8
>>> len(password_generator(length=16))
16
>>> len(password_genera... | [
{
"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 | other/password_generator.py | Pratiyush27/Python |
import cv2
class Visualizer_Global():
def __init__(self):
pass
def showImg(self, img, name='asdf'):
cv2.imshow(name, img)
cv2.waitKey(10000)
def drawBBoxCenter(self, img, offset, relX, relY):
x = offset[:, 0, None] + relX
y = offset[:, 1, None] + relY
N = o... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | DataLoader/DataVis.py | ElliotHYLee/MyYOLO |
import os
import sys
import time
from django.conf import settings
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
# could use Chrome, Firefox, etc... here
BROWSER = os.environ.get('TEST_BROWSER', 'PhantomJS')
class BrowserTest(StaticLiveServerTestCase):
de... | [
{
"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 | src/tests/base/__init__.py | abrock/pretix |
#!/usr/bin/env python3
# programming-with-guis
# Ex. 3.12 Quiz - Question 4
from guizero import App, Text
def game_over():
timer.value = "Game Over"
def timer_tick():
timer.time_left = timer.time_left - 1
if timer.time_left <=0:
game_over()
else:
timer.value = timer.time_left /10
ap... | [
{
"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 | programming-with-guis/ex-03-12_quiz-q4.py | psiborg/FutureLearn |
'''
Most of the driver API is unsupported in the simulator, but some stubs are
provided to allow tests to import correctly.
'''
def device_memset(dst, val, size, stream=0):
dst.view('u1')[:size].fill(bytes([val])[0])
def host_to_device(dst, src, size, stream=0):
dst.view('u1')[:size] = src.view('u1')[:size]... | [
{
"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 | numba/cuda/simulator/cudadrv/driver.py | seberg/numba |
import pyttsx3
import speech_recognition as sr
import openai as op
import os
op.api_key = os.getenv("OPENAI_API_KEY")
engine = pyttsx3.init()
engine.setProperty('rate', 150)
engine.setProperty('volume', 1.0)
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def tell(text):
engine.s... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | main.py | mathew4STAR/GPT-3_based_AI |
#!/usr/bin/env python
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
{
"point_num": 1,
"id": "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 | tables/automl/batch_predict_test.py | plamut/python-docs-samples |
import pytest
from dvc.tree import get_cloud_tree
from dvc.tree.gs import GSTree
from dvc.tree.s3 import S3Tree
def test_remote_with_hash_jobs(dvc):
dvc.config["remote"]["with_hash_jobs"] = {
"url": "s3://bucket/name",
"hash_jobs": 100,
}
dvc.config["core"]["hash_jobs"] = 200
tree = ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | tests/unit/remote/test_remote.py | arthurcgusmao/dvc |
class Solution:
def findTilt(self, root: TreeNode) -> int:
total_tilt = 0
def valueSum(node):
nonlocal total_tilt
if not node:
return 0
left_sum = valueSum(node.left)
right_sum = valueSum(node.right)
tilt = abs(left_sum -... | [
{
"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 | 2020 Leetcode Challenges/11 November Leetcode Challenge 2020/08 binaryTreeTilt.py | FazeelUsmani/Leetcode |
import requests
class Client:
DEFAULT_API_URL = "https://api.mailgun.net/v3"
def __init__(self, mailgun):
self.mailgun = mailgun
def prepare_request(self, url: str, method="get", data=None, headers=None, params=None, **kwargs):
real_url = "%s/%s/%s" % (self.get_api_url(), self.mailgun.pr... | [
{
"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 | django_rebel/api/client.py | socivy/django-rebel |
import torch
import torchvision.transforms as transforms
import numpy as np
import cv2
import logging
from .model import Net
class Extractor(object):
def __init__(self, model_path, use_cuda=True):
self.net = Net(reid=True)
self.device = "cuda" if torch.cuda.is_available() and use_cuda else "cpu"
... | [
{
"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 | libraries/deep_sort/deep_sort/deep/feature_extractor.py | ruidongjr/Aldi |
# This script does 1 thing:
#
# 1. tensorflow/lite/micro/compatibility.h:
# There seems to be a build error with in TF_LITE_REMOVE_VIRTUAL_DELETE
# Update the macro to ensure the "delete" operator is public
def should_patch_file(path: str) -> object:
if path.endswith('kiss_fftr.c'):
return dict(s... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | cpp/shared/kissfft/patch_kissfft.py | SiliconLabs/mltk |
from .models import Product, PackagingInfo
from django import forms
from .presets import CATEGORIES, MATERIAL_AS_CHOICES, UNITS
class ProductForm(forms.ModelForm):
category = forms.TypedChoiceField(choices=CATEGORIES)
quantity_unit = forms.TypedChoiceField(choices=UNITS)
class Meta:
model = Prod... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | GreenData/productapp/forms.py | SuperPlotTwist/GreenDataProject |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.kqueuereactor}.
"""
import errno
from zope.interface import implementer
from twisted.trial.unittest import TestCase
try:
from twisted.internet.kqreactor import KQueueReactor, _IKQueue
kqueueSkip = None... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | SCRAPE/Lib/site-packages/twisted/internet/test/test_kqueuereactor.py | Chinmoy-Prasad-Dutta/scrapy_scraper |
from glob import glob
import pydicom
from pydicom import dcmread
import os
import numpy as np
import nibabel as nib
def dicom_to_nifti(folder):
dicoms = None
return
def read_a_dicom(dicom_file):
ds = dcmread(dicom_file)
def get_array(dcm_file):
ds = dcmread(dcm_file)
location = float(ds[0x0020... | [
{
"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 | lookupcsv/derived_tables/FHS/get_T1_MRI.py | vkola-lab/multi-task |
# -*- coding: utf-8 -*-
import aiounittest
from datetime import datetime
from .fixtures_aio import fixture_data, Worker, Workers, Account
from graphenecommon import exceptions
class Testcases(aiounittest.AsyncTestCase):
def setUp(self):
fixture_data()
async def test_worker(self):
w = await Wo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | tests/test_worker_aio.py | chainsquad/python-graphenelib |
"""
"""
# python
import os
from datetime import datetime
# 3rd party
import pytz # pip install pytz
class timezone_Exception(Exception):
def __init__(self, message=""):
self.message = message
class TimezoneNotFoundError(timezone_Exception):
pass
def get_current_timezone(l... | [
{
"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 | core_dev/timezone/timezone.py | alexzanderr/_core-dev |
from datetime import datetime
CDN_BASE_URL = "https://pod-cdn.timbrook.tech"
def populate_episode(doc, data):
item = doc.new_tag("item")
bare_tags = {
"title": data["name"],
"itunes:duration": data["duration"],
"description": data["description"],
"itunes:subtitle": data["descr... | [
{
"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 | src/podcast.py | timbrook-life/podcast |
import os
from unittest import TestCase, mock
from emailnetwork.extract import MBoxReader
# from emailnetwork.graph import plot_single_email
import emailnetwork.graph as graph
MBOX_PATH = f'{os.path.dirname(__file__)}/test.mbox'
@mock.patch(f"{__name__}.graph.plt")
def test_plot_single_directed(mock_plt):
reader... | [
{
"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 | emailnetwork/tests/test_graph.py | utomoreza/emailnetwork |
#!/usr/bin/python
import EupathExporter
import re
class Genome:
def __init__(self, reference_genome):
"""
Teases out from the user's parameter, the reference genome information used in the construction of dependency
data. The reference genome parameter should be of the form: ProjectId-E... | [
{
"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 | tools/eupath/Tools/lib/python/eupath/ReferenceGenome.py | globusgenomics/galaxy |
from app.db.utils import get_user_id, get_database_id_for_user
def test_get_user_id():
username = "johndoe@example.com"
user_id = get_user_id(username)
assert user_id == "org.couchdb.user:johndoe@example.com"
def test_get_database_id_for_user():
username = "johndoe@example.com"
database_id = get... | [
{
"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 | {{cookiecutter.project_slug}}/backend/app/app/tests/crud/test_get_ids.py | Web-Dev-Collaborative/full-stack-flask-couchdb |
from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email')
class RegisterSerializer(serializers.ModelSerializer):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | leadmanager/accounts/serializers.py | Nerrdii/lead-manager |
from datetime import datetime
from django.contrib.auth.models import User
from django.db.models import Count
from careers.forms import JobPostForm
from careers.models import JobPost
from mezzanine import template
register = template.Library()
@register.as_tag
def jobpost_months(*args):
"""
Put a list of 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | careers/templatetags/career_tags.py | sebasmagri/mezzanine-careers |
#! python
# Removes letter from word to make characters go alphabetically.
# It doesn't work all the time, but is efficient.
import unittest
class TestRemoveLettersAlphabet(unittest.TestCase):
def test_object1(self):
self.assertEqual(letters_to_remove('mateusz'), 3)
def test_object2(self):
s... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | make_string_alphabetic.py | Maffey/FunPythonScripts |
def sum_num(x,y):
sum = x+y
return sum
def div_num(x,y):
div = x/y
return div
| [
{
"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 | call_def_to_main.py | MotiMatika/lemida_atsmit |
import asyncio
from asyncio import Task
from typing import Any, Callable
import appdaemon.plugins.hass.hassapi as hass
import appdaemon.plugins.mqtt.mqttapi as mqtt
import pytest
from cx_core import Controller
from pytest import MonkeyPatch
from tests.test_utils import fake_fn
async def fake_run_in(
self: Contr... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | tests/conftest.py | xaviml/z2m_ikea_controller |
import unittest
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
BASE_URL = 'http://localhost:8001'
USERNAME = 'YOUR_USERNAME'
PASSWORD = 'YOUR_PASSWORD'
cl... | [
{
"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 | launchcontainer/browser_tests.py | appsembler/xblock-launchcontainer |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from typing import List, Optional, Dict
from vizseq.scorers._ter import sentence_ter
from vizseq.scorers imp... | [
{
"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 | github/joeynmt/vizseq/scorers/ter.py | shania3322/joeynmt |
# Uses python3
import sys
# def fibonacci_sum_naive(n):
# if n <= 1:
# return n
#
# previous = 0
# current = 1
# sum = 1
#
# for _ in range(n - 1):
# previous, current = current, (previous + current)%10
# sum += current
#
# return sum % 10
memo = {}
def calc_fib(n):
... | [
{
"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 | week2_algorithmic_warmup/6_last_digit_of_the_sum_of_fibonacci_numbers/fibonacci_sum_last_digit.py | ahmedmeshref/Data-Structures-and-Algorithms-assignments |
from __future__ import absolute_import
try:
from io import BytesIO
except ImportError:
from StringIO import StringIO as BytesIO
import qrcode
from reportlab.platypus.flowables import Image
from ..styles import styles
def qrcode_image(data):
# create QRCode object
code = qrcode.QRCode(
b... | [
{
"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 | dinbrief/contrib/qrcode.py | bikeshedder/dinbrief |
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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/licens... | [
{
"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 | venv/Lib/site-packages/keystoneauth1/tests/unit/extras/kerberos/base.py | prasoon-uta/IBM-coud-storage |
import logging
log = logging.getLogger("MPP-Solar")
class baseoutput:
def __str__(self):
return "baseoutput - the base class for the output processors, not used directly"
def get_kwargs(self, kwargs, key, default=None):
if not key in kwargs or not kwargs[key]:
return default
... | [
{
"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 | mppsolar/outputs/baseoutput.py | 20after4/mpp-solar |
# This file will consist of some wrapper for using MySQL
# It is mainly used for preparing and calling mysql cli
import logging
from mysql_autoxtrabackup.general_conf import path_config
from mysql_autoxtrabackup.general_conf.generalops import GeneralClass
from mysql_autoxtrabackup.process_runner.process_runner import ... | [
{
"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 | mysql_autoxtrabackup/utils/mysql_cli.py | icy1900/MySQL-AutoXtraBackup |
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
BZip = list(zip(*board))
def Checkline(li):
temp = [i for i in li if i!="."]
return len(set(temp))==len(temp)
def check_row(board):
for i in b... | [
{
"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 | valid-sudoku/valid-sudoku.py | Atri10/Leet-code---Atri_Patel |
import unittest
import numpy as np
from megnet.utils.general import expand_1st, to_list, fast_label_binarize
class TestGeneralUtils(unittest.TestCase):
def test_expand_dim(self):
x = np.array([1, 2, 3])
self.assertListEqual(list(expand_1st(x).shape), [1, 3])
def test_to_list(self):
x... | [
{
"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 | megnet/utils/tests/test_general.py | Lalf-Klein/megnet |
import torch.nn as nn
from NeuralBlocks.blocks.convnorm import ConvNorm
class ConvNormPool(nn.Module):
"""
A simply block consisting of a convolution layer,
a normalization layer and a pooling
layer. For example, this is the first block in the
ResNet architecture.
"""
def __init__(self, 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | blocks/convnormpool.py | AntixK/Neural-Blocks |
from .braille_cell import BrailleCell
from .braille_string import BrailleString
class BrailleTranslator(object):
_simple_cells = None
def __init__(self, text):
self.__raw_text = text
if BrailleTranslator._simple_cells is None:
self.__setup_class_simple_cells()
@property
d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | src/braille/braille_translator.py | stuart-stanley/dotspicejar |
import unittest
from src.Presenter.main_presenter import MainPresenter
import os
class SamplePackageTestCase(unittest.TestCase):
def setUp(self):
os.chdir('../')
self.main_presenter = MainPresenter()
self.package_presenter = self.main_presenter.load_package(
'sample_package')... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/sample_package.py | lancondrej/freeconf |
'''
Created on 04-05-2011
@author: Piotr Jessa
'''
class ImageDescriptionWriter(object):
'''
Writes the ImageDescription class to the file stream
'''
def __init__(self):
'''
Constructor
'''
pass
def writeline(self, text):
'''
w... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | alfirt.common/src/image/ImageDescriptionWriter.py | Dzess/ALFIRT |
# Copyright 2017-2021 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
{
"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 | guild/plugins/skopt_forest_main.py | timt51/guildai |
# -*- coding: utf8 -*-
from console.factory import db
from console.models.base import BaseObject, BaseRepository
class TaskInter(BaseObject, db.Model):
__tablename__ = 'task_inter'
id = db.Column(db.VARCHAR(64), primary_key=True, autoincrement=False)
gmt_create = db.Column(db.DateTime)
gmt_modified ... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | efls-console/console/models/task_inter.py | universe-hcy/Elastic-Federated-Learning-Solution |
import numpy as np
def preproccess_plot(func):
"""
creates coordinate in the plot for nodes.
"""
def wrapper(graph, ax, n, weighted, shrinkA, shrinkB, layout, polygon_radius, attr, *args, **kwargs):
space = np.linspace(0,1,n+1)
wrapper.scale = 100 // (n+1)
size = wrapper.sca... | [
{
"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 | graphnet/_vis/decorators.py | Fredpwol/pygnet |
import numpy as np
from itertools import product
class Punto:
def __init__(self, x, y):
self.x = x
self.y = y
def __eq__(self, punto):
return self.x == punto.x and self.y == punto.y
def hay_camino(mapa, salto, inicio=Punto(0, 0)):
if inicio.x == mapa.shape[0] - 1 and inicio.y ==... | [
{
"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 | codes/2017-11-20-ardilla.py | israelem/aceptaelreto.github.io |
import pytest
from tickit.devices.eiger.eiger_status import EigerStatus
# # # # # EigerStatus Tests # # # # #
@pytest.fixture
def eiger_status() -> EigerStatus:
return EigerStatus()
def test_eiger_status_constructor():
EigerStatus()
def test_eiger_status_getitem(eiger_status):
assert 24.5 == eiger_s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/devices/eiger/test_eiger_status.py | dls-controls/tickit |
import unittest
from flask import Flask
from flask.ext import mailerrors
from mock import patch
class MailErrorsTests(unittest.TestCase):
def setUp(self):
app = Flask(__name__)
@app.route('/error')
def explicit_logger_error():
app.logger.error('Error Message')
r... | [
{
"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 | tests.py | sergray/Flask-MailErrors |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import tensorflow as tf
import numpy as np
from dace.frontend.tensorflow import TFSession
import matplotlib.pyplot as plt
import sys
def data_input_fn(filenames, batch_size=2, shuffle=False):
def _parser(record):
features = {
... | [
{
"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 | samples/tensorflow/dataset_reader.py | Walon1998/dace |
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
"""
[1,3,1]
[1,5,1]
[4,2,1]
time O (nm)
space O(nm)
state -> sums[r][c] = min path sum till r, c position
initial state -> sums[0][0…cols] = inf
-> sums... | [
{
"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 | 64-minimum-path-sum/64-minimum-path-sum.py | jurayev/data-structures-algorithms-solutions |
import unittest
from unittest.mock import mock_open, patch
from conjur.data_object.conjurrc_data import ConjurrcData
from conjur.errors import InvalidConfigurationException
EXPECTED_REP_OBJECT={'conjur_url': 'https://someurl', 'conjur_account': 'someaccount', 'cert_file': "/some/cert/path"}
EXPECTED_CONJURRC = \
"""
... | [
{
"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 | test/test_unit_conjurrc_data.py | mbjahnoon/conjur-api-python3 |
# -*- coding: utf-8 -*-
import pytest
from snl_d3d_cec_verify.result.base import _TimeStepResolver
@pytest.mark.parametrize("index, expected", [
(-3, 0),
(-2, 1),
(-1, 2),
( 0, 0),
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tests/test_result_base.py | Data-Only-Greater/SNL-Delft3D-CEC-Verify |
from typing import Dict
class Average:
"""Implements a simple running average counter."""
def __init__(self):
self.total = 0
self.n_steps = 0
def update(self, value: float) -> None:
self.total += value
self.n_steps += 1
def compute(self) -> float:
return 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 | squeezer/reduce.py | esceptico/squeezer |
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.views import LoginView
from stories.models import Stage, StageForm
class SigninView(LoginView):
redirect_authenticated_user = True
def index(request):
return HttpResponse('This ia accounts ind... | [
{
"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/accounts/views.py | scifanchain/scifan-web |
###############################################################################
#
# Tests for libxlsxwriter.
#
# Copyright 2014-2019, John McNamara, jmcnamara@cpan.org
#
import base_test_class
class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
"""
Test file created with libxlsxwriter against a file cre... | [
{
"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 | libxlsxwriter/test/functional/test_chart_up_down_bars.py | White-116/xlsxd |
import psutil
import logging
from pathlib import Path
from typing import Union
logger = logging.getLogger(__name__)
class PIDFile:
def __init__(self, path: Union[str, Path]):
self.path = Path(path)
self._pid = None
@property
def pid(self):
return self._pid or self.load_pid()
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | src/meltano/core/utils/pidfile.py | code-watch/meltano |
'''
Created on Nov 13, 2015
@author: Vlad
'''
class GenericRepository:
'''
GenericRepository, which is a base class for all other repositories
'''
def __init__(self):
self._storage = []
def add(self, obj):
'''
Function to handle the add for every repository
:param obj:
:return:
'''
if obj in ... | [
{
"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 | ubb/fop/RentReturn/Repositories/Repository.py | AlexanderChristian/private_courses |
from datetime import timedelta
from .activity import Activity
from .activity_helper import ActivityHelper
class ActivityStat:
"""Store and update the amount of time spent in a certain activity"""
def __init__(self, work_time: timedelta = timedelta(),
off_time: timedelta = timedelta()) -> No... | [
{
"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 | src/speaking_eye/activity_stat.py | alena-bartosh/speaking-eye |
# encoding=utf-8
import csv
import json
class DATAOutput:
''' data '''
def __init__(self):
print('开启数据保存器')
def save_to_csv(self, parser_result, csvpath):
''' 保存为 json 数据
para: parser_result'''
with open(csvpath, 'w', newline='', encoding='utf-8') as csvfile:
... | [
{
"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 | WeiboSpider/DATAOutput.py | Jonathan1214/myCollege |
from enum import Enum
from typing import List, Optional, Type, Union
import click
from ..types import NotSet
class CSVOption(click.Choice):
def __init__(self, choices: Type[Enum]):
self.enum = choices
super().__init__(tuple(choices.__members__))
def convert(
self, value: str, param:... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | src/schemathesis/cli/options.py | PrayagS/schemathesis |
from dataclasses import dataclass
from typing import Tuple
from command.command_bus import CommandBus
from command.command_handler import CommandHandler, Command, Status
from event.event_store import Event
@dataclass
class SimpleCommand(Command):
name: str
@dataclass
class SimpleCommandExecuted(Event):
def... | [
{
"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 | tests/command/test_command_bus.py | bbougon/crm-pilates |
def test_str(RI, str_data):
assert RI(str_data, 0.8) != str_data
assert type(RI(str_data, 0.8)) is str
assert len(RI(str_data, 0.8, repetition=3)) == 3
def test_list(RI, list_data):
assert RI(list_data, 0.8) != list_data
assert type(RI(list_data, 0.8)) is list
assert len(RI(list_data, 0.8, rep... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | tests/test_insertion.py | toriving/KoEDA |
"""
Progress bars, health bars, etc
"""
import arcade
from ..core.utils import Rect, Position
from .iabstract import _AbstractInterfaceObject
class Bar(_AbstractInterfaceObject):
"""
Drawable bar
"""
MIDDLE_OUT = 'mi'
RIGHT_TO_LEFT = 'rtl'
def __init__(self,
geometry: Rect... | [
{
"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 | _old/interface/bar.py | mccartnm/spaceman |
def get_measure_data(meas_path):
with open(meas_path, 'r') as fs:
# useless lines
fs.readline()
fs.readline()
value = []
while True:
ln = fs.readline()
if ln == '':
break
ln = ln.strip()
column_splitter(value... | [
{
"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 | ASICDesign/measure_helper.py | yyc12345/gist |
# (C) Copyright 2018-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | traits_futures/i_event_loop.py | enthought/traits-futures |
import os
import sys
import logging
from app.config import config
logging.basicConfig(format=config.LOGGER_FORMAT)
def get_level(level):
return {
'CRITICAL': logging.CRITICAL,
'DEBUG': logging.DEBUG,
'ERROR': logging.ERROR,
'FATAL': logging.FATAL,
'INFO': logging.INFO,
... | [
{
"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 | app/logger.py | japinol7/music-lib-explorer |
# Copyright (c) 2020 The ZMK Contributors
#
# SPDX-License-Identifier: MIT
'''Test runner for ZMK.'''
import os
import subprocess
from textwrap import dedent # just for nicer code indentation
from west.commands import WestCommand
from west import log # use this for user output
class Tes... | [
{
"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 | app/scripts/west_commands/test.py | EmmaPrats/zmk |
import unittest
import io
import tempfile
import torch
import torch.utils.show_pickle
from torch.testing._internal.common_utils import IS_WINDOWS
class TestShowPickle(unittest.TestCase):
@unittest.skipIf(IS_WINDOWS, "Can't re-open temp file on Windows")
def test_scripted_model(self):
class MyCoolModu... | [
{
"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 | test/test_show_pickle.py | wenhaopeter/read_pytorch_code |
"""Tests to ensure that the html.parser tree builder generates good
trees."""
from pdb import set_trace
import pickle
from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest
from bs4.builder import HTMLParserTreeBuilder
from bs4.builder._htmlparser import BeautifulSoupHTMLParser
class HTMLParserTreeBuilderSmokeTes... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | kite/venv/lib/python3.7/site-packages/bs4/tests/test_htmlparser.py | pxuanqui/Edge-Assisted-Cart |
from pyenzyme.enzymeml.core.protein import Protein
from pyenzyme.enzymeml.core.ontology import SBOTerm
class TestProtein:
def test_content(self):
# Test consistency of inputs
protein = Protein(
name="SomeProtein", vessel_id="v0",
init_conc=10.0, unit="mmole / l", constant=... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/enzymeml/core/test_protein.py | haeussma/PyEnzyme |
from magma import *
from mantle import Mux
from .register import _RegisterName, Register, FFs
__all__ = ['DefinePISO', 'PISO']
@cache_definition
def DefinePISO(n, init=0, has_ce=False, has_reset=False):
"""
Generate Parallel-In, Serial-Out shift register.
SI : In(Bit), PI : Out(Bits(n)), LOAD : In(Bit), ... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": ... | 3 | mantle/common/piso.py | splhack/mantle |
"""Rectify function"""
import torch
from torch.autograd import Function
from encoding import cpu
if torch.cuda.device_count() > 0:
from encoding import gpu
__all__ = ['rectify']
class _rectify(Function):
@staticmethod
def forward(ctx, y, x, kernel_size, stride, padding, dilation, average):
ctx.s... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | encoding/functions/rectify.py | Womcos/SCARF |
"""pycodestyle support."""
from pycodestyle import BaseReport, StyleGuide, get_parser, _parse_multi_options
from pylama.lint import Linter as Abstract
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Linter(Abstract):
"""pycodestyle runner."""
@staticmethod
... | [
{
"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 | bin/pylama/lint/pylama_pycodestyle.py | ShadowLNC/linter-pylama |
from torch.utils.data import Dataset
import numpy as np
import torch
from . import functions
class TokensDataset(Dataset):
def __init__(self, X, Y):
self.X = self.encode_x(X)
self.y = Y
@staticmethod
def encode_x(x: list) -> list:
max_len = len(max(x, key=lambda i: len(i)))
... | [
{
"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 | models/NER/models/lstm/token_dataset.py | GroupLe/grouple-face-tagger |
import os; exists = os.path.exists
import sys
import csv
import time
args = sys.argv
def err(msg):
print("Error: " + str(msg))
sys.exit(1)
def parfor(my_function, my_inputs):
# evaluate function in parallel, and collect the results
import multiprocessing as mp
pool = mp.Pool(mp.cpu_co... | [
{
"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 | py/misc.py | ashlinrichardson/bcstats_ohcs_craigslist |
import re
SPLIT_RE = re.compile(r'[\.\[\]]+')
class JsonSchemaException(ValueError):
"""
Base exception of ``fastjsonschema`` library.
"""
class JsonSchemaValueException(JsonSchemaException):
"""
Exception raised by validation function. Available properties:
* ``message`` containing huma... | [
{
"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 | fastjsonschema/exceptions.py | giladbarneaallot/python-fastjsonschema |
#!/usr/bin/env python3
import argparse
import io
import sys
PY2 = sys.version_info[0] == 2
if PY2:
from itertools import izip_longest as zip_longest
else:
from itertools import zip_longest
def get_parser():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,... | [
{
"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 | utils/mix-mono-wav-scp.py | texpomru13/espnet |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except jin compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
{
"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 | python/paddle/fluid/dygraph/parallel.py | hjchen2/Paddle |
from rest_framework import permissions, generics
from rest_framework import validators
from rest_framework.response import Response
from .models import Friend
from .serializers import FriendRequestSerializer
# Create your views here.
class FriendRequestView(generics.ListCreateAPIView):
queryset = Friend.objects... | [
{
"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 | friends/views.py | Nijinsha/Inshare |
# -*- coding: utf-8 -*-
from asyncy.Exceptions import StoryscriptError
from asyncy.Sentry import Sentry
from raven import Client
def test_init(patch):
# noinspection PyTypeChecker
Sentry.init(None, None) # No-op.
patch.init(Client)
Sentry.init('sentry_dsn', 'release_ver')
Client.__init__.assert_... | [
{
"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 | tests/unit/Sentry.py | jayvdb/platform-engine |
import logging
import gym
from smarts.core.utils.episodes import episodes
from smarts.core.agent_interface import AgentInterface, AgentType
from smarts.core.agent import AgentSpec, Agent
from examples import default_argument_parser
logging.basicConfig(level=logging.INFO)
AGENT_ID = "Agent-007"
class KeepLaneAge... | [
{
"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 | examples/single_agent.py | amsks/SMARTS |
import numpy as np
# Mini Dataset
input_data = np.array([5, 7, 8, 1])
weights = {'node0': np.array([1, 1]),
'node1': np.array([-1, 1]),
'output': np.array([2, -1])}
# Activation Function
def ReLu(x):
out = max(0, x)
return out
def predict_with_NN(input_data_row, weights):
print("... | [
{
"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 | Week2/ManualNN.py | JoyeBright/nlp981 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | otcextensions/tests/functional/sdk/nat/v2/test_snat.py | spielkind/python-otcextensions |
import datetime
from pyramid import testing
from whoahqa.models import (
DBSession,
ReportingPeriodFactory,
ReportingPeriod,)
from whoahqa.tests.test_base import TestBase
class TestReportingPeriodFactory(TestBase):
def test_get_item_retrieves_by_id(self):
period = ReportingPeriod(
... | [
{
"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 | whoahqa/tests/models/test_reporting_period_factory.py | onaio/who-adolescent-hqa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.