source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
from hearthstone.entities import Entity
from entity.spell_entity import SpellEntity
class LETL_653(SpellEntity):
"""
法力魔棒4
奥术箭额外获得<b>+4奥术伤害</b>,但具有+1冷却。
"""
def __init__(self, entity: Entity):
super().__init__(entity)
def equip(self, hero):
pa... | [
{
"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 | entity/cards/LETL_005H/LETL_653.py | x014/lushi_script |
import file_io
def check_bool(val):
if val == 'true' or val == "True":
val = True
if val == 'false' or val == "False":
val = False
return val
def check_digit(val):
if val.replace(".","").isdigit():
val = float(val)
if val.is_integer():
val = int(val)
ret... | [
{
"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 | utility/read_proto.py | polltooh/TensorflowFramework |
# Copyright 2013 IBM Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
{
"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 | tempest/services/compute/json/instance_usage_audit_log_client.py | afaheem88/tempest_neutron |
import argparse
from . import __version__
from .parser import Package
def get_options():
"""
Faz o parsing dos argumentos recebidos pela linha de comando.
Docs: https://docs.python.org/3.9/library/argparse.html
Tutorial: https://docs.python.org/3.9/howto/argparse.html
"""
parser = argparse.A... | [
{
"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 | 01_versoes_pacotes_pip/async_api_calls/version_checker/main.py | fernandosavio/hackatombo |
#!/usr/bin/env python3
"""
1. 实现微信消息的抓取
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/11
:version 1.0
"""
import itchat,time
import queue
import _thread
XIAOBING_ID = 'xiaoice-ms'
msgQueue = queue.Queue(maxsize=100)
@itchat.msg_register(itchat.conte... | [
{
"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 | python/src/weichat/test/catch_message.py | weiwei02/Technical--Documentation |
from pandas.core.series import Series
from .config import sample_data
from .context import pandas_ta
from unittest import TestCase
from pandas import DataFrame
class TestCylesExtension(TestCase):
@classmethod
def setUpClass(cls):
cls.data = sample_data
@classmethod
def tearDownClass(cls):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | tests/test_ext_indicator_cycles.py | ryanrussell/pandas-ta |
#!/usr/bin/env python3
"""
Author : mahmoudabdelrahman <mahmoudabdelrahman@localhost>
Date : 2022-01-28
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | 03_picnic/picnic.py | mahmoudabderahman/tiny_python_projects |
from time import time
from requests import get
from qaviton_io.async_manager import AsyncManager
from tests.utils import server
def test_simple_requests():
def execute_tasks(number_of_tasks: int):
errors = {}
rs = []
def task():
try:
with server() as (host, por... | [
{
"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 | tests/test_async_manager.py | yehonadav/qaviton_io |
"""
package = {"streamName": streamName, "streamTable": streamTable
, "edgeName": sysutils.hostName(), "modbusAddress": busAdr
, "dtsUTC": datetime.datetime.utcnow().strftime(dtsFormats.std)
, "readings": readings}
"""
from typing import List
from datetime import datetime
from core.sys impo... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | shared/utils/jsonPackageMaker.py | iotech-systems/sbmslib |
class Vessel:
def __init__(self, name: str):
"""
Initializing class instance with vessel name
:param name:
"""
self.name = name
self.fuel = 0.0
# list of dicts with passenger attributes
self.passengers = []
def __enter__(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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | context_managers.py | Stihotvor/python3_magic_method_examples |
from lxml.etree import fromstring, tostring
from lxml import builder
from openpack.basepack import ooxml_namespaces
docx_namespaces = {
'w': "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
've': 'http://schemas.ope... | [
{
"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 | paradocx/util.py | yougov/paradocx |
from .e212_names import operators, countries
from .errors import InvalidNetwork, InvalidCountry
def network(mcc, mnc):
'''
Returns a tuple (country, network_name), with country specified as
ISO-3166-1 alpha-2 code.
'''
mcc = int(mcc)
mnc = int(mnc)
try:
return operators[mcc][mnc]
... | [
{
"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 | phone_iso3166/network.py | foxkirov/phone-iso3166 |
'''
Utility functions to deal with Faker data
'''
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
import os
import yaml
HERE = os.path.abspath(os.path.dirname(__file__))
FAKER_DATA_DIR = os.path.join(HERE, 'faker-data')
def get_faker_data(basename: str, search_path: str = None):
f'''
Ret... | [
{
"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 | tracking_load_faker/_utils.py | diogenes1oliveira/tracking-load-faker |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
# superclass
from .Numeric import Numeric
# declaration
class Integer(Numeric):
"""
A type declarator for integers
"""
# constants
typename = 'int' # the name of my type
complaint = 'could n... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | packages/pyre/schemata/Integer.py | lijun99/pyre |
#!/usr/bin/env python2
# Logger utilities
import math, sys, os, time, struct, traceback, binascii, logging
import datetime as dt
class MyFormatter(logging.Formatter):
#Overriding formatter for datetime
converter=dt.datetime.utcfromtimestamp
def formatTime(self, record, datefmt=None):
ct = self.co... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | mgs/v1.2/logger.py | vt-rocksat-2017/dashboard |
"""
Asyncio using Asyncio.Task to execute three math function in parallel
"""
import asyncio
@asyncio.coroutine
def factorial(number):
f = 1
for i in range(2, number+1):
print("Asyncio.Task: Compute factorial(%s)" % (i))
yield from asyncio.sleep(1)
f *= i
print("Asyncio.Task - facto... | [
{
"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 | Chapter 4/asyncio_Task.py | jsdnhk/python-parallel-programming-cookbook-code |
import deal
import pytest
def test_silent_contract_not_allow_print():
@deal.silent
def func(msg):
if msg:
print(msg)
func(None)
with pytest.raises(deal.SilentContractError):
func('bad')
| [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | tests/test_silent.py | vishalsodani/deal |
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answe... | 3 | compss/programming_model/bindings/python/src/pycompss/api/dummy/mpi.py | ramonamela/compss |
from flask import Blueprint, request, session, render_template
from models.user import requires_login
user_blueprint = Blueprint('users', __name__)
@user_blueprint.route('/login')
def login_user():
is_logged_in = False if not session.get('email') else True
return render_template("users/login.html", is_logged... | [
{
"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 | views/users.py | dimzignas/webapi |
"""
Copyright 2013 Rackspace
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
dist... | [
{
"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 | cloudcafe/compute/volume_attachments_api/config.py | rcbops-qa/cloudcafe |
import os
import glob
import sys
import functools
import jsonpickle
from collections import OrderedDict
from Orange.widgets import widget, gui, settings
import Orange.data
from Orange.data.io import FileFormat
from DockerClient import DockerClient
from BwBase import OWBwBWidget, ConnectionDict, BwbGuiElements, getIconN... | [
{
"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 | biodepot/User/OWFile.py | rgschmitz1/BioDepot-workflow-builder |
from abcunits import ConversionUnit
KFACTOR = 273.15 #Difference Kelvin, C (how precise is this known?)
class TempUnit(ConversionUnit):
""" Temperature units. ALl conversions go through Kelvin. """
#http://www.metric-conversions.org/temperature/fahrenheit-to-kelvin.htm
class Kelvin(TempUnit):
short = 'K'... | [
{
"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 | skspec/units/tempunits.py | hugadams/scikit-spectra |
import argparse
import requests
import json
REST_URL = '/api/todos'
def delete_posts(website_ip, all_ids):
url = 'http://' + website_ip + REST_URL + '/'
for ids in all_ids:
requests.delete(url + ids)
return 1
def GET_from_website(website_ip):
url = 'http://' + website_ip + REST_URL
r = re... | [
{
"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 | Master Node Files/clear_entries.py | xuruichenn/mean-a |
#!/usr/bin/env python3
# Oppgave av Stian Knudsen
# 1 Vokaler
hjelpeStreng = "aeiouyæøå"
def vokaler(streng):
"""
Returnerer vokalene(streng) i inndata
"""
delStreng = ""
for i in streng:
if i.lower() in hjelpeStreng:
delStreng += i
return delStreng
def antallVokaler(str... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | oving_04/oppg1.py | dislabled/INF620 |
"Dummy cache backend"
from django.core.cache.backends.base import BaseCache
class CacheClass(BaseCache):
def __init__(self, *args, **kwargs):
pass
def add(self, key, *args, **kwargs):
self.validate_key(key)
return True
def get(self, key, default=None):
self.validate_key(k... | [
{
"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/django-1.2/django/core/cache/backends/dummy.py | MiCHiLU/google_appengine_sdk |
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Profile
# @receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
# @re... | [
{
"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/users/signals.py | Nilsen11/django-training-CBV |
from functools import partial
from itertools import count
from typing import List
from tutils import lmap, splitstrip, load_and_process_input
DAY = "15"
INPUT = f"input-{DAY}.txt"
ANSWER1 = 240
ANSWER2 = 505
testdata = [
([0, 3, 6], 2020, 436),
([1, 3, 2], 2020, 1),
([2, 1, 3], 2020, 10),
([1, 2, 3], 2... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | 2020/python/day-15-cleaned.py | tadhg-ohiggins/advent-of-code |
import re
from typing import Union
from .validator import Validator, ValidationError, StopValidation
class Boolean(Validator):
true_types = (True, "true", 1, "1",)
false_types = (False, "false", 0, "0")
def __init__(self, message: Union[str, None] = None, parse: bool = True) -> None:
self.parse =... | [
{
"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 | src/flaskFormRequest/validators/boolean.py | edcilo/flaskFormRequest |
import torch.nn as nn
from torch.nn.functional import interpolate
class PixelShuffleUpscaleBlock(nn.Module):
def __init__(self, in_channels=64, kernel_size=3, upscale_factor=2):
super().__init__()
self.block = nn.Sequential(
nn.Conv2d(in_channels=in_channels,
out... | [
{
"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 | nn/block/upsample_blocks.py | Frognar/Super-Resolution |
import json
'''
crash course on APM & PX4 flight modes:
APM:
Stabilize
Alt Hold
Loiter
RTL (Return-to-Launch)
Auto
Additional flight modes:
Acro
AutoTune
Brake
Circle
Drift
Guided (and Guided_NoGPS)
Land
PosHold
Sport
Throw
Follow Me
Simple and Super Simple
Avoid_ADSB for ADS-B based avoidance of manned aircraft. Shou... | [
{
"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 | uav/src/main/python/pyspookystuff/uav/actions.py | fahadsiddiqui/spookystuff |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in 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": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | bcs-ui/backend/tests/container_service/observability/log_stream/test_utils.py | laodiu/bk-bcs |
import fire
import gzip
import pandas as pd
from pathlib import PurePath
def extract_vcf_header(vcf):
if vcf.suffix == '.gz':
vcf_inf = gzip.open(vcf)
else:
vcf_inf = open(vcf)
prefix = ''
for eachline in vcf_inf:
if vcf.suffix == '.gz':
eachline = eachline.decode()... | [
{
"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 | bioinformatics/analysis/snp/replace_score.py | bioShaun/omsCabinet |
# The bullet points associated with this set of tests in the evaluation document
test_set_id = "2.1"
# User friendly name of the tests
test_set_name = "Cap. Statement"
# Mem cache to avoid having to redo the same thing over and over
_capability_statement = None
_resources = None
import logging
logger = logging.get... | [
{
"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 | fhireval/test_suite/capability_statement/__init__.py | ncpi-fhir/ncpi-fhir-platform-evaluation |
class ExperimentList(type):
experiments = {}
def __init__(cls, name, bases, attrs):
if name != "Experiment":
ExperimentList.experiments[cls.name] = cls
class Experiment:
__metaclass__ = ExperimentList
# a list of input files that can be
# used in order to make use of more tha... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | centinel/experiment.py | mikiec84/centinel |
#!/usr/bin/env python
"""
.. code-block:: python
$ python decorator_inprogress.py
The example script can be tested using ``curl``.
.. code-block:: console
$ curl :8000/metrics
# HELP request_in_progress Number of requests in progress
# TYPE request_in_progress gauge
request_in_progress{route="/... | [
{
"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 | examples/decorators/decorator_inprogress.py | JacobHenner/aioprometheus |
from compas_cem.elements import Edge
class TrailEdge(Edge):
"""
A trail edge.
Notes
-----
If a plane is defined, it will override the absolute length of the trail edge.
However, the sign of the length (e.g. the combinatorial state) is preserved.
TODO: addexplicit combinatorial state to t... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/compas_cem/elements/trail.py | dylau/compas_cem |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 Red Hat, 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 requi... | [
{
"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 | sysinv/cgts-client/cgts-client/cgtsclient/v1/sm_service_nodes.py | etaivan/stx-config |
from django.shortcuts import render
from wiki.models import Page
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.http import HttpResponse
class PageList(ListView):
"""
CHALLENGES:
1. On GET, display a homepage that shows all Pages in your wik... | [
{
"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 | wiki/views.py | cherishkim42/makewiki-v1 |
#
from resolve import resolve
####################################
####################################
# 以下にプラグインの内容をペーストする
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout... | [
{
"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 | ABC123C/test_pasted_from_page.py | staguchi0703/atcoder_prob_collection |
# ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | [
{
"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 | pychron/hardware/actuators/ascii_gp_actuator.py | ASUPychron/pychron |
import gc
import pytest
from .index import Tree, Node
class TestTree():
def setup_method(self):
self.node = Node('a')
self.tree = Tree()
def teardown_method(self):
''' tearDown doesn't seem to be able to delete lists created in
each test, thus resulting errors if each te... | [
{
"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 | tree/test_.py | technolingo/AlgoStructuresPy |
# coding: utf-8
"""
RadioManager
RadioManager # noqa: E501
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import radiomanager_sdk
from radiomanager_sdk.api.stor... | [
{
"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_story_api.py | Pluxbox/radiomanager-python-client |
import flask
import flask_login
from . import app
class User(flask_login.UserMixin):
def __init__(self):
self.id = 'admin'
login_manager = flask_login.LoginManager()
login_manager.login_view = "login"
login_manager.init_app(app)
@login_manager.user_loader
def load_user(user_id):
return 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | youtube_sync/login.py | abhayagiri/youtube-sync |
from loguru import logger
from bot import embeds
@logger.catch
def help_commands(bot):
@bot.group(invoke_without_command=True)
async def help(ctx):
await ctx.send(embed=embeds.help())
@help.command()
async def balance(ctx):
await ctx.send(embed=embeds.help_balance())
@help.comma... | [
{
"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 | bot/help.py | thecryptoundertaker/discord-tip-bot |
#!/usr/bin/env python
#coding:utf-8
# Created: 15.11.2010
# Copyright (C) 2010, Manfred Moitzi
# License: MIT License
__author__ = "mozman <mozman@gmx.at>"
try:
# Python 2.6 and earlier need the unittest2 package
# try: pip install unittest2
# or download source from: http://pypi.python.org/pypi/unittest2... | [
{
"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 | barcodes/dxfwrite/tests/test_abstract_entity.py | sbarton272/AcousticBarcodes-Explorations |
# Lab 8
#3.1
def count_words(inpu_str):
return len(inpu_str.split( ))
#3.2
demo_str = 'hi, hello world!'
print(count_words(demo_str))
#3.3
def find_min(input_list):
min_item = input_list[0]
for num in input_list:
if type(num) is not str:
if min_item >= num:
... | [
{
"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 | lab8.py | Haywarax/IA241 |
# ------------------------------------------------
# instead of slack_bolt in requirements.txt
import sys
sys.path.insert(1, "vendor")
# ------------------------------------------------
import logging
from slack_bolt import App
from slack_bolt.adapter.aws_lambda import SlackRequestHandler
from slack_bolt.adapter.aws... | [
{
"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 | examples/aws_lambda/aws_lambda_oauth.py | korymath/bolt-python |
import unittest
import numpy as np
from spatialmath.base import *
# test graphics primitives
# TODO check they actually create artists
class TestGraphics(unittest.TestCase):
def test_plotvol2(self):
plotvol2(5)
def test_plotvol3(self):
plotvol3(5)
def test_plot_box(self):
plot_b... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | tests/base/test_graphics.py | jungr-ait/spatialmath-python |
import sqlite3
class DBManager (object):
def __init__(self):
self.docsetDBLocation = 'Docsets/docsets.db'
self.connection = None
self.SetupDocsetDB()
def SetupDocsetDB(self):
self.connection = sqlite3.connect(self.docsetDBLocation)
c = self.connection.cursor()
c.execute('CREATE TABLE IF NOT EXISTS doc... | [
{
"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 | Managers/DBManager.py | JHP4911/PyDoc |
# -*- coding: utf-8 -*-
"""
Specialized serializers for NSoT API client.
This is an example of how you would use this with the Client object, to make it
return objects instead of dicts::
>>> serializer = ModelSerializer()
>>> api = Client(url, serializer=serializer)
>>> obj = api.sites(1).get()
>>> o... | [
{
"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 | pynsot/serializers.py | dropbox/pynsot |
from abc import ABC, abstractmethod
from typing import Tuple, Dict
from kloppy.infra.utils import Readable
from kloppy.domain import Dataset
class TrackingDataSerializer(ABC):
@abstractmethod
def deserialize(
self, inputs: Dict[str, Readable], options: Dict = None
) -> Dataset:
raise NotI... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | kloppy/infra/serializers/tracking/base.py | eujern/kloppy |
import pytest
from ..validators import DictListValidator, Field, TextField, TimestampField
def test_dict_list_validator_eq_with_empty_instances():
assert DictListValidator({}) == DictListValidator({})
def test_dict_list_validator_eq_with_simple_equal_instances():
a = DictListValidator({
'foo': Time... | [
{
"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 | parkings/tests/test_validators.py | klemmari1/parkkihubi |
"""
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... | [
{
"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 | clients/kratos/python/test/test_submit_self_service_verification_flow_with_link_method_body.py | vinckr/sdk |
#! /usr/bin/env python
# ptags
#
# Create a tags file for Python programs, usable with vi.
# Tagged are:
# - functions (even inside other defs or classes)
# - classes
# - filenames
# Warns about files it cannot open.
# No warnings about duplicate tags.
import sys, re, os
tags = [] # Modified global variable!
def... | [
{
"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 | Tools/scripts/ptags.py | marcosptf/cpython-2.0.1 |
import google.oauth2.credentials
import google_auth_oauthlib.flow as oauth_flow
def fetch_new_creds(config):
return oauth_flow.InstalledAppFlow.from_client_config(
config,
scopes=[
'https://www.googleapis.com/auth/gmail.send',
'https://www.googleapis.com/auth/spreadsheets.readonly',
... | [
{
"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 | emailer/auth.py | marcdurham/emailer |
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.37
工具: python == 3.7.3
"""
"""
思路:
用栈,把 k 个数压入栈中,然后弹出来的顺序就是翻转的
注意:
第一,剩下的链表个数够不够 k 个(因为不够 k 个不用翻转)
第二,已经翻转的部分要与剩下链表连接起来
链接:
https://leetcode-cn.com/problems/reverse-nodes-in-k-group/solution/kge-yi-zu-fan-zhuan-... | [
{
"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 | LeetCode/python-R1/0025-K 个一组翻转链表D/V1.py | huuuuusy/Programming-Practice-Everyday |
# $Id: ospf.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Open Shortest Path First."""
from __future__ import absolute_import
from . import dpkt
AUTH_NONE = 0
AUTH_PASSWORD = 1
AUTH_CRYPTO = 2
class OSPF(dpkt.Packet):
"""Open Shortest Path First.
TODO: Longer class information....
At... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | dpkt/ospf.py | Vito-Swift/dpkt |
"""
Author: Ibrahim Sherif
Date: October, 2021
This script holds the conftest data used with pytest module
"""
import os
import pytest
import pandas as pd
import great_expectations as ge
from sklearn.model_selection import train_test_split
import config
from pipeline.data import get_clean_data
@pytest... | [
{
"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 | src/tests/conftest.py | ibrahim-sheriff/Deploying-a-ML-Model-on-Heroku-with-FastAPI |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from contextlib import contextmanager
from logging import getLogger
import signal
from .compat import iteritems
log = getLogger(__name__)
INTERRUPT_SIGNALS = (
'SIGABRT',
'SIGINT',
'SIGTERM',
'... | [
{
"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 | lib/python3.6/site-packages/conda/common/signals.py | PhonPhey/Magnezi |
from itertools import chain, starmap
from typing import Any, Tuple
def flatten_json(dictionary: dict) -> dict:
"""Flatten a nested json file"""
while True:
dictionary = dict(chain.from_iterable(starmap(_unpack, dictionary.items())))
if _atomic_values(dictionary):
break
return ... | [
{
"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 | activejson/flatten_json_tools.py | danvergara/activejson |
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from sklearn.base import BaseEstimator, TransformerMixin
class Lemmatization(BaseEstimator, TransformerMixin):
def __init__(self):
nltk.download('wordnet')
self.lemmatizer = WordNetLemmatizer()
def fit(self, X, y=None):
retu... | [
{
"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 | Project_2/preprocessors/lemmatization.py | TitoGrine/IART_Project |
import unittest
from zoo import *
class TestHabitat(unittest.TestCase):
def test_name_empty_string_by_default(self):
habitat = Habitat()
self.assertEqual(habitat.name, '')
def test_members_empty_set_by_default(self):
habitat = Habitat()
self.assertIsInstance(habitat.members, set)
def test_add_animal_to_h... | [
{
"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 | zoo/test_habitat.py | josephkane/zoo-testing |
#
# @lc app=leetcode.cn id=173 lang=python3
#
# [173] 二叉搜索树迭代器
#
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class BSTIterator:
def __init__(self, root: TreeNode):
self.stack = []
if root is not None:
self.stack.ap... | [
{
"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 | python/173.binary-search-tree-iterator.py | fengbaoheng/leetcode |
from django.test import TestCase
class HomeTest(TestCase):
def setUp(self):
self.response = self.client.get('/')
def test_get(self):
""" GET / must return status code 200 """
self.assertEqual(200, self.response.status_code)
def test_template_get(self):
""" Must use index.html """
self.assertTemplateUse... | [
{
"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 | pyladies/pyladies/core/tests.py | pyladiesvale/pyladies-site |
#!/usr/bin/env python
from __future__ import with_statement
from os import environ
import json
import yaml
import sys
class ConfigoNotExistingKeyError(Exception): pass
class Configo():
def __init__(self):
self.tmp_conf_name = environ.get('CONFIGO_CONF', None)
def load_config(self, config_path):
... | [
{
"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 | configo/configo.py | mignev/configo |
from database.adatabase import ADatabase
import pandas as pd
class SEC(ADatabase):
def __init__(self):
super().__init__("sec")
def retrieve_num_data(self,adsh):
try:
db = self.client[self.name]
table = db["nums"]
data = table.find({"adsh":adsh},{"_id":0}... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | database/sec.py | chung-ejy/longshot |
"""
scaffoldgraph.io.smiles
Contains functions for reading molecules from SMILES files.
"""
from rdkit.Chem import SmilesMolSupplier
from .supplier import EnumeratedMolSupplier, MolSupplier
def read_smiles_file(smiles_file, delimiter=' ', smiles_column=0,
name_column=1, header=False, requires_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 l... | 3 | scaffoldgraph/io/smiles.py | trumanw/ScaffoldGraph |
# Copyright 2022 Garda Technologies, LLC. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | bugbane/tools/builder/args.py | gardatech/bugbane |
from appannie.util import format_request_data
class Keyword(object):
EXPLORER_ENDPOINT = '/apps/{market}/keywords/explorer'
RANKED_ENDPOINT = '/apps/{market}/app/{product_id}/keywords/ranked'
PERFORMANCE_ENDPOINT = '/apps/{market}/app/{product_id}/keywords/ranks'
def __init__(self, http_client, marke... | [
{
"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 | appannie/store/keyword.py | Julian-O/appannie |
import pytest
from django.core.exceptions import ValidationError
from pretalx.common.css import validate_css
from pretalx.event.models import Event
@pytest.fixture
def valid_css():
return '''
body {
background-color: #000;
display: none;
}
.some-descriptor {
border-style: dotted dashed solid double;
BORD... | [
{
"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/tests/unit/common/test_css.py | td00/pretalx |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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 | kubernetes_asyncio/test/test_v1beta1_certificate_signing_request_status.py | aK0nshin/kubernetes_asyncio |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 6
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_1_1
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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | isi_sdk_8_1_1/test/test_worm_settings_extended.py | mohitjain97/isilon_sdk_python |
import pytest
from aiohttp import web
from app import pochta
@pytest.fixture
def app(aiohttp_client):
app = web.Application()
app.router.add_get('/pochta', pochta)
return aiohttp_client(app)
async def test_work(aiohttp_client, loop, app):
client = app()
resp = await client.get('/pochta?from_ci... | [
{
"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 | test-aiohttp.py | postman17/lks-delivery |
import urlparse
from django.conf.urls.defaults import url
from canvas.exceptions import ServiceError
re_slug = lambda name: "(?P<%s>[a-zA-Z0-9_.,-]+)" % name
re_group_slug = lambda name: "(?P<%s>[-a-zA-Z0-9_]+)" % name
re_int = lambda name: "(?P<%s>\d+)" % name
re_year = re_int('year')
re_month = re_year + "/" + re... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | website/canvas/url_util.py | bopopescu/canvas |
import uuid
from tornado.websocket import WebSocketHandler, WebSocketClosedError
import logging
import json
logger = logging.getLogger(__name__)
class WideCameraFeedWS(WebSocketHandler):
"""
"""
watchers = set()
def open(self):
self.uid = str(uuid.uuid4())
logger.info("WideCameraFeed we... | [
{
"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 | web/handlers/WideCameraFeedWS.py | AmarMaksumic/ML-CV |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao'
import os, sys, time, subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def log(s):
print('[Monitor] %s' % s)
class MyFileSystemEventHander(FileSystemEventHandler):
def __init__(s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | web-app-02/www/pymonitor.py | zunzhuowei/python-study |
from PyQt5 import QtCore
class ConverterModel(QtCore.QObject):
conversion_started = QtCore.pyqtSignal()
conversion_finished = QtCore.pyqtSignal(bool)
conversion_error = QtCore.pyqtSignal(Exception)
conversion_update = QtCore.pyqtSignal()
terminate_work = QtCore.pyqtSignal()
start = QtCore.pyq... | [
{
"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 | transcriber/converter/model.py | ewancook/ft-transcriber |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
"""Basic example which iter... | [
{
"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 | examples/eval_model.py | sumeet-iitg/parlAI |
## Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
import json
import logging
import uuid
import datetime
from datetime import date
import greengrasssdk
import m2c2_globals as var
import m2c2_utils as utils
logger = logging.getLogger()
logger.setLevel(l... | [
{
"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 | source/machine-connector/m2c2-slmp-connector/m2c2_post_handler.py | guikcd/machine-to-cloud-connectivity-framework |
from spotdl.authorize import AuthorizeBase
import pytest
class TestAbstractBaseClass:
def test_error_abstract_base_class_authorizebase(self):
with pytest.raises(TypeError):
AuthorizeBase()
def test_inherit_abstract_base_class_authorizebase(self):
class AuthorizeKid(AuthorizeBase):... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | spotdl/authorize/tests/test_authorize_base.py | khjxiaogu/spotify-downloader |
from morpyneural.Neural.NeuralNetworkClass import NeuralNetwork
class Element:
def __init__(self):
"""
Element is a part of Population, it containing the neural network and (will) handle
the score logic
"""
self.active = True
self.neural_network = NeuralNetwork()
... | [
{
"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 | src/morpyneural/Genetic/ElementClass.py | Morgiver/neural-network |
from cohere import Diffractometer
class Diffractometer_34idc(Diffractometer):
"""
Subclass of Diffractometer. Encapsulates "34idc" diffractometer.
"""
name = "34idc"
sampleaxes = ('y+', 'z-', 'y+') # in xrayutilities notation
detectoraxes = ('y+', 'x-')
incidentaxis = (0, 0, 1)
sample... | [
{
"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 | cohere-scripts/beamlines/aps_34idc/diffractometers.py | jacione/cohere-scripts |
import transformers
import argparse
def none_or_str(value):
if value == 'None':
return None
return value
def primary_parse():
parser = argparse.ArgumentParser()
parser.add_argument('--level') # {"token" "comment"}
parser.add_argument('--max_len', type=int, default=256)
parser.add_argument('--max_len_context'... | [
{
"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 | code/config.py | sahaisaumya/informal_fallacies |
import json
from time import sleep
from click.testing import CliRunner
from habu.cli.cmd_crypto_fernet import cmd_crypto_fernet
def test_crypto_fernet_success():
plain = 'Laiwieng9xuphahkieMohqueton3uaqu'
runner = CliRunner()
result1 = runner.invoke(cmd_crypto_fernet, ['-k', 'zzqNwPL_8XGPHii0vgGrWpMEi... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_crypto_fernet.py | riccigrj/habu |
__import__("pkg_resources").declare_namespace(__name__)
import ctypes
import os
from . import api
class File(object):
def __init__(self, filepath):
super(File, self).__init__()
self._path = filepath
def _get_version_info_size(self):
filepath = ctypes.create_unicode_buffer(self._path)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/infi/winapi/file_version_information/__init__.py | Infinidat/infi.winapi.file_version_information |
"""
Round-rotor generator model.
"""
import logging
from andes.core.service import VarService
from andes.models.synchronous.genbase import GENBase, Flux0
from andes.models.synchronous.genrou import GENROUData, GENROUModel
logger = logging.getLogger(__name__)
class GENROUOSModel(GENROUModel):
def __init__(self)... | [
{
"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 | andes/models/experimental/genrouos.py | cuihantao/Andes |
# coding: utf-8
"""
Engine api
Engine APIs # noqa: E501
OpenAPI spec version: 1.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import vtpl_api
from vtpl_api.models.engine_task_status_cumulative import EngineTask... | [
{
"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 | test/test_engine_task_status_cumulative.py | vtpl1/videonetics_api |
import unittest
from biothings_explorer.registry import Registry
from biothings_explorer.user_query_dispatcher import SingleEdgeQueryDispatcher
from .utils import get_apis
reg = Registry()
class TestSingleHopQuery(unittest.TestCase):
def test_gene2disease(self):
# test <gene, related_to, disease>
... | [
{
"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 | tests/test_apis/test_ctd.py | luluricketts/biothings_explorer |
import pytest
from goji.util.network import get_host_addr
class TestNetwork:
@pytest.mark.asyncio
async def test_get_host_addr4(self):
# Run these tests forcing IPv4 resolution
prefer_ipv6 = False
assert get_host_addr("127.0.0.1", prefer_ipv6) == "127.0.0.1"
assert get_host_add... | [
{
"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 | tests/util/network.py | zcomputerwiz/gojiv2-blockchain |
from interpolate import interpolate_doc
foo = """
hello
world
"""
bar = "foo bar\nbaz"
class Foo:
# cf matplotlib's kwdoc.
__kw__ = "the kw of foo"
@interpolate_doc
def func():
"""
this is a docstring
{interpolate_example.foo}
{bar}
{Foo!K}
"""
try:
@interpolat... | [
{
"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 | interpolate_example.py | anntzer/structured-docstrings |
# If you have not yet seen the source in paging/main.py, please take a look.
# In this sample we modify the query parameters in the MyModelList method to
# allow querying with simple equality filters.
import endpoints
from google.appengine.ext import ndb
from protorpc import remote
from endpoints_proto_datastore.nd... | [
{
"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 | examples/property_filters/main.py | dhermes/endpoints-proto-datastore |
#!/usr/bin/env python3
import unittest
from netsuite.api.customer import (
get_or_create_customer,
get_customer
)
from netsuite.api.sale import (
create_cashsale,
create_salesorder
)
from netsuite.test_data import (
data,
prepare_customer_data,
)
class NetsuiteTestCase(unittest.TestCase):
... | [
{
"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 | tests.py | ginogeorge25/netsuite-python-Jira |
# -*- coding: utf-8 -*-
"""
Created on 2019/8/4 上午9:45
@author: mick.yi
"""
import torch
from torch import nn
import numpy as np
class GuidedBackPropagation(object):
def __init__(self, net):
self.net = net
for (name, module) in self.net.named_modules():
if isinstanc... | [
{
"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 | interpretability/guided_back_propagation.py | rox38431/EyeJaundice |
# coding: utf-8
"""
TeamCity REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2018.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
im... | [
{
"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 | test/test_mute_api.py | DenKoren/teamcity |
from talon import Module, Context
import appscript
mod = Module()
ctx = Context()
ctx.matches = r"""
os: mac
"""
@mod.action_class
class Actions:
def run_shortcut(name: str):
"""Runs a shortcut on macOS"""
pass
@ctx.action_class("user")
class UserActions:
def run_shortcut(name: str... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | code/platforms/mac/user.py | palexjo/pokey_talon |
# -*- coding: utf-8 -*-
import os
import graphviz
import pytest
from ..testing_utils import make_ecommerce_entityset
@pytest.fixture()
def entityset():
return make_ecommerce_entityset()
def test_returns_digraph_object(entityset):
graph = entityset.plot()
assert isinstance(graph, graphviz.Digraph)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | featuretools/tests/entityset_tests/test_plotting.py | thehomebrewnerd/featuretools |
# -*- coding: utf-8 -*-
# @Time : 2020/10/2 21:15
# @Author : Zhiwei Yang
from log_lib import log
def remove_duplicates(nums: list) -> int:
"""
给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
示例 1:
给定数组 nums = [1,1,2],
函数应该返回新的长度 2, 并且原数组 num... | [
{
"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 | algorithm/delete_duplicate_num.py | niasand/experiment_code |
from core.models import Project, Volume
from rest_framework import serializers
from api.v2.serializers.summaries import ProjectSummarySerializer
from .volume import VolumeSerializer
class ProjectRelatedField(serializers.PrimaryKeyRelatedField):
def get_queryset(self):
return Project.objects.all()
def... | [
{
"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 | api/v2/serializers/details/project_volume.py | simpsonw/atmosphere |
import sys
from helpers import read_data_file
print('\n************* Day 09 *************\n')
preamble = 25
def part1():
msg = read_data_file(sys.argv[1], convert=int)
for i in range(preamble, len(msg)):
found = False
for j in range(i-preamble, i):
for k in range(i-preamble, ... | [
{
"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 | 09.py | jakerella/advent2020 |
# -*- coding: utf-8 -*-
# Copyright (c) Polyconseil SAS. All rights reserved.
from __future__ import unicode_literals
import json
import os
import os.path
from dokang import api
from . import compat
def get_harvester(fqn):
module_fqn, function_fqn = fqn.rsplit('.', 1)
# Hack around https://bugs.python.org/... | [
{
"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 | dokang/utils.py | Polyconseil/dokang |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.