source
string
points
list
n_points
int64
path
string
repo
string
import pytest @pytest.mark.django_db def test_valid_with_defaults(Model, ModelForm, pst, pst_tz, gmt, gmt_tz): # seems there should be a better way to get a form's default values...? # http://stackoverflow.com/questions/7399490/ data = dict( (field_name, field.initial) for field_name, fiel...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "ans...
3
tests/test_model_form_field.py
mfogel/django-timezone-field
import sys from PyQt5 import QtWidgets from PyQt5.QtCore import (Qt, QRectF) from PyQt5.QtGui import (QCursor, QPainterPath, QRegion) from Best_Practices_gui import Ui_Form class Form(QtWidgets.QWidget, Ui_Form): def __init__(self): super().__init__() self.setupUi(self) self.btn_minimize_...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (exclud...
3
Final/Best_Practices.py
varunkm192002/Pandemic-Warrior
from django.contrib.auth.models import User from django.urls import reverse, resolve from django.test import TestCase from ..views import BoardListView from ..models import Board class BoardsTests(TestCase): def setUp(self): username = 'joe' password = '123' _ = User.objects.create_user(us...
[ { "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
boards/tests/test_view_boards.py
pydjdev78/abc-for-app
# 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_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
aliyun-python-sdk-emas-appmonitor/aliyunsdkemas_appmonitor/request/v20190611/GetAppDailyDeviceCountRequest.py
yndu13/aliyun-openapi-python-sdk
"""How the variable order in a BDD affects the number of nodes. Reference ========= Randal Bryant "On the complexity of VLSI implementations and graph representations of Boolean functions with application to integer multiplication" TOC, 1991 https://doi.org/10.1109/12.73590 """ from dd import aut...
[ { "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
examples/np.py
krooken/dd
from models.agent import Agent from models.staging_message import StagingMessage from backend.database import db from backend.rabbitmq import rabbit_producer from logger import log def agent_json(agent): log("agent_json", "Working on %s" % agent) agentType = dict({ "Id": agent.AgentType.Id, "...
[ { "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
processing/agent.py
s3b4stian/API
#!/usr/bin/env python #-*- coding: UTF-8 -*- ########################################################################### # # Copyright (c) 2018 www.codingchen.com, Inc. All Rights Reserved # ########################################################################## ''' @brief leetcode algorithm @author chenhui(hui.ch...
[ { "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
4+Median+of+Two+Sorted+Arrays/alg.py
xiaoh12/leetcode
import pandas as pd import featuretools as ft def load_weather(nrows=None, return_single_table=False): ''' Load the Australian daily-min-temperatures weather dataset. Args: nrows (int): Passed to nrows in ``pd.read_csv``. return_single_table (bool): Exit the function ea...
[ { "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
featuretools/demo/weather.py
jacobboney/featuretools
#!/usr/bin/python3 from passlib.context import CryptContext pwd_ctx = CryptContext(schemes=["bcrypt"], deprecated="auto") class Hash: @staticmethod def bcrypt(password: str): """ Generate a bcrypt hashed password Args: password (str): The password to hash Return...
[ { "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
schema/hash.py
yezz123/DogeAPI
#-*-encoding:utf-8-*- import os, logging def test_data_loader(root_path): """ 문장을 리턴한다. return: list of sentence """ data_path = os.path.join(root_path, 'test', 'test_data') return _load_data(data_path, is_train=False) def local_test_data_loader(root_path): """ 문장을 리턴한다. return: list of sentence """ data_p...
[ { "point_num": 1, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/c...
3
missions/srl/data_loader.py
kozistr/naver-nlp-challenge-2018
# 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": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
aliyun-python-sdk-imm/aliyunsdkimm/request/v20170906/ListSetTagsRequest.py
liumihust/aliyun-openapi-python-sdk
import enum import functools from typing import Dict, Type from electrum_gui.common.basic import bip44 from electrum_gui.common.coin import data from electrum_gui.common.conf import chains as chains_conf from electrum_gui.common.secret import data as secret_data CHAINS_DICT = {} COINS_DICT = {} def _replace_enum_fi...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (exclu...
3
electrum_gui/common/coin/loader.py
BixinKey/electrum
# -*- coding: utf-8 -*- # Time : 2021/12/22 9:04 # Author : QIN2DIM # Github : https://github.com/QIN2DIM # Description: from typing import Optional, Sequence class AntiEmailException(Exception): def __init__(self, msg: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None) -> None: ...
[ { "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
V2RaycSpider1225/src/services/utils/armor/anti_email/exceptions.py
winkxx/V2RayCloudSpider
import re import psycopg2 from werkzeug.security import generate_password_hash, check_password_hash from flask import Blueprint, request, jsonify, make_response from app.api.v1.models.landlord_models import LandlordRecords from app.api.v1.models.database import init_db from app.api.v1.utils.validators import validate ...
[ { "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/api/v1/views/landlord_views.py
MurungaKibaara/Kukodi
# -*- coding: utf-8 -*- import fnmatch import os from os.path import join as _j from django.conf import settings from django.core.management.base import BaseCommand, CommandError from django_extensions.management.utils import signalcommand class Command(BaseCommand): help = "Removes all python bytecode compiled...
[ { "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
django_extensions/management/commands/clean_pyc.py
KazakovDenis/django-extensions
#!/usr/bin/python3 # Author: Emmanuel Odeke <odeke@ualberta.ca> # Provides a decorator function that times a function # The speed ups of caching are also demonstrated if this # module's main function is invoked import time cache = dict() # Mapping n to n! [ its factorial value ] def profiled(funct): def decor...
[ { "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
profiler.py
odeke-em/utils
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompar...
[ { "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_textbox35.py
hugovk/XlsxWriter
from ray.rllib.utils.framework import try_import_tf tf = try_import_tf() class GRUGate(tf.keras.layers.Layer): def __init__(self, init_bias=0., **kwargs): super().__init__(**kwargs) self._init_bias = init_bias def build(self, input_shape): h_shape, x_shape = input_shape if x_...
[ { "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
rllib/models/tf/layers/gru_gate.py
acmore/ray
import numpy as np from torch import nn from torch.nn import Conv2d, Module from models.stylegan2.model import EqualLinear class GradualStyleBlock(Module): def __init__(self, in_c, out_c, spatial): super(GradualStyleBlock, self).__init__() self.out_c = out_c self.spatial = spatial ...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class 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 self/cls)...
3
restyle/models/encoders/map2style.py
CTPLab/IID_representation_learning
class CompromisedToken(Exception): """ Raised if the token has been compromised. """ def __init__(self): super().__init__("The sign doesn't match the given contents. The token has been compromised.") class UnexpectedJsonData(Exception): """ Raised if a non string argument is given to ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
ryoken/exceptions.py
drakantas/Ryoken
from django.core.management.base import BaseCommand from django.contrib.auth.models import User from apps.reader.models import UserSubscription import datetime class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("-d", "--days", dest="days", nargs=1, default=1, help="Days of un...
[ { "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
apps/rss_feeds/management/commands/mark_read.py
Paul3MK/NewsBlur
from urllib.parse import urlparse from django.conf import settings from django.db import models from django_extensions.db.fields import UUIDField from pyrabbit.http import HTTPError from django.contrib.sites.models import Site from apps.queues import rabbit class Queue(models.Model): name = models.CharField(max...
[ { "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
k8s/images/codalab/apps/queues/models.py
abdulari/codalab-competitions
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
[ { "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
python_code/vnev/Lib/site-packages/jdcloud_sdk/services/jdfusion/apis/DeleteVpcSubnetByIdRequest.py
Ureimu/weather-robot
# coding: utf-8 """ Betfair: Exchange Streaming API API to receive streamed updates. This is an ssl socket connection of CRLF delimited json messages (see RequestMessage & ResponseMessage) OpenAPI spec version: 1.0.1423 Contact: bdp@betfair.com Generated by: https://github.com/swagger-api/swagger...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
test/test_runner_change.py
akxlr/bf-stream-py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import time from typing import List, Tuple import ray from omegaconf import DictConfig import hydra from hydra.experimental import compose @ray.remote # type: ignore def train(overrides: List[str], cfg: DictConfig) -> Tuple[List[str], float]: ...
[ { "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
examples/advanced/ray_example/ray_compose_example.py
packerliu/hydra
import unittest from remora.tracker import Tracker from remora.collectors import AsyncCollector import requests_mock import json class TestTracker(unittest.TestCase): def test_send_payload(self): url = 'http://127.0.0.1:31311' with requests_mock.mock() as m: req = m.put(url) ...
[ { "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
remora/tests/test_tracker.py
Hugoch/remora-python
import os, pytest from pathlib import Path from ..copygeom import CopyGeom @pytest.mark.parametrize("inputs, outputs", []) def test_CopyGeom(test_data, inputs, outputs): in_file = Path(test_data) / "test.nii.gz" if inputs is None: inputs = {} for key, val in inputs.items(): 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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
pydra/tasks/fsl/utils/tests/test_spec_copygeom.py
djarecka/pydra-fsl
try: from rgbmatrix import graphics except ImportError: from RGBMatrixEmulator import graphics class Color: def __init__(self, color_json): self.json = color_json def color(self, keypath): return self.__find_at_keypath(keypath) def graphics_color(self, keypath): color = s...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a ty...
3
data/config/color.py
ajbowler/mlb-led-scoreboard
import erdos class WaypointsMessage(erdos.Message): """Message class to be used to send waypoints. Optionally can also send a target speed for each waypoint. Args: timestamp (:py:class:`erdos.timestamp.Timestamp`): The timestamp of the message. waypoints (:py:class:`~pylot.pl...
[ { "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
pylot/planning/messages.py
mageofboy/pylot
def confirm(prompt='Yes or no?'): while True: response = input(prompt + ' ').lower() if response in ['yes', 'no', 'y', 'n', 'yep', 'yeah', 'nope']: break print('Please type yes or no.') if response in ['yes', 'y', 'yep', 'yeah']: return True return False def int...
[ { "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/modules/user_input.py
HanKruiger/tsnetwork
# checkbox.py Extension to ugui providing the Checkbox class # Released under the MIT License (MIT). See LICENSE. # Copyright (c) 2019-2021 Peter Hinch from gui.core.ugui import Widget, display dolittle = lambda *_ : None class Checkbox(Widget): def __init__(self, writer, row, col, *, height=30, fillcolor=None,...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than ...
3
gui/widgets/checkbox.py
seelpro/micropython-micro-gui
''' Created by auto_sdk on 2015.08.04 ''' from aliyun.api.base import RestApi class Rds20140815AllocateInstancePublicConnectionRequest(RestApi): def __init__(self,domain='rds.aliyuncs.com',port=80): RestApi.__init__(self,domain, port) self.ConnectionStringPrefix = None self.DBInstanceId = None self.Po...
[ { "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
aliyun/api/rest/Rds20140815AllocateInstancePublicConnectionRequest.py
snowyxx/aliyun-python-demo
from tests.primitives.flow.probe_tcpip_flow_base import ProbeTCPIPFlowBase from netexp.primitives.flow import TCPIPFlowExtendedBiFlowInfo from netexp.common import naming class TestTCPIPExtendedBiFlow(ProbeTCPIPFlowBase): flow_class = TCPIPFlowExtendedBiFlowInfo def test_short_single_flow_internals(self, p...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true ...
3
tests/primitives/flow/probe_tcpip_extended_biflow_test.py
kjerabek/netexp
# -*- coding: utf-8 -*- from __future__ import absolute_import import unittest from pyes.tests import ESTestCase class IndexStatsTestCase(ESTestCase): def setUp(self): super(IndexStatsTestCase, self).setUp() self.conn.indices.create_index(self.index_name) self.conn.indices.put_mapping(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_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false ...
3
tests/test_index_stats.py
ttimasdf/pyes
#!/usr/bin/env python """ This script provides useful funcs to all other scripts """ import yaml import glob import os def clean(flag="all"): """ Cleans project directories. """ subdirs = ["raw", "interim", "processed"] data_filepaths = [] pdb_filepaths = [] for subdir in subdir...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "ans...
3
src/utilities.py
igordub/artificial-pdb-coord
""" 1. Clarification 2. Possible solutions - In-Order Traversal 3. Coding 4. Tests """ # 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 # T=O(n), S=O(n) class Solution: ...
[ { "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
algorithms/897. Increasing Order Search Tree.py
woozway/py3-leetcode
import configparser import os class Config: """ Reads and/or writes the configuration from/to a file """ def __init__(self, path): """ Initializes the parameters and checks if a config file is already existing. :param path: """ self.path = path self.co...
[ { "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
config.py
lagmoellertim/ImageShare-DesktopApp
from math import inf, sqrt from benchmarking.ConfigurableAlgorithmBase import ConfigurableAlgorithmBase def benchmark(algorithm: ConfigurableAlgorithmBase, benchmark_function, bounds, repeat_times=20): results = [] values = [] best = {'input': None, 'value': inf} for i in range(repeat_times): ...
[ { "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
benchmarking/benchmark_algorithm.py
APB97/python-physical-algorithms
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
[ { "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/00_unit/test_base.py
wolcomm/eos-prefix-list-agent
# -*- coding: utf-8 -*- """ Created on Mon Sep 7 14:11:59 2020 @author: Akhil """ from __future__ import print_function import re from pathlib import Path from pycparser import c_ast, c_generator, parse_file from pycparser.c_ast import FuncDef z = [] class FuncDefVisitor(c_ast.NodeVisitor): ...
[ { "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_nested_function_def", "question": "Does this file contain any function defined inside another function?",...
3
functions.py
akhil-eppa/Multi-Source-Plagiarism
from rest_framework import serializers from rest_framework.reverse import reverse from .models import Channel, Datasource, Value class ChannelSerializer(serializers.HyperlinkedModelSerializer): values = serializers.SerializerMethodField() latest = serializers.SerializerMethodField() def get_values(self...
[ { "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
persister/observations/serializers.py
City-of-Helsinki/hel-data-pipe
import torch import numpy as np class ScheduledOptim: """ A simple wrapper class for learning rate scheduling """ def __init__(self, model, train_config, model_config, current_step): self._optimizer = torch.optim.Adam( model.parameters(), betas=train_config["optimi...
[ { "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
model/optimizer.py
keonlee9420/DiffSinger
import artist import track_encrypt import ipfshttpclient import os import json from umbral.keys import UmbralPrivateKey, UmbralPublicKey from flask import Flask, request, Response, jsonify from flask_cors import CORS app = Flask(__name__) app.config['UPLOAD_FOLDER'] = './uploads' CORS(app) api = ipfshttpclient.connec...
[ { "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
nuCypher/creator_server/server.py
nanspro/nuSubscribe
#!/usr/bin/env python # Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. # Government retains certain rights in this software. def platform_expr( expr ): ''' Evaluates the given word expression against the curre...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/c...
3
config/script_util/exprutils.py
rrdrake/vvtest
from django.contrib.auth import get_user_model from django.db import models import uuid UserModel = get_user_model() class Project(models.Model): title = models.CharField(max_length=20, unique=True) description = models.TextField() link = models.URLField(null=True) image = models.ImageField(upload_t...
[ { "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": false }...
3
portfolio/portfolio_projects/models.py
Dafov/portfolio
import io import base64 from IPython.display import HTML import gym import numpy as np def play_video(filename): encoded = base64.b64encode(io.open(filename, 'r+b').read()) embedded = HTML(data=''' <video controls> <source src="data:video/mp4;base64,{0}" type="video/mp4" /> </video>...
[ { "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
mitdeeplearning/lab3.py
aishraghavan/introtodeeplearning
import operator import numpy as np import pytest from algebra.util import squeeze, get_subclasses, broadcast, identical, to_tensor def test_squeeze(): assert squeeze([1, 2]) == [1, 2] assert squeeze([1]) == 1 def test_get_subclasses(): class A: pass class B1(A): pass class B2...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
tests/test_util.py
wesselb/ring
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from ..azure_common import BaseTest class LogicAppTest(BaseTest): def test_azure_logic_app_workflow_schema_validate(self): p = self.load_policy({ 'name': 'test-azure-logic-app-workflow', 'resource': 'azu...
[ { "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
tools/c7n_azure/tests_azure/tests_resources/test_logic_app.py
vkubyshko/cloud-custodian
"""Tests for the switchbot integration.""" from unittest.mock import patch from homeassistant.const import CONF_MAC, CONF_NAME, CONF_PASSWORD, CONF_SENSOR_TYPE from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry DOMAIN = "switchbot" ENTRY_CONFIG = { CONF_NAME: "test-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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/...
3
tests/components/switchbot/__init__.py
bastgau/core
# Find All Possible Recipes from Given Supplies """ toughest part was to handle cycles, which I assumed wouldn't exist in the test cases but did """ from typing import List class Solution: def findAllRecipes(self, recipes: List[str], ingredients: List[List[str]], supplies: List[str]) -> List[str]: """ ...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than cla...
3
solutions/2115.py
pacokwon/leetcode
# uncompyle6 version 3.2.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] # Embedded file name: encodings.cp1026 import codecs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return codecs.charmap_...
[ { "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
encodings/cp1026.py
theclashingfritz/Cog-Invasion-Online-Dump
#!/usr/bin/env python3 import isce from isceobj.Sensor import createSensor import shelve import argparse import glob from isceobj.Util import Poly1D from isceobj.Planet.AstronomicalHandbook import Const import os import datetime import numpy as np def cmdLineParse(): ''' Command line parser. ''' pars...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
contrib/stack/stripmapStack/unpackFrame_ENV.py
mgovorcin/isce2
import json from io import TextIOWrapper, UnsupportedOperation from json import JSONDecodeError import os class Config: def __init__(self, log): self.log = log if not os.path.exists("config.json"): self.log("config.json not found, creating new one") with open("config.json",...
[ { "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
src/config.py
AnonVodka/VALORANT-rank-yoinker
from flask_unchained.bundles.sqlalchemy import ModelManager from ..models import Market class MarketManager(ModelManager): class Meta: model = Market def create(self, abbrev, name, exchange, country, commit=False, **kwargs): return super().create(abbrev=abbrev, name=name, exchange=exchange, ...
[ { "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": false }...
3
bundles/finance/services/market_manager.py
briancappello/flask-techan-unchained
# coding: utf-8 from __future__ import unicode_literals from spacy.lang.da import Danish import pytest @pytest.fixture(scope="session") def da_nlp(): return Danish() @pytest.mark.parametrize( "string,lemma", [ ("affaldsgruppernes", "affaldsgruppe"), ("detailhandelsstrukturernes", "detai...
[ { "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
spacy_lookups_data/tests/test_da.py
CajuM/spacy-lookups-data
import tempfile from typing import List, Optional import allennlp.commands.train from allennlp.models.basic_classifier import BasicClassifier import pytest from konoha.integrations.allennlp import KonohaTokenizer @pytest.fixture def raw_text(): return "吾輩は猫である" @pytest.mark.parametrize( "token_surfaces,t...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (exclu...
3
tests/integrations/test_allennlp_integration.py
altescy/konoha
""" Extract the words from a tree and reverse the tokenization """ def get_words(tree): # Assume well formed if len(tree) == 2: return [tree[1]] else: return get_words(tree[1]) + get_words(tree[2]) LEFT = { '``': '"', '-LRB-': '(', '$': '$', } RIGHT = { "''": '"', "-RR...
[ { "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
stat_parser/treebanks/extract.py
lukaswillsie/TOHacks-2021
#!/usr/bin/env python3 import sys from setuptools.command.test import test as TestCommand try: from setuptools import setup except ImportError: from distutils.core import setup settings = dict() with open('requirements.txt') as file_requirements: requirements = file_requirements.read().splitlines() wit...
[ { "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
setup.py
subhankarc/service-fabrik-backup-restore
import os import time from flask import Flask def create_app(test_config=None): """Create and configure an instance of the Flask application.""" time.sleep(10) app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( # a default secret that should be overridden by instanc...
[ { "point_num": 1, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer...
3
flaskr/__init__.py
vitkhab/flask-example-app
from .. dynamic_array.array import Array class Stack: def __init__(self, cap=float('inf')): self.rep = Array() self.cap = cap self.top = 0 def __repr__(self): return repr(self.rep) def push(self, x): if self.top >= self.cap: raise TypeError('Overflow: ...
[ { "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
ds/stack/arraystack.py
hunan-rostomyan/dsalgo-experiments
try: from PySide import QtCore except: try: from PyQt4 import QtCore except: from PyQt5 import QtCore class TestObject(QtCore.QObject): """ Test class providing some non-argument signal """ try: testSignal = QtCore.Signal() # @UndefinedVariable except: ...
[ { "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
python/helpers/pydev/tests_pydevd_python/_debugger_case_qthread4.py
truthiswill/intellij-community
from django.db import models from django.utils import timezone from django.core.exceptions import ValidationError # from django.contrib.auth.models import User from users.models import Student, College from django.urls import reverse from django.core import validators class AbstractPostModel(models.Model): title ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, {...
3
app/blog/models.py
jayjodev/oncollegehub
# -*- coding: utf-8 -*- from datetime import datetime import time import unittest from webapp2_caffeine.cache import CacheContainer from webapp2_caffeine.cache import flush class DummyCache(CacheContainer): key = 'dummy_cache' @property def fresh_value(self): return datetime.now() class Cache...
[ { "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
tests/test_cache.py
gvigneron/webapp2_caffeine
import time from math import pi, cos, sin, tan #test program to visulaize led sequences. class leds: num = 16 mindelay = 3 modedelay = 333 def test(self, c): temp = '' for i in range(0, self.num): for n in c: if i == n: temp += '+' ...
[ { "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
led.py
saulc/myth-math
import os from setuptools import setup PACKAGE = "allure-behave" VERSION = "2.5.5" classifiers = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Topic :: Software Development :: Quality Assurance', 'Topic ::...
[ { "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
allure-behave/setup.py
SAmorozov/allure-python
# Copyright 2013-2022 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) from spack.package import * class Babelflow(CMakePackage): """BabelFlow is an Embedded Domain Specific Language to 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": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "ans...
3
var/spack/repos/builtin/packages/babelflow/package.py
jeanbez/spack
import os import click from yoda.ssh.shell import Shell from yoda.ssh.config import importHost # Context obj class Cmd(): def __init__(self): self.verbose = False self.shell = None self.host = None pass_cmd = click.make_pass_decorator(Cmd, ensure=True) class CmdsLoader(click.MultiCommand): _cmdFolder...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class 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 self/cls)...
3
yoda/main.py
x0y-gt/yoda
import unittest from .. import PrefJSONRemote, PrefService, PrefRemote import os from datetime import datetime class TestPrefService(unittest.TestCase): remote = PrefJSONRemote() pref_service = PrefService(remote) def test_get_apiKey(self): api_Key = self.pref_service.get_preferences("cooking") ...
[ { "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
services/preferences/test/test_service.py
Ovakefali13/buerro
# From here you can define all the udfs that you want to use from your Spark SQL queries. # getSite(url) is intended as an example of what can be accomplished with UDFs. from pyspark.sql.types import StringType def getSite(url): if "nightnyc.net" in url: return 'nyc' if "nightlondon.co.uk" in url: ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
src/Dashboard/udfs.py
raimonbosch/sparksql-dashboard
""" Problem 1 --------- Description for problem 1. """ import unittest def foo(): pass class TestFoo(unittest.TestCase): def test_foo(self): pass if __name__ == '__main__': unittest.main()
[ { "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
templates/foo.py
corenel/lintcode
#!/usr/bin/env python import sys import time def write(data): sys.stdout.write(data + '\n') sys.stdout.flush() def main(): msg = 'announce attribute next-hop 1.2.3.4 med 100 as-path [ 100 101 102 103 104 105 106 107 108 109 110 ] nlri %s' write(msg % ' '.join('%d.0.0.0/8' % ip for ip in range(0, 22...
[ { "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
qa/self/attribute/api-internet.py
pierky/exabgp
# -*- coding: utf-8 -*- ''' @Description: code @Author: MiCi @Date: 2020-03-07 22:46:46 @LastEditTime: 2020-03-12 10:47:55 @LastEditors: MiCi ''' import matplotlib.pyplot as plt import numpy as np def basic_label_2(): x = np.linspace(-3, 3, 50) y1 = x*2 + 1 y2 = x**2 # label属性设定 图例名称 plt.plot(x, ...
[ { "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
basic-train/basic-2.py
MiCigo/matplotlib-tutorial
# Write a program that prints a multiplication table. # Functions are for single unit tasks. Make a function for the printheader and the sequence(innerds of the table). def positiveinteger(N): try: posnum = int(N) except: raise ValueError('Not an integer.') if posnum <0: raise Value...
[ { "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
Modules/multiplication_table.py
Elizandtech/fun_problems
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.12.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys i...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "...
3
kubernetes/test/test_v1beta1_rolling_update_daemon_set.py
TomasTomecek/kubernetes-python
from django.conf import settings from places.models import Place import requests PLACES_API_ROOT = "https://maps.googleapis.com/maps/api/place" PLACES_DETAILS_URL = "{ROOT_URL}/details/json?inputtype=textquery&key={key}&place_id={place_id}&fields={fields}" PLACES_PHOTO_URL = "{ROOT_URL}/photo?key={key}&photoreference...
[ { "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
backend/places/google_places_helper.py
rebz/inspire-indy-backend
# Use lambdas as in-place functions def CelsisusToFahrenheit(temp): return (temp * 9/5) + 32 def FahrenheitToCelsisus(temp): return (temp-32) * 5/9 def main(): ctemps = [0, 12, 34, 100] ftemps = [32, 65, 100, 212] # Use regular functions to convert temps print(list(map(CelsisusToFahrenheit, ...
[ { "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
advanced-python/03 Functions/3.3-lambdas.py
dasanchez/hellopy
# -*- coding: UTF-8 -*- from nose.tools import assert_equal, assert_raises from ckanapi import LocalCKAN, ValidationError from ckan.tests.helpers import FunctionalTestBase from ckan.tests.factories import Organization from ckanext.recombinant.tables import get_chromo class TestExperiment(FunctionalTestBase): de...
[ { "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
ckanext/canada/tests/test_experiment.py
HoussamBedja/ckanext-canada
import sys from argparse import ArgumentParser from . import search def parse_args(): parser = ArgumentParser(prog="googlelyrics") parser.add_argument( "--no-header", action="store_true", help="don't print the info header" ) parser.add_argument("query", type=str, nargs="+", help="search quer...
[ { "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
googlelyrics/__main__.py
lastsecondsave/googlelyrics
""" Exception Classes for the xdg package """ debug = False class Error(Exception): def __init__(self, msg): self.msg = msg Exception.__init__(self, msg) def __str__(self): return self.msg class ValidationError(Error): def __init__(self, msg, file): self.msg = msg ...
[ { "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
Contents/Libraries/Shared/xdg/Exceptions.py
jippo015/Sub-Zero.bundle
# -*- coding: utf-8 -*- # Copyright (c) 2020, 9T9IT and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class FMDashboard(Document): def make_outstanding_balances(self): """ Make outstanding balances ...
[ { "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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answe...
3
facility_management/facility_management/doctype/fm_dashboard/fm_dashboard.py
odoochain/facility_management
import pandas as pd from utils.exceptions import WrongDataFrameSize, NoScanAvailable from IPython.core.debugger import Tracer; debughere = Tracer() import json def pop_all(l): r, l[:] = l[:], [] return r def extract_scan(df ,ip="",protocol='tcp'): no_scan = [] if ip: scan = df[df["ip"] == i...
[ { "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
utils/datasupport.py
herrfeder/RaaS
import asyncio import time n = 0 async def monitor(): global n while True: await asyncio.sleep(1) print(f"{n} req/sec") n = 0 async def client(address, num): global n reader, writer = await asyncio.open_connection(*address) while True: writer.write(b'1000') ...
[ { "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
server/async_client.py
infotraining-team/python-asyncio-2021-06-14
from mirage.libs import io class Loader: ''' This class permits to dynamically load the modules. ''' def __init__(self): ''' This constructor generates the modules list. ''' import mirage.modules as modules self.modulesList = {} for moduleName,module in modules.__modules__.items(): current = module#...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }...
3
mirage/core/loader.py
epablosensei/mirage
#from MusicTheory.scale.Scale import Scale import MusicTheory.scale.Scale from MusicTheory.scale.ScaleIntervals import ScaleIntervals #from MusicTheory.pitch.PitchClass import PitchClass #from MusicTheory.pitch.OctaveClass import OctaveClass #from Framework.ConstMeta import ConstMeta from MusicTheory.pitch.PitchClass i...
[ { "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
src/MusicTheory/scale/ScaleKey.py
ytyaru/Python.MusicTheory.Scale.201709231350
from .player import Player class Cell: EMPTY = ' ' def __init__(self, value = EMPTY): self.value = value def __eq__(self, other): return other is not None and self.value == other.value def __str__(self) -> str: return str(self.value) def assign(self, player: Player): ...
[ { "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
tiktaktoe/models/cell.py
michelAlexis/tik-tak-toe
import matplotlib.pyplot as plt import numpy as np def gen_data(n, start=0, end=10): x = np.linspace(start, end, n) y = np.sin(10*x) - x*x return y def gen_data_osc(n): return np.array([1024 + (-2)**(-i/100) for i in range(n)]) def gen_data_rand(n): return np.random.randn(n) + 0.3*np....
[ { "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
Data Fusion Test/Minimos Quadrados Puro.py
Raphael-C-Almeida/Wireless-Sensor-Network
import traceback def agency_slug(agency_name): return '#' + ''.join(agency_name.split()) + '#' def user_input(prompt): try: return raw_input(prompt) except NameError: return input(prompt) def error_info(e): return "%s: %s" % (e, traceback.format_exc().replace("\n", "\\n "))
[ { "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
msg/utils.py
hackerlikecomputer/foiamail
import asyncio from loguru import logger from ariadne import gql, make_executable_schema from ariadne import QueryType, MutationType, SubscriptionType from ariadne.contrib.django.scalars import date_scalar from channels.db import database_sync_to_async from orders.models import Order query = QueryType() mutation =...
[ { "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
server/orders/schema.py
kfields/django-arcade
import pytest from rumydata import table, Layout, field from rumydata.rules import row as rr, header as hr def test_row_good(basic): assert not table.Layout(basic).check_row(['1', '2', '2020-01-01', 'X']) def test_row_choice(basic): lay = Layout({'c1': field.Choice(['x'], nullable=True)}) assert not la...
[ { "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/test_row.py
Mikuana/rumydata
from Common.utils import * import sublime import sublime_plugin class LoadAllSnowRecordCommand(sublime_plugin.WindowCommand): this_dirs = [] def run(self, dirs): self.this_dirs = dirs self.window.show_input_panel("Enter an encoded query (or leave blank):", "", self.get_records, None, None) ...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fe...
3
Commands/load_all_snow_record.py
salcosta/servicenow-sync
class Elevator: occupancy_limit = 8 def __init__(self, occupants=0): self.floor = 0 if occupants <= Elevator.occupancy_limit: self.occupants = occupants else: self.occupants = Elevator.occupancy_limit print('too many occupants', occupants - Elevator.o...
[ { "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
Lesson08/elevatorEx.py
PacktPublishing/Python-Fundamentals
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 2 Contact: sdk@isilon.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import isi_sdk_7_2 from isi...
[ { "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
isi_sdk_7_2/test/test_storagepool_tier_create_params.py
mohitjain97/isilon_sdk_python
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
[ { "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
kubernetes/test/test_v1_resource_quota_list.py
scele/kubernetes-client-python
import unittest from challenge2 import findSingleton class TestFindSingleton(unittest.TestCase): def test_base_case(self): aList = [2, 3, 4, 2, 3, 5, 4, 6, 4, 6, 9, 10, 9, 8, 7, 8, 10, 7] bList = [2,'a', 'l', 3, 'l', 4, 'k', 2, 3, 4, 5, 'a', 6, 'c', 4, 'm', 6, 'm', 'k', 9, 10, 9, 8, 7, 8, 10, 7] ...
[ { "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
challenge_2/python/flickdm/test.py
rchicoli/2017-challenges
# GENERATED BY KOMAND SDK - DO NOT EDIT import insightconnect_plugin_runtime import json class Component: DESCRIPTION = "Identifies if a new incident has been created" class Input: FREQUENCY = "frequency" QUERY = "query" class Output: SYSTEM_ID = "system_id" class IncidentCreat...
[ { "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
plugins/servicenow/icon_servicenow/triggers/incident_created/schema.py
lukaszlaszuk/insightconnect-plugins
import subprocess import pytest import testinfra def pytest_addoption(parser): parser.addoption("--image") @pytest.fixture(scope="session") def image(request): return request.config.getoption("--image") @pytest.fixture(scope="session") def host(image): run_command = ["docker", "run", "-d", image, "sl...
[ { "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/conftest.py
sebastien-prudhomme/docker-pytest
import logging import pandas import pymysql from classes.file_query_loader import FileQueryLoader class MySqlFetcher: def __init__(self, query_loader=FileQueryLoader()): self.__db_connection = self.open_connection() self.data_set = pandas.DataFrame() self.query_loader = query_loader ...
[ { "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/mysql_fetcher.py
PrzemyslawSwiderski/PLCOpythonTool
#!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson as json from alipay.aop.api.response.AlipayResponse import AlipayResponse class SsdataDataserviceRiskAntimarketcheatQueryResponse(AlipayResponse): def __init__(self): super(SsdataDataserviceRiskAntimarketcheatQueryResponse, self).__init__()...
[ { "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
alipay/aop/api/response/SsdataDataserviceRiskAntimarketcheatQueryResponse.py
articuly/alipay-sdk-python-all
from django.test import TestCase from django.core.exceptions import ValidationError from chatterbot.ext.django_chatterbot.views import ChatterBotView class MockResponse(object): def __init__(self, pk): self.session = {'chat_session_id': pk} class ViewTestCase(TestCase): def setUp(self): su...
[ { "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_django/test_views.py
rattaphoom/ChatterBot
#!/usr/bin/python3 import json from iot_message.message import Message import iot_message.exception as ex class MessageFactory(object): """Class MessageFactory""" @classmethod def create(cls, data=None): if data is None: return Message() else: return cls._decode(dat...
[ { "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
iot_message/factory.py
bkosciow/python_iot-1