source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
Unittests for examples.
All examples are executed to check against latest code base.
"""
from __future__ import print_function, division
import unittest
import os
import imp
from helpers import filesInDirectory
# ----------------------------------------------------------------
# List of python files to test
# ---... | [
{
"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 | tellurium/tests/test_examples.py | ShaikAsifullah/distributed-tellurium |
import numpy as np
from pysao.eim.evolutionary_interpolation import EvolutionaryInterpolationModel
from pysao.metamodels.metamodel import Metamodel
class EIModel(Metamodel):
def __init__(self):
Metamodel.__init__(self)
self.model = None
def _predict(self, X):
return self.model.predic... | [
{
"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 | pysurrogate/archive/eim/meta_eim.py | julesy89/pysurrogate |
from maml_zoo.baselines.base import Baseline
import numpy as np
class ZeroBaseline(Baseline):
"""
Dummy baseline
"""
def __init__(self):
super(ZeroBaseline, self).__init__()
def get_param_values(self, **kwargs):
"""
Returns the parameter values of the baseline object
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | maml_zoo/baselines/zero_baseline.py | intel-isl/MetaLearningTradeoffs |
import functools
from tornado.routing import PathMatches
from core import PipelineDelegate
class MethodMatches(PathMatches):
"""Matches request path and maethod."""
def __init__(self, path_pattern, method: str):
super().__init__(path_pattern)
self.method = method.upper()
def match(self,... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | routing.py | kingfozhou/tornado-middleware |
from .functions import open_uri_with_browser
from .image_processing import get_colored_image_base64_by_region
from .settings import get_setting
from .shared import global_get
from .types import ImageDict
import sublime
POPUP_TEMPLATE = """
<body id="open-uri-popup">
<style>
img {{
width: {w}{si... | [
{
"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 | plugin/popup.py | jfcherng/Sublime-OpenUriInBrowser |
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from pagarme import sdk
def headers():
_headers = {
'User-Agent': 'pagarme-python/{}'.format(sdk.VERSION),
'X-PagarMe-User-Agent': 'pagarme-python/{}'.format(sdk.VERSION)
}
retu... | [
{
"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 | pagarme/resources/requests_retry.py | pythonprobr/pagarme-python |
"""For entities that have a parameter template."""
from gemd.entity.link_by_uid import LinkByUID
from gemd.entity.setters import validate_list
from gemd.entity.template.base_template import BaseTemplate
from gemd.entity.template.parameter_template import ParameterTemplate
class HasParameterTemplates(object):
"""
... | [
{
"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 | gemd/entity/template/has_parameter_templates.py | lkubie/gemd-python |
import os
import imageio
import numpy as np
from PIL import Image
from torch.autograd import Variable
from torchvision.utils import save_image
def create_gif(image_path):
frames = []
gif_name = os.path.join("images", 'mnist1.gif')
image_list = os.listdir(image_path)
sorted(image_list)
for image... | [
{
"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 | cgan/utils.py | GodWriter/GAN-Pytorch |
from logbunker.contexts.bunker.logs.domain.LogRepository import LogRepository
from logbunker.contexts.bunker.logs.domain.entities.Log import Log
from logbunker.contexts.bunker.logs.domain.entities.LogContent import LogContent
from logbunker.contexts.bunker.logs.domain.entities.LogCreationDate import LogCreationDate
fro... | [
{
"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 | logbunker/contexts/bunker/logs/application/createone/LogCreator.py | parada3desu/logbunker |
import pandas as pd
from opinion import config, utils
def transform_url(df):
df['media_source'] = df['media_source'].apply(
lambda x: x.replace('https', 'http')
)
return df
def process_url(url):
try:
domain, path = utils.parse_url(url)
return domain
except ValueError as ... | [
{
"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 | src/0_test_corpus/01_match_media_ids.py | benlevyx/opinion-vs-fact |
import csv
import sys
def orderEdges(fileName):
dynamic_dependencies_file = open(fileName)
csv_reader = csv.reader(dynamic_dependencies_file)
list_of_edges = []
for row in csv_reader:
list_of_edges.append(row[0].split())
sortedList = insertionSort(list_of_edges)
return sortedList
def w... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | mono2micro/ebc-application/ebc-data_dependencies/dynamic_dependencies/order_dependencies.py | jahn18/Normalized-TurboMQ |
#! /usr/bin/env python3
"""
Bishbot - https://github.com/ldgregory/bishbot
Leif Gregory <leif@devtek.org>
space.py v0.1
Tested to Python v3.7.3
Description:
Bot commands for the Space channel
Changelog:
20200603 - Initial code
Copyright 2020 Leif Gregory
Licensed under the Apache License, Version 2.0 (the "Licens... | [
{
"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 | cogs/space.py | ldgregory/bishbot |
from re import search
from base64 import b64decode
from email.message import Message
class mimetest:
def __init__(self, mime):
self.mime = mime
assert not mime.defects
def __getitem__(self, header):
return self.mime[header]
@property
def transfer_encoding(self):
retur... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/mimetest.py | seantis/mailthon |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Add finished/verified dates to cycle tasks
Revision ID: 13e52f6a9deb
Revises... | [
{
"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 | src/ggrc_workflows/migrations/versions/20160104135243_13e52f6a9deb_add_finished_verified_dates_to_cycle_.py | Smotko/ggrc-core |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_column07.py | dthadi3/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 u... | [
{
"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 | aliyun-python-sdk-unimkt/aliyunsdkunimkt/request/v20181207/GetConsoleInfoRequest.py | liumihust/aliyun-openapi-python-sdk |
import heapq
import rx
class PriorityQueue(object):
"""Priority queue for scheduling"""
def __init__(self, capacity=None):
self.items = []
self.count = 0 # Monotonic increasing for sort stability
self.lock = rx.config.get("Lock")()
def __len__(self):
"""Returns length ... | [
{
"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 | addons/Sprytile-6b68d00/rx/internal/priorityqueue.py | trisadmeslek/V-Sekai-Blender-tools |
""" Helper functions to get information about the environment.
"""
import importlib.util
import os as python_os
import subprocess
import sys as python_sys
from typing import Any, Optional
from homura.liblog import get_logger
logger = get_logger("homura.environment")
# Utility functions that useful libraries are av... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | homura/utils/environment.py | Xiangyu-Han/homura |
import pytest
from portfolio_rebalance.skeleton import fib, main
__author__ = "David Simmons"
__copyright__ = "David Simmons"
__license__ = "MIT"
def test_fib():
"""API Tests"""
assert fib(1) == 1
assert fib(2) == 1
assert fib(7) == 13
with pytest.raises(AssertionError):
fib(-10)
def t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_skeleton.py | desimmons/portfolio_rebalance |
"""Provides functionality for ranking Records and their differences."""
from .db import sesh
from .record import Record, RA
from .difference import Diff, difference
from .filter import filter_
from .exceptions import FilterMetricError
def rank(date, metric, usernames=None, record_filters=None):
"""Rank the Record... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insi... | 3 | rwrtrack/rank.py | david-wm-sanders/rwrtrack |
"""
OpenAI Gym environments with predicted state vector of specified VisionToState model (data_id, model_name) as state
@Author: Steffen Bleher
"""
from gym import spaces
from gym_brt.data.config.configuration import FREQUENCY
import numpy as np
from gym_brt.envs.reinforcementlearning_extensions.vision_wrapping_clas... | [
{
"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 | package/statetoinput/state_estimator_wrapper.py | Data-Science-in-Mechanical-Engineering/furuta-pixel-to-torque-control |
from AbstractObject import *
class EOFObject(AbstractObject):
def __init__(self, value):
super(EOFObject, self).__init__(value)
def generate(self, out_code): pass
| [
{
"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 | src/fecc_object/EOFObject.py | castor91/fecc |
from . import lexer
from .parseRoll import parser
def roll(expression : str):
"Runs the dice expression provided and returns long form result"
try:
tree = parser.parse(expression)
result, hist = tree.roll()
except Exception as E:
return str(E)
return result, hist, tree
... | [
{
"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 | rgr/__init__.py | Faxn/rgr |
'''
Camera Example
==============
This example demonstrates a simple use of the camera. It shows a window with
a buttoned labelled 'play' to turn the camera on and off. Note that
not finding a camera, perhaps because gstreamer is not installed, will
throw an exception during the kv language processing.
'''
# Uncomme... | [
{
"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 | examples/camera/main.py | RiiotLabs/kivy |
from passgen import args
def test_num_words():
mock_argv = ['passgen', '-n', '22']
options = args.get_cli_options(mock_argv)
assert 22 == options.num_words
mock_argv = ['passgen', '--num-words', '33']
options = args.get_cli_options(mock_argv)
assert 33 == options.num_words
mock_argv = ['pa... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_args.py | rauljim/passgen |
import unittest
from programy.utils.logging.ylogger import YLoggerSnapshot
class YLoggerSnapshotTests(unittest.TestCase):
def test_snapshot_with_defaults(self):
snapshot = YLoggerSnapshot()
self.assertIsNotNone(snapshot)
self.assertEquals("Critical(0) Fatal(0) Error(0) Exception(0) Warn... | [
{
"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 | test/programytest/utils/logging/test_snapshot.py | cdoebler1/AIML2 |
def decorate(func):
def decorated():
print("==" * 20)
print("before")
func()
print("after")
return decorated
@decorate
def target():
print("target 함수")
target()
## output
"""
========================================
before
target 함수
after
"""
def target2():
print(... | [
{
"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 | decorator_example/deco1.py | wapj/pyconkr2019 |
""" Core mail sender"""
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
class SendMail:
""" Send email to user """
def __init__(self, template_name, context, to, subject="Awesome Blog API", request=None):
self.template_name = template_name
self.co... | [
{
"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 | authors/apps/core/email.py | Tittoh/blog-API |
# Created by DraX on 2005.08.08
import sys
from ru.catssoftware.gameserver.model.quest import State
from ru.catssoftware.gameserver.model.quest import QuestState
from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest
qn = "30031_biotin_occupation_change"
HIGH_PRIEST_BIOTIN = 300... | [
{
"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 | game/data/scripts/village_master/30031_biotin_occupation_change/__init__.py | TheDemonLife/Lineage2Server-Interlude |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.2
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_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 | kubernetes/test/test_v1_cluster_role_binding.py | sgwilliams-ebsco/python |
import Inline
import Core
import web
info = {
"friendly_name": "Attachment",
"example_template": "pagename:attachmentname",
"summary": "Links to an attachment of this (or another, named) page.",
"details": """
<p>If invoked as [attachment some.filename], it will either embed (if
the attachment... | [
{
"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 | lib/rabbitmq-dotnet-client-rabbitmq_v3_4_4/docs/pyle2-fcfcf7e/spanhandlers/attachment.py | CymaticLabs/Unity3d.Amqp |
#!/usr/bin/env python3
import sys
sys.path.insert(0, "../lib-ext")
sys.path.insert(0, "..")
import unittest
from omron_2jcie_bu01 import Omron2JCIE_BU01
class BLENotificationTestCase(unittest.TestCase):
ADDRESS = None
@classmethod
def setUpClass(cls):
sensor = Omron2JCIE_BU01.ble()
cls.AD... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | test/test_notify.py | nobrin/omron-2jcie-bu01 |
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from src.build_model import convert, predict
app = FastAPI()
# pydantic models
class StockIn(BaseModel):
ticker: str
class StockOut(StockIn):
forecast: dict
# routes
@app.get("/ping")
async def pong():
return {"ping": "pon... | [
{
"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 | main.py | benayas1/FastAPI-demo |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer (serializers.Serializer):
"""Serializes a name field for testing our APIView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Serializes a user profile ... | [
{
"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 | profiles_api/serializers.py | danisuram/profiles-rest-api |
"""
Sprawdz czy istnieje permutacja danego slowa bedaca palindromem.
"""
# Wersja 1
def znajdz_permutacje(napis, start, koniec, wynik=[]):
if start >= koniec:
if "".join(napis) not in wynik:
wynik.append("".join(napis))
else:
for i in range(start, koniec):
napis[start... | [
{
"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 | src/Python/12_Napisy_anagramy_palindromy/Zad6.py | djeada/Nauka-programowania |
#author: Christoffer Norell
#contact: christoffernorell@yahoo.se
#This is a simple simulator of a deck of cards I made for fun.
#The values in the dictionaries are there for better comparison during games.
import random
#Using dictionaries to represent values.
#The color-values was taken from bridge-order:
#http://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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | DeckOfCards.py | crippe-90/DeckOfCards |
from typing import Union, Optional
from slack_sdk.models import JsonObject
class SocketModeResponse:
envelope_id: str
payload: dict
def __init__(
self, envelope_id: str, payload: Optional[Union[dict, JsonObject, str]] = None
):
self.envelope_id = envelope_id
if payload is No... | [
{
"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 | slack_sdk/socket_mode/response.py | priya1puresoftware/python-slack-sdk |
from topaz.astcompiler import SymbolTable
from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
class W_BindingObject(W_Object):
classdef = ClassDef("Binding", W_Object.classdef)
_immutable_fields_ = ["names[*]", "cells[*]", "w_self", "lexical_scope"]
def __init__(self, space,... | [
{
"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 | topaz/objects/bindingobject.py | ruby-compiler-survey/topaz |
import django
from django import template
from django_countries.fields import Country, countries
register = template.Library()
simple_tag = register.simple_tag
@simple_tag
def get_country(code):
return Country(code=code)
@simple_tag
def get_countries():
return list(countries)
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | django_countries/templatetags/countries.py | domdinicola/django-countries |
from flask import Blueprint, render_template, redirect, request
from flask_login import current_user
from app.models import EditableHTML
from app.main.forms import HabitForm
from app.models import Habit
from app import db, csrf
main = Blueprint('main', __name__)
@main.route('/')
def index():
if current_user.i... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | app/main/views.py | melissa-gu/habit_tracker |
import random
from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.plugins.module_utils.cloud import _exponential_backoff, \
_full_jitter_backoff
class ExponentialBackoffStrategyTestCase(unittest.TestCase):
def test_no_retries(self):
... | [
{
"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 | exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/tests/unit/module_utils/cloud/test_backoff.py | tr3ck3r/linklight |
from opencage.geocoder import _query_for_reverse_geocoding
def _expected_output(input_latlng, expected_output): # pylint: disable=no-self-argument
def test():
lat, lng = input_latlng
assert _query_for_reverse_geocoding(lat, lng) == expected_output
return test
def test_reverse():
_expected_... | [
{
"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 | test/test_reverse.py | mtmail/python-opencage-geocoder |
#!/usr/bin/env python
from golbase import GameOfLifeBase, Cell
import random
import time
import logging
class GameOfLifeBlockSwitch(GameOfLifeBase):
def __init__(self, *args, **kwargs):
super(GameOfLifeBlockSwitch, self).__init__(*args, **kwargs)
self.toroidal = True
def run(self):
... | [
{
"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": false... | 3 | pubsub/animation/gol-block-switch.py | yanigisawa/coffee-scale |
from django.contrib.auth import user_logged_out
from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views
from .common import create_user
class TokenDestroyViewTest(restframework.APIViewTestCase,
assertions.... | [
{
"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 | testproject/testapp/tests/test_token_destroy.py | mark-slepkov/djoser |
def valid_pubsub(config):
if (config.get("topic_id") is not None and config.get("project_id") is not None
and config.get("subscription_id") is not None):
return True
return False
def valid_kafka(config):
if config.get("bootstrap_server") is not None and config.get("port") is not None:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | unified_api/utils/utils.py | campos537/deep-fashion-system |
#!/bin/env python
"""
Simple VTK example in Python to load an STL mesh and display with a manipulator.
Chris Hodapp, 2014-01-28, (c) 2014
"""
import vtk
def render():
# Create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# Create a... | [
{
"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 | VTKviewer.py | Benjamin-Fouquet/Processing-scripts |
import json
config = 'config.json'
with open(config, 'r') as f:
data = json.load(f)
default = data["default"]
class AbstractCommand():
def __init__(self, handler = [], description = None):
self.handler = handler
self.description = description
def hdl(self):
return self.ha... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | classes/abstract_command.py | platofff/quote-bot |
from django.db import models
from django.forms import ModelForm
from django.contrib.auth import get_user_model
# Create your models here.
# Get the user model
User = get_user_model()
class BillingAddress(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
address = models.CharField(max_length=1... | [
{
"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 | ecommerce/checkout/models.py | starboi02/e-commerce-CMS |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/DescribeScalingActivityRequest.py | sdk-team/aliyun-openapi-python-sdk |
import asyncio
import discord
from discord.ext.commands import Bot
from discord.ext import commands
from discord import Color, Embed
import backend.commands as db
from backend import strikechannel
# This command allows players to change their name.
#
# !name [new_name]
#
# This replaces the default nickname changin... | [
{
"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 | commands/name.py | DaleNaci/AUC |
from tweetengine import model
from google.appengine.api import users
def setConfiguration():
account_name='tweet_engine'
password='passwd'
oauth_key='fookey'
oauth_secret='foosecret'
conf = model.Configuration.instance()
conf.oauth_key = oauth_key
conf.oauth_secret = oauth_secret
con... | [
{
"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 | src/tweetengine/utils.py | Arachnid/tweetengine |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.220
Contact: customer_support@bmc.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import con... | [
{
"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 | test/test_agent_in_hostgroup.py | dcompane/controlm_py |
"""The tests for the rss_feed_api component."""
from defusedxml import ElementTree
import pytest
from openpeerpower.const import HTTP_NOT_FOUND
from openpeerpower.setup import async_setup_component
@pytest.fixture
def mock_http_client(loop, opp, opp_client):
"""Set up test fixture."""
config = {
"rss... | [
{
"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 | tests/components/rss_feed_template/test_init.py | pcaston/core |
import collections
import random
from typing import Counter
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def parse_data(list_content):
lists_data = []
list_collections: Counter = collections.Counter(list_content)
top_lists = list_collections.most_common(10)
... | [
{
"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 | Packs/IntegrationsAndIncidentsHealthCheck/Scripts/IntegrationsCheck_Widget_IntegrationsCategory/IntegrationsCheck_Widget_IntegrationsCategory.py | diCagri/content |
"""
链家二手房数据抓取
"""
import requests
from lxml import etree
import time
import random
from fake_useragent import UserAgent
import pymongo
class LianJiaSpider:
def __init__(self):
self.url = 'https://lf.lianjia.com/ershoufang/pg{}/'
# 3个对象
self.conn = pymongo.MongoClient('localhos... | [
{
"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 | month05/spider/day04_course/day04_code/01_lianjiaSpider.py | chaofan-zheng/tedu-python-demo |
class DigitalSignatureScheme(object):
def get_public_key(self):
return self.public_key
def sign(self, messsage):
raise NotImplementedError
def verify(self, message, signature):
raise NotImplementedError
| [
{
"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 | common/signature/__init__.py | lukius/mts |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"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 | openstack/tests/unit/clustering/v1/test_profile_type.py | NeCTAR-RC/openstacksdk |
import section
import pytest
# 作成
class Test_2つの整数を引数に閉区間オブジェクトをつくる:
def test_3から8の閉区間を作れる(self):
x=section.Section(3,8)
assert x.lower==3 and x.upper==8
def test_3から8の閉区間を作れる(self):
x=section.Section(3,3)
assert x.lower==3 and x.upper==3
# 作成(例外処理)
class Test_整数以外では閉区間オブジェクトをつ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | section_test.py | y-k-k/python_pytest |
# -*- coding: utf-8 -*-
__author__ = 'huangpeng'
class AGList(list):
def each(self, func):
for a in self:
func(a)
return self
def map(self, func):
return map(func, self)
def filter(self, func):
return filter(func, self)
class AGDict(dict):
def each(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 | containers.py | hpsoar/pplib |
# -*- coding: utf-8 -*-
class Storage(object):
def set(self, key, value, time=0):# pragma: no cover
raise NotImplementedError()
def get(self, key, default=None):# pragma: no cover
raise NotImplementedError()
def delete(self, key):# pragma: no cover
raise NotImplementedError()
cla... | [
{
"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 | iktomi/storage.py | boltnev/iktomi |
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello world!')
class CountHandler(webapp2.RequestHandler):
def get(self):
for i in range(1, 21):
self.response.write('Hello %d <br>' % i)
app = webapp2.WSGIApplication([
('/', MainHan... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | src/example02/main.py | luisibanez/cssi-appengine-introduction-01 |
import re
from typing import List
class StringProcessService:
def __init__(self):
self._charmap = {
0x201c: u'"',
0x201d: u'"',
0x2018: u"'",
0x2019: u"'",
'ff': u'ff',
'fi': u'fi',
'fl': u'fl',
'ffi': u'ffi',
... | [
{
"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 | services/string_process_service.py | ktodorov/historical-ocr |
import unittest
from backend.services.messaging.template_service import (
template_var_replacing,
get_template,
clean_html,
format_username_link,
)
from flask import current_app
class TestTemplateService(unittest.TestCase):
def test_variable_replacing(self):
# Act
content = get_te... | [
{
"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 | tests/backend/unit/services/messaging/test_template_service.py | d-rita/tasking-manager |
# -*- coding: utf-8 -*-
"""API Request cache tests."""
#
# (C) Pywikibot team, 2012-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 790cd19ca8b22937365bf24b6e40ed90c79ee12b $'
#
from pywikibot.site import BaseSite
import scripts.maintenance.cache... | [
{
"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": true
},... | 3 | tests/cache_tests.py | valhallasw/pywikibot-core |
# 279. Perfect Squares
# https://leetcode.com/problems/perfect-squares
import unittest
class Solution(object):
def numSquares(self, n):
if n < 2:
return n
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
queue, depth = {n}, 1
while queue:
next_nodes =... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | problems/perfect_square.py | smartdolphin/recommandation-tutorial |
#!/usr/bin/env python
# *****************************************************************************
# Copyright (C) 2022 Thomas Touhey <thomas@touhey.fr>
#
# This software is licensed as described in the file LICENSE, which you
# should have received as part of this distribution.
#
# THE SOFTWARE IS PROVIDED “AS 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": tru... | 3 | visyerres_sgdf_woob/modules/ressourcessgdf/module.py | cakeisalie5/visyerres_sgdf_woob |
class LeaderboardData:
"""This is the Custom Hypixel API Leaderboard Data Model."""
def __init__(self, data: dict) -> None:
"""
Parameters
----------
data: dict
The Leaderboard JSON data per game response received from the Hypixel API.
"""
self.PATH =... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | hypixelio/models/leaderboard/leaderboard_data.py | FoxNerdSaysMoo/HypixelIO |
from RPG.bot_classes.base_handler import BaseHandler
from RPG.consts.game_states import PLAYER_PROFILE
class PlayerProfile(BaseHandler):
def __init__(self, game):
super().__init__(game, PLAYER_PROFILE)
self.reply_keyboard.row('⬅Atrás')
def show(self, message):
self.game.bot.send_messa... | [
{
"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 | RPG/bot_classes/main_menu/player_profile.py | JuanShotLC/Negative_Space_Bot |
import torch
import torch.distributions as td
class GMM2D(td.MixtureSameFamily):
def __init__(self, mixture_distribution, component_distribution):
super(GMM2D, self).__init__(mixture_distribution, component_distribution)
def mode_mode(self):
mode_k = torch.argmax(self.mixture_distribution.pro... | [
{
"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 | mats/model/components/gmm2d.py | StanfordASL/MATS |
"""
This module contains the tests for the configurations
"""
# standard imports
import unittest
from app import create_app
class TestDevelopmentConfig(unittest.TestCase):
""" Test class for development config """
def setUp(self):
"""Initialize app"""
self.app = create_app('development')
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | app/tests/test_config.py | erick-maina/Questioner_API |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | deeppavlov/__init__.py | techthiyanes/DeepPavlov |
from django.shortcuts import render
from .models import Photos,Category,Location
from django.http import HttpResponse, Http404
# Create your views here.
def home(request):
photos = Photos.objects.all()
return render(request,'index.html',{"photos":photos})
def search_photo(request):
if 'category' in reques... | [
{
"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 | my_gallery/views.py | Abdihakim-Muhumed/gallery |
# Copyright 2014, Dell
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
{
"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": false
},
{... | 3 | core/clients/python/api_bindings/cb2_api/objects/group.py | aledbf/digitalrebar |
def hello():
return get_greeting()
def get_greeting():
return "Hola Mundo en el curso de Python" | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | section-22-unittesting/02_mock_basic/mock_example.py | mugan86/bootcamp-basic-to-expert-from-scratch |
import unittest.mock
from programy.parser.pattern.nodes.base import MultiValueDict
class MultiValueDictTests(unittest.TestCase):
def test_add_remove(self):
multidict = MultiValueDict()
multidict["name"] = "value1"
multidict["name"].append("value2")
self.assertTrue("name" in mult... | [
{
"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 | test/programytest/parser/pattern/nodes_tests/test_multidict.py | cdoebler1/AIML2 |
#!/usr/bin/python2.5
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
{
"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 | base/mapreducer.py | elsigh/browserscope |
import re
### parse_text(text)
# takes a string, return a list of strings with the matching groups
def parse_text_regex(text, regex):
try:
compiled_regex = re.compile(regex)
if compiled_regex is None:
raise Exception(f"String {text} doesn't match {regex}")
except TypeError as te:
... | [
{
"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 | TPS_dice_roller_bot/core/parse.py | PumaConcolor/TPS-dice-roller-bot |
from setuptools import Extension
from .enums import ExtType
class GenericGDNativeLibrary(Extension):
def __init__(self, name, **gdnative_options):
self._gdnative_type = ExtType.GENERIC_LIBRARY
self._gdnative_options = gdnative_options
super().__init__(name, sources=[])
class GDNativeLib... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | godot_tools/setup/libraries.py | WilliamTambellini/godopy |
"""
Generate a `load_data` function to use in a data migration.
Usage:
from django.db import models, migrations
from utils.load_data import load_data
class Migration(migrations.Migration):
dependencies = [ ] # dependencies
operations = [
migrations.RunPython(load_data('path/to/fixtures1.json')),
... | [
{
"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 | django/sierra/utils/load_data.py | Miamiohlibs/catalog-api |
"""Utilities module."""
import base64
import hashlib
import json
import os
import traceback
from copy import copy
from datetime import datetime
from functools import wraps
from itertools import chain
from typing import Callable, List, Optional
from ratelimit import sleep_and_retry, limits
from pacu.settings import 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": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | pacu/utils.py | RyanJarv/Pacu2 |
import json
class Json:
def encode(self, request):
return json.dumps(request.body)
def decode(self, data):
return json.loads(data)
def content_type(self):
return "application/json"
| [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | paypalhttp/serializers/json_serializer.py | cameronmoten/paypalhttp_python |
# Quicksort algorithm by taking last element as pivot
def partitionIndex(arr, l, r):
i = l - 1
pivot = arr[r]
for j in range(l, r):
if arr[j] <= pivot:
i += 1
arr[j], arr[i] = arr[i], arr[j]
arr[i+1], arr[r] = arr[r], arr[i+1]
return (i+1)
def quicks... | [
{
"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 | Code/sorting_algorithms/quick_sort/quick_sort.py | Kevinjadia/Hacktoberfest_DSA_2021 |
import sys
import os
import argparse
import subprocess
class CommandLineParser:
def __init__(self):
self.term_width = 100
self.formater = lambda prog: argparse.HelpFormatter(prog, max_help_position=int(self.term_width / 2), width=self.term_width)
self.commands = {}
self.hidden_comm... | [
{
"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 | crossbuild/crossbuildmain.py | smohantty/tbuild |
'''
Created by auto_sdk on 2015.06.10
'''
from top.api.base import RestApi
class BaichuanOrderurlGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.name = None
def getapiname(self):
return 'taobao.baichuan.orderurl.get'
| [
{
"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 | taobao_wechat_bot/top/api/rest/BaichuanOrderurlGetRequest.py | zyphs21/myPythonPractise |
from django.test import TestCase
from datetime import datetime, timedelta
from django.utils.dateparse import parse_date
from blog.models import Article
from blog.tools import *
# Create your tests here.
class ArticleTests(TestCase):
def test_future_article_will_be_public(self):
p = Article(title='test', content='... | [
{
"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 | blog/tests.py | LeonardA-L/plog |
import re
import json
import importlib
import logging
logger = logging.getLogger(__name__)
class PythonValueInvalid(Exception):
pass
class PythonParser(object):
variable_pattern = r'^\@\{?([\_a-zA-Z0-9][\_\-\.a-zA-Z0-9]+)\}?$'
variable_value_pattern = r'(?<!\@)\@\>?\{?([\_a-zA-Z0-9][\_\-\.a-zA-Z0-9]+... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | app/utility/python.py | criticallycode/zima |
#
# yjDateTime.py, 200506
#
from ctypes import *
from modules.windows_jumplist.lib import Filetimes
import datetime
def filetime_to_datetime(filetime, inchour = 0):
''' v = filetime_to_datetime(ft, 9).isoformat() '''
if __debug__: assert type(filetime) is int
try:
return Filetimes.filetime_to_dt(filetime) + ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | modules/windows_jumplist/lib/yjDateTime.py | naaya17/carpe |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
"""Parent ship class for Blast."""
def __init__(self, blast_settings, screen):
"""Init ship and starting position."""
super(Ship, self).__init__()
self.screen = screen
self.blast_settings = blast_setting... | [
{
"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": true
},... | 3 | src/ship.py | tomice/Blast |
# coding: utf-8
"""
iEngage 2.0 API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagge... | [
{
"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 | test/test_verve_response_comment_list.py | iEngage/python-sdk |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from ripozo.exceptions import RestException
class MissingModelException(RestException):
"""
Raised when a a model_name on a model
class does not exist in th... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | rest_builder/exceptions.py | timmartin19/browser-REST-builder |
# import the necessary packages
from __future__ import absolute_import
import numpy as np
import cv2
from ..convenience import is_cv2
class RootSIFT:
def __init__(self):
# initialize the SIFT feature extractor for OpenCV 2.4
if is_cv2():
self.extractor = cv2.DescriptorExtractor_create("SIFT")
# ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | libs/imutils/feature/rootsift.py | rocketbot-cl/recognition |
#!/usr/bin/python
# encoding=utf-8
""" 只能管理员编辑,只对外提供fixture。
"""
import os
import time
import pytest
# 项目目录路径
_project_dir = os.path.dirname(os.path.abspath(__file__))
# 设置缓存供tep使用
@pytest.fixture(scope="session", autouse=True)
def _project_cache(request):
request.config.cache.set("project_dir", _project_dir)... | [
{
"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 | conftest.py | dongfanger/httpbin |
import pytest
import logging
from traitlets.config.loader import PyFileConfigLoader
from traitlets import TraitError
from jupyter_telemetry.eventlog import EventLog
GOOD_CONFIG = """
import logging
c.EventLog.handlers = [
logging.StreamHandler()
]
"""
BAD_CONFIG = """
import logging
c.EventLog.handlers = [
... | [
{
"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 | tests/test_eventlog.py | blink1073/telemetry |
from . import extension
from torchaudio._internal import module_utils as _mod_utils
from torchaudio import (
compliance,
datasets,
kaldi_io,
utils,
sox_effects,
transforms
)
from torchaudio.backend import (
list_audio_backends,
get_audio_backend,
set_audio_backend,
save_encinfo,
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | torchaudio/__init__.py | mmxgn/audio |
"""empty message
Revision ID: 0059 add show_banner_text
Revises: 0058 set all has_banner_text
Create Date: 2021-10-04 00:10:14.535185
"""
# revision identifiers, used by Alembic.
revision = '0059 add show_banner_text'
down_revision = '0058 set all has_banner_text'
from alembic import op
import sqlalchemy as sa
de... | [
{
"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 | migrations/versions/0059.py | NewAcropolis/api |
import os
import shutil
from openeo.file import File
class RESTFile(File):
"""Represents a file of openeo."""
def download_file(self, target):
"""
Downloads a user file to the back end.
:param target: local path, where the file should be saved.
:return: status: Response stat... | [
{
"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": tru... | 3 | openeo/rest/rest_file.py | clausmichele/openeo-python-client |
# import Flask and pymongo
from flask import Flask, render_template
from flask_pymongo import PyMongo
# import scrape_mars.py
import scrape_mars
# Create an app, being sure to pass __name__
app = Flask(__name__)
# Create connection variable to load in
mongo = PyMongo(app, uri="mongodb://localhost:27017/mars_info"... | [
{
"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 | app.py | obfrap/web-scraping-challenge |
import typing as t
import ssl
from motor.motor_asyncio import AsyncIOMotorClient
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from backend.constants import DATABASE_URL, DOCS_PASSWORD, MONGO_DATABASE
class Data... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | backend/middleware.py | MrGrote/forms-backend |
import asyncio
async def upper_cased(value: str) -> str:
await asyncio.sleep(1)
return value.upper()
coroutines = [
upper_cased("h"),
upper_cased("e"),
upper_cased("l"),
upper_cased("l"),
upper_cased("o"),
upper_cased(" "),
upper_cased("w"),
upper_cased("o"),
upper_cased("r... | [
{
"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 | python/concurrency/async_hello.py | cbare/Etudes |
from svs.models import Customer
from django.db import models
from django.utils import timezone
from svs.models import Customer, Machine
from core.models import CoreUser
from markdownx.models import MarkdownxField
STATUSES = (
("pending_our", "Pending - Our Side"),
("pending_their", "Pending - Their Side"),
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": tr... | 3 | issues/models.py | mariofix/svsagro |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.