source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import os
import subprocess
import typer
from typer.testing import CliRunner
from options.autocompletion import tutorial008 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_completion():
result = subprocess.run(
["coverage", "run", mod.__file__, " "],
stdout=sub... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/test_tutorial/test_options/test_completion/test_tutorial008.py | KBoehme/typer |
from __future__ import absolute_import, unicode_literals
import string
from jaraco.text import FoldedCase
class IRCFoldedCase(FoldedCase):
"""
A version of FoldedCase that honors the IRC specification for lowercased
strings (RFC 1459).
>>> IRCFoldedCase('Foo^').lower()
'foo~'
>>> IRCFolded... | [
{
"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 | irc/strings.py | EliotNapa/slack_irc_rt_gate |
import streamlit as st
from utils.constants import NAVIGATION, NAV_VIZ
from pages.data_visualization import sidebar_filter
def navbar():
st.subheader("Navigation")
st.radio("Go to...", options=NAVIGATION, key="page")
def show_sidebar():
sidebar = st.sidebar
with sidebar:
navbar()
if 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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | streamlit/components/sidebar.py | teresaromero/palmer-penguins |
#!/usr/bin/env python
# coding: utf-8
"""
Copyright (C) 2017 Jacksgong(jacksgong.com)
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... | [
{
"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 | okcat/trans.py | Ryfthink/okcat |
# Manticore Search Client
# Copyright (c) 2020-2021, Manticore Software LTD (https://manticoresearch.com)
#
# All rights reserved
import unittest
class ParametrizedTestCase(unittest.TestCase):
def __init__(self, methodName='runTest', settings=None):
super(ParametrizedTestCase, self).__init__(methodName)
... | [
{
"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 | test/python/parametrized_test_case.py | vsmid/openapi |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Creator reads Program Proposals
Create Date: 2019-07-25 11:55:57.361793
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from ggrc.migr... | [
{
"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": true... | 3 | src/ggrc/migrations/versions/20190725_f00343450894_creator_reads_program_proposals.py | MikalaiMikalalai/ggrc-core |
import logging
class CoreLogging(object):
"""simple logging testing and dev"""
def __init__(self):
self.name = ".simplydomain.log"
def start(self, level=logging.INFO):
logger = logging.getLogger("simplydomain")
logger.setLevel(level)
fh = logging.FileHandler(self.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 | simplydomain/src/core_logger.py | SimplySecurity/SimplyDomain-Old |
import json
import requests
from app.settings import TOKEN
TELEGRAM_URL_API = 'https://api.telegram.org/bot'
def __build_url(method):
url = '{}{}/{}'.format(TELEGRAM_URL_API, TOKEN, method)
return url
def __post(url, body, params=dict()):
"""
Internal post
:param url:
:param body:
:pa... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | app/telegram/api.py | mendrugory/monkey-note-bot |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
829. 连续整数求和
给定一个正整数 N,试求有多少组连续正整数满足所有数字之和为 N?
示例 1:
输入: 5
输出: 2
解释: 5 = 5 = 2 + 3,共有两组连续整数([5],[2,3])求和后为 5。
示例 2:
输入: 9
输出: 3
解释: 9 = 9 = 4 + 5 = 2 + 3 + 4
示例 3:
输入: 15
输出: 4
解释: 15 = 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5
middle_ret肯定为有... | [
{
"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 | algorithms/leetcode/contest/83/829.py | bigfoolliu/liu_aistuff |
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
ConnectionRefusedError = OSError
import logging
import random
import requests
import tornado
import ujson
def parse_body(req, **fields):
try:
data = tornado.escape.json_decode(req.body)
except ValueError... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | crowdsource/utils.py | texodus/crowdsource |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple one dimensional example for a possible user's script."""
import argparse
from orion.client import report_results
def function(x, y):
"""Evaluate partial information of a quadratic."""
y = x + y - 34.56789
return 4 * y**2 + 23.4, 8 * y
def execute(... | [
{
"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 | tests/functional/branching/black_box_with_y.py | satyaog/orion |
"""
strings and logic related to composing notifications
"""
HELLO_STATUS = "Hello! I'm Vaccination Notifier"
HELLO_MESSAGE = (
"Hello there!\n"
"\n"
"I'm Vaccination Notifier. This is just a message to let you know I'm running and "
"to test our notification configuration. I'll check for changes to yo... | [
{
"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 | messages.py | Cedric0303/Vaccination-Notifier |
import dash_bootstrap_components as dbc
from dash import Input, Output, State, html
collapses = html.Div(
[
dbc.Button(
"Toggle left",
color="primary",
id="left",
className="me-1",
n_clicks=0,
),
dbc.Button(
"Toggle rig... | [
{
"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 | docs/components_page/components/collapse/multiple.py | glsdown/dash-bootstrap-components |
from ..factor import TableFactor
import numpy as np
import pandas as pd
from itertools import combinations
def discrete_entropy(x):
def make_factor(data, arguments, leak=1e-9):
factor = TableFactor(arguments, list(data.columns))
factor.fit(data)
factor.table += leak
factor.normaliz... | [
{
"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 | graphmodels/information/information.py | DLunin/pygraphmodels |
#!/usr/bin/env python
from actions.action import Action
import os
import contextlib
import re
import shutil
__author__ = "Ryan Sheffer"
__copyright__ = "Copyright 2020, Sheffer Online Services"
__credits__ = ["Ryan Sheffer", "VREAL"]
class Copy(Action):
"""
Copy Action
An action designed to copy file/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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | PyUE4Builder/actions/copy.py | rfsheffer/PyUE4Builder |
# -*- coding: utf-8 -*-
"""Playbook app wrapper for TextBlob (https://github.com/sloria/TextBlob)."""
import traceback
from tcex import TcEx
from textblob import TextBlob
def parse_arguments():
"""Parse arguments coming into the app."""
tcex.parser.add_argument('--string', help='String', required=True)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | apps/TCPB_-_Text_Blob/text_blob/text_blob.py | cvahid/threatconnect-playbooks |
import requests
class Url:
def __init__(self, url):
self.url = url
def get_url(self):
return self.url
def set_url(self, url):
self.url = url
def open_url(self):
resp = requests.get(self.url)
return resp.text
| [
{
"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 | package/module.py | alexcreek/python-template |
'''
Copyright (c) 2011-2014, Agora Games, LLC All rights reserved.
https://github.com/agoragames/haigha/blob/master/LICENSE.txt
'''
from chai import Chai
from haigha.frames import heartbeat_frame
from haigha.frames.heartbeat_frame import HeartbeatFrame
from haigha.frames.frame import Frame
class HeartbeatFrameTest... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/unit/frames/heartbeat_frame_test.py | simomo/haigha |
from sqlalchemy import Column, Integer, String, Enum as PgEnum, Float
from enum import Enum
from sqlalchemy.orm import relationship
from api.utils.db_init import Base
class Influence(Enum):
bad = "bad"
neutral = "neutral"
good = "good"
class Nutrition(Base):
__tablename__ = 'nutrition'
id = Co... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | api/models/nutrition.py | syth0le/async_cookeat |
#!/usr/bin/env python3
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import unittest
class DummyCliUnittest(unittest.TestCase):
def testImportCrosFactory(self):
from cros.factory.cl... | [
{
"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 | py/cli/testdata/scripts/dummy_script.py | arccode/factory |
#
# 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... | [
{
"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 | airflow/providers/vertica/operators/vertica.py | takuti/airflow |
from flask import request
from injector import inject
from controllers.common.models.CommonModels import CommonModels
from controllers.test.models.TestModels import TestModels
from infrastructor.IocManager import IocManager
from infrastructor.api.ResourceBase import ResourceBase
@TestModels.ns.route('/path/<int:value... | [
{
"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 | controllers/test/TestController.py | muhammetbolat/pythondataintegrator |
from masonite.provider import ServiceProvider
from .Javascript import Javascript
class JavascriptProvider(ServiceProvider):
"""Bind Javascript class into the Service Container."""
wsgi = True
def boot(self):
pass
def register(self):
self.app.bind("Javascript", Javascript)
| [
{
"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 | jsonite/JavascriptProvider.py | ChrisByrd14/JSONite |
# coding: utf-8
"""
No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.1.1+01d50e5
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you m... | [
{
"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_loggers_summary.py | yumimobi/graylog.py |
import misc_tools
import random
def create_routing(env, first_step='op1'):
tasks = {
'op1': misc_tools.make_assembly_step(
env=env,
run_time=random.gauss(mu=12, sigma=0.5),
route_to='op2'),
'op2': {
'location': env['machine_3'],
'worker... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/c... | 3 | examples/part_c.py | Viasat/salabim_plus |
import uuid
from django.db import models
from django.urls import reverse
from core.models import (Authorable,
Titleable,
TimeStampedModel)
class Recipe(Authorable, Titleable, TimeStampedModel):
"""
Recipe model as of v.1.0.
"""
CATEGORY = (
(... | [
{
"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 | recipes/models.py | asis2016/momo-ristorante-v1 |
#!/usr/bin/env python3
import unittest
from helper import cheat_output
#from textreplacer import TextReplacer
# Test locally
import sys
sys.path.append('../textreplacer/')
from textreplacer import TextReplacer
class TestMarkCase2(unittest.TestCase):
def setUp(self):
patterns = [
r"^\d+$",
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/test2.py | ghostduck/text_replacer |
"""Tests for the utils module."""
from soco.utils import deprecated
# Deprecation decorator
def test_deprecation(recwarn):
@deprecated("0.7")
def dummy(args):
"""My docs."""
pass
@deprecated("0.8", "better_function", "0.12")
def dummy2(args):
"""My docs."""
pass
... | [
{
"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 | tests/test_utils.py | relevitt/SoCo |
# Importing Django Models:
from django.contrib import admin
# Importing Database Base Models:
from social_media_api.model_views_seralizers.reddit_api.reddit_models import RedditPosts, RedditDevApps, RedditDevAppForm, Subreddits, RedditLogs, RedditPipeline
from .models.indeed.indeed_models import IndeedJobPosts
from .m... | [
{
"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 | velkozz_web_api/apps/social_media_api/admin.py | velkoz-data-ingestion/velkozz_web_api |
"""Jade Tree Email Support.
Jade Tree Personal Budgeting Application | jadetree.io
Copyright (c) 2020 Asymworks, LLC. All Rights Reserved.
"""
from flask import current_app
from flask_mail import Mail, Message
from jadetree.exc import ConfigError
mail = Mail()
__all__ = ('init_mail', 'mail', 'send_email')
def i... | [
{
"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 | jadetree/mail.py | asymworks/jadetree-backend |
import base64
import cloudpickle
import quartic_sdk.utilities.constants as Constants
from quartic_sdk.core.entities.base import Base
from quartic_sdk.model.helpers import ModelUtils
class Model(Base):
"""
The given class refers to the Model entity which is created based upon the
Model object returned fr... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | quartic_sdk/core/entities/model.py | divyquartic/QuarticSDK |
import re
from .exceptions import BrandNotFound
from .luhn import Luhn
from .utils import sanitize
BRAND_REGEX = {
"banese": r"^(636117|637473|637470|636659|637472)[0-9]{10,12}$",
"elo": r"^(401178|401179|431274|438935|451416|457393|457631|457632|504175|627780|636297|636368|(506699|5067[0-6]\d|50677[0-8])|(50... | [
{
"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 | creditcard/card.py | guilhermetavares/python-creditcard |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Introduction à WxPython
Illustration de l'interaction entre la manipulation des objets
à l'écran et les fonctionnalités du programme.
"""
import wx
class InteractionFrame(wx.Frame):
def __init__(self, title, size):
super().__init__(None, title=title, size... | [
{
"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 | Scripts/009_wxpyhon/script/002_interaction.py | OrangePeelFX/Python-Tutorial |
class OverpassError(Exception):
"""An error during your request occurred.
Super class for all Overpass api errors."""
pass
class OverpassSyntaxError(OverpassError, ValueError):
"""The request contains a syntax error."""
def __init__(self, request):
self.request = request
class TimeoutEr... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | overpass/errors.py | itiboi/overpass-api-python-wrapper |
#appModules/totalcmd.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2012 NVDA Contributors
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import appModuleHandler
from NVDAObjects.IAccessible import IAccessible
import speech
import controlTypes
import... | [
{
"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 | source/appModules/totalcmd.py | oleguldberg/nvda |
import unittest
import checksieve
class TestIndex(unittest.TestCase):
def test_index(self):
sieve = '''
# Implement the Internet-Draft cutoff date check assuming the
# second Received: field specifies when the message first
# entered the local email infrastructure.
require ["date", "re... | [
{
"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 | test/5260/index_test.py | dburkart/check-sieve |
import os
import pytest
from etcetra import EtcdClient, HostPortPair
@pytest.fixture
def etcd_addr():
env_addr = os.environ.get('BACKEND_ETCD_ADDR')
if env_addr is not None:
return HostPortPair.parse(env_addr)
return HostPortPair.parse('localhost:2379')
@pytest.fixture
async def etcd(etcd_addr)... | [
{
"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/conftest.py | lablup/etcetra |
"""Removed request_uri for slots and repeating slots
Revision ID: 449c8b35b869
Revises: 1b81c4cf5a5a
Create Date: 2014-03-22 15:50:29.543673
"""
# revision identifiers, used by Alembic.
revision = '449c8b35b869'
down_revision = '1b81c4cf5a5a'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.dr... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | flod_booking/alembic/versions/20140322-1550-449c8b35b869_removed_request_uri_for_slots_and_.py | Trondheim-kommune/Bookingbasen |
from virgo.parse import parse
def test_parse_simple_edge():
s = "a -> b"
result = parse(s)
assert result is not None
assert "a" in result.nodes
assert list(result.direct_successors_of("a")) == ["b"]
assert list(result.direct_successors_of("b")) == []
def test_parse_simple_edge_with_newline()... | [
{
"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 | test/test_parse.py | terrykong/pyvirgo |
import json
import re
import spacy
import enchant
import copy as cp
sp = spacy.load('en_core_web_sm')
def lemmatize_this(str_word):
return sp(str_word)[0]
def main():
while True:
print("Ingrese la Palabra: ")
word = input()
word = str(lemmatize_this(word))
try:
wit... | [
{
"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 | Demos/Distancias_ocurrencias.py | TheReverseWasp/TBD_TF-IDF_with_Google_Corpus |
from twisted.internet.protocol import Protocol
from gandyloo import parse
class MinesweeperClient(Protocol):
'''Represents a connection to a server using twisted's Protocol framework.
Created with an event sink, where parsed events (subclasses of
gandyloo.message.Response) are fired. Sink should have a met... | [
{
"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 | gandyloo/connection.py | kazimuth/gandyloo |
from django.test import TestCase
from task.models import Task, Tag
from task.serializers import TaskSerializer
from django.conf import settings
class TestFullImageUrl(TestCase):
def setUp(self) -> None:
self.path = '/media/image.png'
self.task = Task.objects.create(name='demo', image='/image.png'... | [
{
"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 | task/tests.py | bubaley/air-drf-relation |
from django import template
from django_gravatar.templatetags.gravatar import gravatar_url
# Get template.Library instance
register = template.Library()
# enables the use of the gravatar_url as an assignment tag
register.assignment_tag(gravatar_url)
@register.simple_tag(takes_context=True)
def display_name(context)... | [
{
"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 | mc2/templatetags/mc2_tags.py | praekeltfoundation/mc2 |
'''
Problem Statement
Write a function that takes in a non-empty array of distinct integers and an integer representing a target sum. If any two numbers in the input array sum up to the target sum, the function should return them in an array, in sorted order. If no two numbers sum up to the target sum, the function 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": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | codes/01_two_sum.py | harshavl/Brain-Teaser-with-Coding |
import abc
import typing_extensions as te
import dataclasses
from databind.core.annotations import fieldinfo, union
from databind.json import loads
@dataclasses.dataclass
class Person:
name: str
age: te.Annotated[int, fieldinfo(strict=False)]
@union()
class Plugin(abc.ABC):
pass
@union.subtype(Plugin)
@dat... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | databind.json/src/test/test_init.py | NiklasRosenstein/databind |
from tkinter.filedialog import askopenfilename
from tkinter import *
import cli
import gettext
window = Tk()
window.title("ofx_to_xlsx")
def close_window():
window.destroy()
def callback():
ofx = askopenfilename()
cli.run(ofx)
gettext.install('ofx_to_xlsx')
t = gettext.translation('gui_i18n', 'locale'... | [
{
"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 | gui.py | eduardokimmel/ofx_to_xlsx |
from time import sleep
import os
import docker
import pytest
from docker.types import EndpointSpec, NetworkAttachmentConfig
import vault
@pytest.fixture(scope="session")
def root_path():
yield os.path.dirname(os.path.dirname(__file__))
@pytest.fixture()
def vault_service(vault_token):
client = docker.from... | [
{
"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/conftest.py | procedural-build/vault-swarm |
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit_page)
def test_phone... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | test/test_phones.py | bopopescu/python_traning |
# -*- coding: utf-8 -*-
"""
Encapsulate the different transports available to Salt.
"""
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.versions
# Import third party libs
from salt.ext import six
from salt.ext.six.moves... | [
{
"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 | salt/transport/__init__.py | MeAndTheFirefly/salt |
import numpy as np
import tensorflow as tf
from MLib.Core.layers import LinearLayer, ConvLayer
from tensorflow.keras.layers import MaxPooling2D, Flatten
from tensorflow.keras import Model
class SimpleCNNModel(Model):
def __init__(self, num_units):
super(SimpleCNNModel, self).__init__()
# Define the architecture... | [
{
"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 | MLib/Models/KerasModels.py | rvegaml/DA_Linear |
import keyboard
from player_detector import PlayerDetector
from drops_detector import DropsDetector
from snapshoter import Snapshoter
PIC_INTERVAL_SEC = 0.1
PICKUP_BUTTON = 'z'
class DropsSnapshoter(Snapshoter):
def __init__(self, pipe_connection):
super().__init__(pipe_connection, PIC_INTERVAL_SEC)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | drops_snapshoter.py | TomerMe2/MapleStory-Auto-Pots |
#!/usr/bin/env python
import os
import subprocess
import sys
from dbusmock import DBusTestCase
from lib.config import is_verbose_mode
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
def start():
log = sys.stdout if is_verbose_mode() e... | [
{
"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 | script/dbus_mock.py | lingxiao-Zhu/electron |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | kubernetes/test/test_auditregistration_api.py | iamneha/python |
import sys
import time
import forward_messages
import helpers
try:
import config
except (ImportError, ModuleNotFoundError):
print(
"config.py not found. Rename config.example.py to config.py after configuration."
)
sys.exit(1)
def main():
if config.forward_user:
forward_messages.... | [
{
"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 | daily.py | jarhill0/PrivateSubBot |
import numpy as np
def get_strehl_from_focal(img, ref_img):
'''Get the Strehl ratio from a focal-plane image.
Parameters
----------
img : Field or array_like
The focal-plane image.
ref_img : Field or array_like
The reference focal-plane image without aberrations.
Returns
-------
scalar
The Strehl ratio... | [
{
"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 | hcipy/metrics/contrast.py | yinzi-xin/hcipy |
class MultipartProblem:
"""A container for multiple related Problems grouped together in one
question. If q1 is a MPP, its subquestions are accessed as q1.a, q1.b, etc.
"""
def __init__(self, *probs):
self.problems = probs
# TODO: This should be ordered.
self._prob_map = {}... | [
{
"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 | learntools/core/multiproblem.py | bkmalayC/learntools |
def draw_mem():
c_width = int( w.Canvas2.cget( "width" ))
c_height = int( w.Canvas2.cget( "height" ))
print( c_width )
box_start = c_width * 0.05
box_end = c_width * 0.95
mem_title = w.Canvas2.create_text(( c_width / 2 ), 10, fill = "black", font = "Times 10", text = "Flash" )
mem1 = w.Canva... | [
{
"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 | Tools/GUI/BlueOS_support_functions.py | speedbug78/BlueOS |
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from waffle.utils import get_setting
from django.apps import apps as django_apps
VERSION = (0, 13, 0)
__version__ = '.'.join(map(str, VERSION))
def flag_is_active(request, flag_name):
flag = get_waffle_flag_model().... | [
{
"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 | waffle/__init__.py | PetterS/django-waffle |
import assembly_x86
import assembly_arm
import assembly_mips
import assembly_ppc
import os
class AsmFactory:
def get_type(self, asm_type, input_path, b_online=False, i_list=[]):
if asm_type == 'X86':
return assembly_x86.X86Asm(input_path, b_online, i_list)
elif asm_type == 'ARM':
... | [
{
"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 | preprocess_assembly.py | LN-Curiosity/PMatch |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Update value by key"
class Input:
ARRAY = "array"
KEY = "key"
OBJECT = "object"
VALUE = "value"
class Output:
JSON = "json"
class UpdateInput(komand.Input):
schema = json.loads("... | [
{
"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 | plugins/json_edit/komand_json_edit/actions/update/schema.py | lukaszlaszuk/insightconnect-plugins |
import theano.tensor as T
import numpy as np
import theano
from theano import shared
class sgd(object):
""" Stochastic Gradient Descent (SGD)
Generates update expressions of the form:
param := param - learning_rate * gradient
"""
def __init__(self, params, masks=None):
self.masks = masks
... | [
{
"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 | models/optimizers/sgd.py | mwong009/iclv_rbm |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 on 2017-03-22.
# 2017, SMART Health IT.
import os
import io
import unittest
import json
from . import servicedefinition
from .fhirdate import FHIRDate
class ServiceDefinitionTests(unittest.TestCase):
def instantiate_from(self, f... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | models/servicedefinition_tests.py | elementechemlyn/CareConnectBuilder |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
#
# Helper script to create the cache
# (see BitcoinTestFramework.setup_chain)
#
... | [
{
"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 | qa/rpc-tests/create_cache.py | jtoomim/BitcoinUnlimited |
from Shoots.bin.shoots import Shoots
from Shoots.bin.info import Info
from Shoots.bin.ai.shooter import CFRShooter as AIShooter
class AIShoots(Shoots):
"""
automatically add two AIShooter
"""
def __init__(self):
super().__init__()
self.map.map = [
[self.map.ROAD] * 5
... | [
{
"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 | Shoots/bin/ai/shoots.py | lyh-ADT/Shoots |
# 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": "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 | aliyun-python-sdk-vs/aliyunsdkvs/request/v20181212/DeleteRenderingDevicesRequest.py | yndu13/aliyun-openapi-python-sdk |
from django.shortcuts import render, redirect, HttpResponse
from student.forms import StudentsForm
from student.models import Students
def std(request):
if request.method == "POST":
form = StudentsForm(request.POST)
if form.is_valid():
try:
form.save()
r... | [
{
"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 | 14_Tran_An_Thien/ManagementStudents/student/views.py | lpython2006e/exercies |
import hashlib
from pathlib import PurePath
# return a mapping from external id to file names
def read_index_file(index_file):
extid_to_name = {}
with open(index_file) as f:
for line in f:
pairs = line.strip().split()
external_id = int(pairs[0])
file_name = PurePath(... | [
{
"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 | multidoc-stave/simple-backend/nlpviewer_backend/utils.py | adithya7/cdec-ann-tool |
import model
def dolzina_maksimalnega_clena(sez):
m = len(sez)
n = len(sez[0])
najvecji = max([sez[i][j] for i in range(m) for j in range(n)])
return len(str(najvecji))
def prikaz_matrike(sez):
m = len(sez)
n = len(sez[0])
razmik = dolzina_maksimalnega_clena(sez)
for i in range(m):
... | [
{
"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 | tekstovni_vmesnik.py | milaneztim/Racunanje-z-matrikami |
import torch
import torch.nn as nn
import torch.nn.functional as F
from networks.network_utils import hidden_init
class MADDPGCriticVersion1(nn.Module):
def __init__(self, num_agents, state_size, action_size, fcs1_units, fc2_units, seed=0):
"""Initialize parameters and build model.
Params
... | [
{
"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 | p3_collab-compet/MADDPG/networks/maddpg_critic_version_1.py | Brandon-HY-Lin/deep-reinforcement-learning |
from django.db import models
from django.contrib.auth import get_user_model
User = get_user_model()
class Group(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
description = models.TextField()
def __str__(self):
return str(self.title) #в задании г... | [
{
"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": false
... | 3 | posts/models.py | DavLivesey/hw02_community-master |
from typing import Callable
from httpx import Request, Response, codes
from pytest import raises
from pytest_httpx import HTTPXMock
from firebolt.client.auth import Token
from firebolt.utils.exception import AuthorizationError
from tests.unit.util import execute_generator_requests
def test_token_happy_path(
htt... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | tests/unit/client/auth/test_token.py | firebolt-db/firebolt-python-sdk |
import telegram
from . import start
from . import add_feed
from . import remove_feed
def register_commands(dispatcher: telegram.ext.Dispatcher):
def add_all(handlers):
for handler in handlers:
dispatcher.add_handler(handler)
add_all(start.get_handlers())
add_all(add_feed.get_handlers())
add_all(remove_fee... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | src/sauce_bot/commands/__init__.py | asmello/feed-tracker-bot |
from django.core.exceptions import BadRequest, PermissionDenied
from .books import books_list, BookListView, BookDetailView, BookDeleteView
from .index import index, IndexView
from .readers import readers_list, ReaderListView
from .users import users_list, UserListView, CreateUserView
def server_death(request):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | microblog/blog/views/__init__.py | zaldis/MAcademy2021 |
# Manter Ordem Alfabética
def join_list(lst, string=', '):
"""
:param lst: List to be joined
:param string: String that will be used to join the items in the list
:return: List after being converted into a string
"""
lst = str(string).join(str(x) for x in lst)
return lst
def unique_list(... | [
{
"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 | Modules/my_list/__init__.py | guilhermebaos/Curso-em-Video-Python |
PI = 3.14
def rectangle_funk():
a = float(input("Please, enter first side of rectangle: "))
b = float(input("Please, enter second side of rectangle: "))
return a * b
def triangle_funk():
a = float(input("Please, enter side of triangle: "))
h = float(input("Please, enter height of triangle: "))... | [
{
"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 | HW6/VeronyWise/task6.2.py | kolyasalubov/Lv-677.PythonCore |
def topological_sort(propagation_end_node):
"""A utility function to perform a topological sort on a DAG starting from
the node to perform backpropagation.
Parameters
----------
propagation_end_node : Node
The node to perform backpropagation.
Returns
-------
List[Node]
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | util.py | ChristophorusX/A-Tentative-Autograd-Implementation |
def add(a,b):
return a + b
def subtract(a,b):
return a - b
def product(a,b):
return a * b
| [
{
"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 | example.py | CJSmekens/code-refinery-bq-1 |
# -*- coding: utf-8 -*-
"""URLs for all views."""
from django.conf import settings
from django.shortcuts import render
def home(request):
"""Dashboard home."""
return render(
request, 'dashboard/home.html', {'foobar': settings.FOO_BAR},
)
def search(request):
"""Dashboard search."""
re... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | djskeletor/dashboard/views.py | carthagecollege/django-djskeletor |
from django.contrib.admin import AdminSite
from django.contrib.admin.apps import AdminConfig
from django.urls import path
class CustomAdminSite(AdminSite):
def get_urls(self):
from degvabank.core import views
urls = super().get_urls()
my_urls = [
path(
'reports/... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | degvabank/degvabank/core/admin.py | Vixx-X/DEGVABanck-backend |
from dataclasses import dataclass
from debussy_concert.core.config.movement_parameters.base import MovementParametersBase
@dataclass(frozen=True)
class BigQueryDataPartitioning:
partitioning_type: str
gcs_partition_schema: str
partition_field: str
destination_partition: str
@dataclass(frozen=True)
c... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | debussy_concert/data_ingestion/config/movement_parameters/time_partitioned.py | DotzInc/debussy_concert |
'''
Created on 8 May 2021
@author: julianporter
'''
from .chunk import FLPChunk
class FLPHeader(FLPChunk):
def __init__(self,data=b''):
super().__init__(data)
try:
self.format = FLPChunk.getInt16(self.data[0:2])
self.nTracks = FLPChunk.getInt16(self.data[2:4])
... | [
{
"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 | FLP/chunks/header.py | TheXIFC/FL-Studio-Time-Calculator |
from HDPython import *
from HDPython.examples import *
from .helpers import Folders_isSame, vhdl_conversion, do_simulation,printf
from HDPython.test_handler import add_test
class test_bench_axi_fifo(v_entity):
def __init__(self):
super().__init__()
self.architecture()
def architecture(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_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | HDPython/tests/test_axi_fifo.py | HardwareDesignWithPython/HDPython |
import unittest
from securityheaders.checkers.cors import AccessControlExposeHeadersSensitiveChecker
class AccessControlExposeHeadersSensitiveCheckerTest(unittest.TestCase):
def setUp(self):
self.x = AccessControlExposeHeadersSensitiveChecker()
def test_checkNoHeader(self):
nox = dict()
... | [
{
"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 | securityheaders/checkers/cors/exposeheaders/test_exposesensitiveheaders.py | th3cyb3rc0p/securityheaders |
#!/usr/bin/env python
"""Tests for synonym."""
import unittest
from synonym import synonym
class SynonymTestCase(unittest.TestCase):
def return_synonym(self, query):
parser = synonym.get_parser()
args = vars(parser.parse_args(query.split(' ')))
return synonym.synonym(args)
def setU... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | test_synonym.py | gavinzbq/synonym |
# Copyright 2020, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/benchmarks/micro/GeneratorComparison.py | juanfra684/Nuitka |
# -*- encoding:utf-8 -*-
import discord
from discord.ext.commands import check, NotOwner
def is_owner():
"""
A :func:`.check` that checks if the person invoking this command is the
owner of the bot.
This is powered by :meth:`.Bot.is_owner`.
This check raises a special exception, :exc:`.NotOwner`... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | utils/overwrite.py | AliasPedroKarim/Kagura |
import asyncio
import inspect
import re
from typing import Any, Callable, Dict, Set
from pydantic.typing import ForwardRef, evaluate_forwardref
def get_typed_signature(call: Callable) -> inspect.Signature:
"Finds call signature and resolves all forwardrefs"
signature = inspect.signature(call)
globalns = ... | [
{
"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 | ninja/signature/utils.py | dengerr/django-ninja |
# -*- coding: utf-8 -*-
'''
Interface with a Junos device via proxy-minion.
'''
# Import python libs
from __future__ import print_function
from __future__ import absolute_import
import logging
# Import 3rd-party libs
# import jnpr.junos
# import jnpr.junos.utils
# import jnpr.junos.utils.config
import json
HAS_JUNOS... | [
{
"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 | salt/proxy/junos.py | vamshi98/salt-formulas |
# -*- coding: utf-8 -*-
from django.contrib.sitemaps import Sitemap
from ionyweb.page.models import Page
class PagesSitemap(Sitemap):
changefreq = "weekly"
priority = 0.5
def items(self):
return Page.objects.filter(draft=False)
def lastmod(self, obj):
return obj.last_modif
| [
{
"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 | ionyweb/page/sitemap.py | makinacorpus/ionyweb |
import imutils
import numpy as np
import cv2
import base64
def byte_to_image(string_byte):
jpg_original = base64.b64decode(string_byte)
jpg_as_np = np.frombuffer(jpg_original, dtype=np.uint8)
img = cv2.imdecode(jpg_as_np, flags=1)
return img
def file_to_image(file):
img = np.asarray(bytearray(fi... | [
{
"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 | Rest Django Framework/api_image_manager/blur_image_app/blur_image.py | PaulMarcelo/Python |
"""Defines the core data classes and types for Gearbox environments."""
from dataclasses import dataclass
from typing import Any, Callable, Iterable, Union
@dataclass
class Action:
"""Base class that all actions are suggested to extend."""
@dataclass
class State:
"""Base class that all states are suggested... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | gearbox_py/core/environments.py | sColin16/gearbox_py |
# -*- coding: utf-8 -*-
"""Experiments Metrics controller."""
import platiagro
from projects.exceptions import NotFound
class MetricController:
def __init__(self, session):
self.session = session
def list_metrics(self, project_id: str, experiment_id: str, run_id: str, operator_id: str):
"""
... | [
{
"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 | projects/controllers/experiments/runs/metrics.py | dnlcesilva/projects |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import random
from torch.nn import Module
from MinkowskiEngine import SparseTensor
class Wrapper(Module):
"""
Wrapper for the segment... | [
{
"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 | downstream/semseg/models/wrapper.py | ut-amrl/ContrastiveSceneContexts |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Factorial test module."""
__author__ = "Stanislav D. Kudriavtsev"
from pytest import mark, raises
from gcd_iter import gcd_iter
from gcd_rec import gcd_rec
# pylint: disable=arguments-out-of-order
@mark.parametrize("num1, num2", [(1.0, 2), (1, 2.0), (0, -1.0), ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | Python/math/gcd/test_gcd.py | stanislav-kudriavtsev/Algorithms |
class CNN(nn.Module):
def __init__(self):
super().__init__() # Important, otherwise will throw an error
self.cnn = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=5, stride=1, padding=2), # 32x32x32
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2, padding=0), # 32x16x16
... | [
{
"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 | static/code/cnn/lenet.py | navivokaj/deepcourse |
from django.db import transaction
from rest_framework import generics, mixins
class BaseAPIView(generics.GenericAPIView,
mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | core/api/base.py | care2donate/care2donate |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:ls
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self,*args,**kwargs):
self.write("Hello, world")
def main():
application = tornado.web.Application([
(r"/", MainHandler),
],debug=True... | [
{
"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 | tornado_learning/simple_server.py | rwbooks/python_learning |
"""
ECB没有偏移量
"""
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
from utils import DES_decrypt, DES_encrypt
def add_to_16(text):
if len(text.encode('utf-8')) % 16:
add = 16 - (len(text.encode('utf-8')) % 16)
else:
add = 0
text = text + ('\0' * add)
return text.encode... | [
{
"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 | try.py | peterzheng98/Valentine-Gift |
import importlib
import inspect
import logging
import os
from app.plugin import Hook, Command
PLUGINS_DIR = 'plugins'
def find_plugins():
"""Returns a list of plugin path names."""
for root, dirs, files in os.walk(PLUGINS_DIR):
for file in files:
if file.endswith('.py'):
... | [
{
"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/processor.py | glombard/python-plugin-experiment |
import cv2 # type: ignore
import numpy as np
def extract_frame_of_movie(tiff_movie, frame_number, output_file):
"""Extract a certain frame of tiff_movie, and write it into a separate file. Used for testing find_frame_of_image
Args:
tiff_movie (str): path to input
frame_number (int): which frame to extract
Rai... | [
{
"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 | biu/siam_unet/helpers/extract_frame_of_movie.py | danihae/bio-image-unet |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.