source
string
points
list
n_points
int64
path
string
repo
string
# Sample code from https://www.redblobgames.com/pathfinding/a-star/ # Copyright 2014 Red Blob Games <redblobgames@gmail.com> # # Feel free to use this code in your own projects, including commercial projects # License: Apache v2.0 <http://www.apache.org/licenses/LICENSE-2.0.html> from __future__ import annotations im...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docs...
3
app/game/pathfinding.py
SMEFIKES/server
from pathlib import Path import click import cv2 from .core import VideoWriter @click.group() def cli(): pass @cli.command() @click.argument('image-dir') @click.option('-o', '--output', default=None) @click.option('--fps', default=60) def merge(image_dir, output, fps): r"""Create video from images""" ...
[ { "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
cv2ools/cli.py
narumiruna/opencv-tools
import pytest from django.contrib.auth.models import AnonymousUser from api.tests.helper.node_helper import assert_node_field, assert_node_id @pytest.mark.django_db def test_query(query_project_types, project_type_objects): data, errors = query_project_types(AnonymousUser()) assert errors is None assert...
[ { "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
api/tests/test_project_type.py
matchd-ch/matchd-backend
import torch import numpy as np import networkx as nx from torch_geometric.data import InMemoryDataset, Data class KarateClub(InMemoryDataset): r"""Zachary's karate club network from the `"An Information Flow Model for Conflict and Fission in Small Groups" <http://www1.ind.ku.dk/complexLearning/zachary197...
[ { "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
torch_geometric/datasets/karate.py
YukeWang96/pytorch_geometric
from typing import Mapping, Any from .base_client import BaseClient class PagedEntryIterator: def __init__(self, client: 'LoggingClient', body: Mapping[str, Any], request_kwargs: Mapping[str, Any]): self._client = client self._body = body self._request_kwargs = request_kwargs self....
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 2...
3
hail/python/hailtop/aiogoogle/client/logging_client.py
MariusDanner/hail
from aceinna.devices.base import UpgradeWorkerBase class ErrorWorker(UpgradeWorkerBase): def __init__(self): super(ErrorWorker, self).__init__() self._total = 1024*1024 # 1M size def get_upgrade_content_size(self): return self._total def work(self): current = 0 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": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answ...
3
tests/mocker/upgrade_workers/error_worker.py
lihaiyong827/python-openimu
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from nipype.testing import assert_equal from nipype.interfaces.afni.preprocess import ZCutUp def test_ZCutUp_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True...
[ { "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
nipype/interfaces/afni/tests/test_auto_ZCutUp.py
grlee77/nipype
import pytest import random import numpy as np from numpy.random import rand import lib.algorithms as al @pytest.fixture(scope="session") def unif_1D(): """ Test case: one dimension, samples evenly distributed. """ data = np.array([[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding se...
3
tests/conftest.py
benbenti/fuzzyclustering
import komand import requests from .schema import DeprovisionUserInput, DeprovisionUserOutput class DeprovisionUser(komand.Action): def __init__(self): super(self.__class__, self).__init__( name="deprovision_user", description="remove user", input=DeprovisionUserInput()...
[ { "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
plugins/lastpass_enterprise/komand_lastpass_enterprise/actions/deprovision_user/action.py
lukaszlaszuk/insightconnect-plugins
import unittest from deploy import Unit class TestUnit(unittest.TestCase): def test_create(self): i = Unit('foo', 'inactive', 'spawn') self.assertEqual(i.__str__(), 'foo') self.assertEqual(i.name, 'foo') self.assertEqual(i.state, 'inactive') self.assertEqual(i.required_a...
[ { "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
tests/test_unit.py
panubo/deploy
n = int(input()) height = list(map(int, input().split())) check = {} for h in height: if check.get(h, 0) > 0: print(-1) quit() else: check[h] = 1 s = [(h, cnt) for cnt, h in enumerate(height)] s.sort() bit = [(x+1) & -(x+1) for x in range(n+10)] def init(): x = 0 while x < N -...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than ...
3
atcoder/other/idn_fb_e.py
knuu/competitive-programming
"""Forms related to import operations.""" from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy class ImportDataForm(forms.Form): """Base form to import objects.""" sourcefile = forms.FileField(label=ugettext_lazy("Select a file")) sepchar ...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": f...
3
modoboa/admin/forms/import_.py
antoniotrento/modoboa
import unittest from app import create_app, db from config.config import TestingConfig class BaseConfig(unittest.TestCase): def setUp(self): self.app = create_app(config=TestingConfig) self.app_context = self.app.app_context() self.app_context.push() def tearDown(self): db.se...
[ { "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
test/base.py
torrescereno/flask-api
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def findDuplicateSubtrees(self, root): """ :type root: TreeNode :rtype: List[TreeNode] """ res = [] self.subtree_serial(root, d...
[ { "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
LeetCodeSolutions/python/652_Find_Duplicate_Subtrees.py
ChuanleiGuo/AlgorithmsPlayground
# coding: utf-8 """ OpsGenie REST API OpsGenie OpenAPI Specification # noqa: E501 OpenAPI spec version: 2.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import opsgenie_swagger from opsgenie_swagger.models.upda...
[ { "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_update_schedule_response.py
Logicworks/opsgenie-python-sdk
from speedtest import Speedtest # debugmode debugmode = 0 st = Speedtest() # debug if debugmode: print(f'Download: {st.download()}') print(f'Upload: {st.upload()}') st.get_best_server([]) print(f'Ping: {st.results.ping}') # functons def get_upload_speed(): print('UPLOAD SPEED: Wait a few seconds...
[ { "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
base.py
tomas-barros/speed-test
from mat.utils.utils import Issue class Issue(Issue): TITLE = 'Secret Codes Search Check' DESCRIPTION = 'Looks for secret codes in the application' ID = 'secret-codes' ISSUE_TITLE = 'Application Has Secret Codes' FINDINGS = 'The Team found the following secret codes associated w...
[ { "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
mat/mat/modules/android/static/secretcodes.py
minkione/mat
# -*- coding: utf-8 -*- # # Copyright 2021 Google LLC. 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 requir...
[ { "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
lib/surface/eventarc/channel_connections/list.py
google-cloud-sdk-unofficial/google-cloud-sdk
import pytest import test_stack @pytest.mark.parametrize("single_floating", [True, False]) @pytest.mark.parametrize("raise_on_click", [True, False]) def test_focus_on_click(hlwm, mouse, raise_on_click, single_floating): if single_floating: hlwm.call('rule floating=on') else: hlwm.call('set_att...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding...
3
tests/test_basic_events.py
uzsolt/herbstluftwm
# builtins import re # ours from . import Rule, UnacceptableContentError class BadWordError(UnacceptableContentError): pass class BadWordRule(Rule): def __init__(self, config): self.bad_words = config if isinstance(self.bad_words, str): self.bad_words = [self.bad_words] ...
[ { "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
src/rules/bad_word.py
riquito/crusca
import requests import threading from random import randrange import datetime def getUrl(limit) : # url = f"https://e9ea25810dfb.ngrok.io?limit={limit}" url = f"http://localhost:3000?limit={limit}" payload = {} headers= {} i=0 while i<1000: try: s = datetime.datetime.now() response = reques...
[ { "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
testing/test-01.py
asraful009/nest-microservices
""" Python 'utf-32-be' Codec """ import codecs ### Codec APIs encode = codecs.utf_32_be_encode def decode(input, errors='strict'): return codecs.utf_32_be_decode(input, errors, True) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codec...
[ { "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_class_has_docstring", "question": "Does every class in this file have a docstring?...
3
AppPkg/Applications/Python/Python-2.7.2/Lib/encodings/utf_32_be.py
CEOALT1/RefindPlusUDK
class Product: def __init__(self, price): self.price = price @property def price(self): return self.__price @price.setter def price(self, value): if value < 0: raise ValueError("Price cannot be negative.") self.__price = value # getter and setter product = Product(10) product.price...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
OOP/10_properties.py
marinaoliveira96/python-exercises
from gevent.monkey import patch_all patch_all() # noqa: E402 import logging from signal import signal from signal import SIGTERM from gevent.pywsgi import WSGIServer from poker.http import app def signal_handler(signum): raise SystemExit(1) signal(SIGTERM, signal_handler) logging.basicConfig(level=logging....
[ { "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
poker/__main__.py
ievans/poker
class Problem: def __init__(self): self.dist = {} self.prev = {} self.edges = {} self.vertices = set() self.risk = [] def readInput(self): f = open(__file__[:-3] + '.in', 'r') self.risk = [] for line in f.read().strip().split('\n'): ...
[ { "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
day15/d15.py
jcisio/adventofcode2021
''' Clipboard Dbus: an implementation of the Clipboard using dbus and klipper. ''' __all__ = ('ClipboardDbusKlipper', ) from kivy.utils import platform from kivy.core.clipboard import ClipboardBase if platform != 'linux': raise SystemError('unsupported platform for dbus kde clipboard') try: import dbus ...
[ { "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
kivy/core/clipboard/clipboard_dbusklipper.py
Sentient07/kivy
import os import logging import sys import nose import angr l = logging.getLogger("angr.tests") test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests') insn_texts = { 'i386': b"add eax, 0xf", 'x86_64': b"add rax, 0xf", 'ppc': b"addi %r1, %r1, 0xf", ...
[ { "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/test_keystone.py
Kyle-Kyle/angr
import pytest import pytest_xvfb import os import cinemasci @pytest.fixture(autouse=True, scope='session') def ensure_xvfb(): if not pytest_xvfb.xvfb_available(): raise Exception("Tests need Xvfb to run.") def test_render(): # create a test database os.system("./bin/create-database --database scratch/cine...
[ { "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
testing/CinemaRenderTest.py
JonasLukasczyk/workbench
from elasticsearch.client import SnapshotClient from fiases.fias_data import ES import fiases.fias_data sn = SnapshotClient(ES) def register(location="/usr/share/elasticsearch/snapshots"): sn_body = { "type": "fs", "settings": { "compress": "true", "location": location } ...
[ { "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
fiases/snapshot.py
u4097/elasticsearch-fias
"""This module contains unit tests for stream module.""" import pytest import pseudo __author__ = "Patryk Niedźwiedziński" @pytest.fixture def stream(): """Returns stream object""" def _s(i): s = pseudo.stream.Stream(i) return s return _s @pytest.mark.timeout(2) def test_get_current...
[ { "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/stream_test.py
pniedzwiedzinski/pseudo
def color_code(color): return colors().index(color) def colors(): return [ "black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white", ]
[ { "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
resistor-color/resistor_color.py
oscantillomen/Exercism-Python
from firestoreauth import FirestoreAuth def create_new_user(): try: with FirestoreAuth('__all') as ctx: ctx.create_user('rob', 'xxx') except Exception as e: print(str(e)) def login(): print('logging in') try: with FirestoreAuth('__all', 'rob', 'xxx') as ctx: tes...
[ { "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
example.py
analyticsdept/py-firestoreauth
from util import Util import numpy as np from sklearn.linear_model import Ridge from sklearn.preprocessing import StandardScaler class ModelRidge(): def __init__(self, run_name="Ridge"): self.run_name = run_name self.params = { } self.model = None def...
[ { "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
code/model_ridge.py
nakazono1011/pj_horidasimono
#!/usr/bin/env python3 from FeatureExamples import FeatureExamples from FeatureHandler import FeatureHandler from matrix_client.client import MatrixClient import os from bs4 import BeautifulSoup import requests def find_room(sender, message, room): html = requests.get("https://foss-ag.de/").text soup = Beaut...
[ { "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
klo/klo.py
foss-ag/tool_matrixbot
""" The tags with which the JS components can be used """ from django import template from django.conf import settings register = template.Library() def pin_header(context, environment=''): """ pin_header - Renders the JavaScript required for Pin.js payments. This will also include the Pin.js file from p...
[ { "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
pinpayments/templatetags/pin_payment_tags.py
rossp/django-pinpayments
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2020 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Segunda edição - Junho/2014 - ISBN 978-85-7522-408-3 # Terce...
[ { "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
exercicios_resolvidos3/exercicios3/capitulo 09/exercicio-09-35.py
tiagosm1/Python_Nilo_Ney
import asyncio, discord try: from _command import Command except: from coms._command import Command import pickle class Com(Command): def __init__(self): self.usage = "!removecensor [text]" self.description = "Uncensors the word, if you have permission." self.keys = ["!removecenso...
[ { "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_multiple_inheritance", "question": "Does any class in this file use multiple inherita...
3
coms/removecensor.py
OliMoose/kermit
import datetime import logging import random from time import sleep from typing import Any import click from project_common.abc import AirflowTask, create_cli from project_common.cli_types import type_timedelta logger = logging.getLogger(__name__) cli = create_cli() @cli.register_callback class RandomFailTask(Airf...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/...
3
project_complex/src/project_complex/random_task.py
KostyaEsmukov/airflow-docker
import secrets def generate_random_key(bytelen=32) -> str: assert bytelen % 2 == 0 return secrets.token_hex(int(bytelen / 2)) def generate_random_bytes(n=32) -> bytes: return secrets.SystemRandom().randbytes(n)
[ { "point_num": 1, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?"...
3
pyportable_crypto/keygen.py
likianta/pyportable-crypto
#!/usr/local/bin/ python3 # -*- coding: utf-8 -*- # @Time : 2022-03-01 17:17 # @Author : Leo # -*- coding: utf-8 -*- import base64 from Crypto.Cipher import AES AES_SECRET_KEY = 'a' * 32 # 此处16|24|32个字符 IV = "1234567890123456" # padding算法 BS = len(AES_SECRET_KEY) pad = lambda s: s + (BS - len(s) % BS) * chr(BS - l...
[ { "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
utils/encryption.py
JiangFeng07/NLPIK
import os import sys __all__ = [ "load_module", "mytest_the_file", ] def load_module(file_path, module_name=None): """ Load a module by name and search path This function should work with python 2.7 and 3.x Returns None if Module could not be loaded. """ if module_name is None: ...
[ { "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
lecode/utils/utils.py
nesen2019/lecode
from presidio_analyzer import EntityRecognizer def test_to_dict_correct_dictionary(): ent_recognizer = EntityRecognizer(["ENTITY"]) entity_rec_dict = ent_recognizer.to_dict() assert entity_rec_dict is not None assert entity_rec_dict["supported_entities"] == ["ENTITY"] assert entity_rec_dict["supp...
[ { "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
presidio-analyzer/tests/test_entity_recognizer.py
teamlumos/presidio
''' Created on Feb 26, 2021 @author: laurentmichel ''' import os class FileUtils(object): file_path = os.path.dirname(os.path.realpath(__file__)) @staticmethod def get_datadir(): return os.path.realpath(os.path.join(FileUtils.file_path, "../client/tests/", "data")) @staticmethod def...
[ { "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
pyvo/vomas/utils/file_utils.py
lmichel/pyvo
from typing import Dict from twitchio.dataclasses import Message class TeamData: def __init__(self, num_teams: int = 2): self.num_teams = num_teams self.teams: Dict[int, int] = {} async def handle_join(self, msg: Message) -> None: if msg.author.id in self.teams: # User al...
[ { "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/bot/TeamData.py
malmgrens4/TwIOTch
""" Leetcode 230 """ # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def kthSmallest(self, root: TreeNode, k: int) -> int: if not root: retu...
[ { "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
leetcode/medium/230-Kth_smallest_BST.py
shubhamoli/practice
import model import view class SingleMove: def __init__(self, friendly, friendly_color, enemy, enemy_color): self.board = model.board self.checkers = model.checkers self.buildGame(friendly, friendly_color, enemy, enemy_color) self.view(view.win1) view.runAI(True) #...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excl...
3
SingleMove.py
jerodray/Checkers
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/1/27 下午5:34 # @Title : 111. 二叉树的最小深度 # @Link : https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/ QUESTION = """ 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 ...
[ { "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
MinimumDepthOfBinaryTree.py
reedwave/leetcode-cn
# -*- coding: utf-8 -*- # # Copyright (c) 2019~2999 - Cologler <skyoflw@gmail.com> # ---------- # # ---------- import itertools from pytest import raises from hash_dict import HashDict, StringComparers, IEqualityComparer def test_hashdict_empty(): test_dict = HashDict() assert len(test_dict) == 0 assert...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "ans...
3
tests/test_hash_dict.py
Cologler/hash-dict-python
from classes.Humanoid import Humanoid class Player(Humanoid): def __init__(self, name, room, dmg=1, hp=10): super().__init__(name, room, dmg, hp) self.equipped = None def __str__(self): return f'{self.name}: ', '{\n', f'\t[\n\t\thp: {self.hp}/{self.max_hp},\n\t\tdmg: {self.dmg}\n\tequ...
[ { "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
src/classes/Player.py
zeerockss/game
# coding: utf-8 """ Mojang Authentication API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 OpenAPI spec version: 2020-06-05 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import uni...
[ { "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
generated-sources/python/mojang-authentication/test/test_profile_id.py
AsyncMC/Mojang-API-Libs
import pytest from datagears.core.network import Network @pytest.fixture def myfeature() -> Network: """Testing fixture for a feature.""" from datagears.core.network import Network from datagears.features.dummy import my_out network = Network("my-network", outputs=[my_out]) return network @pyt...
[ { "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
tests/core/fixtures/features.py
jsam/datagears
import functools import typing class Accumulate: @staticmethod def __call__( func: typing.Callable, identity: int, ): def fn( a: typing.Iterable[int], ) -> int: return functools.reduce( func, a, ident...
[ { "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
tests/test.py
kagemeka/competitive-programming
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools, random from collections import deque from heapq import heappush, heappop sys.setrecursionlimit(10 ** 7) ans = 0 tmp = 0 inf = 10 ** 20 INF = float("INF") eps = 1.0 / 10 ** 10 mod = 10 ** 9 + 7 dd = [(-1, 0), (0, 1), ...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docs...
3
AtC_Gra_Con_021-030/AGC024/B.py
yosho-18/AtCoder
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module provides classes for the Piezoelectric tensor """ import warnings import numpy as np from pymatgen.core.tensors import Tensor __author__ = "Shyam Dwaraknath" __copyright__ = "Copyright 2016, The Materials P...
[ { "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
pymatgen/analysis/piezo.py
exenGT/pymatgen
from dataclasses import dataclass import commonmark import json import pprint @dataclass class Link: url:str text:str def pretty(json): pp = pprint.PrettyPrinter(indent=4, width=40, compact=False, sort_dicts=False) return pp.pprint(json) def markup_to_json(s): parser = commonmark.Parser() a...
[ { "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
core/util.py
dpetz/zettel
import torch.nn as nn from mighty.monitor.mutual_info.mutual_info import MutualInfo class MutualInfoStub(MutualInfo): # pragma: no cover """ Mutual Info stub that does nothing. """ def __init__(self): pass def __repr__(self): return f"{self.__class__.__name__}()" def regis...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
mighty/monitor/mutual_info/stub.py
dizcza/pytorch-mighty
# -*- coding: utf-8 -*- import os class DebugContext(object): def __init__(self, debug_port=None, debugger_path=None, debug_args=None): self.debug_port = debug_port self.debugger_path = debugger_path self.debug_args = debug_args ...
[ { "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
tcfcli/cmds/local/libs/local/debug_context.py
tencentyun/scfcli
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/5/13 17:05 # @Author : gao # @File : perm.py import re from django.utils.deprecation import MiddlewareMixin from django.shortcuts import HttpResponse, redirect def reg(request, current_path): # 校验权限(permission_list) permission_list = request....
[ { "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
Django_perm/perm/service/perm.py
coder-gao/Django-Tools
""" Configuration and utilities for service logging """ import logging from typing import Optional, Union from aiodebug import log_slow_callbacks from aiohttp.log import access_logger from servicelib.logging_utils import config_all_loggers LOG_LEVEL_STEP = logging.CRITICAL - logging.ERROR def setup_logging(*, lev...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or few...
3
services/web/server/src/simcore_service_webserver/log.py
colinRawlings/osparc-simcore
from __future__ import absolute_import from flytekit.common.mixins import registerable as _registerable from flytekit.common import interface as _interface, nodes as _nodes, sdk_bases as _sdk_bases import six as _six class ExampleRegisterable(_six.with_metaclass(_sdk_bases.ExtendedSdkType, _registerable.Registerable...
[ { "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
tests/flytekit/unit/common_tests/mixins/sample_registerable.py
igorvalko/flytekit
import os import requests import subprocess import tarfile import tempfile def ensure_helm_binary(f: callable): def wrapper(helm_client: 'HelmClient', *args, **kwargs): helm_client._get_helm_binary_stream() return f(helm_client, *args, **kwargs) return wrapper def test_helm_binary(execPath): ...
[ { "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
.ci/helm.py
Diaphteiros/landscapercli
from .reward import Reward class ConstantReward(Reward): """ Defines a constant reward on the StateActionSpace or a subset of it. Subsets can be defined by explicitly specifying a Space object, or by providing a function that checks whether the step should be rewarded. """ def __init__(self, s...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/...
3
edge/reward/constant_reward.py
Data-Science-in-Mechanical-Engineering/edge
#!/usr/bin/env python # coding=utf-8 import unittest from ct.cert_analysis import tld_list from ct.test import test_config TLD_FILE = "test_tld_list" class TLDListTest(unittest.TestCase): def default_list(self): return tld_list.TLDList(tld_dir=test_config.get_tld_directory(), ...
[ { "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
vendor/github.com/google/certificate-transparency/python/ct/cert_analysis/tld_list_test.py
weltonrodrigo/origin
''' Class containing a Massey-style model and rankings of a season. todo: documentation todo: type hints todo: inherit from Model? ''' class Massey: def __init__(self): ''' todo: this. what fields does it need? ''' pass def rank(self) -> List[Team]: ''' Giv...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
src/models/Massey.py
alhart2015/march-madness
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
[ { "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
sdk/python/pulumi_azure_native/policyinsights/v20190701/_inputs.py
sebtelko/pulumi-azure-native
from django.db import models # Create your models here. class BaseModel(models.Model): scrap_date = models.DateTimeField(auto_now_add=True) class Articles(BaseModel): title = models.CharField(max_length=200,blank=True) post = models.TextField() user = models.CharField(max_length=80) comments = mo...
[ { "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
webs/backend/models.py
manulangat1/django_docker_webscraping_selenium
import unittest, os.path, os from PIL import ImageGrab from .removeImg import remove_img class TestRemove_img(unittest.TestCase): # Deveria excluir uma imagem def test_remove_img_remove(self): img = ImageGrab.grab((0,0,500,500)) path = "tmp.png" img.save(path) img.close() pathExists = os.path....
[ { "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/utils/removeImg/testRemoveImg.py
FelipeRhoden/gifscreen
import os import logging import shlex import subprocess from documentstore_migracao import config, exceptions logger = logging.getLogger(__name__) ISIS2JSON_PATH = "%s/documentstore_migracao/utils/isis2json/isis2json.py" % ( config.BASE_PATH ) def create_output_dir(path): output_dir = "/".join(path.split("...
[ { "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
documentstore_migracao/utils/extract_isis.py
joffilyfe/document-store-migracao
import json class TestUserResourceEndpoints: def test_user_signup_successfull(self, client): """ Test for a successful user signup """ response = client.post( "/api/v1/user/register", data=json.dumps( { "email": "john.doe@feather-insuranc...
[ { "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/user_entity_tests/test_user_registration.py
jesseinit/feather-insure
import importlib import os from datasets.hdf5 import get_test_loaders from unet3d import utils from unet3d.config import load_config from unet3d.model import get_model logger = utils.get_logger('UNet3DPredictor') def _get_predictor(model, loader, output_file, config): predictor_config = config.get('pr...
[ { "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
predict.py
stonebegin/Promise12-3DUNet
import logging import pickle _logger = logging.getLogger("theano.gof.callcache") class CallCache: def __init__(self, filename=None): self.filename = filename try: if filename is None: raise OSError("bad filename") # just goes to except with open(filename)...
[ { "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
theano/gof/callcache.py
canyon289/Theano-PyMC
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
[ { "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
test/test_dashboard.py
httpsgithu/python-client
import sys from dataclasses import dataclass @dataclass class WindowsConsoleFeatures: """Windows features available.""" vt: bool = False """The console supports VT codes.""" truecolor: bool = False """The console supports truecolor.""" try: import ctypes from ctypes import wintypes ...
[ { "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
rich/_windows.py
cansarigol/rich
import json import logging from urllib import request, parse class Slack(): NOTSET = ':loudspeaker:' DEBUG = ':speaker:' INFO = ':information_source:' WARNING = ':warning:' ERROR = ':exclamation:' CRITICAL = ':boom:' SUCCESS = ':+1:' DONE = ':checkered_flag:' def __init__( self, proc, api_token, ch...
[ { "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
mcp/lib/Slack.py
vspeter/MCP
#!/usr/bin/python # -*- coding: UTF-8 -*- import asyncio import pyppeteer import time import os import random from exe_js import js1, js3, js4, js5 # http://www.mamicode.com/info-detail-2302923.html # https://segmentfault.com/a/1190000011627343 """ { proxy: "127.0.0.1:1234", proxy-auth: "userx:passx", prox...
[ { "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
KnowledgeMapping/puppeteer_exp/demo_ip.py
nickliqian/ralph_doc_to_chinese
import time import platform class Timer: def __init__(self): self.time = [] self.name = [] self.history = {} def initialize(self): for i in range(1, len(self.time)): name = self.name[i] interval = self.time[i] - self.time[i - 1] try: ...
[ { "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
utils/timer.py
FloweryK/PickyCam-server
"""This file is provided as a starting template for writing your own unit tests to run and debug your minimax and alphabeta agents locally. The test cases used by the project assistant are not public. """ import unittest import isolation import game_agent from importlib import reload class IsolationTest(unittest....
[ { "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_game_agent.py
jb892/AIND-IsolationGame
import hashlib import requests import sys def valid_proof(last_proof, proof): guess = f'{last_proof}{proof}'.encode() guess_hash = hashlib.sha256(guess).hexdigest() return guess_hash[:6] == "000000" def proof_of_work(last_proof): """ Simple Proof of Work Algorithm - Find a number p' suc...
[ { "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
client_mining_p/miner.py
lambda-projects-lafriedel/Blockchain
from os import environ, unsetenv TESTING_DB_FLAG = 'tethys-testing_' def set_testing_environment(val): if val: environ['TETHYS_TESTING_IN_PROGRESS'] = 'true' else: environ['TETHYS_TESTING_IN_PROGRESS'] = '' del environ['TETHYS_TESTING_IN_PROGRESS'] unsetenv('TETHYS_TESTING_IN_...
[ { "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
tethys_apps/base/testing/environment.py
quyendong/tethys
from tool.runners.python import SubmissionPy class CocoSubmission(SubmissionPy): def run(self, s): """ :param s: input in string format :return: solution flag """ # Your code goes here # suppositions: all numbers are co-prime (it seems to be the case in the input ??...
[ { "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
day-13/part-2/coco.py
evqna/adventofcode-2020
# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_spawning_platform`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/...
3
tests/functional/test_skip_on_spawning_platform.py
bdrung/pytest-skip-markers
import sys sys.path.append("C:/git/reinforcement-learning") from hyperion.agents import * from hyperion.environment import * import random import numpy as np import uuid import attr STATUSES = ["EGG","CHICKEN","COW","FARMER","SUPERMAN"] SIZE = 100 @attr.s(slots = True) class Player(Agent): # # Agent id ...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, {...
3
westworld/_deprecated/chicken_game.py
TheoLvs/westworld
import os from collections import deque import numpy as np import math class RoutePlanner(object): EARTH_RADIUS = 6371e3 # 6371km def __init__(self, global_plan, curr_threshold=20, next_threshold=75, debug=False): self.route = deque() self.curr_threshold = curr_threshold self.nex...
[ { "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
team_code/planner.py
Kin-Zhang/LAV
# -*- coding: utf-8 -*- # @Author: ronanjs # @Date: 2020-01-19 22:23:54 # @Last Modified by: ronanjs # @Last Modified time: 2020-07-02 10:52:19 class DRV: def __init__(self, objects, rest): self.objects = objects self.rest = rest def subscribe(self): drvHandles = self.objects.ha...
[ { "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
module_utils/drv.py
yonglingchen/stc-ansible
#!/usr/bin/env python # -*- coding:utf-8 -*- # author:luzy # datetime:2021/01/14 下午3:13 # software: PyCharm # project: lingzhi-webapi import logging from core.tasks import update_one_sca from dongtai.endpoint import R, UserEndPoint logger = logging.getLogger('dongtai-engine') class ScaEndPoint(UserEndPoint): "...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docs...
3
vuln/views/sca.py
MadDonkey/DongTai-engine
# View all of the functions for an object using dir output = dir(5) print(output) # Object is a collection of data (variables) and methods that operate on data # A class is a blueprint for one or more objects # example class Car: speed = 0 started = False def start(self): self.started = True ...
[ { "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
classes/intro.py
Brannydonowt/PythonBasics
import torch import torch.fx.experimental.fx_acc.acc_ops as acc_ops import torch.nn as nn from torch.testing._internal.common_fx2trt import AccTestCase from parameterized import parameterized class TestSplitConverter(AccTestCase): @parameterized.expand( [ ("split_size", 3, 1), ("se...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (exc...
3
test/fx2trt/converters/acc_op/test_split.py
adamomainz/pytorch
from boa.builtins import breakpoint def Main(operation): result = False if operation == 1: m = 3 breakpoint() result = True elif operation == 2: breakpoint() result = False elif operation == 3: b = 'hello' breakpoint() j = 32 ...
[ { "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
neo/SmartContract/tests/BreakpointTest.py
conscott/neo-python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os class TemplateHandler(object): def __init__(self): aPath = os.path.realpath(__file__) aPath = os.path.dirname(aPath) aPath = os.path.join(aPath, "..") aPath = os.path.normpath(aPath) self.templatePath = os.path.join(aPath, "templates") self.loadTe...
[ { "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_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "ans...
3
source/templatehandler.py
marctrommen/bloggenerator
import time class Station: duration = 100 file = "" launch_time = 0 special = False special_active = False name = "" def __init__(self, playlist_item): self.file = playlist_item['file'] self.duration = playlist_item['duration'] self.special = playlist_item['special'] if 'special' in playlist...
[ { "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
station.py
mrpjevans/retroradio
""" A QuoteController Module """ from masonite.controllers import Controller from masonite.request import Request from app.Quote import Quote class QuoteController(Controller): def __init__(self, request: Request): self.request = request def show(self): id = self.request.param("id") r...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answ...
3
app/http/controllers/QuoteController.py
code-weather/capstone_backend_tailwindCSS
from sane_doc_reports.domain.CellObject import CellObject from sane_doc_reports.domain.Element import Element from sane_doc_reports.elements import error from sane_doc_reports.populate.utils import insert_text from sane_doc_reports.conf import DEBUG, TREND_MAIN_NUMBER_FONT_SIZE, \ TREND_SECOND_NUMBER_FONT_SIZE, PYD...
[ { "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
docker/sane-doc-reports/src/sane_doc_reports/elements/number.py
devods/dockerfiles
import re from model.contact import Contact def test_data_on_home_page(app, db): contact_from_home_page = sorted(app.contact.get_contacts_list(), key=Contact.id_or_max) contact_from_db = sorted(db.get_contacts_list(), key=Contact.id_or_max) for i in range(len(contact_from_home_page)): contact_from...
[ { "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
test/test_contact_data.py
Margoburrito/python_training_hw
import os import urllib3 import click from constants import ( CHILD_SERVICE, DEFAULT_CONFIG_FILE, PARENT_SERVICE, SERVICE_NAME, VMACONFIG, ) from flask import Flask # Import the Flask class from .db import DB, MIGRATE, init_db, migrate_database from .extensions import login_manager, oauth, jwt_au...
[ { "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
vma_app/__init__.py
shanavas-techversant/vma
import math import os import queue import random import threading import time from pprint import pprint from networkx import DiGraph from Node import Switch class my_thread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.flow_queue = [] def run(self) -> None: ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
ryu/app/simulation/test.py
yuesir137/SDN-CLB
# coding: utf-8 """Base class of pre-processing. If you want to add new pre-processing method to extend HDNNP, inherits this base class. """ from abc import (ABC, abstractmethod) class PreprocessBase(ABC): """Base class of pre-processing.""" name = None """str: Name of this class.""" def __init__(...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer":...
3
hdnnpy/preprocess/preprocess_base.py
s-okugawa/HDNNP
import numpy as np import torch from rlkit.torch import pytorch_util as ptu def eval_np(module, *args, **kwargs): """ Eval this module with a numpy interface, 返回numpy类型变量 Same as a call to __call__ except all Variable input/outputs are replaced with numpy equivalents. Assumes the output is eith...
[ { "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
rlkit/torch/core.py
panpanyunshi/rlkit
import unittest from unittest.mock import Mock from .. import serializers class TestDictSerializer(unittest.TestCase): def setUp(self): self.obj = Mock( attr_1="Attribute 1", attr_2="Attribute 2", attr_3="Attribute 3" ) def test_object_serialize_appropria...
[ { "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
website/webapp/json_api/tests/test_serializers.py
ultimatecoder/dockerapi
from dnload.common import listify ######################################## # SymbolSource ######################### ######################################## class SymbolSource: """Representation of source providing one symbol.""" def __init__(self, name, dependencies, headers, prototypes, source): """Constru...
[ { "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
dnload/symbol_source.py
edwinRNDR/dnload
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import pytest try: from recommenders.models.deeprec.deeprec_utils import download_deeprec_resources from recommenders.models.newsrec.newsrec_utils import prepare_hparams, load_yaml except ImportError: p...
[ { "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
tests/unit/recommenders/models/test_newsrec_utils.py
enowy/Recommenders