source
string
points
list
n_points
int64
path
string
repo
string
#! /usr/bin/env python3 """A program to verify output of prophyle-assembler. Author: Karel Brinda <kbrinda@hsph.harvard.edu> Licence: MIT """ import sys import re from Bio import SeqIO in1_fn = sys.argv[1] in2_fn = sys.argv[2] out1_fn = sys.argv[3] out2_fn = sys.argv[4] inter_fn = sys.argv[5] k = int(sys.argv[6]) ...
[ { "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
prophyle/prophyle_assembler/tools/verify_output.py
karel-brinda/prophyle
class WebPageStatus: def __init__(self, url, ua_type, status_code, location): self.url = url self.ua_type = ua_type self.status_code = status_code self.location = location def output(self): return self.url + ',' + self.ua_type + ',' + str(self.status_code) + ',' + self.location
[ { "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_return_types_annotated", "question": "Does every function in this file have a return...
3
models/web_page_status.py
koba-masa/my_scraping_tool
#!/usr/bin/env python3 import sys import psutil import subprocess import numpy as np import matplotlib.pyplot as plt if (len(sys.argv) < 2): print("usage: python3 driver.py <runs>") sys.exit(1) input_file = 'fib_time' output_file = "time.png" runs = int(sys.argv[1]) def outlier_filter(data, threshold=2): ...
[ { "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
scripts/driver.py
rickywu0421/fibdrv
from __future__ import print_function from ds_stack import Stack import string def convert_infix_to_postfix(infix_str): order = {} order['*'] = 1 order['/'] = 1 order['+'] = 2 order['-'] = 2 order['('] = 3 op_stack = Stack() postfixes = [] tokens = infix_str.split() for token...
[ { "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
alg_infix_to_postfix.py
bowen0701/python-algorithms-data-structures
#!/usr/bin/python # # Copyright 2018-2022 Polyaxon, 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 ...
[ { "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
cli/polyaxon/deploy/operators/pip.py
polyaxon/cli
from datetime import datetime from filetime import from_datetime, to_datetime, utc def test_from_datetime(): assert from_datetime(datetime(2009, 7, 25, 23, 0)) == 128930364000000000 assert from_datetime(datetime(1970, 1, 1, 0, 0, tzinfo=utc)) == 116444736000000000 assert from_datetime(datetime(1970, 1, 1, 0, 0)) ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "ans...
3
tests/test_main.py
jleclanche/filetime
import datetime from django.core.management import call_command from dashboard.testing import BuilderTestCase from apps.fruits.builder import direct_wholesale_06 from apps.dailytrans.models import DailyTran from apps.fruits.models import Fruit from apps.configs.models import Source from django.db.models import Q clas...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true...
3
src/apps/fruits/tests/test_builder_wholesale_06.py
MatsuiLin101/aprp
#!/usr/bin/env python # -*- coding: utf-8 -*- # # date: 2018/2/22 # author: he.zhiming # from __future__ import unicode_literals, absolute_import import random class RandomUtils: @classmethod def get_random_float(cls) -> float: """调整标准库命名 提示调用者, 会返回一个float :return: ...
[ { "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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer"...
3
py3utils/_random.py
hezhiming/py3utils
from abc import ABC def route(rule, **options): """Decorator for defining routes of FlaskController classes. Acts in the same way ass @app.route. Can be used for a class to set a base route too. Args: path (str): The path of the newly defined route options: refer to flasks docs for 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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excludi...
3
flask_controller/controller.py
AlexFence/FlaskController
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import time window = 0 counter = 0 posX = 10 posY = 10 flag =0 width, height = 500, 400 def draw_rect(x,y,width,height): time.sleep(0.01) glBegin(GL_QUADS) glVertex2f(x, y) glVertex2f(x+width, y) glVertex2f(x+w...
[ { "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
AugumentedReality/OpenGl_testing1.py
sainikhilgoud10/ComputerVision-ImageProcessing
"""Tests for distutils.command.bdist.""" import os import unittest from test.support import run_unittest import warnings with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) from distutils.command.bdist import bdist from distutils.tests import support class Buil...
[ { "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
resources/WPy32/python-3.10.2/Lib/distutils/tests/test_bdist.py
eladkarako/yt-dlp_kit
# Copyright 2016 NTT DATA # 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 law or 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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true ...
3
masakari-7.0.0/masakari/tests/uuidsentinel.py
scottwedge/OpenStack-Stein
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 15 10:14:35 2018 @author: alexissoto """ ''' Music Production Kit ''' import librosa as lb song = "Fantasia_Impromptu.m4a" #Input file def TempoChange(): y, sr = lb.load(song, duration = 30) tempo, beat_frames = lb.beat.beat_trac...
[ { "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
MusicP_Kit/Librosa1.py
alexissoto1/AudioNerd.py
# # @lc app=leetcode id=225 lang=python3 # # [225] Implement Stack using Queues # # @lc code=start class MyStack: def __init__(self): """ Initialize your data structure here. """ self.stack = [] def push(self, x: int) -> None: """ Push element x onto stack. ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }...
3
Python3/225.implement-stack-using-queues.py
canhetingsky/LeetCode
from django.views.generic import View from django.shortcuts import render, render_to_response from django.template import Template, Context from django.http import HttpResponse, HttpResponseRedirect from aboutrape.models import Category, Comment, UserProfile import json def about(request): users = UserProfile.obje...
[ { "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
aboutrape/views.py
slamice/aboutrape
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() # NOQA from cached_property import cached_property from chainer imp...
[ { "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
general/chainerrl/baselines/branched_action_values.py
marioyc/baselines
import unittest from unittest.mock import patch, Mock, MagicMock, call from app import app, db from flask import Flask, request, make_response, Response, jsonify, abort, g import datetime import os class BaseTest(unittest.TestCase): def setUp(self): # self.mock_connection = Mock() self.validUserna...
[ { "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.py
chromko/actions_probe
class Robot: def __init__(self, name): self.name = name @staticmethod def sensors_amount(): return 1 class MedicalRobot(Robot): @staticmethod def sensors_amount(): return 6 class ChefRobot(Robot): @staticmethod def sensors_amount(): return 4 class WarRo...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false...
3
Polymorphism and Abstraction/Robots/robots_after.py
vasetousa/OOP
from mmcv.runner import OptimizerHook class DistOptimizerHook(OptimizerHook): def __init__(self, update_interval=1, grad_clip=None, coalesce=True, bucket_size_mb=-1): self.grad_clip = grad_clip self.coalesce = coalesce self.bucket_size_mb = bucket_size_mb self.update_interval = up...
[ { "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
openselfsup/hooks/optimizer_hook.py
speedcell4/OpenSelfSup
import csv import tarfile # from transformers import cached_path import io # empd_file = "https://dl.fbaipublicfiles.com/parlai/empatheticdialogues/empatheticdialogues.tar.gz" EMOTION = 2 CONTEXT = 3 UTTERANCE = 5 def replace_comma(text): p = {'_comma_':' ,', '..':'.', '...':'.'} for k, v in p.items(): ...
[ { "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
clf_dataset/write_files.py
AndreeaGrosuleac/transfer-learning-conv-ai
from django import forms from django.utils.translation import ugettext_lazy as _ from aldryn_apphooks_config.utils import setup_config from app_data import AppDataForm from parler.forms import TranslatableModelForm from sortedm2m.forms import SortedMultipleChoiceField from .models import Category, QuestionListPlu...
[ { "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
aldryn_faq/forms.py
liip-forks/aldryn-faq
#!/usr/bin/env python """Tests for grr.parsers.rekall_artifact_parser.""" import os from grr.lib import config_lib from grr.lib import flags from grr.lib import rdfvalue from grr.lib import test_lib from grr.parsers import rekall_artifact_parser class RekallVADParserTest(test_lib.GRRBaseTest): """Test parsing ...
[ { "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
parsers/rekall_artifact_parser_test.py
nahidupa/grr
import decimal from graphene.types import Scalar from graphql.language import ast # See: https://github.com/graphql-python/graphene-django/issues/91#issuecomment-305542169 class Decimal(Scalar): """ The `Decimal` scalar type represents a python Decimal. """ @staticmethod def serialize(dec): ...
[ { "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
backend/backend/core/graphql/scalars.py
vreaxe/travel-expense-manager
# -*- coding: utf-8 -*- import contextlib import logging from framework.mongo import database as proxy_database from website import settings as osfsettings logger = logging.getLogger(__name__) @contextlib.contextmanager def handle_missing_client(): try: yield except AttributeError: if not osf...
[ { "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
framework/transactions/commands.py
alexschiller/osf.io
from archspee.presenters import PresenterBase from archspee.listeners import ListenerStatus _LOG_LEVEL = None class LogPresenter(PresenterBase): def __init__(self, action_callback, **kwargs): self.__log_level = _LOG_LEVEL super(LogPresenter, self).__init__(action_callback) self.status = Li...
[ { "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
archspee/presenters/log.py
wangpy/archspee
import string import random from functools import wraps from urllib.parse import urlencode from seafileapi.exceptions import ClientHttpError, DoesNotExist def randstring(length=0): if length == 0: length = random.randint(1, 30) return ''.join(random.choice(string.lowercase) for i in range(length)) def...
[ { "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
seafileapi/utils.py
nguacon01/python-seafile
""" Timings against numpy/itk/nibabel/etc where appropriate """ import os import nibabel as nib import itk import ants import time def time_nifti_to_numpy(N_TRIALS): """ Times how fast a framework can read a nifti file and convert it to numpy """ datadir = os.path.join(os.path.dirname(os.path.realpa...
[ { "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
tests/timings.py
ncullen93/ANTsPy
import argparse import json import os import sys from jupyter_client.kernelspec import KernelSpecManager from IPython.utils.tempdir import TemporaryDirectory kernel_json = { "argv": [sys.executable, "-m", "JWLX_kernel", "-f", "{connection_file}"], "display_name": "JWLX", "language": "text", } def install...
[ { "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
JWLX_kernel/install.py
Ludwiggle/JWLX
import torch from torch.utils.data import Dataset import os from torchvision.transforms import transforms from PIL import Image class FaceDataset(Dataset): def __init__(self,path_1=r"D:\DataSet",path_2="D:\DataSet\wider",size=24,tf=transforms.ToTensor()): super(FaceDataset, self).__init__() self.da...
[ { "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
dataset/SamplingDataSetRnet.py
swpucwf/MTCNN_Pytorch
""" Thank you Funkwhale for inspiration on the HTTP signatures parts <3 https://funkwhale.audio/ """ import datetime import logging from typing import Union import pytz from Crypto.PublicKey.RSA import RsaKey from requests_http_signature import HTTPSignatureHeaderAuth from federation.types import RequestType from fe...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/c...
3
federation/protocols/activitypub/signing.py
weex/federation
from django.db.models import Sum from rest_framework import serializers from like.models import Like from .models import Comment from accounts.serializers import UserSerializer class CommentSerializer(serializers.ModelSerializer): owner = UserSerializer(read_only=True) like = serializers.SerializerMethodField() d...
[ { "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
comment/serializers.py
vahidtwo/simpleSocialSite
import logging LOG = logging.getLogger(__name__) class FlushAndLockMySQLAction(object): def __init__(self, client, extra_flush=True): self.client = client self.extra_flush = extra_flush def __call__(self, event, snapshot_fsm, snapshot_vol): if event == 'pre-snapshot': if s...
[ { "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
plugins/holland.backup.mysql_lvm/holland/backup/mysql_lvm/actions/mysql/lock.py
a5a351e7/holland
from covid_news_handling import check_for_deleted_news, delete_news, get_accepted_articles, news_api_request import sched, time, logging def test_all(): test_get_accepted_articles() test_delete_news() test_check_for_deleted_news() test_news_API_request() logging.info("News data handling test comple...
[ { "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
test_news_data_handling.py
joshfinney/COVID-19-Data-Hub
# 这个程序开始即代表进入清洁模式 class cleaner(object): '''Create this class to give a cleaning mode to the program. Attribute: __is_cleaning: A protected attribute refers to the status of cleaning mode. ''' def __init__(self): self.__is_cleaning = False #定义了一个私有属性 def is_cle...
[ { "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
cleaner.py
HdjjSDIM/21_Fall_project_gabbishSorting
import torch.nn as nn import numpy as np import pytest from test.utils import convert_and_test class LayerSigmoid(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerSigmoid, self).__init__() self.sig = nn.Sigmoid() def forward(self, x): x = ...
[ { "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
test/layers/activations/test_sigmoid.py
dawnclaude/onnx2keras
# -*- coding: utf-8 -*- # @Time : 2020/11/26 15:14 # @File : SecurityBase.py # @Author : Rocky C@www.30daydo.com import re class StockBase: def __init__(self): pass def valid_code(self,code): pattern = re.search('(\d{6})', code) if pattern: code = pattern.group(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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
common/SecurityBase.py
cogitate3/stock
# -*- coding: utf-8 -*- """ Created on Wed Oct 19 17:35:09 2016 @author: yxl """ from imagepy.core.engine import Tool import numpy as np from imagepy.core.manager import ColorManager # from imagepy.core.draw.fill import floodfill from skimage.morphology import flood_fill, flood class Plugin(Tool): title = 'Flood...
[ { "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
imagepy/tools/Draw/floodfill_tol.py
CsatiZoltan/imagepy
from porcupine.base import Serializer class User(object): def __init__(self, name=None, surname=None, age=None): self.name = name self.surname = surname self.age = age class UserSerializer(Serializer): name: str surname: str age: int = None @staticmethod def resolve_...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than ...
3
tests/test_resolvers.py
zurek11/simple_serializer
from Queue import Queue import threading class ThreadedReader: def __init__(self, file, startImmediately=True): self.queue = Queue() self.file = file self.thread = None if startImmediately: self.start() def next(self): return None if self.queue.empty() else self.queue.get() def thread_loop(self): f...
[ { "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
threaded_reader.py
vlaznev/SerialPlotter
from flask import Flask, request, Response from flask_restx import Resource, Api, fields from flask import abort, jsonify from flask_cors import CORS app = Flask(__name__) CORS(app) api = Api(app) ns_movies = api.namespace('ns_movies', description='Movies APIs') movie_data = api.model( 'Movie Data', { ...
[ { "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
forflask/app.py
yellowjung/docker-movie-project
import webiopi import datetime GPIO = webiopi.GPIO LIGHT = 17 # GPIO pin using BCM numbering HOUR_ON = 8 # Turn Light ON at 08:00 HOUR_OFF = 18 # Turn Light OFF at 18:00 # setup function is automatically called at WebIOPi startup def setup(): # set the GPIO used by the light to output GPIO.setFunction(LIG...
[ { "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
script.py
fraromesc/conceptos_raspberry
from unittest.mock import MagicMock from django.urls import reverse from hijack.contrib.admin import HijackUserAdminMixin from hijack.tests.test_app.models import Post class TestHijackUserAdminMixin: def test_user_admin(self, admin_client): url = reverse("admin:test_app_customuser_changelist") 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": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false...
3
hijack/tests/test_admin.py
sondrelg/django-hijack
from abc import ABC, abstractmethod class ExplorationPolicy(ABC): def __init__(self): pass @abstractmethod def update(self, *args): """Called at each action""" raise NotImplementedError @abstractmethod def explore(self, *args): """Decides what to do as the next 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_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false ...
3
breakout_RL/exploration_policies/ExplorationPolicy.py
MarcoFavorito/breakout-RL
""" Python 3 Object-Oriented Programming Chapter 13. Testing Object-Oriented Programs. """ import json from pathlib import Path import socketserver from typing import TextIO import pickle import struct import sys class LogDataCatcher(socketserver.BaseRequestHandler): log_file: TextIO count: int = 0 size...
[ { "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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer"...
3
ch_13/src/log_catcher.py
real-slim-chadi/Python-Object-Oriented-Programming---4th-edition
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import List, Optional from didcomm.common.types import DID_URL, VerificationMethodType, VerificationMaterial @dataclass class Secret: """ A secret (private key) abstraction. Attributes: kid (str): a key ID identify...
[ { "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
didcomm/secrets/secrets_resolver.py
alex-polosky/didcomm-python
from genetic import Genetic genetic = Genetic() genetic.generation_gen() def normalize(datas, max_height, max_width): def compute(val, max, min): return (val - min) / max - min for data in datas: data.rocket_top = compute(data.rocket_top, max_height, 0) data.wall_left = compute(data.wall_lef...
[ { "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
src/main.py
hupiat/rocket-game-ml
from __future__ import absolute_import, division, print_function from glue.core.state_objects import State from glue.external.echo import CallbackProperty, keep_in_sync class AladinLiteLayerState(State): layer = CallbackProperty() visible = CallbackProperty(True) zorder = CallbackProperty(0) color =...
[ { "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
glue_aladin/layer_state.py
glue-viz/glue-aladin
""" elasticapm.contrib.pylons ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011-2017 Elasticsearch Large portions are :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from elasticapm.base import Client from elasticapm.middleware import ElasticAPM as Middl...
[ { "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
elasticapm/contrib/pylons/__init__.py
lyrixderaven/apm-agent-python
class NumArray: # O(n) time | O(n) space - where n is the length of the input list def __init__(self, nums: List[int]): self.nums = [] currentSum = 0 for num in nums: currentSum += num self.nums.append(currentSum) # O(1) time to look up the nums list def s...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "...
3
dynamicProgramming/303_range_sum_query_immutable.py
weilincheng/LeetCode-practice
# -* encoding: utf-8 *- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from aptly_api.parts.misc import MiscAPISection from aptly_api.parts.packages import PackageAPIS...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true...
3
aptly_api/client.py
njgraham/aptly-api-client
#!/usr/bin/env python """Provide error classes.""" # Imports from db_tools import __author__, __email__ class DBToolsError(Exception): """Base error class.""" class NotImplementedYet(NotImplementedError, DBToolsError): """Raise when a section of code that has been left for another time is asked to execute....
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": false },...
3
db_tools/errors.py
ScottSnapperLab/db_tools
import insightconnect_plugin_runtime from .schema import GetRuleInput, GetRuleOutput, Input, Output, Component # Custom imports below from insightconnect_plugin_runtime.helper import clean from threatstack.errors import ThreatStackAPIError, ThreatStackClientError, APIRateLimitError from insightconnect_plugin_runtime.e...
[ { "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
plugins/threatstack/icon_threatstack/actions/get_rule/action.py
lukaszlaszuk/insightconnect-plugins
import os import logging import datetime log_level = logging.DEBUG # Default message level class UseridFilter(logging.Filter): '''Default value for the user ID''' def filter(self, record): if not hasattr(record, 'userid'): record.userid = 'Global' return True def setup_logger...
[ { "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
core/botLogger.py
artpavlov/reportme
from django.db import models from django.contrib.auth.models import AbstractUser from django.contrib.postgres.fields import JSONField from django.core.cache import cache from datetime import datetime import pytz, logging from dojo.crest import get_crest_connection, store_connection log = logging.getLogger('dojo') c...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
dojo/main/models.py
kriberg/eve-bushido
import poplib import email import time class MailHelper: def __init__(self, app): self.app = app def get_mail(self, username, password, subject): for i in range(5): pop = poplib.POP3(self.app.config['james']['host']) pop.user(username) pop.pass_(password)...
[ { "point_num": 1, "id": "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
fixture/mail.py
aakulich/python_training_mantis
import cjb.uif from cjb.uif.views import Label from viz.layout import buttonSize class BaseScene(cjb.uif.Scene): def __init__(self, ui, key = None): self.ui = ui self.scroller = None cjb.uif.Scene.__init__(self, ui.manager, key or self.__class__.__name__) self.container.properti...
[ { "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
viz/scenes/base.py
entzian/spats
class ConsoleDialogueView: def __init__(self, speaker="", message=""): self.speaker = speaker self.message = message def render(self): self.__print_message() input() return self def render_with_choice(self, options): if len(options) == 0: raise ...
[ { "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
views/console_dialogue_view.py
Catsuko/Westward
import praw import database_infrastructure.dbHandler as dbController from apscheduler.schedulers.background import BackgroundScheduler import redditController.collectSubredditsForAsync as redditController def collectSubredditsForCovid(): redditController.collectSubredditsForCovid('covid') redditController.col...
[ { "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
projectBase/background/collectSubRedditsforCovid.py
hseyindemir/swe_773_hdemir
# -*- coding: utf-8 -*- # Copyright 2016 Dravetech AB. All rights reserved. # # The contents of this file are 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/LI...
[ { "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
napalm_dellos6/dellos6.py
KingJ/napalm-dellos6
""" Enlace al problema: https://leetcode.com/problems/merge-two-sorted-lists/ Si deseas probar la solución sólo tienes que copiar la clase Solution ya que dicha clase es la que se ejecuta en la plataforma de LeetCode. """ class ListNode: def __init__(self, val=0, next=None): self.val = val ...
[ { "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
leetcode/merge_two_sorted_lists.py
jjrodcast/CompetitiveProblems
# This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.ve/property_nameservers_missing # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser im...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false...
3
test/record/parser/test_response_whois_nic_ve_property_nameservers_missing.py
huyphan/pyyawhois
import abc class BasePureDataset(abc.ABC): @abc.abstractproperty def doi_upload_key(self): """ The DOI for this dataset if available, or another key in the format "no_doi/<header_identifier>" :returns: string """ pass @abc.abstractproperty def original_me...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer":...
3
pure_adaptor/pure/base/models.py
JiscSD/rdss-pure-adaptor
__all__ = [ 'Code', ] import string, random, re class Code: CONTANST = string.ascii_letters + string.digits # 去除掉不易分辨的字符的随机串 def get_code(self, n): t_str = '' length = self.len_constant for _ in range(n): t_str += self.easy_constant[random.randint(0, length-1)] ...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, ...
3
JDjangoDemo/datas_tools/datas.py
JIYANG-PLUS/JDjango
"""Module containing the main config classes""" from typing import Optional from pydantic import BaseModel class RedisConfig(BaseModel): """A config object for connecting to redis""" host: str = "localhost" port: int = 6379 db: int = 0 password: Optional[str] = None ssl: bool = False enc...
[ { "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
pydantic_aioredis/config.py
estesistech/pydantic-aioredis
from PyQt5.QtWidgets import QTableWidget, QHeaderView, QTableWidgetItem class SpreadsheetWidget(QTableWidget): def __init__(self): super().__init__() self.threadDataNames = ['d, D', 'P', 'd1, D1', 'd2, D2', 'z', 'x_вал', 'a_вал', 'f_вал', 'R_вал', 'R1_вал', '...
[ { "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
spreadsheet_widget.py
DefenderOfSockets/-
# coding: utf-8 """ LogicMonitor REST API LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer":...
3
test/test_device_sla_widget_data.py
JeremyTangCD/lm-sdk-python
from dataclasses import dataclass from functools import reduce from parse import findall from aocd import get_data @dataclass class Fold: x_or_y: str value: int def fold(self, coordinates): return {self._transform(x, y) for x, y in coordinates} def _transform(self, x, y): if self.x_...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inherit...
3
aoc/year2021/day13/day13.py
Godsmith/adventofcode
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate plt.ion() f0 = 1e-4 u0 = 1.0 R0 = 40e3 # radius vmax = -1.0 # m/s def v1(rr): v = -vmax*rr/R0*np.exp(-0.5*(rr/R0)**2) # v = -vmax*np.tanh(rr/R0)/(np.cosh(rr/R0))**2/(np.tanh(1.0)/(np.cosh(1.0))...
[ { "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
eddy_airsea/analysis/ode_wave.py
bderembl/mitgcm_configs
import abc from typing import Callable from typing import Iterator from typing import List from typing import Optional from xsdata.codegen.models import Class from xsdata.models.config import GeneratorConfig from xsdata.utils.constants import return_true class ContainerInterface(metaclass=abc.ABCMeta): """Wrap a...
[ { "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
xsdata/codegen/mixins.py
gramm/xsdata
import random def str2bool(v): """Parse boolean value from string.""" return str(v).lower() in ("true", "t", "1") def random_replicate_name(len=12): """Return a random alphanumeric string of length `len`.""" out = random.choices('abcdefghijklmnopqrtuvwxyzABCDEFGHIJKLMNOPQRTUVWXYZ0123456789', k=len)...
[ { "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
pangea/core/utils.py
LongTailBio/pangea-django
# -*- coding: utf-8 -*- import logging import requests # import json from modules import cbpi from thread import start_new_thread headers = {'content-type': '"application/json; charset=utf-8"'} unit = "F" @cbpi.initalizer(order=999) def init(cbpi): # Setup BrewFather telemetry (optional) global unit unit = ...
[ { "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
__init__.py
tlareywi/BrewfatherTelemetry
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ { "point_num": 1, "id": "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
aliyun-python-sdk-pts/aliyunsdkpts/request/v20190810/DescribeJMeterSampleSummaryRequest.py
yndu13/aliyun-openapi-python-sdk
import xml.etree.ElementTree as ET from .. import NAMESPACE class ServerResponseError(Exception): def __init__(self, code, summary, detail): self.code = code self.summary = summary self.detail = detail super(ServerResponseError, self).__init__(str(self)) def __str__(self): ...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false...
3
tableauserverclient/server/endpoint/exceptions.py
reevery/server-client-python
from django.utils import timezone class DurgoMiddleware: def __init__(self, get_response): self.get_response = get_response # One-time configuration and initialization. def __call__(self, request): start_time = timezone.now() response = self.get_response(request) end...
[ { "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
durgo_sdk/integrations/django/middleware.py
safwanrahman/durgo-python
# -*- coding: utf-8 -*- """ Copyright (C) 2015, Radmon. Use of this source code is governed by the MIT license that can be found in the LICENSE file. """ from flask import render_template from ..auth import auth from ..blog import blog def index(): return render_template('site/index.html') def about(): ret...
[ { "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
papery/site/views.py
radonlab/papery
from tests.helpers.run_command import run_command from tests.helpers.runif import RunIf @RunIf(amp_apex=True) def test_apex_01(): """Test mixed-precision level 01.""" command = [ "run.py", "trainer=default", "trainer.max_epochs=1", "trainer.gpus=1", "trainer...
[ { "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
tests/smoke/test_mixed_precision.py
marsggbo/hyperbox
""" Question: Happy Number Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will st...
[ { "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
202-happy-number.py
mvj3/leetcode
# (C) British Crown Copyright 2018 - 2019, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
[ { "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
journal_venv/lib/python3.9/site-packages/cartopy/tests/mpl/test_plots.py
ushham/JournalTool
def sanitize_text(text): text = text.replace('@marcusgabrields', '') text = text.strip() if len(text) > 280 or text.isdigit() is False: return None return int(text) def fizzbuzz(text): num = sanitize_text(text) if num is None: return None if num % 3 == 0 and n...
[ { "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
twitter_fizzbuzz/helpers.py
marcusgabrields/twitter_fizzbuzz
import glob import os.path import shutil import argparse import cv2 def clean_folder(folder_name): try: shutil.rmtree(folder_name) except OSError: pass except TypeError: return os.makedirs(folder_name, exist_ok=True) def make_folder(folder_name): os.makedirs(folder_name,...
[ { "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
tools.py
nodiz/det-reid
# Copyright (c) 2015 Intel Corporation # # 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_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
jacket/tests/storage/unit/fake_backup.py
bopopescu/jacket
from django.shortcuts import render, HttpResponse from django.views.decorators.csrf import csrf_exempt from share.util_file import log_event import json import hashlib, hmac, base64 import os from main_settings.settings import BASE_DIR from .models import WebhookLog from .shell_cmd import Cmds from .hook import GithubH...
[ { "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
fei_webhook/app_webhook/views_github.py
colingong/fei_webhook
import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State from flask_login import logout_user import dash_bootstrap_components as dbc def render_logout_button(): return [ html.Div( [ dbc.Button("Logout", id="logo...
[ { "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
dash_access_manager/logout.py
evan-lh/dash-access-manager
import sys import argparse import pandas as pd from PySide2.QtCore import QDateTime, QTimeZone from PySide2.QtWidgets import QApplication from lesson_08_main_window import MainWindow from lesson_08_mainWidget import Widget def transform_date(utc, timezone=None): utc_fmt = "yyyy-MM-ddTHH:mm:ss.zzzZ" new_date...
[ { "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
pyside/lesson_08_main.py
LueyEscargot/pyGuiTest
import re from collections import Counter def words(text): return re.findall(r'\w+', text.lower()) WORDS = Counter() TOTAL_WORDS = 0 def init(filename = 'big.txt'): global WORDS global TOTAL_WORDS #统计词频,并存储为词典 WORDS = Counter(words(open(filename).read())) #统计总词数 TOTAL_WORDS=sum(WORDS.values()...
[ { "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
evaluate/norvig_spell.py
aiainui/JamSpell
import unittest import pandas as pd import os from kmall_player import * class KmallPlayerTest(unittest.TestCase): def setUp(self) -> None: file_name = "data/MRZ_LARGE_SIZE.kmall" self.f = open(file_name, "rb") self.file_size = os.fstat(self.f.fileno()).st_size self.player = KmallP...
[ { "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
kmall_player.test.py
monsterkittykitty/kmall
import sys import yaml try: from yaml import CSafeLoader as SafeLoader, CSafeDumper as SafeDumper except ImportError: print("Failed to load fast LibYAML bindings. You should install them to speed up kluctl.", file=sys.stderr) from yaml import SafeLoader as SafeLoader, SafeDumper as SafeDumper def constr...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inherit...
3
kluctl/utils/yaml_utils.py
codablock/kluctl
from django.test import TestCase from django.contrib.auth import get_user_model from core import models def sample_user(email='test@ceratopsdev.com', password='testPass'): """Create a sample user""" return get_user_model().objects.create_user(email, password) class ModelTests(TestCase): def test_create_...
[ { "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
app/core/tests/test_models.py
trstocks/recipe-app-api
import html from telethon import utils from telethon.tl import types from FIREX.utils import admin_cmd, edit_or_reply, sudo_cmd def get_who_string(who): who_string = html.escape(utils.get_display_name(who)) if isinstance(who, (types.User, types.Channel)) and who.username: who_string += f" <i>(@{who....
[ { "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
userbot/plugins/who.py
Doom098/userbot
import abc from abc import abstractmethod from typing import Union from osiris.base.generalutils import instantiate class SecretVault(abc.ABC): @abstractmethod def get_secret(self, key: str, attr: str = None, **kwargs) -> Union[dict, str]: pass class NoopSecretVault(SecretVault): def get_secr...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?"...
3
osiris/vault/__init__.py
skadyan/aws-glue-python-kickstart
""" Google web search. Run queries on Google and return results. """ import requests from kochira import config from kochira.service import Service, background, Config, coroutine from kochira.userdata import UserData service = Service(__name__, __doc__) @service.config class Config(Config): api_key = config.F...
[ { "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
kochira/services/web/google.py
gnowxilef/kochira
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry import benchmark from telemetry.web_perf import timeline_based_measurement from benchmarks import simple_story_set class TBMSample(benchmark....
[ { "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
telemetry/examples/benchmarks/tbm_benchmark.py
ravitejavalluri/catapult
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (exclud...
3
aliyun-python-sdk-cloudwf/aliyunsdkcloudwf/request/v20170328/ShopCreatemarketingRequest.py
yndu13/aliyun-openapi-python-sdk
from turbogears import testutil from genshitest.controllers import Root import cherrypy cherrypy.root = Root() def test_method(): "the index method should return a string called now" import types result = testutil.call(cherrypy.root.index) assert type(result["now"]) == types.StringType def test_index...
[ { "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
libs/external_libs/Genshi-0.5.1/examples/turbogears/genshitest/tests/test_controllers.py
google-code-export/django-hotclub
"""Takes filename as input, creates a Markdown table of contents from its Markdown headers, and prints TOC to stdout. """ import re def get_headers(s): """Returns header tuples with text and indentation level. """ PATTERN = '###* (?=\w)' matches = [] for line in s.splitlines(): m = re.matc...
[ { "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
docs/toc.py
chunqian/Requester
import pytest from mergesort import mergesort, merge def test_empty_list_returns_empty_list(): """Test mergesort on empty list returns same.""" empty = [] assert mergesort(empty) == [] def test_list_with_one_value(): """Test mergesort on empty list returns same.""" lst = [8] assert mergesort...
[ { "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
data_structures/sorting_algos/mergesort/test_mergesort.py
jeremyCtown/data-structures-and-algorithms
import unittest import parameterized import numpy as np from rlutil.envs.tabular_cy import q_iteration, tabular_env from rlutil.envs.tabular_cy import q_iteration_py class QIterationTest(unittest.TestCase): def setUp(self): self.num_states = 128 self.env = tabular_env.RandomTabularEnv(num_states=...
[ { "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
rlutil/envs/tabular_cy/test_random_env.py
alexlioralexli/diagnosing_qlearning
from typing import Callable from .subscriber.subscriber import Subscriber from .publisher.publisher import Publisher from ..common.broker_mode import BrokerMode, BROKER_MODE from .subscriber.subscriber_factory import SubscriberFactory from .publisher.publisher_factory import PublisherFactory ''' A host can be both 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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding se...
3
src/app/client/host.py
acatalfano/distributed-systems-assignment-1
class Presenter(): def __init__(self, name): # 생성자(Constructor) self.name = name def say_hello(self): # 메서드(method) print('Hello, ' + self.name) presenter = Presenter('Chris') presenter.name = 'Christopher' presenter.say_hello()
[ { "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
more-python-for-beginners/03 - Classes/basic_class.py
CloudBreadPaPa/c9-python-getting-started
import time from typing import Any, Optional def make_side_effect(messages, delay=None): """Make a side effect from a list of messages, optionally adding a delay.""" msg_queue = list(reversed(messages)) sleep_delay = delay def side_effect(*args, **kwargs): if sleep_delay is not None: ...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside...
3
tests/unit/__init__.py
dailymuse/musekafka-py