source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import pytest
from year_2020.day13.shuttle_search import (
get_bus_id_times_wait_time,
get_earliest_bus_and_wait_time_for_airport,
get_shuttle_company_solution,
)
TEST_INPUT = """
939
7,13,x,x,59,x,31,19
"""
TEST_INPUT_2 = """
0
17,x,13,19
"""
TEST_INPUT_3 = """
0
67,7,59,61
"""
TEST_INPUT_4 = """
0
67... | [
{
"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 | year_2020/day13/test_day13.py | mjalkio/advent-of-code |
import numpy as np
from pymoo.performance_indicator.igd import IGD
from pymoo.util.misc import to_numpy
from pymoo.util.normalization import normalize
from pymoo.util.termination.sliding_window_termination import SlidingWindowTermination
class DesignSpaceToleranceTermination(SlidingWindowTermination):
def __ini... | [
{
"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 | pymoo/util/termination/x_tol.py | gabicavalcante/pymoo |
"""
This file can only be run as a module.
In the root directory run python tests.test_fft
"""
import os, sys
import pytest
from src import fft # fft has been imported in __init__.py in src
def test_basic():
print(fft([1,2,3,4,5,6,7,8]))
def announce(test="basic"):
print(f"package name: {__package__}")
... | [
{
"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 | tests/test_fft.py | YunyyYY/fast-fourier-transform |
from logging_module import Logger
from random import randint
class ProxyPool(object):
def __init__(self, *proxies):
self.logger = Logger.get_logger()
self.proxies = []
for proxy in proxies:
self.add_proxy(proxy)
def add_proxy(self, proxy):
if proxy.is_alive():
... | [
{
"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 | proxies/proxy_pool.py | azraeljack/Image-Scrapper |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def display00():
return 'Heya! </br> This is the first page! </br> Others are at: /01 /02'
@app.route('/01')
def display01():
return 'And now: The second page!'
@app.route('/02')
def display02():
return 'Woah! The last page!'
if __name__ == ... | [
{
"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 | AllRoutesLeadToRome/app.py | kkhan01/softdev |
from torch.nn.utils import clip_grad
from cd_core.runners import Hook,HOOKS
@HOOKS.register_module()
class OptimizerHook(Hook):
def __init__(self, grad_clip=None):
self.grad_clip = grad_clip
def clip_grads(self, params):
params = list(
filter(lambda p: p.requires_grad and p.grad i... | [
{
"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 | cd_core/runners/hooks/optimizer.py | shinianzhihou/change_detection.pytorch |
# source: https://moneroexamples.github.io/python-json-rpc/
'''
Usage: python3 miner.py [blocks to mine] [wallet address] [port]
'''
import sys
import requests
import json
# execute an rpc request
def execute_rpc(inputs, port):
return requests.post(
"http://localhost:"+port+"/json_rpc", # node is running ... | [
{
"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 | scripts/miner.py | sorleone/monero |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0
from isi... | [
{
"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 | isi_sdk_8_0/test/test_worm_settings.py | mohitjain97/isilon_sdk_python |
import json
import requests
import sys
import datetime
unix_epoch = datetime.datetime(1970, 1, 1)
BASE_API_URL = "https://api.pushshift.io"
SUBMISSION_API_URL = "/reddit/search/submission/"
COMMENT_API_URL = "/reddit/search/comment/"
def search_subs_reddit(**kwargs):
request = requests.get(BASE_API_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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | crawler/get_reddit.py | emirunlu/crypto-sentimental-analysis |
import timeit
from socket import socket
from termcolor import colored
def print_memoryview():
data = b'shave and a haircut, two bits'
view = memoryview(data)
chunk = view[12:19]
print(colored(f'chunk: {chunk}', 'green'))
print(colored(f'size: {chunk.nbytes}', 'green'))
print(colored(f'view da... | [
{
"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 | com/shbak/effective_python/_01_example/_74_memoryview_bytearray/main.py | sanghyunbak/effective_python |
import pytest
from trydjango.users.models import User
from trydjango.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"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 | trydjango/conftest.py | vincentsjtu/learn |
import pandas as pd
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def df_summary (df):
info = df.info()
describe = df.describe()
nulls = df.isnull().sum()/len(df)*100
value_count = df.value_counts()
... | [
{
"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 | summarize.py | ljackson707/clustering-exercises |
import pytest
from pandas_visual_analysis import DataSource
from pandas_visual_analysis.widgets import BaseWidget
from tests import sample_dataframes
@pytest.fixture(scope="module")
def small_df():
return sample_dataframes.small_df()
# for coverage
def test_base_widget_abstract_methods(small_df):
BaseWidg... | [
{
"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/widgets/test_base_widget.py | rishigarg94/pandas-visual-analysis |
from Base.Base import Base
import Page
'''
首页操作
'''
class xx_course_Page(Base):
def __init__(self, driver):
Base.__init__(self, driver)
def for_click_sy_element(self):
"""
循环点击首页元素
:return:
"""
self.click_elements(Page.sy_login_lsit_fun(), 3)
def click_sy... | [
{
"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 | Page/home_page.py | Sanmejie/my_app_test |
import info
class subinfo(info.infoclass):
def setTargets(self):
self.versionInfo.setDefaultValues()
self.description = "the KDE terminal emulator"
self.defaultTarget = 'master'
def setDependencies(self):
self.buildDependencies["virtual/base"] = None
self.buildDepende... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | kde/applications/konsole/konsole.py | Inokinoki/craft-blueprints-kde |
#!/usr/bin/python
# vector_comp.py
#
# Author: Nick Shelly, Spring 2013
# Description:
# - Loads SNAP as a Python module.
# - Randomly generates Python types
# - Compares conversion of Python types to SNAP types:
# 1. Python instantiation of SNAP type
# 2. Passing Python objects to SWIG ... | [
{
"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 | test/vector_comp.py | Cam2337/snap-python |
from __future__ import absolute_import
from __future__ import division
from torchvision.transforms import *
from PIL import Image
import random
import numpy as np
class Random2DTranslation(object):
"""
With a probability, first increase image size to (1 + 1/8), and then perform random crop.
Args:
-... | [
{
"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 | transforms.py | bigh2000/reid |
from fabric.api import *
from fabric import colors
from fabric.contrib.files import exists
from fabric.operations import _prefix_commands, _prefix_env_vars, require
import os
import slack
PROJECT_NAME = "Divante.com PWA Book"
STAGES = {
"test": {
"name": "Test",
"hosts": [os.environ['TEST_HOST']],... | [
{
"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 | scripts/deploy/fabfile.py | DivanteLtd/pwa-book |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq_mod.data import LanguagePairDataset, TokenBlockDataset
from fairseq_mod.data.concat_dataset import ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | utils/fairseq_mod/tests/test_concat_dataset.py | saidineshpola/Knowledge-Distillation-Toolkit |
"""
1、case顺序:加-除-减-乘
2、fixture方法在case前打印【开始计算】,结束后打印【计算结束】
3、fixture方法存在在conftest.py,设置scope=module
4、控制case只执行顺序为:加-减-乘-除
5、结合allure生成本地测试报告
"""
import allure
import pytest
import yaml
from test_Calculator.src.calculator import Calculator
def get_data():
with open('./data.yml') as data_x:
data = yaml.saf... | [
{
"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 | test_Calculator/testing/test_cal_plus.py | XuXuClassMate/My_Test_PyProject |
# Copyright 2018 ICON Foundation
#
# 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 writi... | [
{
"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 | iconrpcserver/utils/__init__.py | icon-project/icon-rpc-server |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | [
{
"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 | src/api/dataflow/udf/handlers/bksql_function_debug_log.py | Chromico/bk-base |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox(capabilities={"marionette": Fa... | [
{
"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 | fixture/application.py | oksanacps/python_for_testing |
from flowy.swf.decision import task_key, timer_key
class SWFExecutionHistory(object):
def __init__(self, running, timedout, results, errors, order):
self.running = running
self.timedout = timedout
self.results = results
self.errors = errors
self.order_ = order
def is_r... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | flowy/swf/history.py | severb/flowy |
import inspect
def arg_list(fn):
return list(inspect.signature(fn).parameters.keys())
def calling_module():
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
return mod
def calling_module_name():
mod = calling_module()
return mod.__name__
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | holoniq/utils/helpers.py | stevej2608/dash-spa |
import numpy as np
from basic.types import vector, matrix
from typing import Optional
from basic.tests import dt
# print(dt)
# print(dt.mean(axis=0))
_ptr = np.array([1, 1, 4, 4, 8])
# print(dt - _ptr)
def _is_broadcastable(x: matrix, _x: vector) -> Optional[TypeError]:
if x.shape[1] != _x.shape[0]:
r... | [
{
"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 | core/nearest.py | CubicZebra/anomalydetect |
def print_two(*args):
arg1, arg2 = args
print ("arg1: %r, arg2: %r" % (arg1, arg2))
def print_two_again(arg1, arg2):
print ("arg1: %r, arg2: %r" % (arg1, arg2))
def print_one(arg1):
print ("arg1: %r" % arg1)
def print_none():
print ("I got nothin'.")
print_two ("Zed", "Shaw")
print_two_again("Zed... | [
{
"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 | Ex18.py | Ma-Min-Min/coding-sprint |
class IFormatProvider:
""" Provides a mechanism for retrieving an object to control formatting. """
def GetFormat(self,formatType):
"""
GetFormat(self: IFormatProvider,formatType: Type) -> object
Returns an object that provides formatting services for the specified type.
formatType: An... | [
{
"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": true
}... | 3 | release/stubs.min/System/__init___parts/IFormatProvider.py | htlcnn/ironpython-stubs |
from os import path
from pathlib import Path as path_lib
import json
class LanguageManager(object):
def __init__(self):
self._path_to_language_file = 'config/languageConfig.json'
def get_languages(self):
languages = []
language_file_path = path.join(
path.dirname(path.... | [
{
"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 | models/languageManager.py | falconsmilie/Raspberry-Pi-3-Weather |
import functools
import tornado.ioloop
import tornado.options
import tornado.web
from tornado_swagger.setup import setup_swagger
class ExampleHandler(tornado.web.RequestHandler):
@functools.lru_cache()
def get(self, organization):
"""
Description end-point
---
tags:
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
... | 3 | examples/decorated_handlers.py | samiro/tornado-swagger |
import sigauth.middleware
from django.conf import settings
from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class SignatureCheckMiddleware(sigauth.middleware.SignatureCheckMiddlewareBase):
secret = settings.SIGNATURE_SECRET
def should_check(self, request):
if ... | [
{
"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 | core/middleware.py | uktrade/directory-api |
# File to hold all objects to ease construction of JSON payload.
# Non-PEP8 property declaration used as JSON serializing is 1:1, eg. "clientId = clientId", not "client_id = clientId"
class Client(object):
clientId = ""
clientVersion = "0.0.1"
def __init__(self, client_id, client_version="0.0.1"):
... | [
{
"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 | google_safe_browsing/komand_google_safe_browsing/util/objects.py | GreyNoise-Intelligence/insightconnect-plugins |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def to_hot_encoding(datos,caracteristicas_categoricas):
for cat in caracteristicas_categoricas:
one_encoding=pd.get_dummies(datos[cat],prefix=cat)
datos=pd.concat([datos,one_encoding],axis=1)
del datos[cat]
r... | [
{
"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 | scripts/Introduccion/utiles.py | pvalienteverde/MeetUpIntroMLySistemasRecomendacion |
import os
import time
import subprocess
from argparse import ArgumentParser
import yaml
import tkinter as tk
from tkinter import filedialog
from unsup_spatial_pred import run_experiment
def check_directory(directory):
if not os.path.exists(directory):
root = tk.Tk()
root.withdraw()
directo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | examples/run.py | alaflaquiere/unsupervised-spatial-predictor |
from django.db import models
from daiquiri.core.managers import AccessLevelManager
from daiquiri.jobs.managers import JobManager
class QueryJobManager(JobManager):
def get_size(self, user):
# get the size of all the tables of this user
return self.filter_by_owner(user).exclude(phase=self.model.P... | [
{
"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 | daiquiri/query/managers.py | agy-why/daiquiri |
# coding=utf-8
#
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis-python
#
# Most of this work is copyright (C) 2013-2018 David R. MacIver
# (david@drmaciver.com), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may ho... | [
{
"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 | pyta/hypothesis/extra/django/__init__.py | AbChatt/Tweet-Analyser-Python |
# Copyright (c) 2022 Massachusetts Institute of Technology
# Usage:
#
# python project_tooling/add_header.py
#
import fileinput
import os
import os.path as path
from pathlib import Path
OLD_HEADER = "# Copyright (c) 2021 Massachusetts Institute of Technology"
NEW_HEADER = "# Copyright (c) 2021 Massachusetts Institut... | [
{
"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 | project_tooling/add_header.py | Jasha10/hydra-zen |
"""
This module will run as an independent thread and acts as a wrapper to orchestrate the training, testing, etc.
Supervised training is coordinated here
"""
from queue import Queue
from threading import Thread
from inf import runtime_data
def initialize():
return
class Controller:
def __init__(self):
... | [
{
"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 | src/edu/edu_controller.py | feagi/feagi-core |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20180510/DescribeCdnHttpsDomainListRequest.py | yndu13/aliyun-openapi-python-sdk |
import os
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from multiprocessing import Process
def startTensorboard(logdir):
# Start tensorboard with system call
os.system("tensorboard --logdir {}".format(logdir))
def fitModel():
# Create your m... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_basic.py | mustafamerttunali/Tensorflow-Training-GUI |
# 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-ram/aliyunsdkram/request/v20150501/ListPoliciesForGroupRequest.py | DataDog/aliyun-openapi-python-sdk |
from intake.source.base import DataSource, Schema
import rasterio
import xarray as xr
import warnings
# from . import __version__
class quest_gdal_base(DataSource):
"""Reads an HDF5 table
Parameters
----------
path: str
File to load.
tablename: str
Name of table to load.
metad... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | intake_questgdal/base.py | Aquaveo/intake_questgdal |
from solutions.SUM import sum_solution
class TestSum():
"""Class to test sum_solution"""
def test_sum(self):
"""Happy path test"""
assert sum_solution.compute(1, 2) == 3
def test_check_bounds(self):
"""Raise value error if integer passed in is out of limit"""
try:
... | [
{
"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 | test/solution_tests/SUM/test_sum.py | DPNT-Sourcecode/CHK-ncxx01 |
from ..api import rule
from ..api._endpoint import ApiEndpoint, maybe_login_required
from ..entities._entity import NotFound
from ..entities.commit import Commit, CommitSerializer
class CommitListAPI(ApiEndpoint):
serializer = CommitSerializer()
@maybe_login_required
def get(self):
"""
--... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | conbench/api/commits.py | jonkeane/conbench |
from security_communication.secure_communication_protocol import SecureCommunicationProtocol
class SecurityProtocol(SecureCommunicationProtocol):
communication_protocol = None
def __init__(self, config, communication_protocol, send_callback = None, receive_callback = None):
super(SecurityProtocol, self).__init... | [
{
"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 | security_communication/security/security_protocol.py | rakibulmdalam/IOT-Hardware-Abstraction-Layer |
from hazelcast.protocol.codec import \
semaphore_acquire_codec, \
semaphore_available_permits_codec, \
semaphore_drain_permits_codec, \
semaphore_init_codec, \
semaphore_reduce_permits_codec, \
semaphore_release_codec, \
semaphore_try_acquire_codec
from hazelcast.proxy.base import PartitionS... | [
{
"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 | containers/shiva/hazelcast/proxy/semaphore.py | LifeDJIK/S.H.I.V.A. |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_axis19.py | edparcell/XlsxWriter |
import torch
import torchvision.transforms as T
import numpy as np
import cv2
from PIL import Image
import matplotlib as mpl
import matplotlib.cm as cm
def visualize_depth(depth, cmap=cv2.COLORMAP_JET):
"""
depth: (H, W)
"""
x = depth.astype(np.uint8)
x_ = Image.fromarray(cv2.applyColorMap(x, cmap... | [
{
"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 | src/utils/torchvision_utils.py | likojack/bnv_fusion |
"""Interact with the Censys Seeds, Assets, and Logbook APIs."""
from typing import Optional
from .assets import CertificatesAssets, DomainsAssets, HostsAssets, SubdomainsAssets
from .clouds import Clouds
from .events import Events
from .risks import Risksv1, Risksv2
from .seeds import Seeds
class AsmClient:
"""C... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | censys/asm/client.py | FantasqueX/censys-python |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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 l... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | test/test_node_drives_node_drive.py | Atomicology/isilon_sdk_python |
#!/usr/bin/env python3
# encoding: utf-8
import sys
import npyscreen
from requests import get
import inputForm
import profileSelector
# GLOBALS ATTRIBUTES
APP = None
GATEWAY = None
THREADS = list()
VM = None
VMs = None
SECURITY_GROUP = None
SECURITY_RULE = None
IP = get("https://api.ipify.org").text
# Because it's 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/main.py | outscale-rjt/osc-tui |
from .compiler import Compiler
import colorama
import ctypes
import glob
import os
import sys
colorama.init()
def write(t):
print("\033[22;37m"+t,end="")
def write_warn(w):
print("\033[2;33m"+w,end="")
def write_error(e):
print("\033[2;31m"+e,end="")
if ("--compile" in sys.argv):
sys.argv=sys.argv[1:]
D=(... | [
{
"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 | CPL/__main__.py | Krzem5/Python-Launguage |
# 1. Math greatest common divisor (GCD)
def canMeasureWater(self, jug1Capacity: int, jug2Capacity: int, targetCapacity: int) -> bool:
def gcd(x: int, y: int) -> int:
if x < y :
x, y = y, x
while x != y and y != 0 :
remainder = x % y
x = y... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | Problems/Breadth-FirstSearch/Medium/WaterJugProblem/water_and_jug_problem.py | dolong2110/Algorithm-By-Problems-Python |
#!/usr/bin/env python
# coding: utf-8
from hubblestack.utils.platform import is_windows
from hubblestack.utils.user import get_user
from hubblestack.utils.files import remove
def test_run(__mods__):
"""
test return of whoami in both safecommand module and run_catchlog
"""
if not is_windows():
... | [
{
"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 | tests/unittests/modules/test_run_catchlog.py | grogsaxle/hubble |
from Camera import CameraController
import time
import cv2
class CameraStream:
def __init__(self, resolution=(320,240), framerate=32):
self.stream = CameraController()
def start(self):
return self.stream.start()
def stop(self):
return self.stream.stop()
def display(self):
end_time = time.time() + 10
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | src/main/python/wrappers/camera/CameraStream.py | jjoyce0510/autonomous-shipping-vessel |
import unittest
from singer_encodings import csv
class TestRestKey(unittest.TestCase):
csv_data = [b"columnA,columnB,columnC", b"1,2,3,4"]
def test(self):
row_iterator = csv.get_row_iterator(self.csv_data)
rows = [r for r in row_iterator]
self.assertEqual(rows[0]['_sdc_extra'], ['4'])... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | tests/test_csv.py | pnispel/singer-encodings |
class Xpath(object):
def __init__(self):
self._config = []
self._children = []
self._mode = 'normal'
@property
def config(self):
return self._config
| [
{
"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 | ixnetwork_restpy/xpath.py | Vibaswan/ixnetwork_restpy |
class UserError(RuntimeError):
pass
class CommunicationError(RuntimeError):
pass
class ProtocolError(RuntimeError):
pass
class ManagementError(ProtocolError):
def __init__(self, msg: str, script: str, out: str, err: str):
super().__init__(self, msg)
self.script = script
sel... | [
{
"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 | thonny/vendored_libs/pipkin/common.py | kr-g/thonny |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | kubernetes_asyncio/test/test_storage_v1alpha1_api.py | aK0nshin/kubernetes_asyncio |
class Student:
def __init__(self):
self.surname = None
self.name = None
self.patronymic = None
self.age = 19
self.birthday = None
self.group = None
class Teacher:
def __init__(self):
self.surname = None
self.name = None
self.patronymic = ... | [
{
"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 | 201005/home_task.py | Floou/python-basics |
from flask import Flask, redirect
from flask import request
import json
from flask_cors import cross_origin
from flask_cors import CORS
import requests
app = Flask(__name__)
CORS(app, supports_credentials=True)
@app.route('/')
def hello_world():
return redirect('/static/index.html')
@app.route("/api/v1/ttjj/t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | app.py | objcat/test-html |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | aliyun-python-sdk-rds/aliyunsdkrds/request/v20140815/SwitchDBInstanceChargeTypeRequest.py | xiaozhao1/aliyun-openapi-python-sdk |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import onnx
from ..base import Base
from . import expect
class Flatten(Base):
@staticmethod
def export():
shape = (2, 3, 4, 5)
... | [
{
"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 | onnx/backend/test/case/node/flatten.py | okdshin/onnx |
class InitCommands(object):
COPY = 'copy'
CREATE = 'create'
DELETE = 'delete'
@classmethod
def is_copy(cls, command):
return command == cls.COPY
@classmethod
def is_create(cls, command):
return command == cls.CREATE
@classmethod
def is_delete(cls, command):
... | [
{
"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 | platform/core/polyaxon/polypod/templates/init_containers.py | hackerwins/polyaxon |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | isi_sdk_8_2_0/test/test_sync_policy_extended.py | mohitjain97/isilon_sdk_python |
"""calculate values need in function cv2.putText"""
# python libs
from math import floor
# external libs
import cv2
# internal libs
from Show_Images_Differences.add_text_to_image.helpers.utils import give_pad_value
def calculate_text_values(
img_h,
img_w,
text_description,
font, thi... | [
{
"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": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | Show_Images_Differences/add_text_to_image/helpers/calculate_text_values.py | Luk-kar/Show_Images_Differences |
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
from checkov.common.models.enums import CheckCategories
class S3BlockPublicPolicy(BaseResourceValueCheck):
def __init__(self):
name = "Ensure S3 bucket has block public policy enabled"
id = "CKV_AWS_54"
... | [
{
"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 | checkov/terraform/checks/resource/aws/S3BlockPublicPolicy.py | cclauss/checkov |
print("telnet")
import time
import telnetlib
__all__ = ["CiscoTelnet"]
class CiscoTelnet:
def __init__(self, ip, username, password, enable, disable_paging=True):
self.telnet = telnetlib.Telnet(ip)
self.telnet.read_until(b"Username:")
self.telnet.write(username.encode("utf-8") + b"\n")
... | [
{
"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 | package/cisco_connect/telnet.py | levs72/pyneng-examples |
# Create a function that implements a basic compression algorithm by counting the chars
# thtat are present in a string, if the result string is longer than input
# then return original input.
#
# Examples:
# aaabcccccaaa: a3b1c5a3
# abcdef: abcdef
# aaaaaaaaaaba: a10b1a1
### Note: Don't use extra space
import unit... | [
{
"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 | python/ctci/1_arrays_strings/6_Compression.py | othonreyes/code_problems |
from configparser import ConfigParser
from pyrogram import Client
class Bot(Client):
def __init__(self):
name = self.__class__.__name__.lower()
config_file = f"{name}.ini"
config = ConfigParser()
config.read(config_file)
super().__init__(
name,
bot... | [
{
"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 | bot/bot.py | Anarhyst266/CW_TU_Order_Bot |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.9.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"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 | kubernetes/test/test_v1_container_state_running.py | kevingessner/python |
import torch
import torch.nn as nn
import torch.nn.functional as F
class MolDQN(nn.Module):
def __init__(self, input_length, output_length):
super(MolDQN, self).__init__()
self.linear_1 = nn.Linear(input_length, 1024)
self.linear_2 = nn.Linear(1024, 512)
self.linear_3 = nn.Linear(... | [
{
"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 | dqn.py | iamchosenlee/MolDQN-pytorch |
"""
Represents a connection response message
"""
from marshmallow import fields
from ...agent_message import AgentMessage, AgentMessageSchema
from ..message_types import CONNECTION_RESPONSE
from ....models.connection_detail import ConnectionDetail, ConnectionDetailSchema
HANDLER_CLASS = (
"indy_catalyst_agent.me... | [
{
"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 | agent/indy_catalyst_agent/messaging/connections/messages/connection_response.py | mikelodder7/indy-catalyst |
def find(lst,n):
count=0
lst_=range(1,n+1)
for i,j in enumerate(lst):
#print j
if (abs(lst_.index(j)-i))>2:
return "Too chaotic"
for i in xrange(n-1,0,-1):
#print "---",i
if (lst[i] - (i+1)>2):
return "Too chaotic"
for j in xrange(max(0,lst[i]-2),i):
#print ">>",j,lst[j],lst[i]
... | [
{
"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 | _100daysofcoding_/HackerRank/CrackingTheCodingInterview/new_year_chaos.py | Sayak9495/100DaysofCoding |
import unittest
import numpy as np
from modules import ReLU
from .utils import *
class TestReLU(unittest.TestCase):
""" The class containing all test cases for this assignment"""
def setUp(self):
"""Define the functions to be tested here."""
pass
def _relu_forward(self, x):
relu =... | [
{
"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 | Pytorch/Scratch CNN and Pytorch/part1-convnet/tests/test_relu.py | Kuga23/Deep-Learning |
import re
from pinry.core.models import Pin
from pinry.users.models import User
email_re = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
# quoted-string, see also http://tools.ietf.org/html/rfc2822#section-3.2.5
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[... | [
{
"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 | pinry/users/auth/backends.py | Stackato-Apps/pinry |
from django.db import models
from django.contrib.auth import models as authmodels
from django.conf import settings
import os.path
# Models for file attachments uploaded to the site
# basically just a simple container for files
# but allowing for replacement of previously uploaded files
class Attachment(models.Model):... | [
{
"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 | signbank/attachments/models.py | Signbank/signbank |
from django.http import HttpResponse
from django.utils.translation import ugettext_noop
from corehq.apps.styleguide.examples.simple_crispy_form.views import \
BaseSimpleCrispyFormSectionView
def default(request):
return HttpResponse('woot')
class FormsSimpleCrispyFormExampleView(BaseSimpleCrispyFormSectionV... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | corehq/apps/styleguide/views/docs.py | johan--/commcare-hq |
import pytest
from blacksheep.common.files.pathsutils import (
get_file_extension_from_name,
get_mime_type_from_name,
)
@pytest.mark.parametrize(
"full_path,expected_result",
[
("hello.txt", ".txt"),
(".gitignore", ".gitignore"),
("ØØ Void.album", ".album"),
("", ""),
... | [
{
"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_pathutils.py | Cdayz/BlackSheep |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..resampling import ApplyTransforms
def test_ApplyTransforms_inputs():
input_map = dict(args=dict(argstr='%s',
),
default_value=dict(argstr='--default-value %g',
usedefault=True,
),
dimension=dic... | [
{
"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 | nipype/interfaces/ants/tests/test_auto_ApplyTransforms.py | HussainAther/nipype |
from doubles.class_double import ClassDouble
from doubles.lifecycle import current_space
def patch_class(target):
"""
Replace the specified class with a ClassDouble
:param str target: A string pointing to the target to patch.
:param obj values: Values to return when new instances are created.
:re... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | doubles/targets/patch_target.py | fakeNetflix/uber-repo-doubles |
from datetime import date
import dateparser
from scrapy import FormRequest, Request
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class VilaVelhaSpider(BaseGazetteSpider):
name = "es_vila_velha"
allowed_domains = ["www.vilavelha.es.gov.br"]
TERRITORY_ID = "3205200... | [
{
"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 | data_collection/gazette/spiders/es_vila_velha.py | kaiocp/querido-diario |
import numpy as np
def map_reg_to_text(reg_code):
reg_dict = ("rip", "rsp", "rax", "rbx", "rcx", "rdx", "cs", "ss", "eflags", "rbp", "r8", "r9",
"r10", "r11", "r12", "r13", "r14", "r15", "rsi", "rdi", "orig_rax", "fs_base", "gs_base",
"ds", "es", "fs", "gs")
return reg_dict[reg_code]
class ucXception_fi_p... | [
{
"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 | framework/parsers/ucXception_fi_parser.py | ucx-code/ucXception |
"""This test module verifies the QFactor instantiater."""
from __future__ import annotations
import numpy as np
from scipy.stats import unitary_group
from bqskit.ir.circuit import Circuit
from bqskit.ir.gates.parameterized import RXGate
from bqskit.ir.gates.parameterized.unitary import VariableUnitaryGate
from bqskit... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | tests/ir/opt/instantiaters/test_qfactor.py | jkalloor3/bqskit |
from flask import current_app
def add_to_index(index, model):
if not current_app.elasticsearch:
return
payload = {}
for field in model.__searchable__:
payload[field] = getattr(model, field)
current_app.elasticsearch.index(index=index, doc_type=index, id=model.id,
... | [
{
"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 | app/search.py | fckuligowski/microblog |
from flask import g
import logging
from datetime import datetime
import config
def get_logger(name):
# type: (str) -> logging.Logger
logging.basicConfig()
logger = logging.getLogger(name)
logger.setLevel(config.GLOBAL_LOGGING_LEVEL)
ch = logging.StreamHandler()
ch.setLevel(config.GLOBAL_LOGGING_LEVEL)
fo... | [
{
"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 | app_util.py | Bhaskers-Blu-Org1/long-way-home-callforcode |
# -*- test-case-name: twisted.web2.test.test_httpauth -*-
from twisted.cred import credentials, error
from twisted.web2.auth.interfaces import ICredentialFactory
from zope.interface import implements
class BasicCredentialFactory(object):
"""
Credential Factory for HTTP Basic Authentication
"""
imple... | [
{
"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 | twisted/web2/auth/basic.py | twonds/twisted |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""ToS ECN Field"""
from aenum import IntEnum, extend_enum
__all__ = ['ToSECN']
class ToSECN(IntEnum):
"""[ToSECN] ToS ECN Field"""
Not_ECT = 0b00
ECT_0b01 = 0b01
ECT_0b10 = 0b10
CE = 0b11
@staticmethod
def get(key, default=-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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | pcapkit/const/ipv4/tos_ecn.py | chellvs/PyPCAPKit |
# -*- coding: utf-8 -*-
import sys
sys.path.insert(0,"../../src2")
import math
import functools
import time
import torch
import numpy as np
from scipy.special import gamma
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import emcee
from source_1d_likelihood_fn import compute_log_likelihood_2
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tests_dissertation/source1d/test1a_mcmc.py | DFNaiff/Dissertation |
# city_separation_2.py
# book p.300
import sys
input = sys.stdin.readline
def find_parent(parent, x):
if parent[x] != x:
parent[x] = find_parent(parent, parent[x])
return parent[x]
def union_parent(parent, a, b):
a = find_parent(parent, a)
b = find_parent(parent, b)
if a < b:
pare... | [
{
"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 | ps/review/city_separation_2.py | underflow101/code-example |
"""
@brief test tree node (time=2s)
"""
import os
import unittest
import datetime
import pandas
from pyquickhelper.pycode import ExtTestCase
from mathenjeu.datalog import enumerate_qcmlog, enumerate_qcmlogdf
class TestLocalAppData(ExtTestCase):
def test_datalog(self):
this = os.path.abspath(os.path.... | [
{
"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 | _unittests/ut_datalog/test_datalog.py | sdpython/mathenjeu |
import scrapy
from scrapy.item import Item, Field
from scrapy.loader.processors import TakeFirst, MapCompose
def format_desc(value):
data = list(value.split('",'))
prod_desc = list()
for i in range(len(data)):
if data[i] != " ":
prod_desc.append(data[i].strip())
return prod_desc
de... | [
{
"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 | Artyvis_Tech/faballey_indya/faballey_indya/items.py | Sachin-Kahandal/web_scraping |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kubernetes/test/test_v1beta1_certificate_signing_request_condition.py | L3T/python |
from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorator_function(*args, **kwargs):
if not current_user.can(permission):
abort(40... | [
{
"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 | app/decorators.py | rudGess/flasky_python |
#!/usr/bin/python
import time
import re
import os
class ScavUtility:
def __init__(self):
pass
def check(self, email):
regex = '^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$'
if (re.search(regex, email)):
return 1
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | classes/utility.py | pianomanx/Scavenger |
# build_features.py
# This module holds utility classes and functions that creates and manipulates input features
# This module also holds the various input transformers
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
def correlation_columns(dataset: pd.DataFrame, targe... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | credit-card-fraud/src/features/build_features.py | samie-hash/data-science-repo |
from django.shortcuts import render, get_object_or_404
from .models import PostReview
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
def single_review(request, year, month, day, review):
review = get_object_or_404(PostReview, slug=review,
status='published'... | [
{
"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 | main/reviews/views.py | Karol-Zielke/book_post_review |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_image29.py | edparcell/XlsxWriter |
def max_subarray(nums):
# kadane algorithm
max_so_far = max_ending = 0
begin = start = end = 0
for i in range(len(nums)):
max_ending += nums[i]
if max_ending < 0:
max_ending = 0
begin = i + 1
if max_so_far < max_ending:
max_so_far =... | [
{
"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 | Solutions1/maximum_subarray.py | mohamedsugal/Leetcode-Solutions |
"""
Copyright 2018 Skyscanner Ltd
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 dis... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_rules_sqs_policy_public.py | ocrawford555/cfripper |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.