source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#@+leo-ver=5-thin
#@+node:tbrown.20171029210211.1: * @file ../plugins/editpane/clicky_splitter.py
#@@language python
"""
clicky_splitter.py - a QSplitter which allows flipping / rotating of
content by clicking on the splitter handle
Terry Brown, TerryNBrown@gmail.com, Sun Oct 29 21:02:25 2017
"""
from leo.core.leoQt ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
... | 3 | leo/plugins/editpane/clicky_splitter.py | leonidborisenko/leo-editor |
"""Main library."""
from typing import Optional
# Import module
import jpype
# Enable Java imports
import jpype.imports
# Pull in types
from jpype.types import *
import importlib
class JavaLib:
ROBOT_LIBRARY_SCOPE = "GLOBAL"
"""General library documentation."""
def __init__(
self,
lib... | [
{
"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 | jpype/JavaLib.py | Hi-Fi/robotframework-after-jython |
from Frame.baseFunctions import *
from Frame.gui.Gui import Gui
class Button(Gui):
def __init__(self, function, functionArgs, *args, **kwargs):
super().__init__(*args, **kwargs)
output("Button: Creating " + self.text + " button...", "debug")
self.wasPressed = False
self.function = ... | [
{
"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 | Frame/gui/Button.py | PyRectangle/GreyRectangle |
class DataGridViewCellMouseEventArgs(MouseEventArgs):
"""
Provides data for mouse events raised by a System.Windows.Forms.DataGridView whenever the mouse is moved within a System.Windows.Forms.DataGridViewCell.
DataGridViewCellMouseEventArgs(columnIndex: int,rowIndex: int,localX: int,localY: int,e: MouseEven... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellMouseEventArgs.py | tranconbv/ironpython-stubs |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
from openvino.tools.mo.graph.graph import Graph
from openvino.tools.mo.ops.op import Op
class Reverse(Op):
op = 'Reverse'
def __ini... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | tools/mo/openvino/tools/mo/ops/Reverse.py | ieliz/openvino |
import webbrowser
from googletrans import Translator
class Network:
@staticmethod
def Download(download_keyword):
webbrowser.open(f"https://store.steampowered.com/search/?term={download_keyword}")
@staticmethod
def Translate(word, when_lang):
translator = Translator()
return t... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | Network/Network.py | ibrahimAlbyrk/PythonProjects |
import predictive_punter
import pytest
@pytest.fixture(scope='module')
def seed_command(database_uri):
predictive_punter.SeedCommand.main(['-d', database_uri, '2016-2-1', '2016-2-2'])
def test_samples(database, seed_command):
"""The seed command should populate the database with the expected number of samp... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | tests/seed_test.py | justjasongreen/predictive_punter |
#h. Send data to Flask template (Jinja2)
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def student():
return render_template('student.html')
@app.route('/result', methods=['POST', 'GET'])
def result():
if request.method == 'POST':
result = request.form
... | [
{
"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 | item_h/server.py | augustocarrlos10/Flask_TecWeb |
from core.advbase import *
from module.bleed import Bleed
from slot.a import *
def module():
return Botan
class Botan(Adv):
a3 = [('prep',1.00), ('scharge_all', 0.05)]
conf = {}
conf['slots.a'] = RR() + United_by_One_Vision()
conf['acl'] = """
`dragon.act('c3 s end')
`s3, not self.... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | adv/botan.py | slushiedee/dl |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .video_record import VideoRecord
from datetime import timedelta
import time
def timestamp_to_sec(timestamp):
x = time.strptime(timestamp, '%H:%M:%S.%f')
sec = float(timedelta(hours=x.tm_hour,
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | slowfast/datasets/epickitchens_record.py | dylan-campbell/Motionformer |
__author__ = 'patras'
from domain_searchAndRescue import *
from timer import DURATION
from state import state
def GetCostOfMove(r, l1, l2, dist):
return dist
DURATION.TIME = {
'giveSupportToPerson': 15,
'clearLocation': 5,
'inspectPerson': 20,
'moveEuclidean': GetCostOfMove,
'moveCurved': GetC... | [
{
"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 | problems/SR/auto/problem33_SR.py | sunandita/ICAPS_Summer_School_RAE_2020 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
{
"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 | coherent_gradients/weak_and_strong/datasets/dataset_with_indices.py | pedersor/google-research |
"""
The Ramer-Douglas-Peucker algorithm roughly ported from the pseudo-code provided
by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
"""
from math import sqrt
def distance(a, b):
return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def point_line_distance(point, start, end):
if (start == en... | [
{
"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/api/util/RDP.py | hostbaby/RedisLive |
import numpy as np
import cv2
def load_batch(ls,od,data_path,batch_size,which_batch):
image_list=[]
for i in range(which_batch*batch_size,(which_batch+1)*batch_size):
image=[]
image.append(cv2.imread(data_path+ls[od[i]]+'_red.png',0))
image.append(cv2.imread(data_path+ls[od[i]]+... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | code/resnet_approach/prepare.py | liuchangtai1996/MLIP |
# Harmonize functionality between the different OS implementations
import errno
def err_bind_inuse(err):
return err == errno.EADDRINUSE
def err_conn_refused(errex):
return (errex.errno in [errno.ECONNREFUSED, errno.EPIPE] or
(hasattr(errex, 'winerror') and
errex.winerror == 10057))... | [
{
"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 | thespian/system/transport/errmgmt.py | aytchell/Thespian |
import aiohttp
from flask import Flask
from aio_executor import run_with_asyncio
app = Flask(__name__)
async def get_random_quote():
async with aiohttp.ClientSession() as session:
async with session.get('https://api.quotable.io/random') as response:
quote = await response.json()
return f'... | [
{
"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 | examples/quotes.py | miguelgrinberg/aio-executor |
# encoding=utf-8
"""
@desc: 将自然语言转为SPARQL查询语句
"""
from kgqa.KB_query import question_drug_template
from kgqa.KB_query import word_tagging
class Question2Sparql:
def __init__(self, dict_paths):
self.tw = word_tagging.Tagger(dict_paths)
self.rules = question_drug_template.rules
def get_sparql... | [
{
"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 | kgqa/KB_query/question2sparql.py | couldandblow/Intelligent-QA-in-medicine |
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pylab
import csv
import random
import sys
import os
def get_data(path):
epoch = []
num_reach_target = []
num_hit_obs = []
num_out_of_range = []
num_moving = []
with open(path, "r+", encoding="utf-8") as csvfile:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | vis/draw_result.py | ChangQingAAS/MFDDPG_Path_Planning |
from synapse.syncmd import exec_cmd
from synapse.synapse_exceptions import ResourceException
from synapse.logger import logger
log = logger('yum-pkg')
def install(name):
ret = exec_cmd("/usr/bin/yum -q -y install {0}".format(name))
if ret['returncode'] != 0:
raise ResourceException(ret['stderr'])
d... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"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 | synapse/resources/packages-plugin/yum-pkg.py | mrmuxl/synapse-agent |
import wx
from .misc.helpers import deg_to_rad, rad_to_deg
from .misc.vector import Vector
# Size of the turtle canvas. We assume no user will have a screen
# so big that the canvas will be bigger than this.
BITMAP_SIZE = Vector((2000, 1200))
# Center of the canvas.
origin = BITMAP_SIZE / 2.0
def to_my_angle(angle... | [
{
"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 | pythonturtle/my_turtle.py | Cleverect/PythonTurtle |
from minidoc import minidoc
from minidoc import tst
import argparse
from efdir import fs
parser = argparse.ArgumentParser()
parser.add_argument('-tst','--test_file', default="code.tst.py",help=".tst.py file name")
parser.add_argument('-codec','--codec', default="utf-8",help=".tst.py file codec")
parser.add_argument('-... | [
{
"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 | minidoc/bin.py | ihgazni2/minidoc |
import pandas as pd
from tidyframe import nvl
def test_nvl_series():
test_list = [0, 1, None, pd.np.NaN]
test_series = pd.Series(test_list)
nvl(test_series, 10)
def test_nvl_list():
test_list = [0, 1, None, pd.np.NaN]
nvl(test_list, 10)
def test_nvl_int():
nvl(None, 10)
def test_nvl_str(... | [
{
"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 | tests/test_nvl.py | Jhengsh/tidyframe |
from tkinter import *
root = Tk()
root.title("Listbox Demo")
def on_add():
text = txtContent.get()
listbox.insert(END, text)
def on_del():
selections = listbox.curselection()
for i in reversed(selections):
listbox.delete(i)
def on_show():
# items = [ l.split() for l in listbox.get(0, END... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/menu.py | Inndy/tkinter_samples |
from spInDP.Behavior import Behavior
import time
from spInDP.AnimationController import AnimationController
class PushBehavior(Behavior):
frameNr = 1
lastZ = 0
animationController = None
remoteContext = None
def __init__(self, spider):
print("Initializing push (spider gap) behavior."... | [
{
"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 | spInDP/PushBehavior.py | henkmollema/spInDP |
import jinja2
class SPMObject(object):
""" Abstract Base Class for all SPM objects.
Even though SPM objects are not Spire tasks (as some of them will modify
in-place their file_dep, which is not compatible with doit's task
semantics), they nonetheless include task-related properti... | [
{
"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 | spire/spm/spm_object.py | lamyj/spire |
def cast_kwargs(kwargs):
kwargs_copy = kwargs.copy()
for arg, value in kwargs_copy.items():
if isinstance(value, dict):
kwargs_copy[arg] = cast_kwargs(value)
else:
kwargs_copy[arg] = cast_string(kwargs_copy[arg])
return kwargs_copy
def cast_string(s):
if s == "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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | python-lib/gluonts_forecasts/custom_models/utils.py | RedaAffane/dss-plugin-timeseries-forecast |
from tests import splice_tests
def splice_1():
'''For each question, replace the "None" with your answer!'''
hello_string = "Hello World!"
name_string = "My name is Fernando."
# q_1: splice the "Hello" from hello_string
q_1 = "None"
# q_2: splice the "World" from hello_string
q_2 = "None"
# q_3: sp... | [
{
"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 | lesson-2/string_splice.py | laurendayoun/intro-to-python |
###################################
# CS B551 Fall 2018, Assignment #3
#
# Scoring code by D. Crandall
#
# PLEASE DON'T MODIFY THIS FILE.
# Edit pos_solver.py instead!
#
class Score:
def __init__(self):
self.word_scorecard = {}
self.sentence_scorecard = {}
self.word_count = 0
self.... | [
{
"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 | pos_scorer.py | animeshsagar/Part-of-Speech-Tagging |
import math
def pra(n):
for i in range (2,(int)(math.sqrt(n))):
if (n%i==0):
return False
return True
def izpisi():
for i in range (2,200):
if (pra(i)):
print(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 | test.py | BlackPhoenixSlo/vislice |
from application import db
from flask import Blueprint
from flask_login import current_user
from flask import current_app as app
from flask import request, jsonify, make_response
from flask_jwt_extended import jwt_required
import logging
# Blueprint Configuration
friends_bp = Blueprint('friends_bp', __name__)
@frien... | [
{
"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 | application/friends/routes.py | Sebex0/friendship-diary-backend-python |
""" director subsystem's configuration
- config-file schema
- settings
"""
from typing import Dict
import trafaret as T
from aiohttp import ClientSession, web
from yarl import URL
from servicelib.application_keys import APP_CLIENT_SESSION_KEY, APP_CONFIG_KEY
APP_DIRECTOR_API_KEY = __name__ + ".director_api"... | [
{
"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 | services/web/server/src/simcore_service_webserver/director/config.py | KZzizzle/osparc-simcore |
from dataclasses import asdict, dataclass, field
from datetime import date, datetime
from typing import List, TypeVar, Union
from uuid import UUID
import ujson
T = TypeVar("T")
@dataclass
class MetaState:
exclude: List[str] = field(default_factory=list)
class BaseModel:
__state__: MetaState
def __pos... | [
{
"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 | Chapter10/graphql/application/world/common/base_model.py | maggias/Python-Web-Development-with-Sanic |
from functools import wraps
def singleton(cls):
"""装饰器,被装饰的类为单例模式"""
instances = {}
@wraps(cls)
def getinstance(*args, **kw):
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return getinstance
| [
{
"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 | cuclasses/SingletonDecoration.py | HHHHhgqcdxhg/cuclasses |
import torch
import torch.nn as nn
import torch.nn.functional as F
class ActorNetwork(nn.Module):
def __init__(self,input_size,hidden_size,action_size):
super(ActorNetwork, self).__init__()
self.fc1 = nn.Linear(input_size,hidden_size)
self.fc2 = nn.Linear(hidden_size,hidden_size)
s... | [
{
"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 | models.py | IandRover/meta-gradient_RL |
import logging
import requests
import moment
import utils
import time
import json
class weather(utils.utils):
def message_callback(self,ch, method, properties, body):
logging.info('messgae received weather')
time.sleep(1)
self.__get_weather(body)
ch.basic_ack(delivery_tag=method.de... | [
{
"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 | Reptile/weather.py | hqs666666/python |
from dateutil import parser
import preprocessor as p
def timestamp_to_date(timestamp):
"""
Conver a twitter timestamp to a datetime object
:param timestamp: a string represent the timestamp
:return: a datetime object
"""
return parser.parse(timestamp)
def day_diff(timestamp1, timestamp2)... | [
{
"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/features/utils.py | iamhuy/rumour-veracity-verification |
import unittest
from translator import english_to_french,french_to_english
class Testfr2eng(unittest.TestCase):
def test1(self):
self.assertEqual(french_to_english('Bonjour'), 'Hello')
self.assertNotEqual(french_to_english('Bonjour'), 'potato')
class Testeng2fr(unittest.TestCase):
def te... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | final_project/machinetranslation/tests.py | Stephanie041996/xzceb-flask_eng_fr |
class Solution:
def searchMatrix(self, matrix, target) -> bool:
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
if not matrix:
return False
row = 0
col = len(matrix[0]) - 1
while row <= len(matrix) - 1 and col... | [
{
"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": false... | 3 | leetcode/[cutz][2darray.py | cutz-j/AlgorithmStudy |
import re
from math import log10
class Vulcanizer():
def __init__(self, log_fold_re_list, p_value_re_list):
self.log_fold_re_list = log_fold_re_list
self.p_value_re_list = p_value_re_list
def vulcanize(self, dataframe):
"""
Given a dataframe,
identify the columns for ... | [
{
"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 | context/app/utils/vulcanize.py | mccalluc/heatmap-scatter-dash |
"""
This module contains shared fixtures.
"""
import json
import pytest
import selenium.webdriver
@pytest.fixture
def config(scope='session'):
# Read JSON file
with open('config.json') as config_file:
config = json.load(config_file)
# Assert values are acceptable
assert config['browser'] in ['Firefox'... | [
{
"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 | tests/conftest.py | jaswanth-amili/RailYatri-Automation |
import hashlib
from corehq.apps.integration.models import (
DialerSettings,
GaenOtpServerSettings,
HmacCalloutSettings,
)
def domain_uses_dialer(domain):
try:
settings = DialerSettings.objects.get(domain=domain)
return settings.is_enabled
except DialerSettings.DoesNotExist:
... | [
{
"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 | corehq/apps/integration/util.py | dimagilg/commcare-hq |
from joerd.mkdir_p import mkdir_p
from joerd.plugin import plugin
from os import link
from contextlib2 import contextmanager
import os.path
class CacheStore(object):
"""
Every tile that gets generated requires ETOPO1. And most require a GMTED
tile, which are pretty large and cover much of the world. Rathe... | [
{
"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 | joerd/store/cache.py | Hivemapper/HM-colony-joerd |
"""
Module: 'utimeq' on esp8266 v1.11
"""
# MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.11-8-g48dcbbe60 on 2019-05-29', machine='ESP module with ESP8266')
# Stubber: 1.2.0
class utimeq:
''
def peektime():
pass
def pop():
pass
def push():
... | [
{
"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 | packages/micropython-official/v1.11/esp8266/stubs/utimeq.py | TheVinhLuong102/micropy-stubs |
from typing import Any
from checkov.common.models.enums import CheckCategories
from checkov.cloudformation.checks.resource.base_resource_value_check import BaseResourceValueCheck
from checkov.common.models.consts import ANY_VALUE
class SQSQueueEncryption(BaseResourceValueCheck):
def __init__(self) -> None:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | checkov/cloudformation/checks/resource/aws/SQSQueueEncryption.py | pmalkki/checkov |
# -*- test-case-name: axiom.test.test_upgrading -*-
from axiom.item import Item
from axiom.attributes import text, integer, reference, inmemory
from axiom.upgrade import registerUpgrader
class ActivateHelper:
activated = 0
def activate(self):
self.activated += 1
class Adventurer(ActivateHelper, Ite... | [
{
"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 | axiom/test/newapp.py | hawkowl/axiom |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
import torch
from torch import nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, dim_in, dim_hidden, dim_out):
super(MLP, self).__init__()
self.layer_input = nn.Linear(dim_in, dim_hidden)
self.re... | [
{
"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 | models/Nets.py | yss-al/dssgd |
######################################################################
#
# File: test/unit/test_base.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from contextlib import context... | [
{
"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 | test/unit/test_base.py | ehossack/b2-sdk-python |
# -*- coding: utf-8 -*-
"""
获取YCY图片
"""
import json
import os
import requests
from settings import PROJECT_PATH
class YCYImage(object):
def __init__(self):
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"... | [
{
"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 | utils/imgs_getter.py | albertschr/wechat_robot_supported_blockchain |
# -*- encoding: utf-8 -*-
#
# Copyright 2014 OpenStack 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 ap... | [
{
"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 | ceilometer/cmd/storage.py | vmturbo/ceilometer |
from ert_gui.tools.manage_cases.case_init_configuration import CaseInitializationConfigurationPanel
from ert_gui.tools import Tool
from ert_gui.widgets import util
from ert_gui.widgets.closable_dialog import ClosableDialog
class ManageCasesTool(Tool):
def __init__(self):
super(ManageCasesTool, self).__ini... | [
{
"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 | data/test/python/f718df30f82beb6e6e21b89a28a1753ce7989932manage_cases_tool.py | harshp8l/deep-learning-lang-detection |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from tiveU.articles.models import Article
from .models import User
class UserDetailView(LoginRequiredMixin, DetailView):
model = User
# The... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
... | 3 | tiveU/users/views.py | rds0751/newtiveu |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""add slug to task group task
Revision ID: 3605dca868e4
Revises: 1431e7094e26
Create Date: 2015-07-14 22:06:05.063945
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by ... | [
{
"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": tru... | 3 | src/ggrc_workflows/migrations/versions/20150714220605_3605dca868e4_add_slug_to_task_group_task.py | sbilly/ggrc-core |
#!/usr/bin/env python3
import wpilib
import ctre
class MyRobot(wpilib.IterativeRobot):
"""
This is a short sample program demonstrating how to use the basic throttle
mode of the TalonSRX
"""
def robotInit(self):
self.motor = ctre.WPI_TalonSRX(1) # Initialize the TalonSRX on device 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | examples/basic/robot.py | benjiboy50fonz/robotpy-ctre-draft |
"""
Rhino Python Script Tutorial
Advanced
Exercise 00
Analytical surfaces - the roof of the British Museum.
Bibliography:
Williams, Christopher JK. "The analytic and numerical definition of the geometry of the British Museum Great Court Roof." (2001): 434-440.
"""
import rhinoscriptsyntax as rs
import math
nx ... | [
{
"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 | 2 Scriptissimo/00/main.py | peterszerzo/rhino-pythonscript-tutorials |
import redis
import frappe
import logging
from zlib import compress
from six import string_types
from pygelf import GelfUdpHandler
def publish_redis_event(queue, compressed):
client = get_redis_client()
if not client:
return
client.lpush(f'events:queue:{queue}', compressed)
def publish_gelf_event(queue, compress... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | latte/utils/background/event.py | sunnyakaxd/latte |
import os.path
from PIL import Image
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
class SingleDataset(BaseDataset):
def initialize(self, opt):
self.opt = opt
self.root = opt.dataroot
self.dir_A = os.path.join(opt.dataroot)
s... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | data/single_dataset.py | troyliu0105/DeblurGAN |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ZetCode PyQt4 tutorial
This program creates a skeleton of
a classic GUI application with a menubar,
toolbar, statusbar and a central widget.
author: Jan Bodnar
website: zetcode.com
last edited: September 2011
"""
import sys
from PyQt4 import QtGui
class Example(QtG... | [
{
"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 | app10.py | pacpac1992/pyqt4_examples |
import pytest
from riotwatcher import ValWatcher
@pytest.mark.val
@pytest.mark.usefixtures("reset_globals")
class TestValWatcher:
def test_require_api_key(self):
with pytest.raises(ValueError):
ValWatcher(None)
def test_allows_positional_api_key(self):
ValWatcher("RGAPI-this-is-a... | [
{
"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 | tests/test_ValWatcher.py | TheBoringBakery/Riot-Watcher |
"""Algorithm to invert a binary tree"""
import unittest
import queue
class Node(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def invert_binary_tree_recursive(tree):
"""Recursive implementation of the binary tree inversion algorithm"""
... | [
{
"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": false... | 3 | algorithms/invert_binary_tree.py | avg-2049-joe/py-algo-ds |
#!/usr/bin/env python3
"""
Main module for the deployable project.
"""
# Bootstrap to be able to perform absolute imports as standalone code
if __name__ == "__main__":
from absolute_import import absolute_import
absolute_import(file=__file__, name=__name__, path=__path__)
# Normal imports
from argparse import Argu... | [
{
"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 | src/deployable/__main__.py | cpuabuse/py-deployment-automation |
#standard
import unittest
import math
# from collections import OrderedDict
from random import uniform
#external
import pandas as pd
from scipy.spatial import KDTree
def Find_RSE_range(df, RSEs, minrange):
sub_df = df[['vehicle_ID', 'location_x', 'location_y']]
tree = KDTree(sub_df[['location_x', 'locati... | [
{
"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 | old_versions/TCA_2_2/TCA_V_2_2_1/code/TCASpacePartitioning.py | OSADP/TCA |
from flask import redirect, render_template, url_for
from flask_login import login_required
from app import db
from app.models import User
from . import user
@user.route("/")
def index():
users = User.query.all() # Select * from users;
return render_template("users.html", users=users)
@user.... | [
{
"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 | app/user/views.py | EmersonsfDev/Flask_login |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | kubernetes/test/test_v1_resource_quota_spec.py | woqer/python |
""" App database access information """
class sa_db_access:
def username(self):
""" Get database username """
sa_usr = "__db_user_name__"
return sa_usr
def password(self):
""" Get database password """
sa_pwd = "__mysql_user_password__"
return sa_pwd
def db... | [
{
"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 | sa_db.py | project-k-0-1/project-k |
import theano
import theano.tensor as T
import numpy as np
from utility.utility import *
def activation_init(prefix, params, layer_setting):
#do Nothing
return params
def activation_calc(prefix, params, layer_setting, state_below, mask_below = None):
actFunc = eval(layer_setting['activation'])
flag =... | [
{
"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 | Layers/activation_layer.py | KaiQiangSong/Structure-Infused-Copy-Mechanism |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..epi import ApplyTOPUP
def test_ApplyTOPUP_inputs():
input_map = dict(args=dict(argstr='%s',
),
datatype=dict(argstr='-d=%s',
),
encoding_file=dict(argstr='--datain=%s',
mandatory=True,
),
... | [
{
"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/fsl/tests/test_auto_ApplyTOPUP.py | effigies/nipype |
# Copyright (c) 2020 Pavel Vavruska
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publis... | [
{
"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 | projectile.py | PavelVavruska/binary-space-partitioning |
import aioredis
from sanic import Sanic
class RedisWorker:
def __init__(self):
self.__host = None
self.__pool = None
async def init(self, app: Sanic):
self.__host = app.config.REDIS_HOST
self.__pool = await aioredis.create_redis(self.__host)
async def check_session(self, ... | [
{
"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 | service_api/domain/redis.py | 123456789-dnipro/hackaton |
import ila
from gb_arch import GBArch
from gb_nxt_wri import WRI
from gb_nxt_wr0 import WRU0
from gb_nxt_wr0b import WRU0b
from gb_nxt_wr1 import WRU1
from gb_rdi import defNext as rdDefNext
def defUSts (gb):
m = gb.abst
gb.pre_pix = m.reg ('pre_pix', gb.DATA_SIZE)
gb.pre_pix_nxt = gb.pre_pix
... | [
{
"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 | examples/GB-Halide/ila_spec_a/all.py | pramodsu/ILA-Tools |
import numpy as np
import hypothesis
import strax.testutils
import straxen
def channel_split_naive(r, channel_ranges):
"""Slower but simpler implementation of straxen.split_channel_ranges"""
results = []
for left, right in channel_ranges:
results.append(r[np.in1d(r['channel'], np.arange(left, rig... | [
{
"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 | tests/test_channel_split.py | zhut19/straxen |
#Contains all the functions required for assessing flood risk
#Exercise 2B - assessing flood risk by level:
def stations_level_over_threshold(stations, tol):
"""returns a list of tuples of stations with relative water level over tol."""
stations_over_threshold = []
for station in stations:
try: ... | [
{
"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 | floodsystem/flood.py | HSCam/Flood-Warning-Sytem |
import os
import time
import traceback
# import functools
def getobj(s):
return open(s, "r", encoding='utf-8').read()
def getobjs(s):
objs = []
fs = os.listdir(s)
for f in fs:
absf = os.path.join(s, f)
if os.path.isfile(absf) and os.path.splitext(f)[1] == '.py':
objs.append(absf)
elif ... | [
{
"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 | oiasg_base/lib/game.py | will7101/OIASG |
from progress_passthrough.iterator_wrappers import (
IteratorWrapper,
AttachedLengthIterator,
CallbackIterator,
wrap_source,
wrap_source_len,
)
from unittest.mock import Mock
def test_iterator_wrapper_on_iterable():
it = range(10)
w = IteratorWrapper(it)
assert len(w) == len(range(10))... | [
{
"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 | tests/test_iterator_wrappers.py | smheidrich/progress-passthrough |
"""Warnings raised by the library.
"""
class ProntoWarning(Warning):
"""The class for all warnings raised by `pronto`.
"""
pass
class NotImplementedWarning(ProntoWarning, NotImplementedError):
"""Some part of the code is yet to be implemented.
"""
pass
class UnstableWarning(ProntoWarning... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
... | 3 | pronto/utils/warnings.py | jiggylepcha/pronto |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | isi_sdk_9_0_0/test/test_result_directories_extended.py | mohitjain97/isilon_sdk_python |
import os
import traceback
from uuid import uuid4
import cv2
from cvlog import log
from cvlog.config import Config
from cvtest.csv_reporter import CsvReporter
class Reporter:
def __new__(cls):
if not hasattr(cls, 'instance') or not cls.instance:
cls.instance = super().__new__(cls)
... | [
{
"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 | cvtest/reporter.py | AndreyChertckov/opencv-log |
import numpy as np
from irf.ensemble import wrf
from sklearn.base import BaseEstimator
class IRFClassifier(BaseEstimator):
def __init__(self):
self.model = wrf()
self.predict = self.model.predict
self.predict_proba = self.model.predict_proba
def fit(self, X, y, lambda_reg=0.1, sample_... | [
{
"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 | imodels/tree/iterative_random_forest/iterative_random_forest.py | csinva/interpretability-workshop |
from fasture import specs
import time
def some_func(one, two):
"""This takes time to compute"""
time.sleep(25)
return one + two
@specs.fasture_job_impl
def fasture_job(json_payload: dict) -> dict:
"""Show this as summary in openAPI
and the rest as long description
"""
# some validation
... | [
{
"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 | plugin_example/plugin.py | nlaurance/fasture |
class Solution:
def search(self, nums, target: int) -> int:
def find_rotate_index(start, end):
if nums[start] < nums[end]:
return 0
while start <= end:
mid = (start + end) // 2
if nums[mid] > nums[mid + 1]:
return mi... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | leetcode/python/medium/p033_search.py | kefirzhang/algorithms |
import pandas as pd
from pandas import DataFrame
from ..transformers import Transformer
from ..internal import ColumnResolver, listify
class TransformerExecutor:
def validate(self, df, columnDefinitions):
for columnDef in columnDefinitions:
for transformer in listify(columnDef['transformers'])... | [
{
"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 | src/pandashape/internal/TransformerExecutor.py | jammerware/pandashape |
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
from gallery.models import Photo
class Post(models.Model):
title = models.CharField(max_length=100, null=False, blank=False)
author = models.ForeignKey(User, on_delete=models.CASCADE)
body = models.TextField(... | [
{
"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 | blog/models.py | PsychedelicMonkey/Portfolio-v2 |
import json
def flatten(data):
output_text = []
beg_index = 0
end_index = 0
text = data["text"]
all_labels = sorted(data["labels"])
for ind in range(len(all_labels)):
next_label = all_labels[ind]
output_text += [(label_word, "O") for label_word in text[end_index:next_label[0]].strip().split()]
... | [
{
"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 | jsonl_to_conll/convert.py | joeyism/jsonl-to-conll |
import fileinput
f = fileinput.input()
cases = int(next(f))
next(f)
def solve(n, jobs):
result = [i + 1 for i in range(n)]
result.sort(key=lambda i: (jobs[i - 1][0]/jobs[i - 1][1], i))
print(*result)
def solve_case(f):
n = int(next(f))
jobs = [tuple(map(int, next(f).split())) for i in range(n)... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | python/UVA/10026_shoemaker.py | gineer01/programming-challenges |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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 th... | [
{
"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 | fiware_cloto/cloto/tests/test_views.py | telefonicaid/fiware-cloto |
import pytest
from azureml_appinsights_logger.console_logger import ConsoleLogger
from azureml_appinsights_logger.logger_interface import Severity
@pytest.fixture
def mock_run(mocker):
mocker.patch.object(ConsoleLogger,
'get_run_id_and_set_context',
return_value="MY... | [
{
"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 | common/azureml_appinsights_logger/tests/test_console_logger.py | h2floh/MLOpsManufacturing-1 |
def extract_history(input):
"""extract the past metrics"""
prev = input['prev']
prev['prev'] = True
return input['_id'], prev
def extract_update(input):
"""extract the update data, from which we compute new metrics"""
update = input['update']
update['_id'] = input['_id']
return update
... | [
{
"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": tru... | 3 | coral/metrics/rolling.py | coralproject/atoll |
import pytest
from .solution import solve
INPUT = """5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526
"""
def test_solve():
assert solve(INPUT) == 1656
def test_solve2():
assert solve(INPUT, 999999999999) == 195
| [
{
"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 | 2021/day_11/test_solution.py | krother/advent_of_code |
class Fragment:
def __init__(self):
pass
def populate(self, data):
return None
def name(self):
return "noname" | [
{
"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 | src/template/fragment.py | filipfur/smoothsource |
from djangular import middleware
from django.test import SimpleTestCase
from django.http import HttpRequest, HttpResponse
class AngularJsonVulnerabilityMiddlewareTest(SimpleTestCase):
def test_that_middleware_does_nothing_to_html_requests(self):
resp = HttpResponse(content_type='text/html', content='<ht... | [
{
"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 | djangular/tests/test_middleware.py | mohamedmehdigara/djangular |
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_publ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | polls/models.py | ibowditch/polls |
def strip(value):
if not value:
return value
return value.strip()
def logical_xor(a, b):
return bool(a) ^ bool(b)
| [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | neurovault/utils.py | aphroditepv/NeuroVault |
# © 2019 Nokia
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
from radish_ext.radish.template_with_nested_data_replacer import TemplateForNestedDict
from radish_ext.sdk.l import Logging
class TestDataBase(object):
def __init__(self, cfg) -> None:
super().__init__()
... | [
{
"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 | pkg_radish_ext/radish_ext/radish/base_test_data.py | bbielicki/radish-bdd-extensions |
import struct
import unittest
from typing import List
import pyparcel
DATA: List[int] = [
-1 << 31,
-1000,
-57,
-26,
-20,
-5,
-2,
-1,
0,
1,
2,
5,
20,
57,
1000,
(1 << 31) - 1,
]
class MyTestCase(unittest.TestCase):
def test_pack(self):
for 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | tests/test_int.py | stephend017/pyparcel |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"point_num": 1,
"id": "every_function_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 | keystone/common/sql/migrate_repo/versions/062_drop_assignment_role_fk.py | yanheven/keystone |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# See the full API here:
# https://poloniex.com/support/api/
__author__ = 'maxim'
from six import string_types
import pandas as pd
from util import *
AVAILABLE_PERIODS = [300, 900, 1800, 7200, 14400, 86400]
def get_chart_data(pair, start_time, end_time, period):
... | [
{
"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 | poloniex/api.py | maxim5/time_series_machine_learning |
import unittest
import tfexpt
import expt
from tensorlog import matrixdb
from tensorlog import program
from tensorlog import dataset
class TestNative(unittest.TestCase):
def setUp(self):
(self.n,self.maxD,self.epochs) = (16,8,20)
(self.factFile,trainFile,testFile) = expt.genInputs(self.n)
# (self.factF... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | datasets/grid/testexpt.py | saraswat/TensorLog |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
import pytest
import spack.main
import spack.binary_distribution
buildcache = spack.main.SpackCommand('... | [
{
"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 | lib/spack/spack/test/cmd/buildcache.py | ttroy50/spack |
# -*- coding: utf-8 -*-
from SMLite import SMLite
from ItemStruct._SMLite_ConfigState import _SMLite_ConfigState
class SMLiteBuilder (object):
def __init__ (self):
self.__states = {}
self.__builded = False
def Configure (self, state):
if self.__builded:
raise Exception ("shouldn't configure builder after ... | [
{
"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 | src_python/PySMLite/SMLiteBuilder.py | fawdlstty/smlite |
# -*- coding: utf-8 -*-
"""
sphinx.writers.websupport
~~~~~~~~~~~~~~~~~~~~~~~~~
sphinx.websupport writer that adds comment-related annotations.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx.writers.html import HTMLTranslat... | [
{
"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 | docs/target/sphinx/sphinx/writers/websupport.py | SergeyParamoshkin/sqoop2 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
{
"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 | research/object_detection/tpu_exporters/utils_test.py | duncanriach-nvidia/tensorflow-models |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.