source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# CPU: 0.05 s
def row04():
output = ".." + "...".join("#" * length) + ".."
for pos in range(10, len(output), 12):
output = output[:pos] + "*" + output[pos + 1:]
print(output)
def row13():
output = "." + ".".join("#" * length * 2) + "."
for pos in range(9, len(output), 12):
output = output[:pos] + "*" + output... | [
{
"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 | kattis/Okviri.py | jaredliw/python-question-bank |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `taurus_pyqtgraph` package."""
from click.testing import CliRunner
def test_smoke():
import taurus_pyqtgraph # noqa
def test_command_line_interface():
"""Test the CLI."""
from taurus_pyqtgraph import cli
runner = CliRunner()
result ... | [
{
"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_taurus_pyqtgraph.py | vallsv/taurus_pyqtgraph |
import ast
from pypytranspy.transformations.base_transformer import BaseTransformer
from pypytranspy.transformations.utils import replace_node_field
class RemoveAnnotationsTransformer(BaseTransformer):
minimum_version = [3]
def pre_arg(self):
"""
Remove annotations from function's arguments
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | src/pypytranspy/transformations/remove_annotations_transformer.py | expobrain/pypytranspy |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users objects"""
class Meta:
model = get_user_model()
fields =... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | app/user/serializers.py | acnewberry/recipe-app-api |
from fbs_runtime.application_context import cached_property
from imagewao import QImageWAO
class Combiner:
def __init__(self, ctx):
self.ctx = ctx
@cached_property
def window(self):
return QImageWAO()
def run(self):
with open(self.ctx.get_resource("style.qss")) as f:
... | [
{
"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/main/python/combiner.py | boom-roasted/ImageWAO |
class Calculator(object):
"""calclator class"""
def add(self, a, b):
return a + b
def sub(self, a, b):
return a - b
def mul(self, a, b):
return a * b
def div(self, a, b):
return a / b
| [
{
"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 | unittest/calculatorTest/calc.py | terasakisatoshi/pythonCodes |
from cornice.resource import resource, view
from ode.models import Source
from ode.resources.base import ResourceMixin, set_content_type
from ode.resources.base import COLLECTION_JSON_MIMETYPE
from ode.validation.schema import SourceCollectionSchema
from ode.validation.validators import has_provider_id
from ode.valida... | [
{
"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 | ode/resources/source.py | LiberTIC/ODE |
class Device(object):
'''
This is an object that provides information about the device making the
request.
'''
def __init__(self, device_id, supported_interfaces):
self._device_id = device_id
self._supported_interfaces = supported_interfaces
@classmethod
def crea... | [
{
"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 | askalexa/request/device.py | scottenglert/AskAlexa |
from dynamic_stack_decider.abstract_action_element import AbstractActionElement
from tf2_geometry_msgs import PoseStamped
import rospy
class GoToDefensePosition(AbstractActionElement):
def __init__(self, blackboard, dsd, parameters=None):
super(GoToDefensePosition, self).__init__(blackboard, dsd, paramete... | [
{
"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 | bitbots_body_behavior/src/bitbots_body_behavior/actions/go_to_defense_position.py | MosHumanoid/bitbots_behavior |
import numpy as np
def get_confusion_matrix(output,target):
confusion_matrix = np.zeros((output[0].shape[0],output[0].shape[0]))
for i in range(len(output)):
true_idx = target[i]
pred_idx = np.argmax(output[i])
confusion_matrix[true_idx][pred_idx] += 1.0
return confusion_matri... | [
{
"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 | utils/metrics.py | yongpi-scu/TPRNet |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_2
from i... | [
{
"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 | isi_sdk_8_2_2/test/test_healthcheck_parameter.py | mohitjain97/isilon_sdk_python |
from django_filters import rest_framework as filters
from rest_framework import viewsets
from rest_framework.filters import SearchFilter, OrderingFilter
from rest_framework.permissions import IsAuthenticated, BasePermission
from invoices.api.serializers import InvoiceSerializer
from invoices.models import Invoice
cl... | [
{
"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 | invoices/api/viewsets.py | elcolie/zero-to-deploy |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"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 | samples/snippets/export_model_tabular_classification_sample_test.py | nachocano/python-aiplatform |
# coding: utf-8
""" Handle Steps Plugins """
import importlib
import os
import pkgutil
import sys
import tmt
import fmf
log = fmf.utils.Logging('tmt').logger
def explore():
""" Explore all available plugins """
# Check all tmt steps for native plugins
root = os.path.dirname(os.path.realpath(tmt.__fil... | [
{
"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 | tmt/plugins.py | stepnem/tmt |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
def test_200_success(petstore):
User = petstore.get_model('User')
user = User(
id=1,
username='bozo',
firstName='Bozo',
lastName='TheClown',
email='bozo@clown.com',
password='newpasswor... | [
{
"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 | tests/petstore/user/updateUser_test.py | andriis/bravado |
from flask import Flask, json
import logging
def log_exception(sender, exception, **extra):
sender.logger.debug('Got exception during processing: %s', exception)
def create_app(config_file):
#Instantiating Flask and appling config
app = Flask(__name__)
app.config.from_object(config_file)
from ap... | [
{
"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 | run.py | dipans/case-service |
# coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... | [
{
"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_get_account_plan.py | Danilka/APIv3-python-library |
from itertools import zip_longest
def group(iterable, n):
"""Splits an iterable set into groups of size n and a group
of the remaining elements if needed.
Args:
iterable (list): The list whose elements are to be split into
groups of size n.
n (int): The number ... | [
{
"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 | 222/grouping1.py | alehpineda/bitesofpy |
#!/usr/bin/env python
# -*- coding: utf-8
import itertools
import subprocess
import yaml
from k8s import config
from k8s.models.namespace import Namespace
from tqdm import tqdm
from fiaas_deploy_daemon.tpr.types import PaasbetaStatus
"""Requires `tqdm`, which is not usually part of our requirements."""
def _config... | [
{
"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 | utils/cleanup.py | j-boivie/fiaas-deploy-daemon |
import os
import discord
from discord import InteractionContext
from dotenv import load_dotenv
if os.name != "nt":
import uvloop
uvloop.install()
load_dotenv()
bot = discord.Bot(intents=discord.Intents.default())
TOKEN = os.getenv("TOKEN")
@bot.event
async def on_ready():
print("봇이 준비되었습니다!")
@bot.... | [
{
"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 | main.py | Bing-su/monil-babo-bot |
# import moonshine as ms
# from moonshine.curves import discount_factor
from .curves import get_discount_factor
from .instruments import price_cashflow
def egg(num_eggs: int) -> None:
"""prints the number of eggs.
Arguments:
num_eggs {int} -- The number of eggs
Returns:
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 | src/moonshine/__main__.py | CatchemAl/moonshine |
from django.contrib.auth.models import User
from django.db import models
from tinymce.models import HTMLField
# Create your models here.
class Profile(models.Model):
profile_photo = models.ImageField('profile/', null = True)
bio = models.TextField()
user = models.ForeignKey(User)
last_update = mod... | [
{
"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 | insta/models.py | brayomumo/Instagram |
from abc import ABC, abstractmethod
from pathlib import Path
from virtool_workflow.data_model import Index
from virtool_workflow.data_model.files import VirtoolFileFormat
class AbstractIndexProvider(ABC):
@abstractmethod
async def get(self) -> Index:
"""Get the current index."""
...
@ab... | [
{
"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 | virtool_workflow/abc/data_providers/indexes.py | BlakeASmith/virtool-workflow |
"""Example games module."""
class Game(object):
"""Base game class."""
def __init__(self, player1, player2):
"""Initializer."""
self.player1 = player1
self.player2 = player2
def play(self):
"""Play game."""
print('{0} and {1} are playing {2}'.format(
s... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
... | 3 | examples/providers/factory_aggregate/games.py | vlad-ghita/python-dependency-injector |
"""rest freamwork import"""
from . import serializers
from rest_framework import status
from rest_framework_simplejwt.views import TokenObtainPairView
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
from rest_framework.response import Response
from rest_framework import (
generics,
pe... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | app/user/api/views.py | HSAkash/Questionnaire_api |
from django.db import models
from django.utils import timezone
from django.urls import reverse
from datetime import datetime
from markdownx.models import MarkdownxField
from cloudinary.models import CloudinaryField
# Create your models here.
class Post(models.Model):
author = models.ForeignKey('auth.User', on_del... | [
{
"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 | exhibit/blog/models.py | ddonco/django_blog |
import gzip
import json
from hashlib import md5
from concurrent import futures
from operator import itemgetter
import requests
from .utils import prepare_url
from . import BASE
class InvalidReferenceData(Exception):
pass
def _load_single_file(url):
r = requests.get(url['url'])
data = gzip.decompress(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 | transperth/silver_rails/reference_data.py | Mause/pytransperth |
from cms.models import Menu, CompanyLogo
from django import template
from django.utils import translation
register = template.Library()
@register.simple_tag()
def get_menu(slug, page, logged_in):
# returns a list of dicts with title, url, slug, page and icon of all items in the menu of the given slug or page
... | [
{
"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 | cms/templatetags/cms_tags.py | DBonbon/pythoneatstail |
try:
from prawframe.obfuscation import Scrambler
except ImportError:
from .obfuscation import Encryptor
def bytes_packet(_bytes, termination_string=']'):
"""
Create a packet containing the amount of bytes for the proceeding data.
:param _bytes:
:param termination_string:
:return:
"""
... | [
{
"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 | PyRemoteConsole/common_connection.py | Wykleph/PyRemoteConsole |
from typing import Any, Callable, Dict, List, Optional
import torch
from PIL import Image
class ImageDataset(torch.utils.data.Dataset):
def __init__(
self, imgs: List[str], transform: Optional[Callable[[Image.Image], Any]] = None
):
assert isinstance(imgs, (list, tuple))
super().__ini... | [
{
"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 | laia/data/image_dataset.py | eivtho/PyLaia |
from __future__ import absolute_import
import abc
import math
import os
import socket
import struct
from future.utils import with_metaclass
from boofuzz.connections import itarget_connection
def _seconds_to_sockopt_format(seconds):
"""Convert floating point seconds value to second/useconds struct used by UNIX ... | [
{
"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 | boofuzz/boofuzz/connections/base_socket_connection.py | mrTavas/owasp-fstm-auto |
"""Compute a Pade approximation for the principle branch of the
Lambert W function around 0 and compare it to various other
approximations.
"""
import numpy as np
try:
import mpmath # type: ignore[import]
import matplotlib.pyplot as plt
except ImportError:
pass
def lambertw_pade():
derivs = [mpmath... | [
{
"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 | scipy/special/_precompute/lambertw.py | daniel-dr-rojas/scipy |
class DataGridViewAutoSizeColumnMode(Enum,IComparable,IFormattable,IConvertible):
"""
Defines values for specifying how the width of a column is adjusted.
enum DataGridViewAutoSizeColumnMode,values: AllCells (6),AllCellsExceptHeader (4),ColumnHeader (2),DisplayedCells (10),DisplayedCellsExceptHeader (8),Fill... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewAutoSizeColumnMode.py | tranconbv/ironpython-stubs |
from django.shortcuts import render , render_to_response, RequestContext, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse , Http404
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
fro... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},... | 3 | comment/views.py | 28harishkumar/Social-website-django |
from scipy.stats.distributions import chi2
#
# def ipte_formula(iterations_or_ipte, number_of_incidents, confidence):
# chi_square_inverse_right_tailed = chi2.ppf(confidence, df=2 * (number_of_incidents + 1))
# return chi_square_inverse_right_tailed * (1000 / (iterations_or_ipte * 2))
#
def calculate_iterati... | [
{
"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 | ucm_drf/api/ipte_util.py | ManianVSS/Shani |
#!/usr/bin/python
#
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import base64
class EnrolledIdentity:
def __init__(self, name, cert, private_key, ca, hsm):
self.name = name
self.cert = cert
self.private_ke... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | plugins/module_utils/enrolled_identities.py | m-g-k/ansible-collection |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
{
"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 | mindspore/ops/composite/multitype_ops/logical_and_impl.py | i4oolish/mindspore |
# 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": "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 | aliyun-python-sdk-linkwan/aliyunsdklinkwan/request/v20190301/CancelJoinPermissionAuthOrderRequest.py | yndu13/aliyun-openapi-python-sdk |
from unittest import TestCase
from cr8.log import format_stats
from cr8.metrics import Stats
class ResultTest(TestCase):
def test_short_result_output_with_only_1_measurement(self):
stats = Stats()
stats.measure(23.4)
self.assertEqual(
format_stats(stats.get(), 'short'),
... | [
{
"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_log.py | seut/cr8 |
import os
from nitrado import Service, initialize_client
def set_client():
url = "https://api.nitrado.net/"
key = os.getenv('NITRADO_KEY')
initialize_client(key, url)
def test_services():
set_client()
services = Service.all()
assert len(services) > 0
def test_logs():
set_client()
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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_service.py | GameServerGurus/Nitrado-SDK |
"""added about_me and last_seen to user
Revision ID: 0b9fe706da69
Revises: 3f0fb80d30af
Create Date: 2019-12-14 14:45:04.886154
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0b9fe706da69'
down_revision = '3f0fb80d30af'
branch_labels = None
depends_on = None
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/0b9fe706da69_added_about_me_and_last_seen_to_user.py | kowabunga314/KarmaCompanion |
import logging
from . import wrapper
from ..app_settings import settings
logger = logging.getLogger(__name__)
class Mime(wrapper.Wrapper):
def __init__(self, filepath):
super().__init__(exec_name=settings.BINARY_FILE)
self.filepath = filepath
def get_cmd(self):
cmd = super().get_cmd... | [
{
"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 | papermerge/core/lib/mime.py | papermerge/papermerge-core |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
""" Test creating a new user with an email is successful """
def test_create_user_with_email_successful(self):
payload = {'email': 'pudgeinvonyx@gmail.com', 'password': '1111qqqq='}
user... | [
{
"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/core/tests/test_models.py | pudka/recipe-app-api |
"""
This file will parse the input text file and get important
knowledge from it and create a database known as Knowledge Base
"""
import json
import os
from engine.components.knowledge import Knowledge
from engine.logger.logger import Log
class KnowledgeBaseParser:
"""
Class the parse the file and create t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | engine/parser/knowledgeParser.py | ariyo21/Expert-System |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | aliyun-python-sdk-imm/aliyunsdkimm/request/v20170906/CompareFaceRequest.py | liumihust/aliyun-openapi-python-sdk |
import numpy as np
from openephys_fileIO.fileIO import *
from openephys_fileIO.Binary import *
def test_write_binary_data():
# Test writing of binary data
dataFolder = 'test/data'
# Read the data in original int16 format
data,headers = load_OpenEphysRecording4BinaryFile(dataFolder,
num_d... | [
{
"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 | test/test_binary.py | teristam/openephys-fileIO |
import cv2
import numpy as np
import re
def read_list(f):
l = []
for line in open(f, 'r'):
l.append(line.strip())
return l
def get_identity(img_name, names):
indices = [i.start() for i in re.finditer('_', img_name)]
name = img_name[:indices[len(indices)-5]]
if name in names:
... | [
{
"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 | src/utils.py | njuaplusplus/AmI |
class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def ... | [
{
"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 | data_structures/Project_Show_me_Data_Structures/active_directory.py | severian5it/udacity_dsa |
import numpy as np
import pandas as pd
from pathlib import Path
from ast import literal_eval
def convert_scores_literal(score):
try:
return literal_eval(score)
except:
return f'Error: {score}'
def pts_diff(row):
try:
winner_pts = sum(row['winning_team_scores_lst'])
loser_... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": f... | 3 | src/elopackage/preprocess.py | bf108/elo_package |
import pytest
from PJ.application import Application
__author__ = 'Max'
@pytest.fixture(scope="session", autouse=True)# run all tests in one session.
def app(request):
global fixture
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
# ID = 1
def test_with_valid_login_and_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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | Tests/Test_login_form.py | mihushynmaksym/PJ |
"""
Download the device tree overlay package use Robert C Nelson's source install:
https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
After installing the software, make the file executable, and then run the bash
file to install device-tree-overlay (dtc) from the source:
> sudo chmod +x dtc.sh
> sudo bash d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | measurement/onewire.py | cgiacofei/pybrew |
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.mark.parametrize("sort", [True, False])
def test_factorize(index_or_series_obj, sort):
obj = index_or_series_obj
result_codes, result_uniques = obj.factorize(sort=sort)
constructor = pd.Index
if is... | [
{
"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 | venv/Lib/site-packages/pandas/tests/base/test_factorize.py | OliviaNabbosa89/Disaster_Responses |
'''
Created on Aug 9, 2017
@author: Hao Wu
'''
from ScopeFoundry import HardwareComponent
from .daq_do_dev import DAQSimpleDOTask
from PyDAQmx import *
import numpy as np
import time
class DAQdoHW(HardwareComponent):
'''
Hardware Component Class for receiving AI input for breathing, licking etc
'''
... | [
{
"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 | VOTA_Control/VOTAScopeHW/daq_do/daq_do_hw.py | fullerene12/VOTA |
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from bs4 import BeautifulSoup
from urllib.parse import ... | [
{
"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 | sample/web_assistant.py | janakhpon/PersonalAssistant |
from .base import MethodBuilderBase
class FieldConverterMethodBuilder(MethodBuilderBase):
"""
Builds a method for converting to a Java type by
looking up a static field by name.
"""
def __init__(self, cls, field, xlname):
super().__init__(cls, field, xlname)
self._method_str = Non... | [
{
"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 | tools/gencode/method_builders/field_converter.py | tonyroberts/strata-excel |
import sys
# inserting pybullet-driving-env to the path
sys.path.insert(1, '/home/ck/pybullet-driving-env')
import gym
import pybullet_driving_env
from cogment_verse_environment.base import BaseEnv, GymObservation
from cogment_verse_environment.env_spec import EnvSpec
class DrivingEnv(BaseEnv):
"""
Class... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | environment/cogment_verse_environment/pybullet_driving_env.py | kharyal/cogment-verse |
'''
Given a string, write a function that uses recursion to output a
list of all the possible permutations of that string.
For example, given s='abc' the function should return ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
Note: If a character is repeated, treat each occurence as distinct,
for example an input of 'xxx' ... | [
{
"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 | udemy-data-structures-and-algorithms/15-recursion/15.8_string_permutation.py | washimimizuku/python-data-structures-and-algorithms |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1VHqKm6KjUqspTAmWiBJbTDBjbn8PAfGvr(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... | [
{
"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/storage/cases/test_KT1VHqKm6KjUqspTAmWiBJbTDBjbn8PAfGvr.py | juztin/pytezos-1 |
from django.contrib.admin import ModelAdmin
from django.conf import settings
from garb.config import default_config, get_config
from garb.tests.mixins import UserTestCaseMixin
from garb.tests.models import *
class ConfigTestCase(UserTestCaseMixin):
def test_garb_config_when_not_defined(self):
try:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | garb/tests/config.py | marcelogumercinocosta/django-garb |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... | [
{
"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 | xlsxwriter/test/comparison/test_print_options02.py | yxwlr995/-Python-Pandas-XlsxWriter |
#
# 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... | [
{
"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/providers/google/cloud/operators/test_video_intelligence_system.py | emilioego/airflow |
import re
GENERIC_REGISTRY_REGEX_PATTERN = "(.*[.][^/]*)/(.*)"
DEFAULT_DOCKER_REGISTRY = "docker.io"
DEFAULT_TAG = "latest"
def getRegistry(imageName):
if re.match(GENERIC_REGISTRY_REGEX_PATTERN, imageName, re.IGNORECASE):
return re.search(GENERIC_REGISTRY_REGEX_PATTERN, imageName, re.IGNORECASE).group(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": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | src/nightwatch/dockerutils.py | edevouge/nightwatch |
import os
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from zvt import zvt_env
from zvt.api.data_type import Region, Provider
from zvt.factors.candlestick_factor import CandleStickFactor, candlestick_patterns
# import faulthandler
# faulthandler.enable()
... | [
{
"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 | candle.py | doncat99/FinanceAnalysis |
from ..config import config
import logging
import os
import shutil
import subprocess
from subprocess import CalledProcessError, Popen
from time import sleep
logging.basicConfig(
level=config.log_level, format='%(asctime)s | %(levelname)s | %(message)s')
PORT = config.port
def rm_gen_dir():
try:
shut... | [
{
"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 | insights_connexion/test/oatts.py | fijshion/insights_connexion |
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class ImagePullPolicyAlways(BaseResourceCheck):
def __init__(self):
"""
Image pull policy should be set to always to ensure you get the correct... | [
{
"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 | checkov/terraform/checks/resource/kubernetes/ImagePullPolicyAlways.py | pmalkki/checkov |
import pytest
from lcs import Perception
from lcs.agents.macs.macs import Effect
class TestEffect:
def test_should_initialize(self):
effect = Effect('1???')
assert len(effect) == 4
def test_should_build_empty(self):
assert Effect.empty(4) == Effect('????')
@pytest.mark.parametr... | [
{
"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/lcs/agents/macs/test_Effect.py | Gab0/pyalcs |
import math
import scene
class Calculator:
def __init__(self):
self.scene = scene.Scene()
def calculate(self, feathers, pictures_count, cutter_angle):
self.scene.set(feathers, cutter_angle)
self.pictures_count = pictures_count
self.angle = math.radians(360) / self.pictures_c... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | scripts/calculator.py | Coolxer/image_creator |
"""empty message
Revision ID: 884fbf8b24ed
Revises: 84b5ddd15854
Create Date: 2022-02-13 16:31:44.422780
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '884fbf8b24ed'
down_revision = '84b5ddd15854'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | migrations/versions/884fbf8b24ed_.py | tewhalen/chicagodir |
import torch
import torch.nn as nn
from torch.distributions import MultivariateNormal
from torchdyn.models import NeuralODE
from torchdyn import Augmenter
from torchdyn.models.cnf import CNF, hutch_trace, autograd_trace
def test_cnf_vanilla():
device = torch.device('cpu')
net = nn.Sequential(
nn.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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | test/test_normalizing_flows.py | qpwodlsqp/torchdyn |
import os
import csv
from holecardhandicapper.model.const import PREFLOP, FLOP, TURN, RIVER
class Utils:
@classmethod
def build_preflop_winrate_table(self):
fpath = self.get_preflop_winrate_data_path()
table = [[0 for j in range(53)] for i in range(53)]
with open(fpath, "r") as f:
reader = csv.r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | holecardhandicapper/model/utils.py | skyler-cs/HoleCardHandicapper |
from idaapi import *
'''
Author: Chris Eagle
Name: Clemency function fixup plugin defcon 25
How: Install into <idadir>/plugins
Activate within a function using Alt-8
'''
class clemency_plugin_t(plugin_t):
flags = 0
wanted_name = "Fix Clemency Functions"
wanted_hotkey = "Alt-8"
comment = ""
help = ... | [
{
"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 | clemency_fix.py | cseagle/ida_clemency |
from typing import Counter
from prometheus_client import start_http_server, Summary, Counter, Gauge ,__all__ ,Histogram
import random
import time
from requests import get
import requests
from requests.api import post
urls =["https://httpstat.us/503","https://httpstat.us/200"]
sitestatus = Gauge('sample_external_url_... | [
{
"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 | exporter/myapp.py | zeshahid/websitecheck_exporter |
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from test.unit.rules import BaseRuleTestCase
from cfnlint.rules.resources.properties.OnlyOne import OnlyOne # pylint: disable=E0401
class TestPropertyOnlyOne(BaseRuleTestCase):
"""Test OnlyOne Property ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | test/unit/rules/resources/properties/test_onlyone.py | duartemendes/cfn-python-lint |
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class IEC_61883_1(Base):
__slots__ = ()
_SDM_NAME = 'iec61883-1'
_SDM_ATT_MAP = {
'CIP 1': 'iec61883-1.header.CIP-1',
'CIP 2': 'iec61883-1.header.CIP-2',
'Select FDF': 'iec61883-1.header.selectFDF',
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/iec61883_1_template.py | Vibaswan/ixnetwork_restpy |
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated = "auto")
def hash(password: str):
return pwd_context.hash(password)
def verify(plain_password, hashed_password):
return pwd_context.verify(plain_password, hashed_password)
| [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | app/utils.py | cfranco1015/social_media_api |
""" ************************************************
* fileName: perceptual_loss.py
* desc: Perceptual loss using vggnet with conv1_2, conv2_2, conv3_3 feature,
before relu layer.
* author: mingdeng_cao
* date: 2021/07/09 11:08
* last revised: None
************************************************ """
import ... | [
{
"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 | simdeblur/model/loss/perceptual_loss.py | ljzycmd/SimDeblur |
from celery import task
from .models import Bid
from django.conf import settings
import requests
@task
def check_for_bid_confirmation(bid_id):
bid = Bid.objects.get(id=bid_id)
item = bid.item
item.buyer = bid.current_bidder
item.cost_sold = bid.current_highest
item.save()
bid.delete()
prin... | [
{
"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 | api/tasks.py | IamMayankThakur/farm-bid |
from cvpods.layers import ShapeSpec
from cvpods.modeling.backbone import Backbone
from cvpods.modeling.backbone.fpn import build_resnet_fpn_backbone
from cvpods.modeling.meta_arch.rcnn import GeneralizedRCNN
from cvpods.modeling.proposal_generator import RPN
from cvpods.modeling.roi_heads import StandardROIHeads
from c... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | playground/detection/voc/rcnn/faster_rcnn.res50.fpn.voc.multiscale.1x/net.py | hanqiu-hq/cvpods |
import numpy as np
import cv2
def draw_flow(img, flow, step=8):
h, w = img.shape[:2]
y, x = np.mgrid[step/2:h:step, step/2:w:step].reshape(2,-1).astype(int)
fx, fy = flow[y,x].T
lines = np.vstack([x, y, x+fx, y+fy]).T.reshape(-1, 2, 2)
lines = np.int32(lines + 0.5)
# vis = cv2.cvtColor(img, cv... | [
{
"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 | utils/common.py | lws803/Crime-detect |
# Copyright(c) 2019 UnitedStack Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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/cls)?"... | 3 | masakari_monitors_icmp_plugin/tests/unit/fakes.py | ooneko/masakari-monitors-icmp-plugin |
def for_O():
"""printing capital 'O' using for loop"""
for row in range(5):
for col in range(5):
if col==0 and row not in(0,4) or col==4 and row not in(0,4) or row==0 and col in(1,2,3) or row==4 and col in(1,2,3) :
print("*",end=" ")
else:
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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | package/alphabets/capital_alphabets/O.py | venkateshvsn/patterns |
import numpy as np
import torch
import torch.nn as nn
from rgb_stacking.utils.utils import init
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Sum(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
def forward(self, x):
... | [
{
"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 | rgb_stacking/contrib/common.py | ava6969/rgb_stacking_extend |
import datetime
import resource
from pandas_datareader import data as pdr
import fix_yahoo_finance as yf
from tickers import test_tickers
def get_all_stock_data(start, end, threads=(int)(resource.RLIMIT_NPROC*0.25)):
assert isinstance(start, datetime.datetime), "Error: start time must be datetime object"
asse... | [
{
"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 | tendytrader/numeric/get_finance.py | Volhacks-III-Supreme-Team/tendytrader |
#!/usr/bin/python
import re
import sys
import glob
import subprocess
BLACKLIST = [
"googlestreetview"
]
def main():
if len(sys.argv) > 1:
split_current, split_number = (int(v) for v in sys.argv[1].split("/"))
split_current = split_current - 1
else:
split_current, split_number = ... | [
{
"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 | buildtools/test_examples.py | loicgasser/ngeo |
# Python3 TLE
# PyPy3 AC
class fenwick_tree:
def __init__(self, n):
self.data = [0 for _ in range(n+1)]
self.n = n
def add(self, p, x):
p += 1
while p <= self.n:
self.data[p-1] += x
p += p & -p
def sum(self, l, r):
return self._sum(r) - ... | [
{
"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 | atcoder/fenwicktree.py | zeppeki/ac-library-python |
# coding: utf-8
"""
PDF stamper
The PDF Stamper API enables the possibility to add both static and dynamic stamps on existing PDFs. The stamps can consist of one or more barcode, hyperlink, image, line or text elements. The flow is generally as follows: 1. Make a configuration containing the stamp informa... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | test/test_error.py | BruceNL/pdf-stamp---1.0 |
import os
from .base import add_misc_options, add_cuda_options, adding_cuda, ArgumentParser, add_experiment_options
from .tools import save_args
from .dataset import add_dataset_options
from .model import add_model_options, parse_modelname
from .checkpoint import construct_checkpointname
def add_training_options(par... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | src/parser/training.py | GuyTevet/ACTOR |
__all__ = ['Map']
class Map(object):
'''Represents static elements in the game, such as walls, paths, taverns,
mines and spawn points.
Attributes:
size (int): the board size (in a single axis).
'''
def __init__(self, size):
'''Constructor.
Args:
s... | [
{
"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 | vindinium/models/map.py | renatopp/vindinium-python |
import torch
import torch.nn as nn
from math import sqrt
class VDSR(nn.Module):
def __init__(self):
super(VDSR, self).__init__()
self.layer = self.make_layer(18)
self.conv1 = nn.Conv2d(1, 64, kernel_size=3,stride=1, padding=1, bias=False)
self.conv2 = nn.Conv2d(64, 1, kernel_size=3,... | [
{
"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 | super_resolution/VDSR_PyTorch/model.py | kumayu0108/model-zoo |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# License: BSD-3 (https://tldrlegal.com/license/bsd-3-clause-license-(revised))
# Copyright (c) 2016-2021, Cabral, Juan; Luczywo, Nadia
# Copyright (c) 2022, QuatroPe
# All rights reserved.
# =============================================================================
# D... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/utils/test_bunch.py | leliel12/scikitcriteria |
import numpy as np
class Deriv:
"""
Calculate the derivative with given order of the function f(t) at point t.
"""
def __init__(self, f, dt, o=1):
"""
Initialize the differentiation solver.
Params:
- f the name of the function object ('def f(t):...')
... | [
{
"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 | pypv/lib/nummath/deriv.py | TomLXXVI/pypv |
import json
from vcx.api.connection import Connection
from utils import init_vcx, run_coroutine_in_new_loop
from connection import BaseConnection
class Inviter(BaseConnection):
async def start(self):
await init_vcx()
print("Create a connection to alice and print out the invite details")
c... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | vcx/wrappers/python3/aries-test-server/inviter.py | sklump/indy-sdk |
import time
import logging
logger = logging.getLogger(__name__)
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
name = kw.get('log_name', method.__name__.upper())
kw['log_time']... | [
{
"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 | height_map/timeit.py | jaluebbe/HeightMap |
class RPGinfo():
author = 'BigBoi'
def __init__(self,name):
self.title = name
def welcome(self):
print("Welcome to " + self.title)
@staticmethod
def info():
print("Made using my amazing powers and Raseberry Pi's awesome team")
@classmethod
def credits(c... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | rpginfo.py | haroldboi/OOP-Python-Adventure-Game |
import string
from flask import Blueprint
from flask import abort
from flask import redirect
from flask import render_template
from meerkat import utils
from meerkat.db import DataAccess
page = Blueprint('simple', __name__)
@page.route('/simple/')
def simple_index():
links = DataAccess.get_libs(... | [
{
"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 | meerkat/views/simple.py | by46/meerkat |
import threading, queue
import time
import random
import logging
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s',)
NUMBER_OF_THREADS = 4
TIMEOUT_SECONDS = 5
class SampleThread(threading.Thread):
def __init__(self, group=None, target=None, name=None, id=None, kwargs=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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | multithreading/multithreading_simple.py | guneykayim/python-examples |
#!/usr/bin/env python
# coding: utf-8
from werkzeug.routing import BaseConverter, ValidationError
from hseling_lib_diachrony_webvectors.strings_reader import language_dicts
"""
this module enables delicate control of the URL argument in requests
see this for details:
http://stackoverflow.com/questions/5870188/does-fl... | [
{
"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 | hseling_lib_diachrony_webvectors/hseling_lib_diachrony_webvectors/lang_converter.py | wadimiusz/hseling-repo-diachrony-webvectors |
from __future__ import absolute_import, print_function
__all__ = ('Annotation', 'Notification')
import warnings
class Annotation(object):
__slots__ = ['label', 'url', 'description']
def __init__(self, label, url=None, description=None):
self.label = label
self.url = url
self.descri... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/cobra/core/plugins/base/structs.py | lyoniionly/django-cobra |
from random import randint
from time import sleep
def sorteia(lista):
print("Sorteando 5 valores da lista: ", end="")
for cont in range(0, 5):
n = randint(1, 10)
lista.append(n)
print(f"{n} ", end="")
sleep(0.3)
print("PRONTO!")
def somaPar(lista):
soma = 0
for va... | [
{
"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 | PYTHON/ex100.py | george-git-dev/CursoemVideo |
import pytest
from feast import Feature, ValueType
from feast.errors import SpecifiedFeaturesNotPresentError
from tests.integration.feature_repos.universal.entities import customer, driver
from tests.integration.feature_repos.universal.feature_views import (
conv_rate_plus_100_feature_view,
create_conv_rate_re... | [
{
"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 | sdk/python/tests/integration/registration/test_universal_odfv_feature_inference.py | dmatrix/feast |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.