source
string
points
list
n_points
int64
path
string
repo
string
"""Problem 55: Lychrel numbers""" import unittest def is_palindrome(n): return str(n) == str(n)[::-1] def reverse_and_add(n): """Returns n + reversed(n).""" return n + int(str(n)[::-1]) def is_Lychrel(n): """"Tests up to 50 iterations.""" count = 1 current = n while count < 50: cu...
[ { "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
probs/prob55.py
mattrid93/ProjectEuler
import unittest import numpy as np import logging from dsbox.ml.neural_networks.keras_factory.text_models import LSTMFactory from dsbox.ml.neural_networks.processing.workflow import TextNeuralNetPipeline, ImageNeuralNetPipeline logging.getLogger("tensorflow").setLevel(logging.WARNING) np.random.seed(42) class T...
[ { "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
tests/ml/neural_networks/processing/test_workflow.py
Pandinosaurus/dsbox
from django import template, VERSION from django.conf import settings from django.utils.safestring import mark_safe from .. import utils register = template.Library() @register.simple_tag def render_presigned_bundle( bundle_name, bucket_name, prefix=None, expiration=None, extension=None, con...
[ { "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/webpack_loader_remote/templatetags/webpack_loader_remote.py
alexseitsinger/django-webpack-loader-remote
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2021 Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram 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...
[ { "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_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "an...
3
venv/Lib/site-packages/pyrogram/raw/types/send_message_record_video_action.py
D1ne2021/jjhhhjj
#!/usr/bin/env python3 # Copyright (c) 2017-2018 The BitsCoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test wallet replace-by-fee capabilities in conjunction with the fallbackfee.""" from test_framework.te...
[ { "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/functional/wallet_fallbackfee.py
Bits-Coin/bits-coin
import time def time_stamp_now(): time_now = int(time.time()) time_local = time.localtime(time_now) return time.mktime(time_local) class FileMetaData: def __init__(self, fname, blocks=None, timestamp=None): if blocks is None: blocks = [] self.fname = fname self.bl...
[ { "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
src/model.py
2019ds-fnw/FinalDFS
# -*- coding: utf-8 -*- """Test helpers""" import imaplib import sys import unittest from imap_cli import const from imap_cli import summary from imap_cli import tests class FetchTest(unittest.TestCase): def setUp(self): imaplib.IMAP4_SSL = tests.ImapConnectionMock() def test_status_command(self...
[ { "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
imap_cli/tests/test_summary.py
salewski/imap-cli
from flask import render_template from app import db from app.errors import bp @bp.app_errorhandler(404) def not_found_error(error=None): return render_template('errors/404.html'), 404 @bp.app_errorhandler(500) def internal_error(error=None): db.session.rollback() return render_template('errors/500.html...
[ { "point_num": 1, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answe...
3
app/errors/handlers.py
AdamVerner/flask-boilerplate
#!/usr/bin/python # -*- coding: utf-8 -*- from flask_mailer.backends.base import Mailer class DummyMailer(Mailer): """Dummy mailing instance for unittests. Keeps all sent messages in *oubox* list. """ def __init__(self, **kwargs): self.outbox = [] def send(self, message): """Send...
[ { "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
Backend/lib/python3.6/site-packages/flask_mailer/backends/dummy.py
sahilb2/SelfImprovementWebApp
""" Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1 return [ [5,4,11,2], ...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docst...
3
algorithms/tree/path_sum2.py
Heart-throb-Rajnish/algorithms
# A diagnostic tool from pathlib import Path from typing import List from IPython.display import display from PIL import Image, ImageDraw from .types import Candidate class Diagnostics: def __init__(self, screenshot_path: Path): self._path = screenshot_path self._backup = Image.open(self._path)...
[ { "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
scrapegoat/diagnostics.py
gabrielelanaro/scrapegoat
from django.db import models from django.utils import timezone from jackal.managers import SoftDeleteManager class JackalModel(models.Model): soft_delete = True NAME_FIELD = 'name' created_at = models.DateTimeField(auto_now_add=True, null=True) deleted_at = models.DateTimeField(null=True) objec...
[ { "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
jackal/models.py
joyongjin/Jackal
from program import * from pcfg import * from collections import deque from heapq import heappush, heappop import time def bounded_threshold(G : PCFG, threshold = 0.0001): ''' A generator that enumerates all programs with probability greater than the threshold ''' frontier = deque() initial_non_t...
[ { "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
Algorithms/threshold_search.py
LouisJalouzot/DeepSynth-ARC
import shutil from genrl.agents import A2C from genrl.environments import VectorEnv from genrl.trainers import OnPolicyTrainer def test_a2c(): env = VectorEnv("CartPole-v0", 1) algo = A2C("mlp", env, rollout_size=128) trainer = OnPolicyTrainer(algo, env, log_mode=["csv"], logdir="./logs", epochs=1) t...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": tru...
3
tests/test_deep/test_agents/test_a2c.py
Zeus3101/genrl
class Document(object): def __init__(self, table_parser): self.table_parser = table_parser self.document = None def create(self, sql): table = self.table_parser.parse_table(sql) table_metadata = self.table_parser.parse_table_metadata(sql) fields = self.table_parser.parse...
[ { "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
documentr/document.py
hellofresh/documentr
# coding: utf-8 # cf.http://d.hatena.ne.jp/white_wheels/20100327/p3 import numpy as np import matplotlib.pylab as plt from mpl_toolkits.mplot3d import Axes3D import logging logger = logging.getLogger(__name__) def _numerical_gradient_no_batch(f, x): h = 1e-4 # 0.0001 grad = np.zeros_like(x) ...
[ { "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
src/ch04/gradient_2d.py
banbiossa/deep-learning-from-scrach
import sys class Solution: # Write your code here def __init__(self): self.stack = [] self.queue = [] def popCharacter(self): return self.stack.pop() def pushCharacter(self, char): self.stack.append(char) def dequeueCharacter(self): char = self.queue[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": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
Day 18/Queue and stacks.py
SayanBan/HackerRank-30-Days-of-code
class PolicyService(object): def __init__(self, client): self.client = client def list_policies(self, headers=None): _data = {} return self.client.perform_query('GET', '/policies/clusters/list', data=_data, headers=headers) @staticmethod def policy_to_full_dict(policy): ...
[ { "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
databricks_sync/sdk/service/cluster_policies.py
OliverJG/databricks-sync
import os from os.path import dirname from unittest import TestCase import src.superannotate as sa class TestCloneProject(TestCase): PROJECT_NAME_1 = "test create from full info1" PROJECT_NAME_2 = "test create from full info2" PROJECT_DESCRIPTION = "desc" PROJECT_TYPE = "Vector" TEST_FOLDER_PATH...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer":...
3
tests/integration/test_create_from_full_info.py
superannotateai/superannotate-python-sdk
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import os import unittest import nose import numpy as np from numpy.testing import assert_equal from pims import FramesSequence, Frame from pims.process import crop class RandomReader(FramesSequen...
[ { "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
pims/tests/test_process.py
nkeim/pims
#! /usr/bin/env python # Copyright 2014 SUSE Linux Products GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ { "point_num": 1, "id": "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
tools/jenkins-projects-checks.py
10171121/project-config-ci-name
import random import threading import time class Philosopher(threading.Thread): def __init__(self, name, leftFork, rightFork): print(f'{name} Has Sat Down At the Table') threading.Thread.__init__(self, name=name) self.leftFork = leftFork self.rightFork = rightFork def run(sel...
[ { "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
src/04_sync/philosopher.py
rurumimic/concurrency-python
import os import base64 from django.conf import settings from django.contrib.gis.geoip2 import GeoIP2 from geoip2.errors import AddressNotFoundError from pyotp import TOTP from KlimaKar.email import mail_managers, get_email_message def report_user_login(user_session): country = "-" if os.path.exists(os.pat...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding s...
3
apps/accounts/functions.py
karpiq24/django-klima-kar
''' Citing this pytorch implementation of tiny yolo from: https://github.com/marvis/pytorch-yolo2/blob/master/models/tiny_yolo.py Original YOLO: https://pjreddie.com/darknet/yolo/ ''' import numpy as np import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from .bbox_detector impo...
[ { "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
VideoSearchEngine/ObjectDetection/Yolo.py
AkshatSh/VideoSearchEngine
from typing import List, Optional, Tuple def build_node(type: str, name: str, content: str) -> str: """ Wrap up content in to a html node. :param type: content type (e.g., doc, section, text, figure) :type path: str :param name: content name (e.g., the name of the section) :type path: str ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": fals...
3
src/fonduer/utils/utils_parser.py
SenWu/fonduer
from sparkdq.analytics.states.State import DoubleValuedState class ModeState(DoubleValuedState): def __init__(self, mode_value): self.mode_value = mode_value def metric_value(self): return self.mode_value # def sum(self, other): # return ModeState(max(self.mode_value, other.mode...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false },...
3
sparkdq/analytics/states/ModeState.py
PasaLab/SparkDQ
from fastapi import FastAPI from fastapi.testclient import TestClient app = FastAPI() @app.get("/api/v1/healthcheck") async def read_main(): return "OK" @app.post("/api/v1/query") async def query(): return [{"event_date": "20210105"}] client = TestClient(app) def test_read_main(): response = client.g...
[ { "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
tests/test_mmtpa_adapter.py
UrbanOS-Examples/MMTPA_adapter
import atexit from Adafruit_MotorHAT import Adafruit_MotorHAT import traitlets from traitlets.config.configurable import Configurable class Motor(Configurable): value = traitlets.Float() # config alpha = traitlets.Float(default_value=1.0).tag(config=True) beta = traitlets.Float(default_value=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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding sel...
3
jetbot/motor.py
geoc1234/jetbot
# 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": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "ans...
3
aliyun-python-sdk-scdn/aliyunsdkscdn/request/v20171115/StopScdnDomainRequest.py
yndu13/aliyun-openapi-python-sdk
from django.db import models from django.contrib.auth.models import User # Create your models here. class UserProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) UserBio = models.TextField(max_length=100) ProfileImage = models.ImageField(upload_to='ProfilePics', blank=True)...
[ { "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
UserPage/models.py
MidnightMadne33/Image-Blog
# Copyright 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 law or agreed to in writ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true },...
3
core/results/results.py
shreyagupta30/vineperf
from fireorm.Fields import Field class BooleanField(Field): def __init__(self, **kwargs): super().__init__(validate=BooleanField.validate, **kwargs) @staticmethod def validate(value): if not type(value) == bool: raise Exception(f'Value: {value} is not valid boolean! It is type: {type(value)}') if __name...
[ { "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
src/fireorm/Fields/BooleanField.py
jerber/FireORM
import pytest # from collections import namedtuple from colt import Plugin @pytest.fixture def plugin(): class ExamplePlugin(Plugin): _plugins_storage = '_methods' _is_plugin_factory = True class PluginOne(ExamplePlugin): pass class PluginTwo(ExamplePlugin): pass c...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": tru...
3
tests/test_plugin.py
xiki-tempula/colt
from discord.ext import commands import discord import sys from pathlib import Path import motor.motor_asyncio from config import token, extension_dir from utils.context import UnnamedContext from utils.help import PaginatedHelpCommand class UnnamedBot(commands.Bot): def __init__(self, command_prefix, **options):...
[ { "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
utils/bot.py
davisschenk/Unnamed-Bot
''' Exercise 5: Vectors A vector of dimension 𝑛𝑛 can be represented by a list in Python. For example, a vector of dimension 3 could represent a point in space, and a vector of dimension 4 could represent a point in space and time (the fourth dimension being the time). In mathematical notation, a vector of dimension 3...
[ { "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
week4/week4_additionalexercice_5.py
harshonyou/SOFT1
""" To understand why this file is here, please read: http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django """ from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site d...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fe...
3
dev_insta/contrib/sites/migrations/0003_set_site_domain_and_name.py
hyowoo/dev_insta
from itunes_app_scraper.scraper import AppStoreScraper from itunes_app_scraper.util import AppStoreException, AppStoreCollections, AppStoreCategories, AppStoreUtils import json import pytest import os def test_term_no_exception(): scraper = AppStoreScraper() results = scraper.get_app_ids_for_query("mindful", ...
[ { "point_num": 1, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
scraper_test.py
svennickel/itunes-app-scraper
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class Vegetable(models.Model): name = models.CharField(max_length=50) price = models.DecimalField(max_digits=5, decimal_places=2) class Meta: verbose_name = "légume" or...
[ { "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
myWebsite/front_app/models.py
fossabot/python-website
# Copyright (c) 2010-2020 openpyxl import pytest @pytest.fixture def Image(): from ..image import Image return Image class TestImage: @pytest.mark.pil_not_installed def test_import(self, Image, datadir): from ..image import _import_image datadir.chdir() with pytest.raises(Im...
[ { "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
openpyxl/drawing/tests/test_image.py
VariantXYZ/openpyxl-variant
from app.api.data.query.ExerciseEvaluationMongoQueryRepository import ExerciseEvaluationMongoQueryRepository from tests.integration.PdbMongoIntegrationTestBase import PdbMongoIntegrationTestBase class ExerciseEvaluationMongoQueryRepositoryIntegrationTest(PdbMongoIntegrationTestBase): def setUp(self): sel...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
app/tests/integration/ExerciseEvaluationMongoQueryRepositoryIntegrationTest.py
GPortas/Playgroundb
# Copyright 2017 Google 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 law or ag...
[ { "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
scoreboard/validators/__init__.py
jnovikov/ctfscoreboard
# Copyright (c) 2013 Ondrej Kipila <ok100 at openmailbox dot org> # This work is free. You can redistribute it and/or modify it under the # terms of the Do What The Fuck You Want To Public License, Version 2, # as published by Sam Hocevar. See the COPYING file for more details. """Common functions used across the whol...
[ { "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
lyvi/utils.py
tikservices/lyvi
# -*- coding: utf-8 -*- import pytest from wemake_python_styleguide.violations.consistency import ( UselessOperatorsViolation, ) from wemake_python_styleguide.visitors.ast.operators import ( UselessOperatorsVisitor, ) # Usages: assignment = 'constant = {0}' assignment_addition = 'constant = x + {0}' assignme...
[ { "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/test_visitors/test_ast/test_operators/test_useless_operators_before_numbers.py
teners/wemake-python-styleguide
import pytest from salesman.orders.models import Order from salesman.orders.signals import status_changed _signal_called = False def on_status_changed(sender, order, new_status, old_status, **kwargs): global _signal_called _signal_called = True @pytest.mark.django_db def test_order_changed_signal(rf): ...
[ { "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
example/tests/orders/test_orders_signals.py
icvntechstudio/django-salesman
''' Source : https://leetcode.com/problems/long-pressed-name/description/ Author : Yuan Wang Date : 2019-01-12 /********************************************************************************** *Your friend is typing his name into a keyboard. Sometimes, when typing a character *c, the key might get long pressed, ...
[ { "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
String/isLongPressedName.py
konantian/LeetCode
import warnings from contextlib import contextmanager from numba.tests.support import override_config, TestCase from numba.cuda.testing import skip_on_cudasim from numba import cuda from numba.core import types from numba.cuda.testing import SerialMixin import unittest @skip_on_cudasim("Skipped on simulator") class ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }...
3
numba/cuda/tests/cudapy/test_deprecation.py
svrakitin/numba
import os import shutil from .base import GnuRecipe class FuseRecipe(GnuRecipe): def __init__(self, *args, **kwargs): super(FuseRecipe, self).__init__(*args, **kwargs) self.sha256 = 'ec632de07b79ec72a591f9878a6d090c' \ '249bdafb4e2adf47fa46dc681737b205' self.name = '...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }...
3
hardhat/recipes/fuse.py
stangelandcl/hardhat
from flask import redirect, request from webViews.dockletrequest import dockletRequest from webViews.view import normalView import json class grouplistView(normalView): template_path = "user/grouplist.html" class groupdetailView(normalView): @classmethod def post(self): return json.dumps(dockletRe...
[ { "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
web/webViews/user/grouplist.py
SourceZh/Docklet
class MapyMaster(object): def __init__(self): print ("hello Mapy master") def __call__(self, *args, **kwargs): print ("hello from Mapy master")
[ { "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
mapy/master.py
isurusiri/mapy
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from time import sleep from OpenGL.GLUT import * from OpenGL.GL import * from OpenGL.GLU import * animationAngle = 0.0 frameRate = 25 def doAnimationStep(): """Update animated parameters. This Function is made active by glutSetIdleFunc""" globa...
[ { "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
DemOpenGL/proesch/simple/simpleAnimation.py
ismaelxyz/graphic-concentration
"""Fixtures.""" import pytest from library import config from library.facades import seed @pytest.fixture def default_seed(): """Set the default seed.""" name = config.get_env().default_seed_name value = "value 1" seed.get_seed().set(name=name, value=value) yield name, value seed.get_seed()...
[ { "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
api/tests/conftest.py
open-alchemy/Editor
from pytest_snapshot.plugin import shorten_path from tests.utils import assert_pytest_passes try: from pathlib import Path except ImportError: from pathlib2 import Path def test_help_message(testdir): result = testdir.runpytest('--help') result.stdout.fnmatch_lines([ 'snapshot:', '*--...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer":...
3
tests/test_misc.py
Justice4Joffrey/pytest-snapshot-pickle
import tornado.web from app.domain.task_step import TaskStep from app.service import token_service from app.database import task_step_db from app.utils import mytime import json class TaskStepApi(tornado.web.RequestHandler): async def post(self, *args, **kwargs): token = token_service.get_token(self.requ...
[ { "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
umm-python/app/web/rest/task_step_api.py
suomitek/cubeai
# qubit number=4 # total number=8 import pyquil from pyquil.api import local_forest_runtime, QVMConnection from pyquil import Program, get_qc from pyquil.gates import * import numpy as np conn = QVMConnection() def make_circuit()-> Program: prog = Program() # circuit begin prog += H(0) # number=1 pro...
[ { "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_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "an...
3
data/p4VQE/R4/benchmark/startPyquil21.py
UCLA-SEAL/QDiff
from dagstermill.io_managers import OutputNotebookIOManager from dagster import io_manager from .fixed_s3_pickle_io_manager import s3_client class S3OutputNotebookIOManager(OutputNotebookIOManager): """Defines an IOManager that will store dagstermill output notebooks on s3""" def _get_key(self, context) ->...
[ { "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
examples/hacker_news/hacker_news/resources/s3_notebook_io_manager.py
kstennettlull/dagster
from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_create_user_with_email_successful(self): """Test creating a new user with an email is successful""" email = 'test@gmail.com' password = 'Testpass123' user = get_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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }...
3
app/core/tests/test_models.py
omarmorales/recepie-app-api
# content of test_sample.py def func(x): return x * 2 def test_answer(): assert func(5) == 10
[ { "point_num": 1, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?...
3
exemplos/test.1.py
cirino/python
api = "https://api.telegram.org/bot" class Config(object): def __init__(self): pass def load_settings(self, settings): self.commands = settings['commands'] self.timeout = settings['timeout'] self.interval = settings['interval'] self.uri = api + settings['token'] conf...
[ { "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
lorembot/config.py
DSW12018/LoremBot
"""Base classes for Axis entities.""" from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import DeviceInfo, Entity from .const import DOMAIN as AXIS_DOMAIN class AxisEntityBase(Entity): """Base common to all Axis entiti...
[ { "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
homeassistant/components/axis/axis_base.py
MrDelik/core
from __future__ import division import numpy as np from scipy.ndimage.morphology import binary_erosion, binary_fill_holes def hu_to_grayscale(volume): volume = np.clip(volume, -512, 512) mxmal = np.max(volume) mnval = np.min(volume) im_volume = (volume - mnval) / max(mxval - mnval, 1e-3) im_volume ...
[ { "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
lungSegmentation/RFunction.py
slowy07/medical-BCDU
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.utils.translation import ugettext_lazy as _ from re import compile setting_name_re_str = '^[A-Z][A-Z0-...
[ { "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
stagesetting/validators.py
kezabelle/django-stagesetting
import sys, os sys.path.append(os.pardir) import numpy as np from common.functions import softmax, cross_entropy_error from common.gradient import numerical_gradient class simpleNet: def __init__(self): self.W = np.random.randn(2, 3) def predict(self, x): return np.dot(x, self.W) def loss...
[ { "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
result_of_deep-learning-from-scratch/chap4/4_4_2.py
ijufumi/demo-python
#!/usr/bin/env python from gimpfu import * from gimpenums import * import sys import os def color2id(color): a = (color[0]<<16) | (color[1]<<8) | color[2] b = (a & 0xF00000) >> 12 | (a & 0xF000) >> 8 | (a & 0xF00) << 4 | \ (a & 0xF0) >> 4 c = (b & 0xF000) | (b & 0x800) >> 11 | (b & 0x400) >> 7 | \ ...
[ { "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
script/gimp_histemul.py
matteli/histemul
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 class SeedGenerator: def __init__(self, seed): self.seed = seed self.counters = dict() def next(self, key='default'): if self.seed == None: return None if...
[ { "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
MaskRCNN/utils/randomnness.py
covernal/mask-rcnn-tensorflow
import pygame from collections import OrderedDict sidebar_width = 200 class Display: def __init__(self, title, world_size, initial_scale, delay=30): self.width = world_size * initial_scale self.height = world_size * initial_scale self.world_size = world_size self.initial_scale = 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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding se...
3
shared/display.py
DOsinga/reinforced_artificial_life
import numpy as np def plot(b,d,C,t,x1,y1,x2,y2,fn, show_solution=False): ''' This function finds solutions. b,d : boundary conditions, C : thermal diffusivity t : time x2-x1 : size of a square in X direction, y2-y1 : size of the square in Y direction, fn : initial condition ''' impo...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 l...
3
heatpy.py
marianna13/heatpy
from sys import maxsize class Group: def __init__(self, name=None, header=None, footer=None, id=None): self.name = name self.header = header self.footer = footer self.id = id def __repr__(self): return"%s:%s:%s:%s" % (self.id, self.name, self.header, self.footer) ...
[ { "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
model/group.py
Docent321/python_traning
import cmd class TrainShell(cmd.Cmd): intro = '[[ Welcome to the shell. Type help or ? to list commands. ]]' prompt = '>' def __init__(self, _trainer): super().__init__() self.trainer = _trainer def do_save(self, _arg): self.trainer.agent.save( self.trainer.epoc...
[ { "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
DeepRL/Train/TrainShell.py
ppaanngggg/DeepRL
""" """ from campy.cameras import unicam import os import time import logging import sys import numpy as np from collections import deque import csv import imageio def LoadSystem(params): return params["cameraMake"] def GetDeviceList(system): return system def LoadDevice(cam_params): return cam_p...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer"...
3
campy/cameras/emu.py
Wolfffff/campy
#added after changing folder structure import os class Config: SECRET_KEY = os.environ.get('SECRET_KEY') # SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://cherucole:cherucole@localhost/blog' UPLOADED_PHOTOS_DEST ='app/static/photos' # email configurations MAIL_SERVER = 'smtp.googlemail.com' ...
[ { "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
config.py
cherucole/Blog-Project
#!/usr/bin/env python3 import unittest from nose.tools import eq_ import pandas as pd import os import decisiveml as dml TEST_DIR = os.path.dirname(os.path.realpath(__file__)) class TestTradingHolidays(unittest.TestCase): def setUp(self): self.short_holiday = pd.read_csv( os.path.join( ...
[ { "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
tests/test_helpers.py
avielfedida/DecisiveML
from flask import Flask, render_template from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.security import Security, SQLAlchemyUserDatastore, \ UserMixin, RoleMixin, login_required # Create app app = Flask(__name__) app.config['DEBUG'] = True app.config['SECRET_KEY'] = 'super-secret' app.config['SQLALCHE...
[ { "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
play/flaskTrySecurity2.py
WorldViews/Spirals
from django.db import models from django.utils.timezone import datetime,now class Category(models.Model): name = models.CharField(max_length=20) def __str__(self): return self.name class Project(models.Model): title = models.CharField(max_length=100) description = models.TextField() techn...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false ...
3
projects/models.py
acary/opencreative
import unittest import shape7 class Test_Shape7(unittest.TestCase): coords = ( (-74.012666, 40.70136), (-74.012962, 40.700478), (-74.01265, 40.699074) ) encoded = ( 243, 223, 202, 70, 224, 182, 232, 38, 207, 4, 227, 13, 240, 4, 247, 21 ) tolerance = ...
[ { "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
transitland_tiles/test_shape7.py
transitland/transitland-tiles-python
import numpy as np def subtract_nonzero_elements(arr,minuend): newarr = arr np.putmask(newarr,newarr != 0, minuend-newarr) return(newarr) def replace_zero_elements(arr,replacement): newarr = np.copy(arr) newarr[newarr == 0] = replacement return(newarr) def num_nonzero_elements(arr): retur...
[ { "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": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 li...
3
code/python/src/lib/array.py
queirozfcom/recommendation_systems
""" Created by Epic at 8/18/20 """ import logging from discord.ext import commands import discord class Sponsor(commands.Cog): def __init__(self, bot): self.bot = bot self.logger = logging.getLogger("salbot.cogs.sponsor") @commands.Cog.listener() async def on_member_update(self, before: ...
[ { "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
cogs/sponsor.py
salc1-org/salbot-rewrite
import numpy as np from collections import defaultdict class Agent: def __init__(self, nA=6): """ Initialize agent. Params ====== nA: number of actions available to the agent """ self.nA = nA self.Q = defaultdict(lambda: np.zeros(self.nA)) def ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true...
3
agent.py
adityasaxena26/OpenAI-Gym-Taxi-v2-Task
#!/usr/bin/env python # # Copyright (c) 2018 All rights reserved # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # """Define the classes requir...
[ { "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
security/onap_security/test_security_test.py
onap/integration-xtesting
import functools import requests import logging from settings import settings from utils.validators import check_russian_word class Translator: @functools.lru_cache(None) def translate(self, word, language='en-ru'): params = { 'lang': language, 'text': word, 'optio...
[ { "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
utils/translator.py
stspbu/vk-hack-2019
import pytest from src.conanbuilder.remote import Remote @pytest.fixture def remote(): return Remote("myName", "myUrl") def test_default_values(remote): assert remote.name == "myName" assert remote.url == "myUrl" assert remote.verify_ssl is True assert remote.priority == 0 assert remote.forc...
[ { "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
tests/conanbuilder/test_remote.py
arnaudgelas/mumoco
from typing import List from pathlib import Path import sys # ours from jekyll_relative_url_check.html import HTMLRelativeURLHook from jekyll_relative_url_check.markdown import MarkdownRelativeURLHook def html_pre_commit(files: List[str]): ret = HTMLRelativeURLHook().check_files(map(Path, files)) if not ret:...
[ { "point_num": 1, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answe...
3
jekyll_relative_url_check/cli.py
klieret/jekyll-relative-url
import pytest from DataStructures.LRUCache.lru_cache_ddl import LRUCacheDDL @pytest.fixture() def lru_cache(): return LRUCacheDDL(2) class TestLRUCacheDDL: def test_put_and_get(self, lru_cache): key = 2 val = 1 lru_cache.put(key, val) result = lru_cache.get(key) as...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cl...
3
DataStructures/LRUCache/tests/lru_cache_ddl_test.py
Nalhin/AlgorithmsAndDataStructures
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from conftest import Mock import responses class TestIP(object): @responses.activate def test_get_ip(self, manager): data = Mock.mock_get('ip_address/10....
[ { "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
test/test_ip_manager.py
t-tran/upcloud-python-api
from fcntl import ioctl import socket class HCIConfig(object): ''' This class allows to easily configure an HCI Interface. ''' @staticmethod def down(index): ''' This class method stops an HCI interface. Its role is equivalent to the following command : ``hciconfig hci<index> down`` :param index: index ...
[ { "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
mirage/libs/bt_utils/hciconfig.py
epablosensei/mirage
from dataclasses import dataclass from dataclasses import field @dataclass class User: identifier: str connected_node_id: str node_history: list[str] = field(default_factory=list) def last_nodes(self, n: int=5): return reversed(self.node_history[-n:]) class SimulationContext: iteration: ...
[ { "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
simulation/evaluator/simulation.py
nbelzer/msc-thesis
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ An example client. Run simpleserv.py first before running this. """ from __future__ import print_function from twisted.internet import reactor, protocol # a client protocol class EchoClient(protocol.Protocol): """Once connected, send...
[ { "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
docs/core/examples/simpleclient.py
apjanke/twisted
# This file is part of Indico. # Copyright (C) 2002 - 2019 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from indico.modules.admin.views import WPAdmin from indico.util.i...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": true }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { ...
3
indico/modules/news/views.py
uxmaster/indico
import bpy from .base import AbstractHelper #pylint: disable=W0223 class AbstractBoneEditHelper(AbstractHelper): def _is_active_target(self, target, context): if target is None: return False bone = context.active_bone if bone is None: return False return (bo...
[ { "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
io_scene_xray/edit_helpers/base_bone.py
vika-sonne/blender-xray
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
[ { "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
xlsxwriter/test/comparison/test_image26.py
totdiao/XlsxWriter
import functools from hashlib import md5 import dill from pandas import DataFrame, Series # pylint: disable=too-many-return-statements def to_bytes(obj: object) -> bytes: """Convert any object to bytes @param obj: @return: """ if isinstance(obj, DataFrame): if obj.empty: retur...
[ { "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
data-detective-airflow/data_detective_airflow/test_utilities/assertions.py
dmitriy-e/metadata-governance
from indicators.SingleValueIndicator import SingleValueIndicator from math import sqrt class StdDev(SingleValueIndicator): def __init__(self, period, timeSeries = None): super(StdDev, self).__init__() self.period = period self.initialize(timeSeries) def _calculate(self): if len(self.timeSeries) < self.per...
[ { "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
creten/indicators/StdDev.py
nardew/Creten
from django.db.models.query import QuerySet from styleguide_example.users.models import BaseUser from styleguide_example.users.filters import BaseUserFilter def user_get_login_data(*, user: BaseUser): return { 'id': user.id, 'email': user.email, 'is_active': user.is_active, 'is_ad...
[ { "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
styleguide_example/users/selectors.py
HackSoftware/Django-Styleguide-Example
import os from pathlib import PurePath from jupyter_core.paths import jupyter_path import tornado class SnippetsLoader: def __init__(self): self.snippet_paths = jupyter_path("snippets") def collect_snippets(self): snippets = [] for root_path in self.snippet_paths: for d...
[ { "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
jupyterlab-snippets/loader.py
drykovanov/jupyterlab-snippets
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import inspect from spack.directives import extends from spack.package import PackageBase, run_after class RPackage(Pa...
[ { "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
lib/spack/spack/build_systems/r.py
m-shunji/spack
# imports - standard imports import os, os.path as osp from functools import partial import sys # imports - module imports from pipupgrade.config import PATH, Settings from pipupgrade.util.imports import import_handler from pipupgrade.util.system import popen from pipupgrade.util._dict import me...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "ans...
3
src/pipupgrade/util/jobs.py
martinet101/pipupgrade
from django.core.management.base import BaseCommand from dimagi.utils.couch.database import iter_docs from corehq.apps.domain.models import Domain class Command(BaseCommand): def _get_domains_without_last_modified_date(self): docs = iter_docs(Domain.get_db(), [ domain['id'] for ...
[ { "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
corehq/apps/domain/management/commands/fill_last_modified_date.py
dimagilg/commcare-hq
# coding=utf-8 # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from textw...
[ { "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
tests/python/pants_test/backend/python/tasks/test_python_binary_create.py
lahosken/pants
# coding=utf-8 # Copyright 2020 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
[ { "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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer...
3
tensorflow_datasets/scripts/cli/main.py
rushabh-v/datasets
import pickle from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from main import clf def test_accuracy(): # Load test data with open("data/test_data.pkl", "rb") as file: test_data = pickle.load(file) # Unpack the tuple X_test, y_test = test_data # Co...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "ans...
3
course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py
awsgyani/machine-learning-engineering-for-production-public
from typing import Optional, Dict ERROR_CODES = { # our codes: 423: "Locked", 428: "Precondition Required", # JSON RPC Prefedined codes -32700: "Parse error", # Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. -32600: "Invalid Request", ...
[ { "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
pyscard_json_rpc/json_rpc.py
namespace-ee/pyscard-json-rpc