source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from contextlib import closing
import json
import logging
import boto3
from lambda_logs import JSONFormatter, custom_lambda_logs
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.handlers[0].setFormatter(JSONFormatter())
class QCFailed(Exception):
def __init__(self, message: str):
self.... | [
{
"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 | lambda/src/qc_checker/qc_checker.py | jack-e-tabaska/BayerCLAW |
import sys
import json
import numpy as np
import pylab
def plot(X,Y,theory,data,err):
#print "theory",theory[1:6,1:6]
#print "data",data[1:6,1:6]
#print "delta",(data-theory)[1:6,1:6]
pylab.subplot(3,1,1)
pylab.pcolormesh(X,Y, data)
pylab.subplot(3,1,2)
pylab.pcolormesh(X,Y, theory)
py... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | doc/examples/peaks/plot.py | cyankaet/bumps |
import unittest
from unittest import TestCase
import mechanize
def first_form(text, base_uri="http://example.com/"):
return mechanize.ParseString(text, base_uri)[0]
class MutationTests(TestCase):
def test_add_textfield(self):
form = first_form('<input type="text" name="foo" value="bar" />')
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | test/test_form_mutation.py | smalllark/mechanize |
# coding=utf-8
# Copyright 2017-2019 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
_ENGINE = None
def enable_distributed_training():
global _ENGINE
try:
import horovod.tensorflow as hvd
_ENGINE = hvd... | [
{
"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 | thumt/utils/distribute.py | THUNLP-MT/Copy4APE |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from . import Attribute
class Item(object):
"""
"""
ID = 0
def __init__(self):
"""
"""
self.id = Ite... | [
{
"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 | item.py | stavsta/tpzgraphml |
'''
Some utility functions
'''
import os.path
def cm2inch(value):
'''
convert from cm to inches
'''
return value / 2.54
def read_pdb_distribution(residue):
'''
read the pdb distributions
'''
if residue.lower() == 'ile':
path = os.path.join(
os.path.split(__file_... | [
{
"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 | pyroshift/util.py | L-Siemons/PyRoShift |
import pytest
from contoso import get_company_name, get_company_address
def test_get_company_name():
assert get_company_name() == "Contoso"
def test_get_company_address():
assert get_company_address() == "Contosostrasse 1, Zurich, Switzerland" | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | src/packages/tests/test_company_details.py | fbeltrao/az-func-gh-deployment |
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(cl... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | test gui.py | shogan50/paint_bot_ml |
# coding: utf-8
import chainer
import chainer.links as L
# Network definition
class A(chainer.Chain):
def __init__(self, n_vocab, n_out):
super(A, self).__init__()
with self.init_scope():
self.l1 = L.EmbedID(n_vocab, n_out)
def forward(self, x):
return self.l1(x)
# ===... | [
{
"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 | testcases/ch2o_tests/node/EmbedID.py | vermashresth/chainer-compiler |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
"""Serializes a name field for testing our APIView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Serializes a user profile ob... | [
{
"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 | profiles_api/serializers.py | SrijitPal/profiles-rest-api |
"""
test for the module `remove_salts`
"""
import pytest
import sys
import rdkit
from rdkit import Chem
from opencadd.compounds.standardization.remove_salts import remove_salts
def _evaluation_mol_generator(test_smiles=None, test_inchi=None):
"""Creates mol files directly with rdkits functions for evaluation.""... | [
{
"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 | opencadd/tests/compounds/standardization/test_remove_salts.py | Allend95/opencadd |
def do(action, value, acc, i):
if action == 'acc':
acc += value
elif action == 'jmp':
i += value - 1
elif action == 'nop':
pass
return acc, i
def run(instrs):
visited, acc, i = set(), 0, 0
while i < len(instrs):
if i in visited:
break
else:
... | [
{
"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 | day_08/day_08.py | niccolomarcon/AoC_2020 |
import socket
import time
class TestIO:
def __init__(self):
# self.ipAddress = "10.20.8.136"
self.ipAddress = "10.20.0.194"
self.port = 63350
def queryServer(self, query):
"""
Private method that sends a command and returns the server's response
in a readable ... | [
{
"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 | forcecopilot/forcecopilot_reading.py | roymart1/RQBasicDevTest |
#!/usr/bin/env python
import numpy as np
import cv2 as cv
from umucv.stream import Camera
from umucv.util import ROI, putText
from skimage.feature import hog
cv.namedWindow('cam')
roi = ROI('cam')
PPC = 16
CPB = 2
SHOW = False
cam = Camera()
def feat(region):
r = cv.cvtColor(regi... | [
{
"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 | code/hog/hog0.py | josemac95/umucv |
from flask import Flask, flash, redirect, render_template, request, session, abort
app = Flask(__name__)
@app.route("/")
def index():
return "Flask App!"
@app.route("/plants")
def plants():
return render_template('plants.html')
@app.route("/animals")
def animals():
return render_template('animals.html')... | [
{
"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 | webapp.py | sheldon-cooper26/PythonFlask-Docker |
from hangul_romanize import Transliter
from hangul_romanize.rule import academic
class Word:
"""
Object representation of a word record that can update the success_rating of that record.
"""
_romanize = Transliter(academic).translit
def __init__(self, _id: int, english: str, korean: str, score: 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 | database/word.py | YeetmeisterII/KoreanVocabularyLearner |
# from typing_extensions import Required
from django.shortcuts import redirect, render
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from .decorators import allowed_users, unauthenticated_user
from .models impor... | [
{
"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-Directory/app1/views.py | RonBulaon/DockeredDjangoNginx |
from collections import OrderedDict
from typing import Dict, List
from models.base import ServerBase
class Server(ServerBase):
"""服务端只做模型参数的融合
"""
def __init__(self) -> None:
super().__init__()
self._params = None
@property
def params(self):
return self._params
@para... | [
{
"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 | models/FedGMF/server.py | TD21forever/QoS-Predcition-Algorithm-library |
import numpy as np
from grove.alpha.jordan_gradient.gradient_utils import binary_to_real, \
measurements_to_bf
def test_binary_to_real():
for sign in [1, -1]:
decimal_rep = sign * 0.345703125
binary_rep = str(sign * 0.010110001)
decimal_convert = binary_to_real(binary_rep)
a... | [
{
"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 | grove/tests/jordan_gradient/test_gradient_utils.py | msohaibalam/grove |
""" Group all tests cases for layers"""
import pytest
import torch
from polaris.network.layers import SqueezeExcitation, ResidualBlock2D
def test_squeeze_excitation():
X = torch.tensor([[[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]]])
se = SqueezeExcitation(channels=1, ratio=1)
se.dense_linear_1.... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | polaris/tests/test_layers.py | leelastar/leelastar-training |
from abc import ABC
from datetime import datetime
from pyramid.response import Response
class BaseView(ABC):
@staticmethod
def json_response(json):
""""
:param dict | list json:
:rtype: dict | list
"""
if isinstance(json, dict):
result = BaseView._dict_resp... | [
{
"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 | backend/app/views/_base.py | scottsbergeron/pyramid-react-template |
#!/usr/bin/env python
import os
try:
from http.server import HTTPServer #python3
from socketserver import ThreadingMixIn
except ImportError:
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler #python2
from SocketServer import ThreadingMixIn
class MyHTTPServer(ThreadingMixIn,H... | [
{
"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 | lang/py/rfc/22/myhttp.py | ch1huizong/learning |
##
# Copyright (c) 2007-2016 Apple Inc. 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 applicable l... | [
{
"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 | caldavclientlibrary/protocol/webdav/tests/test_report.py | LaudateCorpus1/ccs-caldavclientlibrary |
from django.conf import settings
import requests
import socket
BASE_HOST = '127.0.0.1'
PORT = 4040
class Ngrok(object):
def __init__(self, port=PORT, *args, **kwargs):
super(Ngrok, self).__init__(*args, **kwargs)
self.port = port
self._check_launch_ngrok()
def _check_launch_ngrok(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | app/ngrok.py | nnsnodnb/line-bot-django-handle |
import unittest
from discrete_probability.concept.random_variable import RandomVariable, SetOfRandomVariable, Assignment, Conditional
from discrete_probability.concept.event import Event
class RandomVariableTestCase(unittest.TestCase):
def test_name(self):
name = 'A'
self.assertEqual(RandomVaria... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/concept/test_random_variable.py | DiscreteProbability/DiscreteProbability |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
from typing import Tuple, Dict
from augly.video.augmenters.ffmpeg import BaseFFMPEGAugmenter
from ffmpeg.nodes import FilterableStream
class VideoAugmenterByBrightness(BaseFFMPEGAugmenter):
def __init__(self, level: float):
assert... | [
{
"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 | augly/video/augmenters/ffmpeg/brightness.py | Ierezell/AugLy |
# Copyright (c) Alex Ellis 2017. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
from flask import Flask, request, jsonify
from function import handler
#from gevent.wsgi import WSGIServer
from gevent.pywsgi import WSGIServer
app = Flask(__name... | [
{
"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 | template/python3-flask/index.py | AFCYBER-DREAM/piperci-noop-faas |
import urllib
from io import BytesIO
import requests
from flask import (Blueprint, current_app, jsonify, make_response,
render_template, request)
from .helpers import prepare_image_for_json
bp = Blueprint('routes', __name__, url_prefix='')
@bp.route('/', methods=['GET'])
def home():
return r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | demo_site/routes.py | ArtemiiH/ppl_eraser_demo_site |
from django.contrib.auth.backends import ModelBackend
from ratelimitbackend.backends import RateLimitMixin
from .profiles.models import User
from .utils import is_email
class CaseInsensitiveModelBackend(ModelBackend):
def authenticate(self, username, password, request):
try:
user = User.obje... | [
{
"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": true
},
{
... | 3 | feedhq/backends.py | feedhq/feedhq |
# encoding: utf-8
"""
config_file_backing_store.py
Created by Scott on 2014-08-12.
Copyright (c) 2014 Scott Rice. All rights reserved.
"""
import ConfigParser
import backing_store
class ConfigFileBackingStore(backing_store.BackingStore):
def __init__(self, path):
super(ConfigFileBackingStore, self).__init__... | [
{
"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 | src/ice/persistence/config_file_backing_store.py | geraldhumphries/Ice |
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten, Conv2D, MaxPooling2D
from tensorflow.keras.callbacks import TensorBoard
import pickle, os, time
DATADIR="data/"
NAME="cachorros-gatos-cnn-128-128-128-{}".format(int(time.time... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/backend/model.py | inacioMattos/DeepLearning-Cachorros-e-Gatos |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class GoalStatus(models.Model):
status_name = models.CharField(max_length=200)
def __str__(self):
return self.status_name
class ScrumyGoals(models.Model):
#goal_name, goal_id, created_by, moved_... | [
{
"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 | django-semiuscrumy1/semiuscrumy/models.py | trustidkid/myscrumy |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import json
import frappe
def execute():
frappe.reload_doc('crm', 'doctype', 'lead')
frappe.reload_doc('crm', 'doctype', 'opportunity')
add_crm_to_user_desktop_items()
def add_crm_to_use... | [
{
"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 | frappe-bench/apps/erpnext/erpnext/patches/v5_0/new_crm_module.py | Semicheche/foa_frappe_docker |
"""
cfg_loader.fields
~~~~~~~~~~~~~~~~~
Implement marshmallow fields to validate against specific input data
:copyright: Copyright 2017 by ConsenSys France.
:license: BSD, see :ref:`license` for more details.
"""
import os
from marshmallow import validate, fields
class PathValidator(validate.V... | [
{
"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 | cfg_loader/fields.py | theatro/cfg-loader |
class HTTPException(Exception):
"""
Exception which happens when HTTP status code is not 200 (OK).
"""
def __init__(self, code, url) -> None:
self.error = f"While requesting to {url}, request returned status {code}."
def __str__(self) -> str:
return self.error
class NoCatalogResu... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": tru... | 3 | pyapple/interface/exceptions.py | fxrcha/PyApple |
from typing import Dict, List, Optional
from pydantic import BaseModel
class SetuData(BaseModel):
title: str
urls: Dict[str, str]
author: str
tags: List[str]
pid: int
p: int
r18: bool
class SetuApiData(BaseModel):
error: Optional[str]
data: List[SetuData]
class Setu:
def _... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | nonebot_plugin_setu_now/models.py | kexue-z/nonebot-plugin-setu-now |
import unittest
import os
import pytest
import testinfra.utils.ansible_runner
class TestIntermediateSetup(unittest.TestCase):
def setUp(self):
self.host = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_host('instance')
@pytest.mark.parametrize('fi... | [
{
"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 | roles/keychain/tests/test_keychain.py | nimi0112/osx-box-bootstrap |
import unittest
from my_program import make_it_uppercase, get_first_word, return_a_list
class TestMyProgram(unittest.TestCase):
def test_hello_world(self):
result = make_it_uppercase("hello world")
self.assertEqual(result, 'HELLO WORLD')
def test_first_word_in_sentence(self):
sentenc... | [
{
"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 | 630_Unit_Tests/tests.py | PacktPublishing/Python-for-Everybody-The-Ultimate-Python-3-Bootcamp |
#
# iris data set
# 150 total entries
# features are: sepal length in cm, sepal width in cm, petal length in cm, petal width in cm\n
# labels names: setosa, versicolor, virginica
#
# used algorithm: SVC (C-Support Vector Classifiction)
#
# accuracy ~100%
#
from time import time
import numpy as np
from sklearn.datasets ... | [
{
"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 | iris_svc.py | LSchultebraucks/support-vector-machines-blog-post |
"""
@brief test log(time=150s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import check_pep8, ExtTestCase
class TestCodeStyle(ExtTestCase):
"""Test style."""
def test_style_src(self):
thi = os.path.abspath(os.path.dirname(__file__))
sr... | [
{
"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 | _unittests/ut_module/test_code_style.py | sdpython/papierstat |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from happy_python import bytearray_to_str, gen_random_str, to_hex_str1, is_ascii_str, to_hex_str2, \
from_hex_str
from happy_python import bytes_to_str
from happy_python import dict_to_str
from happy_python import str_to_dict
class TestUtils(unittes... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/str_util_test.py | geekcampchina/happy-python |
import itertools
def turn(face, dir):
nface=face[:]
if dir==1:
nface=[0, face[2],face[6],face[3],face[1],face[5],face[4]]
if dir==2:
nface=[0, face[3],face[2],face[6],face[4],face[1],face[5]]
if dir==3:
nface=[0, face[4],face[1],face[3],face[6],face[5],face[2]]
if dir==4:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | problem/01000~09999/02642/2642.py3.py | njw1204/BOJ-AC |
from datetime import datetime
from decimal import Decimal
from typing import Tuple, List
from gps import gps, WATCH_ENABLE, WATCH_NEWSTYLE
from . import constants as c
from .location import Location
class GPSD:
gpsd = gps(mode=WATCH_ENABLE | WATCH_NEWSTYLE)
@classmethod
def get_location(cls) -> Locatio... | [
{
"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 | client/gps_tracker/gpsd.py | jorgemira/gps_tracker |
# -*- coding: utf-8 -*-
"""
shellstreaming.util.resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Reports HW resource info
"""
# standard modules
import time
# 3rd party moduels
import psutil
_cpu_percent_called = False
def avail_cores():
"""Return number of available cores on the node"""
# Sin... | [
{
"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 | shellstreaming/util/resource.py | laysakura/shellstreaming |
# SPDX-FileCopyrightText: 2022 Tim Hawes <me@timhawes.com>
#
# SPDX-License-Identifier: MIT
from django.contrib import admin
from .models import ChangeOfAddress, GroupPolicy, MailingList
class GroupPolicyInline(admin.TabularInline):
model = GroupPolicy
fields = ("group", "policy", "prompt")
extra = 0
... | [
{
"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 | mailman2/admin.py | edinburghhacklab/hackdb |
#!/usr/bin/env python3
import trio
async def a():
print('enter a')
await trio.sleep(0)
print('leave a')
async def b():
print('enter b')
await trio.sleep(0)
print('leave b')
async def main():
async with trio.open_nursery() as nursery:
print(nursery.start_soon(a))
nursery.start_soon(b)
# seems like the ou... | [
{
"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 | trio-stuff/interleaved_output.py | bmintz/python-snippets |
import os
import sys
from clint.textui import puts, colored
import conf
def display_intro():
print_message('''
__ ____ ____ ___ _____ __ ___ _______ __
/ / / ___|| _ \\ / _ \\_ _| \\ \\ |_ _| ___\\ \\ / /
| | \\___ \\| |_) | | | || | | | | || |_ \\ V /
| | ___) | __/| |_| || | | | | ... | [
{
"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 | spotted_on_spotify/util.py | anthonymirand/SpottedOnSpotify-cmdline |
from collections import OrderedDict
import re
from dockerfile_parse import DockerfileParser
from dockerfile_parse.constants import COMMENT_INSTRUCTION
# class CheckovDockerFileParser(DockerfileParser)
from checkov.common.comment.enum import COMMENT_REGEX
def parse(filename):
dfp = DockerfileParser(path=filename... | [
{
"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 | checkov/dockerfile/parser.py | kylelaker/checkov |
from __future__ import print_function
_ = raw_input()
words = [set(w) for w in raw_input().split()]
result = 0
def search(words, layer=0):
global result
if len(words) + layer <= result:
# simple cut
return
if layer > result:
result = layer
def isConflict(word1, word2):
... | [
{
"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 | 0000 hihoOnce/170 Word Construction/main.py | SLAPaper/hihoCoder |
# -*- coding: utf-8 -*-
"""Python e GTK 4: PyGObject Gtk.Calendar()."""
import gi
gi.require_version(namespace='Gtk', version='4.0')
from gi.repository import Gio, Gtk
class MainWindow(Gtk.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.set_title(title='Pytho... | [
{
"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 | src/gtk4/calendar/MainWindow.py | natorsc/gui-python-gtk |
from lib.compileException import compileException
class WhileStmtNode():
def __init__(self, stmt_type=None, expr=None, block=None, line=None ):
self.stmt_type = stmt_type
self.expr = expr
self.block = block
self.line = line
self.return_type = None
def checkType(self, s)... | [
{
"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 | src/lib/WhileStmtNode.py | Amtoniusz/latte |
# -*- coding: utf-8 -*-
"""
mod: api
version: v1
"""
from flask import (
Flask, Blueprint, request, session, g,
redirect, url_for, abort, render_template,
flash, current_app, make_response
)
from flask_restful import reqparse, abort, Resource, Api
bp = Blueprint(__name__, __name__, url_prefix='/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 | blueprints/api_v1.py | gaohongsong/flask-demo |
#!/usr/bin/env python3
"""
Convert COCO17 2D poses to dummy embeddings for 2D-VPD.
"""
import os
import argparse
import numpy as np
from tqdm import tqdm
from util.io import store_pickle, load_gz_json
from vipe_dataset.dataset_base import normalize_2d_skeleton
def get_args():
parser = argparse.ArgumentParser()... | [
{
"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 | dummy_2d_features.py | jhong93/vpd |
"""inline_tags
Revision ID: a92d92aa678e
Revises: e7004224f284
Create Date: 2018-05-10 15:41:28.053237
"""
import re
from funcy import flatten, compact
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from redash import models
# revision identifiers, used by Alembic.
revision... | [
{
"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 | migrations/versions/a92d92aa678e_inline_tags.py | zero1number/redash |
from flask import Flask, render_template, redirect
from jinja2 import Template
from splinter import browser
from flask_pymongo import PyMongo
import scrape_mars
# Create an instance of our Flask app.
app = Flask(__name__)
# Use flask_pymongo to set up mongo connection
app.config["MONGO_URI"] = "mongodb://localhost:2... | [
{
"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 | app.py | computercavemen/web-scraping-challenge |
import unittest
import numpy
import nlcpy
from nlcpy import testing
import nlcpy as vp
nan_dtypes = (
numpy.float32,
numpy.float64,
numpy.complex64,
numpy.complex128,
)
shapes = (
(4,),
(3, 4),
(2, 3, 4),
)
@testing.parameterize(*(
testing.product({
'shape': shapes,
})
))... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/pytest/statistics_tests/test_quantile.py | SX-Aurora/nlcpy |
#!/usr/bin/env python
import os
import pyfwk
from pyfi.entity.entity.db import EntityDB
# -----------------------------EXCHANGE-MODEL-----------------------------#
class ExchangeModel(pyfwk.Model):
model = None
dbase = None
table = None
columns = None
@staticmethod
def instance():
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 | pyfi/entity/exchange/model.py | rlinguri/pyfi |
import pylab
def rgb2gray(rgb_image):
"Based on http://stackoverflow.com/questions/12201577"
# [0.299, 0.587, 0.144] normalized gives [0.29, 0.57, 0.14]
return pylab.dot(rgb_image[:, :, :3], [0.29, 0.57, 0.14])
def initialize(usegpu):
return 1
def describe(image):
return rgb2gray(image).reshap... | [
{
"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 | descriptors/raw_gray_descriptor.py | RealJohnSmith/circulant_matrix_tracker |
"""included ordering for sections
Revision ID: 91052a50e2b0
Revises: 5716caecc491
Create Date: 2020-06-26 14:49:21.905034
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '91052a50e2b0'
down_revision = '5716caecc491'
branch_labels = None
depends_on = None
def ... | [
{
"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 | app/alembic/versions/2020_06_26_14_49_21.py | Juan7655/wfh-movies |
from abc import ABCMeta
import logging
import json
class BaseObject(object):
__metaclass__ = ABCMeta
def __init__(self, **kwargs):
self.log = logging.getLogger("irchooky")
for prop in self.properties:
setattr(self, prop, kwargs.get(prop, ""))
def load(self, object_dict):
... | [
{
"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 | irc_hooky/base_object.py | byorgey/irc-hooky |
import master_duel_auto_scan_version as mda
from threading import Thread
def start():
"""method to start searching
"""
scan_card = Thread(target=mda.main)
scan_card.start()
def kill():
"""method to exit searching
"""
mda.status_change(False, False, True,False)
def paus... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | search_engine.py | lqzhou123/MasterDuelSimpleTranslateTool |
from datetime import datetime
from typing import Any, Dict, List, Union
from fastapi.encoders import jsonable_encoder
from sqlalchemy.orm import Session
from .crud_base import CRUDBase
from models import Show
from schemas.shows import ShowCreate, ShowUpdate, ShowDelete
class CRUDShow(CRUDBase[Show, ShowCreate, Show... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | pilitgui2/api/crud/crud_show.py | skypanther/clc |
# -*- coding: utf-8 -*-
"""kmp_algorithm.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1wsUiWXaWKuIxv-udYnxqV463PD4z2ps-
"""
def init_next(pattern):
M = len(pattern)
next = [0 for _ in range(M)] # 정보 저장용 배열
j = 0 # 배열의 값을 불러오고,... | [
{
"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 | 3. Algorithms/04. String Process Algorithm/KMP Algorithm Design/kmp_algorithm.py | oneonlee/Computer-Science |
from discord.ext import commands
"""
A custom Cooldown type subclassing built in cooldowns from discord.ext commands.
This is a bucket type that allows cooldowns to work based on some text, allowing
things like cooldown on individual `Tags`, or message spam detection.
"""
class MessageTextBucket(commands.BucketType):... | [
{
"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 | utils/message_cooldown.py | Chr1sDev/Bloo |
##
# Copyright (c) 2012-2017 Apple Inc. 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 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | contrib/performance/sqlusage/requests/propfind_invite.py | backwardn/ccs-calendarserver |
from bs4 import BeautifulSoup
from datetime import datetime
import requests
import time
def get_code(company_code):
url="https://finance.naver.com/item/main.nhn?code=" + company_code
result = requests.get(url)
bs_obj = BeautifulSoup(result.content, "html.parser")
return bs_obj
def get_price(company_co... | [
{
"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 | classification-multi/a/a.py | fishduke/vision |
def selectionSort(arr):
for i in range(len(arr)):
minIdx = i
for j in range(i+1, len(arr)):
if arr[minIdx] > arr[j]:
minIdx = j
arr[i], arr[minIdx] = arr[minIdx], arr[i]
for i in arr:
print(i, end=" ")
print()
def bubbleSort(arr):
for i in ra... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | Topic-2/sort.py | PritishWadhwa/Python-DSA |
# -*- coding: utf-8 -*-
# Copyright (C) 2021 GIS OPS UG
#
#
# 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 ... | [
{
"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_convert.py | schaemar/routing-py |
# -*- coding: utf-8 -*-
"""
AsciiDoc Reader
===============
This plugin allows you to use AsciiDoc to write your posts.
File extension should be ``.asc``, ``.adoc``, or ``asciidoc``.
"""
from pelican.readers import BaseReader
from pelican.utils import pelican_open
from pelican import signals
import six
try:
# a... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | plugins/asciidoc_reader/asciidoc_reader.py | craigriley39/pelican-site |
# Copyright (c) 2021 Xiaomi Corporation (authors: Guo Liyong)
# Apache 2.0
from typing import List, Union
from pathlib import Path
import k2
import sentencepiece as spm
Pathlike = Union[str, Path]
class Numericalizer(object):
def __init__(self, tokenizer, tokens_list):
super().__init__()
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 | snowfall/text/numericalizer.py | aarora8/snowfall |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 06:08:57 2019
@author: Khoi To
"""
class PopulationHandler(object):
def __init__(self, characteristics):
self.characteristics = characteristics
def init(self, number_of_population):
pass
def selection(self):
pass
... | [
{
"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 | ga/population.py | tokhoi/genetic-algorithm |
"""
:class:`~allennlp.common.tqdm.Tqdm` wraps tqdm so we can add configurable
global defaults for certain tqdm parameters.
Adopted from AllenNLP:
https://github.com/allenai/allennlp/blob/v0.6.1/allennlp/common/tqdm.py
"""
from tqdm import tqdm as _tqdm
# This is neccesary to stop tqdm from hanging
# when exceptio... | [
{
"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 | miso/utils/tqdm.py | pitrack/arglinking |
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QCheckBox, QLabel, QWidget, QHBoxLayout
from traitlets import HasTraits, Bool, link, Unicode
from regexport.model import AppState
from regexport.views.utils import HasWidget
class CheckboxModel(HasTraits):
label = Unicode(default_value='')
checked ... | [
{
"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 | regexport/views/checkbox.py | jonnykohl/ABBA-QuPath-RegistrationAnalysis |
from random import *
from turtle import *
from freegames import vector
bird = vector(0, 0)
balls = []
def tap(x, y):
"Move bird up in response to screen tap."
up = vector(0, 30)
bird.move(up)
def inside(point):
"Return True if point on screen."
return -200 < point.x < 200 and -200 < point.y < 200... | [
{
"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 | Python/Projects/flappy.py | janvi16/-HACKTOBERFEST2K20 |
# -*- coding: utf-8 -*-
from ccxt.btcbox import btcbox
class jubi (btcbox):
def describe(self):
return self.deep_extend(super(jubi, self).describe(), {
'id': 'jubi',
'name': 'jubi.com',
'countries': 'CN',
'rateLimit': 1500,
'version': 'v1',
... | [
{
"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 | python/ccxt/jubi.py | hippylover/ccxt |
'''
@Author: ZM
@Date and Time: 2019/10/8 6:28
@File: Dataset.py
'''
class Dataset:
def __init__(self, x, y=None, transform=None, y_transform=None):
self.x = x
self.y = y
self.transform = transform
self.y_transform = y_transform
def __len__(self):
return... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | word_similarity/Dataset.py | mengzhu0308/word2vec |
import boto3
import json
import pprint
pp = pprint.PrettyPrinter(width=41, compact=True)
# Create IAM client
iam = boto3.client('iam')
response = iam.list_roles()
# list all roles
def getRoles():
role_data = []
for role in response['Roles']:
role_list = {}
role_name = role['RoleName']
ro... | [
{
"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 | scripts/IAM/getRolesData.py | Taranpreet26311/myrepo |
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(val):
return 1/(1 + np.exp(-val))
def stable_coeff(rho, psi):
r = sigmoid(rho)
theta = np.pi * sigmoid(psi)
a_1 = -2*r*np.cos(theta)
a_2 = r**2
return a_1, a_2
def roots_polynomial(a_1, a_2):
delta = a_1**2 - 4 * a_2
del... | [
{
"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 | test_code/stable_ocs_param.py | temcdrm/dynonet |
"""Add signature for st
Revision ID: 38a1521607b5
Revises: 2fd64f1e524c
Create Date: 2015-01-04 15:40:04.177104
"""
from alembic import op
import sqlalchemy as sa
import base64
import pkg_resources
# revision identifiers, used by Alembic.
revision = '38a1521607b5'
down_revision = '2fd64f1e524c'
def upgrade():
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | src/sw/allotmentclub/alembic/versions/add_signature_for_st_38a1521607b5.py | sweh/sw.allotmentclub.backend |
#-*- coding: utf-8 -*-
'''
Created on 2021. 7. 11.
@author: FlareWizard
'''
from Game.Scene.SceneBase import SceneBase, eSceneType
#-------------------------------------------------------------------------------
# SceneLobby
#-------------------------------------------------------------------------------
class Sc... | [
{
"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 | FirstPythonGame/Game/Scene/SceneLobby.py | chowizard/StudyPython |
def invertBinaryTree(tree):
invert(tree)
return tree
def invert(tree):
if (tree) is None:
return
if(tree) is not None:
tree.right, tree.left = tree.left, tree.right
invert(tree.left)
invert(tree.right)
def invertBinaryTree(tree):
treeStack = [tree]
while len(treeStack) ... | [
{
"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 | AlgoExpert/InvertBinaryTree.py | akhil-ece/160Days |
import torch.nn as nn
class LSTMClassifier(nn.Module):
"""
This is the simple RNN model we will be using to perform Sentiment Analysis.
"""
def __init__(self, embedding_dim, hidden_dim, vocab_size):
"""
Initialize the model by settingg up the various layers.
"""
super(L... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | train/model_stack.py | pabloserna/SentimentAnalysisinAWS |
#!/usr/bin/env python
# Copyright 2014 Boundary, Inc.
#
# 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 o... | [
{
"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 | metric.py | jdgwartney/sdk |
from djoser.conf import settings
__all__ = ['settings']
def get_user_email(user):
email_field_name = get_user_email_field_name(user)
return getattr(user, email_field_name, None)
def get_user_email_field_name(user):
try: # Assume we are Django >= 1.11
return user.get_email_field_name()
exce... | [
{
"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 | djoser/compat.py | mark-slepkov/djoser |
#!/Users/yaroten/Library/Mobile Documents/com~apple~CloudDocs/git/crawling_scraping/crawling_scraping/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generat... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | crawling_scraping/bin/rst2odt_prepstyles.py | litteletips/crawling_scraping-scrapy_tool |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `cookiecutter_pydemo` package."""
import unittest
from click.testing import CliRunner
from cookiecutter_pydemo import cookiecutter_pydemo
from cookiecutter_pydemo import cli
class TestCookiecutter_pydemo(unittest.TestCase):
"""Tests for `cookiecutter_... | [
{
"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/test_cookiecutter_pydemo.py | cgDeepLearn/cookiecutter_pydemo |
import pytest
from unyt.unit_object import define_unit
from unyt.unit_registry import UnitRegistry
from unyt.array import unyt_quantity
def test_define_unit():
define_unit("mph", (1.0, "mile/hr"))
a = unyt_quantity(2.0, "mph")
b = unyt_quantity(1.0, "mile")
c = unyt_quantity(1.0, "hr")
assert a =... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | unyt/tests/test_define_unit.py | migueldvb/unyt |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... | [
{
"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 | telestream_cloud_qc_sdk/test/test_location_test.py | pandastream/telestream-cloud-python-sdk |
from django.views import generic
from django.shortcuts import redirect
class IndexView(generic.ListView):
template_name = 'Dashboard.html'
def get_queryset(self):
pass
def home(request):
return redirect('/privacy/') | [
{
"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 | server/views.py | sylar233/de-identification |
# -*- coding: utf-8 -*-
"""
To connect the power meter you'll need to use the "Power meter driver switcher" application to switch to the PM100D (Ni-Visa) drivers.
Then the resource name should show up when exceuting:
import visa
visa.ResourceManager().list_resources()
"""
from lantz.messagebased import MessageBasedD... | [
{
"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 | lantz/drivers/thorlabs/pm100d.py | ZixiLi0520/lantz |
import unittest
from acme import Product, BoxingGlove
from acme_report import generate_products, ADJECTIVES, NOUNS
"""Tests for Acme Python modules."""
class AcmeProductTests(unittest.TestCase):
"""Making sure Acme products are the tops!"""
def test_default_product_price(self):
"""Test ... | [
{
"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 | Sprint-challenge/acme_test.py | iesous-kurios/DS-Unit-3-Sprint-1-Software-Engineering |
from ast import mod
from msilib.schema import ListView
from pyexpat import model
from django.shortcuts import render
from django.views import generic
from . import models
class Index(generic.TemplateView):
template_name = 'catalog/index.html'
def get_context_data(self, **kwargs):
context = super().get... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | .history/catalog/views_20220304001504.py | arsalandehghani/locallibrary |
# Fix the code so that there's no error!
def count_evens(start, end):
"""Returns the number of even numbers between start and end."""
counter = start
num_evens = 0
while counter <= end:
if counter % 2 == 0:
num_evens += 1
counter += 1
return num_evens
def count_multiples(start, end, divisor):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | exercise_brokencounts_solution.py | annezola/gdi-python |
# compare contents of two files in binary form
import sys
def compareFile(srcFile,destFile):
with open(srcFile,"rb") as src:
srcData = src.read()
with open(destFile,"rb") as dest:
destData = dest.read()
checked = False
if(len(srcData)!=len(destData)):
print("It unequal between ... | [
{
"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 | compare.py | zhoukaisspu/py_script |
from moto.core.responses import BaseResponse
class PlacementGroups(BaseResponse):
def create_placement_group(self):
if self.is_not_dryrun("CreatePlacementGroup"):
raise NotImplementedError(
"PlacementGroups.create_placement_group is not yet implemented"
)
def d... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | moto/ec2/responses/placement_groups.py | symroe/moto |
# coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask_restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/repo/', endpoint='api.repo.list')
class RepoListAPI(flask_restful.Resource):
def g... | [
{
"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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | main/api/v1/repo.py | AlexRogalskiy/github-stats |
from .net_stream_interface import INetStream
class NetStream(INetStream):
def __init__(self, muxed_stream):
self.muxed_stream = muxed_stream
self.mplex_conn = muxed_stream.mplex_conn
self.protocol_id = None
def get_protocol(self):
"""
:return: protocol id that stream ... | [
{
"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 | libp2p/network/stream/net_stream.py | ChihChengLiang/py-libp2p |
# coding: utf-8
"""
Cloudsmith API
The API to the Cloudsmith Service
OpenAPI spec version: v1
Contact: support@cloudsmith.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import cloudsmith_api
f... | [
{
"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 | bindings/python/src/test/test_rates_api.py | cloudsmith-io/cloudsmith-api |
"""
EDID helper
"""
from subprocess import CalledProcessError, check_output
from typing import ByteString, List
__all__ = ["EdidHelper"]
class EdidHelper:
"""Class for working with EDID data"""
@staticmethod
def hex2bytes(hex_data: str) -> ByteString:
"""Convert hex EDID string to bytes
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer"... | 3 | pyedid/helpers/edid_helper.py | timotheuslin/pyedid |
# Global Imports
import json
from collections import defaultdict
# Metaparser
from genie.metaparser import MetaParser
# =============================================
# Collection for '/mgmt/tm/ltm/profile/server-ssl' resources
# =============================================
class LtmProfileServersslSchema(MetaParse... | [
{
"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 | src/genie/libs/parser/bigip/get_ltm_profileserver_ssl.py | balmasea/genieparser |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.