source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... | [
{
"point_num": 1,
"id": "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 | Head/typer.py | D3crypT0r/D3crypt |
from migen import *
from migen.fhdl import verilog
# TODO get this working right
from .context import migen_fsmgen
class Foo(Module):
def __init__(self):
self.s = Signal()
self.counter = Signal(8)
x = Array(Signal(name="a") for i in range(7))
self.submodules += self.test_fsm(self.counter, self.coun... | [
{
"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 | tests/test_migen_fsmgen.py | cactorium/fsm-gen-migen |
import pyperclip
class User:
user_details = []
def __init__(self, account, first_name, last_name, phone_number, email_address, username, password):
self.account = account
self.first_name = first_name
self.last_name = last_name
self.phone_number = phone_number
self.email_... | [
{
"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 | user.py | AugustineOchieng/passwordLocker |
def tokenize(s):
return s.replace('(', ' ( ').replace(')', ' ) ').split()
def read_from(tokens):
if len(tokens) == 0:
raise SyntaxError('unexpected EOF while reading')
token = tokens.pop(0)
if '(' == token:
L = []
while tokens[0] != ')':
L.append(read_from(token... | [
{
"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 | python/parser.py | komi1230/minilisp |
from __future__ import (
absolute_import,
unicode_literals,
)
import functools
def decorated(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
| [
{
"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/sphinx_ext/utils.py | arareko/conformity |
import os, pytest
from pathlib import Path
from ..convertwarp import ConvertWarp
@pytest.mark.parametrize("inputs, outputs", [])
def test_ConvertWarp(test_data, inputs, outputs):
in_file = Path(test_data) / "test.nii.gz"
if inputs is None:
inputs = {}
for key, val in inputs.items():
try:
... | [
{
"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 | pydra/tasks/fsl/utils/tests/test_spec_convertwarp.py | htwangtw/pydra-fsl |
from scipy.io.wavfile import read
import numpy as np
import io
import csv
class TensorFlowPredictor:
def __init__(self, tensorflow_client, config):
self.client = tensorflow_client
self.class_names = self.class_names_from_csv("class_names.csv")
def class_names_from_csv(self, csv_file):
... | [
{
"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/apis/tensorflow/sound-classifier/predictor.py | wja30/cortex_0.31 |
def fabo(num):
def fb(n):
if n <= 0:
print("Enter a valid number")
elif n == 1:
return 0
elif n == 2:
return 1
else:
return(fb(n-1)+fb(n-2))
return num(n)
return fb
@fabo
def fb_num(n):
print(n,"this is t... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | Day-8-assign-1.py | aveline2703/aveline-letsupgrade-python |
import random
def mergeSort(arr):
if len(arr) <= 1:
return arr
half = len(arr) // 2
sortedLeft = mergeSort(arr[:half])
sortedRight = mergeSort(arr[half:])
return mergeSortedArrays(sortedLeft, sortedRight)
def mergeSortedArrays(left, right):
leftIndex, rightIndex = 0 , 0
result = []
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | LeetCode/Session3/mergesort_home.py | shobhitmishra/CodingProblems |
from cls.repository import Repository
from cls.package import Package
from cls.custom_file import CustomFile
class Parser:
def __init__(self,data):
self.data = data
def repositories_from_yaml(self):
key = 'repositories'
repositories = []
data = self.data
for rkey in da... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | bin/cls/parser.py | rongworks/open-gecko-de |
import pytest
import numpy as np
from landlab import RasterModelGrid
from landlab.data_record import DataRecord
grid = RasterModelGrid((3,3))
@pytest.fixture
def dr_time():
time=[0.]
data_vars={'mean_elevation' : (['time'], np.array([100]))}
attrs={'time_units' : 'y'}
return DataRecord(grid=grid,
... | [
{
"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 | landlab/data_record/tests/conftest.py | joeljgeo/landlab |
# -*- coding: utf-8 -*-
"""Click commands."""
import os
from glob import glob
from subprocess import call
import click
HERE = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.join(HERE, os.pardir)
TEST_PATH = os.path.join(PROJECT_ROOT, "tests")
@click.command()
def test():
"""Run the tests."""
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | edurange_refactored/commands.py | kovada06/edurange-flask |
from functools import partial
import pytest
from pytest_factoryboy import register
from tests.factories.entity_factories import (
CreateTodoItemDtoFactory,
TodoItemFactory,
UpdateTodoItemDtoFactory,
)
from tests.factories.utils import make_many
FACTORIES = [
CreateTodoItemDtoFactory,
TodoItemFact... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | tests/integration/api/routers/todo/conftest.py | GArmane/python-fastapi-hex-todo |
import asyncio
import random
async def work(i):
print(await asyncio.sleep(random.randint(0, i)))
result = f'work {i}'
async def main():
# print(work(1),type(work(1)))
# print(asyncio.ensure_future(work(1)),type(asyncio.ensure_future(work(1))))
# tasks = [asyncio.ensure_future(work(i)) for i in r... | [
{
"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 | async/p23.py | ls-2018/tips |
from unittest import TestCase, main
from qiita_core.util import qiita_test_checker
@qiita_test_checker()
class TestSQL(TestCase):
"""Tests that the database triggers and procedures work properly"""
def test_collection_job_trigger_bad_insert(self):
# make sure an incorrect job raises an error
... | [
{
"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 | qiita_db/test/test_sql.py | adamrp/qiita |
from MiniAmazon.models import db
def search_by_name(query):
#Search for the product here
db_query = {'name': query}
matchingproducts = db['products'].find(db_query) # Products is the table/collection. It returns a cursor(pointer).Cursor is a type of Generator.
if matchingproducts:
return list(... | [
{
"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 | models/product.py | KennyLingineni/MiniAmazon |
import sys
import time
import logging
import datetime
from django.db import transaction
from django.utils import timezone
from framework.celery_tasks import app as celery_app
from website.app import setup_django
setup_django()
from osf.models import Session
from scripts.utils import add_file_logger
logger = logging... | [
{
"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 | scripts/clear_sessions.py | gaybro8777/osf.io |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 2
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_7_2
from isi... | [
{
"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 | isi_sdk_7_2/test/test_settings_mappings.py | mohitjain97/isilon_sdk_python |
from src.abstract_load_balancer import AbstractLoadBalancer, LoadBalancerQueue
class RoundRobinLoadBalancer(AbstractLoadBalancer):
def __init__(self, APISERVER, DEPLOYMENT):
self.apiServer = APISERVER
self.deployment = DEPLOYMENT
self.internalQueue = []
def UpdatePodList(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | src/old/round_robin_load_balancer.py | ssupdoc/k8-simulation |
import json
import pickle
from TwitterAPI import TwitterAPI
with open("api_key.json") as json_data:
all_keys = json.load(json_data)
consumer_key = all_keys["consumer_key"]
consumer_secret = all_keys["consumer_secret"]
access_token_key = all_keys["access_token_key"]
access_token_secret = all_keys["a... | [
{
"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 | search_to_follow.py | hallowf/MotivationalBinary |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""
Sent when a user is removed from a guild (leave/kick/ban).
"""
from ..core.dispatch import GatewayDispatch
from ..objects.events.guild import GuildMemberRemoveEvent
from ..utils import Coro
from ..utils.conversion im... | [
{
"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 | pincer/middleware/guild_member_remove.py | shivamdurgbuns/Pincer |
#!/usr/bin/env python3
import swimlane_environment_validator.lib.config as config
import swimlane_environment_validator.lib.log_handler as log_handler
from threading import Thread
from flask import Flask
import click
import ssl
from OpenSSL import crypto, SSL
logger = log_handler.setup_logger()
app = Flask(__name__... | [
{
"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 | swimlane_environment_validator/lib/http_listener.py | swimlane/swimlane-environment-validator |
#!/usr/bin/python3
from login import LoginClass
def get_playlists_recursive(count, reps, user, playlists):
try:
if count > 20:
get_playlists_recursive(count - 20, reps + 1, user, playlists)
playlists += user.get_playlists(playlist_limit=count, offset=(reps * 50))
except ValueError... | [
{
"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 | main.py | bearhudson/PyByeSpotify |
from matrices import Matrix
from tuples import Point
from canvas import Canvas
from colours import Colour
from math import pi
def run():
# our clock face will be drawn in the x-y plane, so z-components will always be 0
WIDTH = 500
HEIGHT = 500
c = Canvas(WIDTH, HEIGHT)
for i in range(12):
... | [
{
"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 | chapters/chap04.py | DatHydroGuy/RayTracer |
from abc import ABC, abstractmethod
import slippy.core as core
from numbers import Number
from slippy.contact._step_utils import make_interpolation_func
class _TransientSubModelABC(core._SubModelABC, ABC):
def __init__(self, name, requires, provides, transient_values, transient_names, interpolation_mode):
... | [
{
"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": true
},
... | 3 | slippy/contact/sub_models/_TransientSubModelABC.py | KDriesen/slippy |
import unittest
from acme import Product
from acme_report import generate_products, adj, name
class AcmeProductTests(unittest.TestCase):
"""Making sure Acme products are the tops!"""
def test_default_product_price(self):
"""Test default product price being 10."""
prod = Product('Test Product')... | [
{
"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 | SprintNour/SprintChallenge/acme_test.py | nouretienne/DS-Unit-3-Sprint-1-Software-Engineering |
#Given two strings that include only lowercase alpha characters, str_1 and str_2,
#write a function that returns a new sorted string that contains any character (only once) that appeared in str_1 or str_2.
def csLongestPossible(str_1, str_2):
concatStr = str_1 + str_2
sortedStr = "".join(sorted(set(concatStr)... | [
{
"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 | I-III.py | Vehmeyer/CS_Problems |
import glob
import os
from typing import Sequence
def get_inputdata_file(name: str) -> str:
return os.path.join(os.path.dirname(__file__), 'inputdata', name)
def get_inputdata_files(pattern: str) -> Sequence[str]:
return glob.glob(os.path.join(os.path.dirname(__file__), 'inputdata', pattern))
| [
{
"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 | test/genl2c/snap/helpers.py | CyanoAlert/xcube |
from threading import Event
class Message:
def __init__(self, timeout=10):
self._ready = Event()
self._timeout = timeout
self._response = None
@property
def result(self):
received = self._ready.wait(timeout=self._timeout)
if not received:
raise MqttErro... | [
{
"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 | python-client/onesaitplatform/mqttclient/utils.py | javieronsurbe/onesait-cloud-platform-clientlibraries |
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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | flaskr/__init__.py | iJKENNEDY/template_flask |
from copy import deepcopy
from quest.quest_manager import QuestManager
import settings
from twitch.channel import Channel
class QuestChannel(Channel):
def __init__(self, owner, channel_manager):
super().__init__(owner, channel_manager)
self.quest_manager = QuestManager(self)
self.mod_co... | [
{
"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 | quest_bot/quest_channel.py | Xelaadryth/Xelabot |
"""Pytest conftest module
In this file you will find all **fixtures** that you are used while running
mgear tests.
Github Actions workflow will run Pytest but because their clusters will not have
Autodesk Maya install / neither PyMel, most of the tests will be skip.
In order to ensure all tests are correctly execute... | [
{
"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/conftest.py | yamahigashi/mgear4 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import os
from os.path import abspath, dirname
from restclients_core.dao import DAO
class Sdbmyuw_DAO(DAO):
def service_name(self):
return 'sdbmyuw'
def service_mock_paths(self):
return [abspath(os.path.jo... | [
{
"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 | uw_sdbmyuw/dao.py | uw-it-aca/uw-restclients-sdbmyuw |
"""lower activites
Revision ID: bcb4dc0e73e2
Revises: 25116bbd585c
Create Date: 2020-10-06 11:34:47.860748
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
# revision identifiers, used by Alembic.
revision = 'bcb4dc0e73e2'
down_revision = '25116bbd585c'
branch_labels = None
depends... | [
{
"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 | migrations/versions/bcb4dc0e73e2_lower_activites.py | betagouv/ecosante |
import random
import math
import numpy as np
from typing import List
class EpsilonGreedy:
def __init__(self, epsilon: float, counts: List[int], values: List[float]):
assert epsilon is None or 0.0 <= epsilon <= 1.0
self.epsilon = epsilon
self.counts = counts
self.values = values
... | [
{
"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 | ReinforcementLearning/Bandit/EpsilonGreedy.py | MitI-7/MachineLearning |
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
from PyQt4.QtCore import QMimeData
from TableModel.TableModel import CTableModel
from Utils.Forcing import forceString
class CDragDropTableModel(CTableModel):
def __init__(self, parent, cols=None, tableName=''):
if cols is None:
cols = []
... | [
{
"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 | DisplayTable/TableModel/DragDropTableModel.py | soltanoff/pyqt_libs |
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
from article.models import Article, Categroy, Tag
from frontuser.models import User, UserExtendsion
def index(request):
user = User(name="小红")
user.save()
category = Categroy(name='中国古典文学')
category.sav... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | django_day05/article/views.py | maoxuelin083/Django-Study |
from django.test import TestCase
from tests.test_app.models import ExampleModel
class ModelTest(TestCase):
def setUp(self) -> None:
super().setUp()
# =======================================================================
# ./manage.py test tests.test_app.tests.test_models.ModelTest --settings=... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | tests/test_app/tests/test_models.py | frankhood/django-activation-model-mixin |
# 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.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_li... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | mcrouter/test/test_miss_on_error_arith_ops.py | yns88/mcrouter |
import click
import os
import kfp
import sys
import yaml
import importlib
import importlib.util
import inspect
from hypermodel.kubeflow.deploy_prod import deploy_to_prod
@click.group()
@click.pass_context
def deploy(ctx):
"""Deploy to Kubeflow"""
pass
@deploy.command()
@click.option("-f", "--file", required... | [
{
"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 | src/hyper-model/hypermodel/cli/groups/deploy.py | GrowingData/hyper-model |
from flask import request, jsonify, session
from app.log import logger
import os
def user_session_check():
if 'username' not in session:
logger.warning('user not login')
return jsonify(status=False, message='user not login', data='')
else:
return None
# 支持跨域
def after_request(resp):
... | [
{
"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 | SA-be/app/route/requestHandler.py | ninanshoulewozaizhe/ShopAccount |
from prj.api import serializers, permissions, authenticators
from rest_framework.views import APIView
from django.contrib.auth.models import User
from rest_framework.response import Response
from rest_framework import viewsets
from django.contrib.auth import login, logout
from rest_framework.permissions import AllowAny... | [
{
"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 | prj/api/views.py | rendrom/django-dynamit |
from beepbot.utils import python3_run
def is_int(d):
int_t = type(0)
return d == int_t
def clear():
python3_run("import board;import neopixel;pixels = neopixel.NeoPixel(board.D18, 16);pixels.fill((0, 0, 0));")
def off():
python3_run("import board;import neopixel;pixels = neopixel.NeoPixel(board.D18, ... | [
{
"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 | build/lib/beepbot/light.py | makebot-lab/beepbot |
from huobi.connection.restapi_sync_client import RestApiSyncClient
from huobi.constant.system import HttpMethod
from huobi.utils import *
from huobi.model.etf import *
class PostEftSwapInService:
def __init__(self, params):
self.params = params
def request(self, **kwargs):
channel = "/etf/s... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answe... | 3 | hb_quant/huobi/service/etf/post_etf_swap_in.py | wenli135/Binance-volatility-trading-bot |
import os
import os.path as osp
from PIL import Image
__all__ = [ "ImageDataset" ]
class ImageDataset:
def __init__(self, root, transform):
self.root = root
self.transform = transform
self.files = [ osp.join(root, f) for f in os.listdir(root) ]
def __len__(self):
return len(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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | data/classification/__init__.py | johnnylord/trytry-segmentation |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is sucessful"""
email = "test@respposta.com"
password = "Test@123"
user = get_us... | [
{
"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 | app/core/tests/test_models.py | adelvanL/recipe-app-api |
from arena import *
import random
scene = Scene(host="arenaxr.org", realm="realm", scene="example")
def click(scene, evt, msg):
if evt.type == "mouseup":
print("mouseup!")
elif evt.type == "mousedown":
print("mousedown!")
@scene.run_once
def main():
my_tet = Tetrahedron(
object_id... | [
{
"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 | examples/attributes/clickable.py | jameszha/ARENA-py |
import sqlite3
class myunfollowersdb:
def __init__(self):
self.connection = sqlite3.connect('database/myunfollowers.db')
self.cursor = self.connection.cursor()
def createTables(self):
self.cursor.execute("""CREATE TABLE "users" (
"userId" INTEGER NOT NULL,
... | [
{
"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 | models.py | rawheel/My_Unfollowers |
import pytest
from helpers.client import QueryTimeoutExceedException, QueryRuntimeException
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance('node')
@pytest.fixture(scope="module")
def start_cluster():
try:
cluster.start()
yield clu... | [
{
"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/integration/test_read_temporary_tables_on_failure/test.py | lizhichao/ClickHouse |
from narrative2vec.logging_instance.logging_instance import LoggingInstance, _get_first_rdf_query_result
from narrative2vec.logging_instance.reasoning_task import ReasoningTask
from narrative2vec.ontology.neemNarrativeDefinitions import QUATERNION
from narrative2vec.ontology.ontologyHandler import get_knowrob_uri
cla... | [
{
"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 | narrative2vec/logging_instance/pose.py | code-iai/narrative2vec |
from django.utils.translation import ugettext as _
from psycopg2 import errorcodes
from sqlalchemy.exc import ProgrammingError
class UserReportsError(Exception):
pass
class UserReportsWarning(Warning):
pass
class TableNotFoundWarning(UserReportsWarning):
pass
class MissingColumnWarning(UserReportsW... | [
{
"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 | corehq/apps/userreports/exceptions.py | dimagilg/commcare-hq |
import os
filename = 'seg-0_0_0.npz'
outputdir = os.getcwd() + os.sep + 'inferred_segmentation'
inputdir = os.getcwd()
import numpy as np
import h5py
import PIL
import PIL.Image
import cv2
import png
def save_tif8(id_data, filename):
cv2.imwrite(filename, id_data.astype('uint8'))
def save_tifc(id_data, fil... | [
{
"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 | postprocessing/npz_to_png.py | urakubo/ffn_windows |
def leiaInt(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('ERRO: Por favor digite um número inteiro válido.')
continue #Para jogar novamente pro while
except KeyboardInterrupt:
print('Usuário preferiu não digitar esse número.')
return 0
else:
return n
def ... | [
{
"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 | Python 3 - Mundo 3/Desafios das Aulas - Mundo 3/Ex115/funcoes.py | Pedro0901/python3-curso-em-video |
from rest_framework import serializers
from apps.currency.models import Currency
class CurrencyWalletSerializer(serializers.ModelSerializer):
actual_nonce = serializers.SerializerMethodField("get_nonce")
def get_nonce(self, wallet):
return wallet.nonce
class Meta:
from apps.wallet.model... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | apps/currency/serializers.py | ecoo-app/ecoo-backend |
# This import verifies that the dependencies are available.
import sqlalchemy_pytds # noqa: F401
from .sql_common import BasicSQLAlchemyConfig, SQLAlchemySource
class SQLServerConfig(BasicSQLAlchemyConfig):
# defaults
host_port = "localhost:1433"
scheme = "mssql+pytds"
def get_identifier(self, sche... | [
{
"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 | metadata-ingestion/src/datahub/ingestion/source/mssql.py | OddCN/datahub |
class Solution(object):
def findSpecialInteger(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
t = len(arr) // 4 + 1
prev, c = arr[0], 1
for i in range(1, len(arr) - 1):
if arr[i] == prev:
c += 1
if c >= t:
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | python/array/1287_element_appearing_more_than_25_percent_in_sorted_array.py | linshaoyong/leetcode |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenServicemarketOrderRejectResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenServicemarketOrderRejectResponse, self).__init__()
def par... | [
{
"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 | alipay/aop/api/response/AlipayOpenServicemarketOrderRejectResponse.py | articuly/alipay-sdk-python-all |
"""
Created on Jan 25, 2017
@author: Martin Vo
"""
import unittest
import numpy as np
from lcc.entities.star import Star
from lcc.stars_processing.deciders.supervised_deciders import QDADec
from lcc.stars_processing.descriptors.abbe_value_descr import AbbeValueDescr
from lcc.stars_processing.descriptors.curves_shap... | [
{
"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/stars_processing/test_params_estim.py | mavrix93/LightCurvesClassifier |
import cv2
from fastai import *
from fastai.vision import *
import imp
import sys
import os
import warnings
from pathlib import Path
warnings.filterwarnings("ignore")
class Mask:
def Determine(path):
prefix=sys.prefix
learn=load_learner(imp.find_module('detect_mask')[1])
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | detect_mask/Mask.py | Jash271/Detect_Mask |
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return self.name
class Category(models.Model):
name = models.CharField(max_length=20)
def __str__(self):
return self.name
class Journal(models.Model):
title = mo... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | core/models.py | danielqiang/CombineSearch |
import coinbase
import os
from coinbase.wallet.client import Client
from coinbase.wallet.model import APIObject
SELL_FEE = 0.0149 #see: https://support.coinbase.com/customer/portal/articles/2109597-buy-sell-bank-transfer-fees
def get_current_gains(user):
api_key, api_secret = os.environ.get(f'API_KEY_{user.upper... | [
{
"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 | gains.py | mehdibaha/daily-crypto |
"""
# cfg-bnf
Entender e reconhecer operações básicas de gramática generativa na notação BNF
* Reconhecer linguagens regulares na forma de gramática livre de contexto.
* Identificar quando uma gramática livre de contexto corresponde a uma linguagem regular.
A regra para "seq" e "block" na gramática do ruspy está inc... | [
{
"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 | test_cfg_bnf.py | LhTaira/ruspy |
import yfinance
class Stock:
__stock_data = None
def __init__(self):
pass
def grab(self):
self.__stock_data = yfinance.download(tickers='BASFY', period='1d', interval='1m')
def to_console(self):
print(self.__stock_data)
| [
{
"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 | StockZ/modules/grabber.py | KKGPW/KPW-StockZ |
from bridges.symbol import *
class Text(Symbol):
def __init__(self, label = None):
super(Text, self).__init__()
if label is not None:
self._text = label
else:
self._text = ""
self.stroke_width = 1.0
self._font_size = None
self._anchor_ali... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | bridges/text.py | BridgesUNCC/bridges-python |
from abc import abstractmethod, ABC
class PrefixOnlyField(ABC):
"""
Interface for fields that only have a prefix.
"""
@abstractmethod
def is_compound(self) -> bool:
pass
@abstractmethod
def get_prefix(self) -> str:
pass
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer"... | 3 | src/wai/common/file/report/_PrefixOnlyField.py | waikato-datamining/wai-common |
from flask import Flask
app = Flask(__name__, static_url_path='', static_folder='static')
app.config['DEBUG'] = True
@app.route('/')
def root():
# Note: this is probably handled by the app engine static file handler.
return app.send_static_file('index.html')
@app.errorhandler(404)
def page_not_found(e):
"""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_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | main.py | rekab/papt |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..resampling import WarpTimeSeriesImageMultiTransform
def test_WarpTimeSeriesImageMultiTransform_inputs():
input_map = dict(args=dict(argstr='%s',
),
dimension=dict(argstr='%d',
position=1,
usedefaul... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | nipype/interfaces/ants/tests/test_auto_WarpTimeSeriesImageMultiTransform.py | mfalkiewicz/nipype |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pjbank.api import PJBankAPI
from pjbank.recebimentos.boleto import Boleto
from pjbank.recebimentos.cartaocredito import CartaoCredito
class ContaDigital(PJBankAPI):
"""docstring for ContaDigital."""
def __init__(self, credencial=None, chave=None, webhook_chav... | [
{
"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 | pjbank/contadigital/__init__.py | pjbank/pjbank-python-sdk |
from scripts.helpers import smart_get_account, LOCAL_BLOCKCHAIN_ENVIRONMENTS, approve_transfer
from scripts.runAstroSwap import deploy_erc20
from brownie import network, accounts, config, MiniSwap, MockERC20
from brownie.network.contract import Contract
fee = 400
def deploy_mini_swap(fee):
account = smart_get_acc... | [
{
"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 | brownie/scripts/runMiniSwap.py | SuperZooper3/AstroSwap |
import tldextract as tld
import string
import random
import starlette.status as status
import os
import os.path as path
from pathlib import Path
from fastapi import FastAPI, Request, UploadFile
from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.templating import Jinja2Templates
from fastapi.stat... | [
{
"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 | dsapps/wordcloud/app.py | mjsmagalhaes/examples-datascience |
#!/usr/bin/env python3
import codecs
import hashlib
import random_tweets
import requests
import sys
def make_fingerprint(url):
host = requests.urllib3.util.url.parse_url(url).host
if host is None:
host = '-INVALID-'
fingerprint = hashlib.md5(host.encode('utf-8')).hexdigest()
comment = codecs.... | [
{
"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 | make_fingerprint.py | BenWiederhake/random_tweets |
import re
import sys
import requests
import threading
from JShoter.core.args import web_url
from concurrent.futures import ThreadPoolExecutor
from bs4 import BeautifulSoup
from JShoter.core.colors import GRAY, GRAY, RED, RESET, GREEN
html = requests.get(web_url).content
soup = BeautifulSoup(html, "html.parser")
js_fi... | [
{
"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 | JShoter/__main__.py | DevanshRaghav75/jshoter |
from keras.layers import Input
from keras import backend as K
from keras.engine.topology import Layer
import numpy as np
class NonMasking(Layer):
def __init__(self, **kwargs):
self.supports_masking = True
super(NonMasking, self).__init__(**kwargs)
def build(self, input_shape):
input_sh... | [
{
"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 | matchzoo/layers/NonMasking.py | ChangQF/MatchZoo |
from typing import List, Tuple
import aiosqlite
from venidium.types.blockchain_format.sized_bytes import bytes32
from venidium.util.db_wrapper import DBWrapper
import logging
log = logging.getLogger(__name__)
class HintStore:
coin_record_db: aiosqlite.Connection
db_wrapper: DBWrapper
@classmethod
as... | [
{
"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 | venidium/full_node/hint_store.py | Venidium-Network/venidium-blockchain |
from itertools import cycle
def rail_pattern(n):
r = list(range(n))
return cycle(r + r[-2: 0: - 1])
def encode(a, b):
p = rail_pattern(b)
# this relies on key being called in order, guaranteed?
return ''.join(sorted(a, key=lambda i: next(p))).replace(" ", "_")
def decode(a, b):
p = rail_pa... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/test/java/ee/taltech/arete/initializers/cipher.py | envomp/arete |
from django import VERSION
if VERSION < (1, 5):
from django.conf.urls.defaults import patterns, url # noqa
elif VERSION < (1, 8):
from django.conf.urls import patterns, url # noqa
else:
from django.conf.urls import url # noqa
patterns = None
try:
# Django 1.7 or over use the new application lo... | [
{
"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 | autocomplete_light/compat.py | julyzergcn/django-autocomplete-light-2.3.3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"point_num": 1,
"id": "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 | karbor-1.3.0/karbor/i18n.py | scottwedge/OpenStack-Stein |
import unittest
from streamlink.plugins.turkuvaz import Turkuvaz
class TestPluginTurkuvaz(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
'http://www.atv.com.tr/a2tv/canli-yayin',
'https://www.atv.com.tr/a2tv/canli-yayin',
'https://www.atv.com.tr/we... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/plugins/test_turkuvaz.py | hitrow/streamlink |
from __future__ import print_function
from exodus import BaseMigration
class Migration(BaseMigration):
version = '2015_10_10'
def can_migrate_database(self, adapter):
return self.version > adapter.db.get('version', None)
def migrate_database(self, adapter):
# migrate the keys
ada... | [
{
"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/migrations/2015_10_10_move_keys.py | adamlwgriffiths/exodus |
from __future__ import annotations
import re
import pkg_resources
VERSION_FORMAT = re.compile('([0-9]+)\\.([0-9]+)\\.([0-9]+)')
class Version(object):
def __init__(self, major: int, minor: int, revision: int):
self.major = major
self.minor = minor
self.revision = revision
def __str__... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | cowait/utils/version.py | ProgHaj/cowait |
import tensorflow as tf
import numpy as np
def body(x):
a = tf.random_uniform(shape=[2, 2], dtype=tf.int32, maxval=100)
b = tf.constant(np.array([[1, 2], [3, 4]]), dtype=tf.int32)
c = a + b
return tf.nn.relu(x + c)
def condition(x):
return tf.reduce_sum(x) < 100
x = tf.Variable(tf.constant(0, ... | [
{
"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 | 08_midi_generate/test.py | bnusss/tensorflow_learning |
from ..models.producto import Producto
from rest_framework import serializers, viewsets
from rest_framework import permissions
from django.db.models import Q
from operator import __or__ as OR
from functools import reduce
class ProductoSerializer(serializers.ModelSerializer):
class Meta:
model = Producto
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | catalogo/views/producto_view.py | davquipe/farm-server |
from defs import *
__pragma__('noalias', 'name')
__pragma__('noalias', 'undefined')
__pragma__('noalias', 'Infinity')
__pragma__('noalias', 'keys')
__pragma__('noalias', 'get')
__pragma__('noalias', 'set')
__pragma__('noalias', 'type')
__pragma__('noalias', 'update')
def make_parts(max_energy):
parts = [CARRY, 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/bots/tower_bro.py | ForgedSnow/ScreepsPython |
import h3.api.basic_str as h3
def test1():
assert h3.geo_to_h3(37.7752702151959, -122.418307270836, 9) == '8928308280fffff'
def test5():
expected = {
'89283082873ffff',
'89283082877ffff',
'8928308283bffff',
'89283082807ffff',
'8928308280bffff',
'8928308280ffff... | [
{
"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 | tests/test_basic_str.py | SaveTheRbtz/h3-py |
# https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/
import unittest
from typing import List
import common
class Solution:
def maxProfit(self, prices: List[int]) -> int:
return self._helper(prices)
def _helper(self, prices):
return common.Solution().maxProfit(2, prices)
cl... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": fals... | 3 | stocks/test_123.py | JackieMa000/problems |
from typing import List, Callable
from autumn.curve import scale_up_function
def get_importation_rate_func_as_birth_rates(
importation_times: List[float],
importation_n_cases: List[float],
detect_prop_func,
starting_pops: list,
):
"""
When imported cases are explicitly simulated as part of the... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | apps/covid_19/preprocess/importation.py | malanchak/AuTuMN |
import pandas as pd
import psycopg2
import os
from dotenv import load_dotenv
load_dotenv()
# read in our data
df = pd.read_csv('./titanic.csv')
print(f"DF shape: {df.shape}")
# create connection to db we want to move the data to
conn = psycopg2.connect(
host=os.getenv('DB_HOST'),
dbname=os.getenv('DB_USER')... | [
{
"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 | module2-sql-for-analysis/insert_titantic.py | bendevera/DS-Unit-3-Sprint-2-SQL-and-Databases |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: logger
Description :
Author : Liangs
date: 2019/7/28
-------------------------------------------------
Change Activity:
2019/7/28:
-----------------------------------------------... | [
{
"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 | PyToolkit/logger.py | LiangsLi/PyToolkit |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
"""Tests for database"""
def test_wait_for_db_ready(self):
"""Test waiting for db when db is available"""
... | [
{
"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 | app/core/tests/test_commands.py | malinovka/recepe-app-api |
import frappe
from frappe.modules.import_file import import_file_by_path
from frappe.utils import get_bench_path
import os
from os.path import join
def after_migrate(**args):
callyzer_integration_create_custom_fields(**args)
def callyzer_integration_create_custom_fields(**args):
from frappe.custom.doctype.cus... | [
{
"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 | callyzer_integration/migrations.py | ashish-greycube/callyzer_integration |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Manipulate the global config file
"""
import json
import logging
config_file = "/etc/wlanpi-chat-bot/config.json"
logging.basicConfig(level=logging.INFO)
class_logger = logging.getLogger("Config")
class Config(object):
"""
Manipulate the global config file
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | chatbot/utils/config.py | WLAN-Pi/wlanpi-chat-bot |
import os
#required for python 2.7 & >=3.3
import json
from jinja2 import Template
from PIL import Image
import operator
directory_path = os.getcwd()
DATA_DIR = 'data'
RML_DIR = 'rml'
class Chord(object):
"Empty class to hold parsed chord attributes"
pass
def parse_chords(filename):
chords = []
with ... | [
{
"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 | chord_book.py | personalnadir/Chord-Of-the-Week |
from pdpf import *
from pyspark.sql.types import StructField, StructType, StringType
class M1(PdpfSparkDfMod):
def requiresDS(self):
return []
def run(self, i):
schema = StructType([ StructField('str', StringType(), False) ])
df = self.pdpfCtx.sparkSession.createDataFrame(
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/test/python/testIoStrategy/project2/modules.py | ninjapapa/PDPF |
#!/usr/bin/env python3
"""
(C) Copyright 2018-2022 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import re
def extract_redundancy_factor(oclass):
"""Extract the redundancy factor from an object class.
Args:
oclass (str): the object class.
Returns:
int: the redu... | [
{
"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 | src/tests/ftest/util/oclass_utils.py | cibervicho/daos |
# just for fun, give channel some meanings about relations
# between positions.
from modules import *
from torch import tensor
import torch
import numpy as np
import torch.nn.functional as F
from torch import nn
class Group(nn.Module):
"""
resblocks with same input and output size.
"""
def __init__(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | Chanet.py | ParadoxZW/CIFAR100-PRACTICE |
from django.shortcuts import get_object_or_404
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from events.models import Event
from events.serializers import EventSerializer
from tickets.serializers import TicketAvailabilitySerializer
clas... | [
{
"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 | ticket_selling/events/views.py | noxITRS/ticket_selling |
from django.db import models
from django.urls import reverse
from django.conf import settings
from django.contrib.auth.models import User
import datetime
class Info_Article(models.Model):
title = models.CharField(
max_length=30,
verbose_name='제목'
)
author = models.ForeignKey(User, on_dele... | [
{
"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 | InformationBoard/models.py | insung151/Pwannar |
import typing
import dataclasses as dc
from .common import AuthorizationBase
from .._api_base import RawClient, ApiStorage
from .._http import Request, Response, RequestMakerBase, RequestMiddlewareBase
@dc.dataclass
class SessionIdAuthorization(AuthorizationBase, RequestMiddlewareBase):
session_id: str
yandex... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | yah/auth/session_id.py | sunsx0/yah |
#! /usr/bin/env python
import sys
import numpy as np
from sensor_msgs.msg import Image
def imgmsg_to_cv2(img_msg):
if img_msg.encoding != "bgr8":
rospy.logerr("This Coral detect node has been hardcoded to the 'bgr8' encoding. Come change the code if you're actually trying to implement a new camera")
d... | [
{
"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 | notcv_bridge.py | Prakadeeswaran05/Simple-Tf-ObjectDetection-SemanticSegmentation-ROS |
""" Module for serving static files. """
from flask import send_from_directory
def serve_index():
"""
Serves `index.html` for root endpoints.
"""
return send_from_directory('../client', 'index.html')
def serve_files(path):
"""
Serves files using the path provided.
Args:
path (st... | [
{
"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 | server/views/home.py | ArnavChawla/requests |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.