source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from functorch import grad, nnc_jit, make_fx, make_nnc
import torch
import time
def f(x):
return torch.sin(... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | examples/compilation/simple_function.py | mathandy/functorch |
from __future__ import absolute_import
import os
import pandas as pd
from pytest import fixture
@fixture
def simple_df():
return pd.DataFrame(data=[[1, 1], [2, 2]], columns=["c1", "c2"])
@fixture
def pandas_data_frame():
names = ["Bob", "Jessica", "Mary", "John", "Mel"]
births = [968, 155, 77, 578, 9... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | modules/dbnd/test_dbnd/targets_tests/conftest.py | ipattarapong/dbnd |
# coding: utf-8
"""
DeepAffects
OpenAPI Specification of DeepAffects APIs
OpenAPI spec version: v1
"""
from __future__ import absolute_import
import os
import sys
import unittest
import deepaffects
from deepaffects.rest import ApiException
from deepaffects.models.audio import Audio
class TestAudio(... | [
{
"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 | test/test_audio.py | s16h/deepaffects-python |
from django.db import models
from django.contrib.postgres import fields as pg_fields
from ..data import DBStored
from ..group import Group
from .tally import UserDefTallyBaseNonStored
from .lang import run, Env
from .lang.json import decode
class UserDefGroupTallyBaseNonStored(UserDefTallyBaseNonStored):
get_gr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | django_tally/user_def/group_tally.py | CodeYellowBV/django-tally |
import argparse
import os
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from PIL import Image
import models
def predict(model_data_path, image_path):
# Default input size
height = 228
width = 304
channels = 3
batch_size = 1
# Read image
img = Image.o... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | tensorflow/predict.py | alishameli/CS231n-Sample-Code-1 |
import json
import web
import calendar
import datetime
import cloudserver
urls = (
"/BuildingFootprint/", "BuildingFootprint",
"/BuildingFootprintDisaggregated/", "BuildingFootprintDisaggregated",
"/PersonalConsumption/", "PersonalConsumption",
"/HistoricalConsumption/", "HistoricalConsumption")
class BuildingFoo... | [
{
"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 | newDataAnalytics.py | PeterJWei/EnergyFootprinting |
from flask import Flask
test = Flask(__name__)
@test.route("/")
def start():
return "Hello Start Page"
@test.route("/home")
def home_page():
return "Welcome Home page"
@test.route("/blog")
def blog():
return "Welcome Author"
@test.route('/<name>')
def base():
if name =='home':
return redirec... | [
{
"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 | 07.Redirect/main.py | sarincr/Introduction-to-Flask-Web-framework |
from __future__ import print_function
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api.utils import itertags
from streamlink.stream import HLSStream
from streamlink.utils import update_scheme
class EuropaPlusTV(Plugin):
url_re = re.compile(r"https?... | [
{
"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 | src/streamlink/plugins/europaplus.py | zel4ever/streamlink |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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 | kubernetes_asyncio/test/test_v1_scale_spec.py | PidgeyBE/kubernetes_asyncio |
import os
from json import loads
snyk_config = loads("""{
"OrginisationMap": [
{ "Name": "FirstChecked-Org", "Matcher": "1-*" },
{ "Name": "SecondChecked-Org", "Matcher": "2-*" },
{ "Name": "CatchAll-Org", "Matcher": "*" }
]
}""")
def get_snyk_token():
return os.environ.get('SECRET... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | app/snyk/config.py | serdalis/snyk-watcher |
from datetime import date
current_date = date.today()
class Note():
def __init__(self, title, memo, tags):
self.__title = title
self.__memo = memo
self.__tags = tags
self.__creation_date = current_date
@property
def title(self):
return self.__title
@property
... | [
{
"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 | Note/note.py | NathanMuniz/notbook_with_sqlalhcemy |
# Maki
# ----
# Discord bot by MrDetonia
#
# Copyright 2018 Zac Herd
# Licensed under BSD 3-clause License, see LICENSE.md for more info
# IMPORTS
import os
import asyncio
import subprocess
import discord
import urllib.request
# LOCAL IMPORTS
from common import *
from helpers import *
# COMMAND IMPLEMENTATINS
@asyn... | [
{
"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 | admincommands.py | MrDetonia/Maki |
import json
from datetime import timedelta
from multiprocessing import set_start_method
from typing import List, AsyncGenerator
import pytest
from resotocore.analytics import AnalyticsEventSender
from resotocore.db.graphdb import ArangoGraphDB
from resotocore.db.model import GraphUpdate
from resotocore.dependencies i... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 4 | resotocore/tests/resotocore/model/db_updater_test.py | someengineering/resoto |
from django.test import TestCase
from users.models import User
class UserIsActiveTest(TestCase):
def setUp(self):
self.valid_email = "test@example.com"
self.valid_password = "test_password"
self.user = User.objects.create_user(
email = self.valid_email,
password = s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | buildbuild/users/tests/test_is_active.py | buildbuild/buildbuild |
# Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
import unittest
import parser_test_case
from pygccxml import parser
from pygccxml import declarations
code = \
"""
class... | [
{
"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 | unittests/gccxml10184_tester.py | iMichka/pygccxml |
def _zero_one_validator(x, function):
message = function + " must be a float between zero and one"
if x < 0.0 or x > 1.0:
raise ValueError(message)
return x
def _intenger_validator(x, function):
message = function + " must be positive intenger"
if isinstance(x, int) and x > 0:
ret... | [
{
"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 | skroute/_validators/_validators.py | arubiales/scikit-route |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import pytest
from cardea.fhir import Patient
@pytest.fixture()
def patient_df():
return pd.DataFrame({"identifier": [0, 1, 2, 3],
"gender": ['female', 'female', 'male', 'female'],
"birthDate": ['... | [
{
"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/cardea/fhir/test_fhirbase.py | sarahmish/Cardea |
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class SparseMM(torch.autograd.Function):
"""
Sparse x dense matrix multiplication with autograd support.
Implementation by Soumith Chintala:
https://discuss.pytorch.org/t/
does-pytorch-s... | [
{
"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 | segcn/layers.py | zoubaihan/SEGCN |
'''
Authors: Marc Pfister
Contact: marc.pfister@maxar.com
Unit tests for the DemImage class
'''
from gbdxtools import DemImage
import unittest
from helpers import mockable_interface, gbdx_vcr
class DEMImageTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.gbdx = mockable_interface()
... | [
{
"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 | tests/unit/test_dem_image.py | DigitalGlobe/gbdxtools |
# -*- coding: utf-8 -*-
"""Console script for pyalmondplus."""
import sys
import time
import click
import pyalmondplus.api
import threading
import asyncio
def do_commands(url, my_api):
click.echo("Connecting to " + url)
while True:
value = click.prompt("What next: ")
print("command is: " + val... | [
{
"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 | pyalmondplus/cli.py | penright/pyalmondplus |
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
@override_settings(TWILIO_ACCOUNT="foo", TWILIO_AUTH="foo", TWILIO_FROM="123")
class AddSmsTestCase(BaseTestCase):
url = "/integrations/add_sms/"
def test_instructions_work(self):
self.c... | [
{
"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 | hc/front/tests/test_add_sms.py | Lemmah/healthchecks-clone |
import datetime
from http import HTTPStatus
from locust import HttpUser, task, between
# This test can be run after installing locust through the cli as "locust --host=http://<deployed_host>:<port>"
# Then url http://localhost:8089/ should be access to start the test.
# Can also be run using no UI mode as "locust --no... | [
{
"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 | loadtests/locustfile.py | javieraviles/quarkus-github-flow |
from django.shortcuts import render
from django.db import connection
from django.http import HttpResponse
import json
from json import loads
def traerAgendaMedico(request):
dic = loads(request.body)
dataRequestUsername=dic['username']
with connection.cursor() as cursor:
cursor.execute("""SELECT... | [
{
"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 | Apps/share/medico/views.py | Jorge-DevOps/API_HealthTech |
import IPython.lib.demo as ipd
# To use, run ipython, then
#
# In [1]: %run Demos.py
# In [2]: d = ImageDemo()
# In [3]: d()
# In [4]: d()
def ImageDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/Image.py' )
def InputOutputDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/InputOutput.py' )
def MemoryManag... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | Examples/Demos.py | SimpleITK/SimpleITK-MICCAI-2011-Tutorial |
key_a = 17
key_b = 44_207
g = 3
n = 57_349
message = "IM THE WINNER AND YOU'RE NOT!"
# encrypt function given key, g, n
def encrypt(key: int, g: int, n: int):
ans = pow(g, key, n)
print(f"{key=} {ans=}")
return ans
def encrypt_message(key: int, text: str):
cipher = ''
for i, c in enumerate(r... | [
{
"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 | diffie_helman.py | kbrezinski/Cryptography-Encryption |
"""added tags
Revision ID: 31728148ab63
Revises: add5f60f0f67
Create Date: 2020-01-20 15:11:56.273986+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '31728148ab63'
down_revision = 'add5f60f0f67'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | packages/postgres-database/src/simcore_postgres_database/migration/versions/31728148ab63_added_tags.py | colinRawlings/osparc-simcore |
import unittest
import os,sys,inspect
sys.path.append('..')
from neural.neuron import Neuron
class NeuronTests(unittest.TestCase):
def test_size(self):
n = Neuron(10)
self.failUnless(n.size == 10)
def test_serialization(self):
n = Neuron(10)
original = [0.1,0.2,0.3,0.4,0.5,... | [
{
"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 | test/test_neuron.py | gsideris/genetic-train-neural |
import logging
import time
import traceback
import stopit
from .errors import TimeoutError
logger = logging.getLogger(__name__)
def jsonify_error(error):
error_type = error.__class__.__name__
message = str(error)
return {'error': {'type': error_type, 'message': message}}
def timeout(func, *args, sec... | [
{
"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 | ores/util.py | ureesoriano/ores |
import os
from fractions import Fraction
from PIL import Image
from PIL.ExifTags import TAGS
def get_exif(fn):
ret = {}
i = Image.open(fn)
info = i._getexif()
decoded_dict = {}
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
decoded_dict[decoded] = value
ret['ISO'... | [
{
"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 | main.py | kchandra423/JPEG-Reader |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from exam import fixture
from sentry.interfaces.template import Template
from sentry.models import Event
from sentry.testutils import TestCase
class TemplateTest(TestCase):
@fixture
def interface(self):
return Template.to_p... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/sentry/interfaces/test_template.py | ChadKillingsworth/sentry |
"""
My Data My Consent - Developer API
Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organizations. The API can be used to request, manage and upd... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/test_data_protection_officer.py | My-Data-My-Consent/python-sdk |
from util import get_named_tu
import ffig.cppmodel
import nose
from nose.tools import assert_equals
def test_new_class_is_added():
tu_a = get_named_tu('class A{};', 'a.cpp')
tu_b = get_named_tu('class B{};', 'b.cpp')
model = ffig.cppmodel.Model(tu_a)
model.extend(tu_b)
classes = model.classes
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/cppmodel/test_extend_model.py | FFIG/ffig |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"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 | pythonspain/contrib/sites/migrations/0003_set_site_domain_and_name.py | python-spain/socios.es.python.org |
""" Userbot module for other small commands. """
from random import randint
from asyncio import sleep
from os import execl
import sys
import os
import io
import sys
import json
from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP, bot, GIT_REPO_NAME, ALIVE_NAME
from userbot.events import register
# ================= ... | [
{
"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 | userbot/modules/remixhelper.py | denomparkour/oub-remix |
"""Trace support for automation."""
from __future__ import annotations
from contextlib import contextmanager
from typing import Any
from homeassistant.components.trace import ActionTrace, async_store_trace
from homeassistant.components.trace.const import CONF_STORED_TRACES
from homeassistant.core import Context
from... | [
{
"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 | homeassistant/components/automation/trace.py | MrDelik/core |
from talon import Context, actions, scope
# Main page (subpath 2)
# /[Page/<page>]
ctx = Context()
ctx.matches = r"""
app: anandtech
browser.path: /^\/(Page\/\d+\/?)?$/
"""
ctx.tags = ["user.pages"]
@ctx.action_class("user")
class UserActions:
# user.pages
def page_current():
tokens = scope.get("brows... | [
{
"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 | apps/web/anandtech/anandtech_pages.py | timo95/knausj_talon |
from django.shortcuts import render
from django.http import HttpResponse
from Users.models import UserProfile
from Torrents.models import UploadTorrents, Likes
from django.forms.models import model_to_dict
from django.core import serializers
import json
from django.http import JsonResponse
from Torrents.views 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": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | Pages/views.py | tabish-ali/torrent_site |
class DM():
def __init__(self):
self.container = None
def allocContainer(self, container):
self.container = container | [
{
"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 | simulator/container/DiskModels/DM.py | BirgittM/COSCO-1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Given a binary search tree with non-negative values, find the minimum
absolute difference between values of any two nodes.
"""
import sys
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def t... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | leet/problems/530_min_abs_diff_in_bst.py | blurrcat/leet |
# MIT License
#
# Copyright (c) 2017 Tom Runia
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | [
{
"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 | assignment_2/part3/model.py | davide-belli/deep-learning-labs |
"""Test fixtures."""
import ast
import json
import os
NAPALM_TEST_MOCK = ast.literal_eval(os.getenv("NAPALM_TEST_MOCK", default="1"))
NAPALM_HOSTNAME = os.getenv("NAPALM_HOSTNAME", default="127.0.0.1")
NAPALM_USERNAME = os.getenv("NAPALM_USERNAME", default="vagrant")
NAPALM_PASSWORD = os.getenv("NAPALM_PASSWORD", de... | [
{
"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 | incendio/base/test/conftest.py | ktbyers/incendio_old |
# 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
# 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | zun/tests/unit/scheduler/fakes.py | wanghuiict/zun |
import unittest
import unittest.mock
import shutil
import os.path
from programy.storage.stores.file.engine import FileStorageEngine
from programy.storage.stores.file.config import FileStorageConfiguration
from programytest.storage.test_utils import StorageEngineTestUtils
class FileStorageEngineTests(StorageEngineTes... | [
{
"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/programytest/storage/stores/file/test_engine.py | motazsaad/fit-bot-fb-clt |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script for src/extensions/common/permissions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more det... | [
{
"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 | extensions/common/permissions/PRESUBMIT.py | iridium-browser/iridium-browser |
# 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20141111/DescribeDomainCustomLogConfigRequest.py | sdk-team/aliyun-openapi-python-sdk |
# -*- coding: utf-8 -*-
"""
@author: Thorsten
"""
import numpy as np
from numba import jit
import os
import sys
nb_dir = os.path.split(os.getcwd())[0]
if nb_dir not in sys.path:
sys.path.append(nb_dir)
from lib import bresenham
@jit
def addMeasurement(grid, x, y, pos_sensor, offset, resolution, l_occupied, l_fr... | [
{
"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 | lib/mapping.py | MouvementMondial/OccupancyGridSLAM |
import __common__
def keyquery(cdim=None):
return( set(['PSDCON']) )
def getval(prob, cdim=None):
if prob.psdmapnum == 0:
return( 0 )
else:
cdim = __common__.parse_cdim(cdim)
return( sum([n*(n+1)/2 for n in prob.psdmapdim if cdim(n) ]) )
| [
{
"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 | cblib/scripts/filters/psdmap.py | HFriberg/cblib-base |
from collections import namedtuple
from typing import List
import numpy as np
ColorResult = namedtuple("ColorResult", ["name", "ratio"])
class ColorDetectionResult:
def __init__(self, color_list: List[ColorResult], labelled_frame: np.ndarray):
self.color_list = color_list
self.labelled_frame = 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 | talking_color/algorithms/base_algorithm.py | dasyad00/talking-color |
# coding: utf-8
import os
from .models import Person
from nose.tools import with_setup
from django.conf import settings
from django.test.utils import get_runner
class TestClassWithoutUnittest(object):
"""
Uses a model to ensure the table exist, even with no migrations available.
"""
def setUp(self):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/myapp/nose_tests.py | gbdlin/django-test-without-migrations |
# Python solution for 'Convert number to reversed array of digits' codewars question.
# Level: 8 kyu
# Tags: Fundamentals, Numbers, and Arrays
# Author: Jack Brokenshire
# Date: 11/02/2020
import unittest
def digitize(n):
"""
You have to return the digits of this number within an array in reverse order.
... | [
{
"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 | Python/eight_kyu/digitize.py | Brokenshire/codewars-projects |
'''
Created on Dec 20, 2014
@author: scarriere
'''
from event.IngoingEvent import IngoingEvent
from aiclient.Singleton import Singleton
from world.World import World
class StartGameEvent(IngoingEvent):
def __init__(self):
pass
def fillArguments(self, string):
pass
def execut... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | AIClient_Python/src/event/StartGameEvent.py | CSGames-Archive/AI-2015 |
def deferRun(fn, delayFrames=0):
run('args[0]()', fn, fromOP=me, delayFrames=delayFrames)
class Async:
def __init__(self, name):
self.name = name
def sayHello(self):
print('Hello ' + self.name)
deferRun(self.sayGoodbye, delayFrames=me.time.rate * 1)
def sayGoodbye(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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | examples/async/scripts/async_example.py | thisjeremiah/td-resources |
# Copyright 2021 The Brax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
{
"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 | brax/io/model.py | bharadwaj1098/brax |
import pytest
from pytest_cases import parametrize_with_cases, case, parametrize
class FooCases:
@staticmethod
def case_static():
return 1
@classmethod
def case_class(cls):
return 1
@staticmethod
@case(id="foo")
def case_static_custom_id():
return 1
@staticm... | [
{
"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 | tests/cases/issues/test_issue_168.py | broglep-work/python-pytest-cases |
seq = 'CTTCTCACGTACAACAAAATC'
symbol2number = {"A":0,"C":1,"G":2,"T":3}
def PatternToNumber(Pattern):
if not Pattern:
return 0
symbol = Pattern[-1]
prefix = Pattern[:-1]
return ((4*PatternToNumber(prefix))+symbol2number[symbol])
def NumberToPattern(index, k):
bases = ['A', ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | fasterfrequentwords.py | Zeynep98/Bioinformatics-101 |
from heapq import *
from environment.utils import distance, neighbors, direction
class Node(object):
def __init__(self, position, parent, cost, heuristic):
self.position = position
self.parent = parent
self.cost = cost
self.heuristic = heuristic
def __lt__(self, other):
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 li... | 3 | agents/search/astar.py | jmribeiro/PLASTIC-Algorithms |
import Room
import Constants as c
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located
from selenium.webdriver.firefox.options import Options
class E11_R... | [
{
"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 | rooms/E11_R1.py | stfbnc/TrovaEscapeBackEnd |
#!/bin/python
def is_valid_triangle(edges):
assert len(edges) == 3, "input should have 3 edges"
if edges[0] + edges[1] > edges[2] and edges[0] + edges[2] > edges[1] and edges[1] + edges[2] > edges[0]:
return True
else:
return False
def main():
response = is_valid_triangle([5, 10, 25])... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},... | 3 | day3/solution.py | hejnal/advent-of-code |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import glob
import os.path
import sys
DIR = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(DIR))
SRC_DIR = os.path.join(REPO, "src")
def check_header_files(component):
component_dir = os.path... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | misc/style/check-include-guard-convention.py | nitinkaveriappa/downward |
"""
Prepare transcriptiondata from the transcription sources.
"""
from uritemplate import URITemplate
from clldutils.clilib import ParserError
from csvw.dsv import UnicodeWriter
from pyclts.commands.make_dataset import process_transcription_data
try:
from lingpy.sequence.sound_classes import token2class
from l... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | src/pyclts/commands/make_pkg.py | XachaB/pyclts |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
{
"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 | paddlers/models/ppseg/utils/env/seg_env.py | huilin16/PaddleRS |
from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Diary
class DiaryModelForm(forms.ModelForm):
class Meta:
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'daily_record': forms.Textarea(attrs={'rows': 4, 'class': 'cked... | [
{
"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 | diary/forms.py | j3ygh/ctdb |
from libs import command
from addons.pipes.libs import pipe as pipe_class
import re
class Command(command.DirectOnlyCommand):
'''Authorize other people to modify your pipe
**Usage**
```@Idea authorize <user> for pipe "<name>"```
Where
**`<user>`** is the user you want to add (user mention/ping)
**`<name>`** is th... | [
{
"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 | pipe_auth.py | IdeaBot/pipes |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | examples/text_graph/erniesage/models/loss.py | tanhanzhuo/PaddleNLP |
# --------------------------
# UFSC - CTC - INE - INE5663
# Exercício da Tribo
# --------------------------
# Classe responsável por criar uma tribo
#
from model.tribo import Tribo
from view.paineis.painel_abstrato import PainelAbstrato
class PainelCriaTribo(PainelAbstrato):
def __init__(self, iu):
super... | [
{
"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 | tarefas-poo/lista-03/tribo/view/paineis/painel_cria_tribo.py | victoriaduarte/POO_UFSC |
# 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": "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 | aliyun-python-sdk-reid/aliyunsdkreid/request/v20190928/DescribeOverviewDataRequest.py | LittleJober/aliyun-openapi-python-sdk |
from rich import print
from time import time
from fraction import square_check
t1 = time()
def do_map(dic: dict, word: str):
for ele in dic:
word = word.replace(ele, dic[ele])
return word
squares = [1]
i = 2
while squares[-1] < 10**8:
squares.append(i**2)
i += 1
def square_anagram(word1: ... | [
{
"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 | Solutions/Problem_098.py | PraneethJain/Project-Euler |
import argparse
import pprint
import sys
import torch
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from mtcnn.config import cfg
from mtcnn.datasets.iteration_based_batch_sampler import build_batch_sampler
from mtcnn.datasets.roidb import get_roidb
from mtcnn.engine.trainer impor... | [
{
"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 | tools/train_net.py | tkhe/simple-mtcnn |
import numpy as np
import cross_sections as xs
xs1 = xs.IBeam(1, 1, 0.1, 0.1)
L = 10
p = 1
E = 29000
def constant(x, **kwargs):
return 1
def linearup(s, **kwargs):
return x
load = constant
def simpsons(f, a, b, n): #function, start, stop, intervals
if n % 2 == 0:
h = (b-a)/n
k = 0.0
x = a + h
for i ... | [
{
"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 | Examples/In progress/CEE213 CP4.py | Komutsou/StructPy |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1_subject_access_review_spec.py | Scalr/kubernetes-client-python |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | [
{
"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 | ansible/module_utils/facts/namespace.py | EnjoyLifeFund/macHighSierra-py36-pkgs |
#!/usr/bin/env python
import sys
import argparse
import glob
import os.path
import os
import logging
def parse_args(argv):
parser = argparse.ArgumentParser(description="Summarize inferred FIRE motifs.")
parser.add_argument('-i', '--dir_input', dest='dir_input', type=str)
parser.add_argument('-o', '--fn_o... | [
{
"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 | CODE/parse_motif_summary.py | ygidtu/NetProphet_2.0 |
# -*- encoding: utf-8 -*-
# pylint: disable=E0203,E1101,C0111
"""
@file
@brief Runtime operator.
"""
from scipy.linalg import solve
from ._op import OpRunBinaryNum
from ._new_ops import OperatorSchema
class Solve(OpRunBinaryNum):
atts = {'lower': False,
'transposed': False}
def __init__(self, on... | [
{
"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 | mlprodict/onnxrt/ops_cpu/op_solve.py | xadupre/mlprodict |
""" Maximum Sum of a Circular Sub-array: A circular sub-array is when you connect the last element to first
We have to find sum among all sub arrays, circular and normal"""
"""Solution: """
def max_circular_sum(a) -> int:
n = len(a)
res = a[0]
for i in range(n):
curr_max = a[i]
curr_... | [
{
"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 | Arrays/max_circular_subarray.py | lakshyarawal/pythonPractice |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_chart_combined09.py | hugovk/XlsxWriter |
from flask import Flask, render_template, redirect, flash
app = Flask(__name__)
#Cross Site Request Forgery estämiseen
app.secret_key = "mikalegall"
@app.route('/')
def index():
message = "Tämä viesti on etusivun Flashin jonopuskurista"
flash(message)
return render_template('index.html')
@app.route("/uudelleenoh... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | flash_multiple/hello.py | mikalegall/flask |
#!/usr/bin/python3
from Sprko.ui import arguments, console
from requests import post as sendPostRequest
from urllib3 import disable_warnings
from modules import readData
# skip ssl error
disable_warnings()
msg = console.msg
telegram_config = readData.sender('telegram')
telegram_bot_api = readData.sender('telegr... | [
{
"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 | modules/sender.py | Abdulrahman-Kamel/sprko |
import random
import GenericDummy
class Gas(GenericDummy.GenericDummy):
def __init__(self):
super(Gas, self).__init__()
self.version = '01000000000001010000000000000000'
self.id = 'gassnszeus'
self.name = 'gas'
self.port = 5002
def update_state(self):
i = rando... | [
{
"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 | Dummies/gas.py | GabrielCFigueira/SIRS |
from ourstylePy import data
def our_colours(colours=[]):
'''
Extract hexcodes for our colours
If passed a sting, returns the matching hexcode.
If passed a list, returns a list of hexcodes.
Method from https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2.
- colours, list of... | [
{
"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 | ourstylePy/our_colours.py | PeterGrahamJersey/ourstylePy |
from ..field import StringField, FieldError
class Relation(StringField):
def __init__(self, model, cascade=False, *args, **kwargs):
self._model = model
self._cascade = cascade
super(Relation, self).__init__(*args, **kwargs)
def save(self, model, name):
raise NotImplementedE... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | mintools/ormin/relations/relation.py | bitstein/elements-explorer |
import pytest
from django.contrib import admin
# from sme_material_apps.proponentes.admin import TipoDocumentoAdmin
from sme_material_apps.proponentes.models import TipoDocumento
pytestmark = pytest.mark.django_db
def test_instancia(tipo_documento):
assert isinstance(tipo_documento, TipoDocumento)
assert ti... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | sme_material_apps/proponentes/tests/test_tipo_documento/test_tipo_documento_model.py | luizhpriotto/piloto_apresentacao |
"""
多线程操作共享的全局变量是不安全的,多线程操作局部 只归某个线程私有,其他线程是不能访问的
"""
import threading
def do_sth(arg1, arg2, arg3):
local_var1 = arg1
local_var2 = arg2
local_var3 = arg3
fun1(local_var1, local_var2, local_var3)
fun2(local_var1, local_var2, local_var3)
fun3(local_var1, local_var2, local_var3)
def fun1(loca... | [
{
"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 | 17_process_thread/46_why_need_ThreadLocal.py | hemuke/python |
from sfepy.linalg import norm_l2_along_axis
from quantum_common import common
def fun_v(ts, coor, mode=None, region=None, ig=None):
from numpy import sqrt
if not mode == 'qp': return
out = {}
C = 0.5
r = norm_l2_along_axis(coor, axis=1)
V = - C * 1.0 / r
V.shape = (V.shape[0], 1, 1)
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | examples/quantum/hydrogen.py | olivierverdier/sfepy |
# inspired from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# https://localhost:4443
import http.server, ssl, os
from subprocess import check_call
IP='0.0.0.0'
PORT... | [
{
"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 | serve.py | AlexisTM/FindMyBrick |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('mock_output')
class MockOutput(object):
"""
Debugging plugin which... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | flexget/plugins/output/mock_output.py | sillygreen89/Flexget |
import cv2 as cv
def scale(img, scale):
"""scale preserving aspect ratio"""
return resize(img, x_scale=scale, y_scale=scale)
def resize(img, x_scale, y_scale, optimize=True):
"""resize image by scaling using provided factors"""
interpolation = cv.INTER_LINEAR
# pick an optimized scaler if asked... | [
{
"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 | src/rakali/transforms.py | sthysel/rakali |
from .NNModel import Layer, LayerKind
from .utils import verbose
from keras.models import load_model
from keras.layers import Dense, Activation, Dropout, InputLayer
import tensorflow as tf
def createModelFromKerasModel(m, input_length):
X = tf.placeholder(tf.float32, shape=[None, input_length])
layers = m.lay... | [
{
"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 | nnExplain/kerasUtils.py | xinpl/Polaris |
import unittest
import torch
from models import VanillaVAE
from torchsummary import summary
class TestVAE(unittest.TestCase):
def setUp(self) -> None:
# self.model2 = VAE(3, 10)
self.model = VanillaVAE(3, 10)
def test_summary(self):
print(summary(self.model, (3, 64, 64), device="cpu"... | [
{
"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/test_vae.py | threewisemonkeys-as/PyTorch-VAE |
import poplib
import email
import time
class MailHelper:
def __init__(self, app):
self.app = app
def get_mail(self, username, password, subject):
for i in range(5):
pop = poplib.POP3(self.app.config['james']['host'])
pop.user(username)
pop.pass_(password)
... | [
{
"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 | fixture/mail.py | NinaFilatova/python_training_mantis |
import sqlite3 as sqlite
class ConType:
query = 0
mutation = 1
batch = 2
class DatabaseConnection:
is_batching = False
def __init__(self, database_object: 'MrDatabase', con_type: int=ConType.mutation):
self.database_object = database_object
self.con_type: int = con_type
... | [
{
"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 | mr_database/databaseconnection.py | SorenSeeberg/MrDatabase |
# coding: utf-8
"""
Waitlisted API
Waitlisted API
OpenAPI spec version: 2.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obt... | [
{
"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 | test/test_reservation.py | waitlisted/waitlisted-python |
## Bibliotecas
import RPi.GPIO as GPIO
import time
## Modo da GPIO
GPIO.setmode(GPIO.BCM)
## Definindo os pinos usados
GPIO_TRIGGER = 6
GPIO_ECHO = 5
## Definindo entrada e saida
GPIO.setup(GPIO_TRIGGER, GPIO.OUT)
GPIO.setup(GPIO_ECHO, GPIO.IN)
def med_distancia():
## Inicio de pulso sonoro
GPIO.output(GPIO... | [
{
"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 | 2_PCs/Ponto de controle 2/ultrassom.py | Metalus/Sistemas-Embarcados |
import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
)
if test_config is 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_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | flaskr/__init__.py | EthanKubistek/Flask_Tutorial |
# 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": "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 | aliyun-python-sdk-sae/aliyunsdksae/request/v20190506/DescribeNamespaceResourcesRequest.py | yndu13/aliyun-openapi-python-sdk |
from django.shortcuts import render
from django.http.response import JsonResponse
from rest_framework.parsers import JSONParser
from rest_framework import status
from .models import Scale
from .serializers import ScaleSerializer
from rest_framework.decorators import api_view
APP_NAME="Scale"
@api_view(['GET', 'PO... | [
{
"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 | back/scales/views.py | EDario333/idia |
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import random
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator
notify = directNotify.newCategory('AvatarDNA')
class AvatarDNA:
def __str__(self):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | otp/avatar/AvatarDNA.py | TheFamiliarScoot/open-toontown |
import pytest
def test_get(session, search_filter):
from dispatch.search_filter.service import get
t_search_filter = get(db_session=session, search_filter_id=search_filter.id)
assert t_search_filter.id == search_filter.id
def test_get_all(session, search_filters):
from dispatch.search_filter.servic... | [
{
"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 | tests/search_filter/test_search_filter_service.py | ymatsiuk/dispatch |
"""
MD Analysis
===========
#. :class:`.MDAnalysis`
Class for converting a molecule to and back from an MDAnalysis object.
"""
import logging
from ...utilities import WrapperNotInstalledException
try:
import MDAnalysis as mda
except ModuleNotFoundError:
mda = None
logger = logging.getLogger(__name__)
c... | [
{
"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 | stko/molecular/conversion/md_analysis.py | stevenbennett96/stko |
import graphene
from ..translations.mutations import ShopSettingsTranslate
from .mutations import (
AuthorizationKeyAdd,
AuthorizationKeyDelete,
HomepageCollectionUpdate,
ShopAddressUpdate,
ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
StaffNotificationRecipientCreate,
St... | [
{
"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 | saleor/graphql/shop/schema.py | fooliscool/saleor |
# Copyright (c) 2020 fortiss GmbH
#
# Authors: Patrick Hart
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import pickle
class Tracer:
"""The tracer can be used to log certain values during episodes."""
def __init__(self, states=None, trace_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | bark_ml/commons/tracer.py | bark-simulator/rl |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.