source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#
# pyip is a Python package offering assembling/disassembling of raw ip packet
# including ip, udp, and icmp. Also it includes 2 utilities based on raw ip,
# traceroute and ping.
#
# pyip is released under PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, and is
# a project inspired by 'ping' written by Jeremy Hylt... | [
{
"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 | test/iptests.py | koodaamo/pyip |
import torch
import torch.nn
from typing import Dict, Tuple
from models.encoder_decoder import add_eos
from models.transformer_enc_dec import TransformerResult
from ..model_interface import ModelInterface
import framework
from ..encoder_decoder import EncoderDecoderResult
class TransformerEncDecInterface(ModelInterf... | [
{
"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 | interfaces/transformer/encoder_decoder_interface.py | lukovnikov/transformer_generalization |
from date_sniff.sniffer import DateSniffer
def test_years_separation():
sniffer = DateSniffer(year=2019)
assert sniffer.sniff('2019') == {'2019': []}
assert sniffer.sniff('prefix 2019 and long text') == {'prefix 2019 and long text': []}
res = {'prefix 2019 and long text another 2019': []}
assert s... | [
{
"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 | date_sniff/tests.py | nanvel/date-sniff |
# Logging level must be set before importing any stretch_body class
import stretch_body.robot_params
stretch_body.robot_params.RobotParams.set_logging_level("DEBUG")
import unittest
import stretch_body.lift
import time
class TestLift(unittest.TestCase):
def test_homing(self):
"""Test lift homes correct... | [
{
"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 | body/test/test_lift.py | soumith/stretch_body |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 2 18:34:05 2020
@author: leemshari
"""
# I wanted to create an n cubed icon
#My goal was to get this to get this to print with & or @ signs but I was unable to
#get this array to look decent with anything but integers.
#I changed the dtype to str ... | [
{
"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 | icon.py | ccacNMorris/dat129_ccac |
from pypy.rpython.test.test_llinterp import gengraph, interpret
from pypy.rlib import rgc # Force registration of gc.collect
import gc
def test_collect():
def f():
return gc.collect()
t, typer, graph = gengraph(f, [])
ops = list(graph.iterblockops())
assert len(ops) == 1
op = ops[0][1]
... | [
{
"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 | pypy/rlib/test/test_rgc.py | camillobruni/pygirl |
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.arm.base_resource_value_check import BaseResourceValueCheck
# https://docs.microsoft.com/en-us/azure/templates/microsoft.web/2019-08-01/sites
class AXA_VirtualMachineExists(BaseResourceValueCheck):
def __init__(self):
name ... | [
{
"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 | checkov/arm/checks/resource/AXA_VirtualMachineExists.py | kn0wm4d/checkov |
from turtle import Turtle
class Ball(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.shape("circle")
self.color("white")
self.speed("slowest")
self.x_move = 10
self.y_move = 10
def move(self):
new_x = self.xcor() + self.x_mo... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | 100_days_of_code/Intermediate/day_22/ball.py | Tiago-S-Ribeiro/Python-Pro-Bootcamp |
'''HDF5 operating system operations.
license: HDF5Application/license.txt
Main authors:
Philipp Bucher
Michael Andre
'''
import KratosMultiphysics
import KratosMultiphysics.kratos_utilities as _utils
import os
class DeleteOldH5Files(object):
'''Delete h5-files from previous simulations.'''
def __ca... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | applications/HDF5Application/python_scripts/core/operations/system.py | Jacklwln/Kratos |
from flask import g
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
from app.models import User
from app.api.v1.errors import error_response
basic_auth = HTTPBasicAuth()
token_auth = HTTPTokenAuth()
@basic_auth.verify_password
def verify_passowrd(username, password):
"""Receives username and password fr... | [
{
"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 | app/api/v1/auth.py | camisatx/flasker |
"""
Make yaml respect OrderedDicts and stop sorting things
"""
from collections import OrderedDict
import sys
import yaml
_items = 'viewitems' if sys.version_info < (3,) else 'items'
def map_representer(dumper, data):
return dumper.represent_dict(getattr(data, _items)())
def map_constructor(loader, node): # ... | [
{
"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 | crosscap/yamlhack.py | corydodt/Crosscap |
#!/usr/bin/env python
## @package teleop_joy A node for controlling the P3DX with an XBox controller
import rospy
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from sensor_msgs.msg import Joy
import numpy as np
def quat2yaw(q):
return np.arctan2(2*(q.y*q.z + q.w*q.x), 1 - 2*(q.z**2 + q.w... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | nodes/teleop_joy.py | Lovestarni/asv_simulator |
import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerCoffeePullV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _parse_obs(obs):
return {
'hand_pos': obs[:3],
'mug_pos':... | [
{
"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 | metaworld/policies/sawyer_coffee_pull_v2_policy.py | rmrafailov/metaworld |
# -*- coding: utf-8 -*-
"""Flask extension pacakge for Sendgrid"""
from . import FlaskExtension
from sendgrid import SendGridClient, Mail
class SendGrid(FlaskExtension):
"""A helper class for managing a the SendGrid API calls"""
EXTENSION_NAME = 'sendgrid'
def __init__(self, app=None):
super... | [
{
"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 | yoapi/extensions/flask_sendgrid.py | YoApp/yo-api |
import numpy as np
import os
import shutil
import sys
from torch.utils.tensorboard import SummaryWriter
import torch
def model_input(data, device):
datum = data.data[0:1]
if isinstance(datum, np.ndarray):
return torch.from_numpy(datum).float().to(device)
else:
return datum.float().to(devic... | [
{
"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 | log.py | skat00sh/Handcrafted-DP |
import os
import sys
from robotframework_ls.impl.robot_lsp_constants import (
ENV_OPTION_ROBOT_LSP_DEBUG_PROCESS_ENVIRON,
ENV_OPTION_ROBOT_LSP_DEBUG_MESSAGE_MATCHERS,
)
def _is_true_in_env(env_key):
return os.getenv(env_key, "") in ("1", "True", "true")
class Options(object):
tcp = False
host =... | [
{
"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 | src/robotframework_ls/options.py | Snooz82/robotframework-lsp |
#!/usr/bin/env python
import codecs
import os.path
import re
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
return codecs.open(os.path.join(here, *parts), "r", encoding="utf-8").read()
def find_version(*file_paths):
version_file = read(*fil... | [
{
"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 | setup.py | gonzaloarro/amazon-transcribe-streaming-sdk |
import math
import time
t1 = time.time()
def digt(num):
n = num
digt = 0
while n > 0:
digt += n%10
n = n//10
return digt
temp = []
for i in range(2,200):
for j in range(2,50-i//10):
t = round(math.pow(i,j))
if digt(t) == i:
temp.append(t)
def quickSor... | [
{
"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 | Problem 001-150 Python/pb119.py | Adamssss/projectEuler |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox(capabilities={"marionette": Fa... | [
{
"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 | fixture/application.py | Dansmael/python_training |
from fetchcode.vcs.pip._vendor.pkg_resources import yield_lines
from fetchcode.vcs.pip._vendor.six import ensure_str
from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Dict, Iterable, List
class DictMetadata(object):
"""IMetadataProvider that re... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/fetchcode/vcs/pip/_internal/utils/pkg_resources.py | quepop/fetchcode |
from DataStream.ByteReader import ByteReader
from Protocol.Messages.Server.KeepAliveServerMessage import KeepAliveServerMessage
from Logic.Player import Player
from Protocol.Messages.Server.AvailableServerCommandMessage import AvailableServerCommandMessage
class KeepAliveMessage(ByteReader):
def __init__(sel... | [
{
"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 | Server/Protocol/Messages/Client/KeepAliveMessage.py | Voeed/Brawl-stars-v11 |
from django.core.management.base import BaseCommand, CommandError
from cddp.models import CptCadastreScdb
from shack.utils import copy_cddp_cadastre, prune_addresses
class Command(BaseCommand):
help = 'Undertakes copy of cadastre data from a database connection'
def add_arguments(self, parser):
pars... | [
{
"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 | shack/management/commands/copy_cadastre.py | parksandwildlife/caddy |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerailizer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
serializer_class = UserSeraili... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | user/views.py | prajilmv/recipe-app-api |
from __future__ import absolute_import
import unittest
from blingalytics.sources import static
from mock import Mock
from test import reports
class TestStaticSource(unittest.TestCase):
def setUp(self):
self.report = reports.SuperBasicReport(Mock())
def test_static_source(self):
source = sta... | [
{
"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 | test/sources/test_static.py | ChowNow/blingalytics |
from fastapi import FastAPI
import uvicorn
from logic import add
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello"}
@app.get("/add/{num1}/{num2}")
async def adder(num1: int, num2: int):
"""Add two numbers together"""
total = add(num1,num2)
return {"total": total}
if __name_... | [
{
"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 | mainFastApi.py | aimanh22/microservices-key-concepts |
# coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
from django.conf import settings
url = False
if hasattr(settings, 'KOBOFORM_URL') and settings.KOBOFORM_URL:
url = settings.KOBOFORM_URL
else:
url = False
active = bool(url)
autoredirect = active
if active and... | [
{
"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 | onadata/koboform/__init__.py | ubpd/kobocat |
from celescope.mut.__init__ import __ASSAY__
from celescope.tools.multi import Multi
class Multi_mut(Multi):
def mapping_mut(self, sample):
step = 'mapping_mut'
fq = f'{self.outdir_dic[sample]["cutadapt"]}/{sample}_clean_2.fq{self.fq_suffix}'
cmd = (
f'{self.__APP__} '
... | [
{
"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 | celescope/mut/multi_mut.py | pigraul/CeleScope |
# 與moudle1有相同名稱的函數
def foo():
return ('happy birthday~')
def bar ():
return print('happy new year !!') | [
{
"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 | Day01-15/pratice_code/HY_module2.py | reic/groupLearning-Python-100-Days |
"""BayesianTracker (`btrack`) is a multi object tracking algorithm,
specifically used to reconstruct trajectories in crowded fields. New
observations are assigned to tracks by evaluating the posterior probability of
each potential linkage from a Bayesian belief matrix for all possible
linkages. """
from setuptools im... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | setup.py | dpshelio/BayesianTracker |
#crypto.py
from urllib.request import urlopen as req
from bs4 import BeautifulSoup as soup
def rangeprice(name='bitcoin',start='20200101',end='20200131'):
url = 'https://coinmarketcap.com/currencies/{}/historical-data/?start={}&end={}'.format(name,start,end)
webopen = req(url)
page_html = webopen.read()
webopen... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | unclecrypto/crypto.py | UncleEngineer/unclecrypto |
import re
import six
import unicodedata
def smart_text(s, encoding='utf-8', errors='strict'):
if isinstance(s, six.text_type):
return s
if not isinstance(s, six.string_types):
if six.PY3:
if isinstance(s, bytes):
s = six.text_type(s, encoding, errors)
e... | [
{
"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 | slugify/__init__.py | mathiasose/unicode-slugify |
#!/usr/bin/env python
import os
import jinja2
import yaml
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = jinja2.Environment(
autoescape=False,
loader=jinja2.FileSystemLoader(os.path.join(PATH, 'data')),
trim_blocks=False)
def render_template(template_filename, context):
ret... | [
{
"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 | load_styles.py | wouter-veeken/docs |
"""
This class contains functions to interact between user interactions provided through HTML requests and the forms that
the user is using.
"""
from django.contrib.auth import authenticate
from django.contrib.auth import login as auth_login
def signup(form, request):
"""
This function saves a new user accoun... | [
{
"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 | capstoneproject/helpers/form_helper.py | athrun22/content-rating |
import os.path
from app.data.database import init_db, db_path, get_expected_pathname, set_path
def db_exists():
return os.path.isfile(db_path)
def check_db():
global db_path
if (db_path != get_expected_pathname()):
print('DB Check: Running backup')
backup_database_to(get_expected_pathname... | [
{
"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 | app/data/check.py | redforge/Flask_Signin |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check that it's not possible to start a second cheesecoind instance using the same datadir or wallet."""
imp... | [
{
"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/functional/feature_filelock.py | minblock/cheesecoin |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import threading
from xrd.core.Singleton import Singleton
from pyqryptonight import pyqryptonight
class Qryptonight7(object, metaclass=Singleton):
def __init__(... | [
{
"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 | src/xrd/crypto/Qryptonight7.py | jack3343/xrd-core |
import math
from typing import Iterable
from .base import BaseMeasure
class OverlapMeasure(BaseMeasure):
def __init__(self, db=None, maxsize: int = 100) -> None:
super().__init__()
if db:
self.maxsize = db.max_feature_size()
else:
self.maxsize = maxsize
def min... | [
{
"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 | simstring/measure/overlap.py | icfly2/simstring-1 |
import re
class PacBioReadName:
"""A class to get information from PacBio read names
Only supports subreads and ccs reads for now, but may be
nice to add isoseq support in the future
:param name: Name is a pacbio name
:type name: string
"""
def __init__(self,name):
self._name = name.rstrip()
... | [
{
"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 | seqtools/format/pacbio.py | jason-weirather/py-seq-tools |
from openslides_backend.permissions.permissions import Permissions
from tests.system.action.base import BaseActionTestCase
class PollDeleteTest(BaseActionTestCase):
def test_delete_correct(self) -> None:
self.set_models({"poll/111": {"meeting_id": 1}, "meeting/1": {}})
response = self.request("pol... | [
{
"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/system/action/poll/test_delete.py | OpenSlides/openslides-backend |
from abc import ABCMeta, abstractmethod
class IBenchmarker(metaclass=ABCMeta):
"""
"""
def __init__(self, config):
import util.constant as const
try:
self._check_config(config)
except KeyError:
raise
except:
raise
self._benchmar... | [
{
"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 | benchmarker/base.py | cuponthetop/masters-student |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..preprocess import AutoTcorrelate
def test_AutoTcorrelate_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
eta2=dict(argstr='-eta2',
),
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | nipype/interfaces/afni/tests/test_auto_AutoTcorrelate.py | sebastientourbier/nipype |
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertE... | [
{
"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 | test/UnitTest.py | Wenbo16/OpenSCAD-parser |
# coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... | [
{
"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 | test/test_package_version_resource.py | cvent/octopus-deploy-api-client |
from data import watermelon_2_0
from decision_tree import tree_generate
def get_tree():
features, examples = watermelon_2_0()
return tree_generate(features, examples)
def make_dot_source(root):
def node_source(node):
dot_label = node.feature
if node.leaf:
dot_label = node.lab... | [
{
"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 | decision_tree_run.py | tioover/bendan |
from django.core.management.base import BaseCommand, CommandParser
from zerver.lib.actions import do_create_user
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.onboarding import send_initial_pms
from zerver.models import Realm, UserProfile
from typing import Any
class Command(ZulipBaseCommand):
... | [
{
"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 | zilencer/management/commands/add_new_user.py | Rishabh570/zulip |
class LMS8001_CHANNEL_PD(object):
def __init__(self, chip, channel, cfgNo):
self.chip = chip
self.channel = channel
self.cfgNo = cfgNo
#
# Read channel PD
#
def __getattr__(self, name):
channel = self.__dict__["channel"]
cfgNo = self.__dict__["cfgNo"]
... | [
{
"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 | pyLMS8001/LMS8001_CHANNEL_PD.py | myriadrf/pyLMS8001 |
"""Model module for images."""
from django.db import models
from django.contrib.auth.models import User
from imager_profile.models import ImagerProfile
# Create your models here.
class ImageBaseClass(models.Model):
"""Base class for Photo and Album classes."""
PRIVATE = 'PRVT'
SHARED = 'SHRD'
PUBLIC ... | [
{
"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": true
}... | 3 | imagersite/imager_images/models.py | Loaye/django-imager-group |
import os
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return """
<h1>Hello user</h1>
<img src="http://loremflickr.com/600/400">
<p><a href="/sida2"title ="Síða 2">Síða 2</a> | <a href="/sida3"title ="Síða 3">Síða 3</a></p>
"""
@app.route("/sida2")
def sida2():
retu... | [
{
"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 | verk2.py | Kristberg/VEF-2VF05CU |
import asyncio, logging
from aiohttp import web
logging.basicConfig(level=logging.INFO)
def index(request):
return web.Response(body=b'<h1>Hello World</h1>', content_type='text/html')
async def init(loop):
app = web.Application(loop=loop)
app.router.add_route('GET', '/', index)
srv = await loop.cr... | [
{
"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 | ResolveWang/minifw |
"""
Demonstrate differences between __str__() and __reper__().
"""
class neither:
pass
class stronly:
def __str__(self):
return "STR"
class repronly:
def __repr__(self):
return "REPR"
class both(stronly, repronly):
pass
class Person:
def __init__(self, name, age):
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | Python3/Python3_Lesson09/src/reprmagic.py | ceeblet/OST_PythonCertificationTrack |
#!/usr/bin/venv python3
'email-examples.py - demo creation of email messages'
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from smtplib import SMTP
# multipart alternative: text and html
def make_mpa_msg():
email = MIMEMultipart('alter... | [
{
"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 | CorePython/InternetClient/Email/eamil-examples.py | AnatoleZho/Python3 |
from django.test import TestCase
from hardware.photoCell import PhotoCell
class LightSensorTest(TestCase):
"""
Tests multiple methods for light sensor.
"""
def setUp(self):
example = PhotoCell(18) # try/except if pin is not connected
def test_sensor_reading_returns_number(self):
sensorReadout... | [
{
"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 | hardware/tests.py | edisondotme/motoPi |
# Trie Tree Node
from typing import Optional
class TrieNode:
def __init__(self, char: Optional[str] = None):
self.char = char
self.children = []
self.counter = 0
self.end = False
def add(self, word: str):
node = self
for char in word:
found_in_child... | [
{
"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 | python-algorithm/common/trie_node.py | isudox/nerd-algorithm |
class response():
def __init__(self) -> None:
self.num = 5
def call_result(self):
return(self.num) | [
{
"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 | sub_call/file_call.py | jyhh1992/test_algorithm |
"""
Copyright (c) 2017 Eric Shook. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
@author: eshook (Eric Shook, eshook@gmail.edu)
@contributors: <Contribute and add your name here!>
"""
from forest import *
import unittest
# Test forest/bobs/Bob.p... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | unittests/test_IO.py | tyburesh/Forest |
from inspect import signature
from typing import Callable, Any, List
import re
import copy
from .type import Type
class Function(Type):
def __init__(self, fn: Callable[..., Any], name: str = "anonymouse") -> None:
self.name = name
self.vars = list(signature(fn).parameters)
self.expr = "[bu... | [
{
"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 | computorv2/types/function.py | ayoubyt/ComputorV2 |
from geojson_rewind import rewind
from geomet import wkt
import decimal
import statistics
def wkt_rewind(x, digits=None):
"""
reverse WKT winding order
:param x: [str] WKT string
:param digits: [int] number of digits after decimal to use for the return string.
by default, we use the mean num... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | pygbif/utils/wkt_rewind.py | bartaelterman/pygbif |
import sqlite3
class DBHelper:
def __init__(self, dbname="nsnotif.sqlite"):
self.dbname = dbname
self.conn = sqlite3.connect(dbname)
def setup(self):
tblstmt = "CREATE TABLE IF NOT EXISTS users (username text , cid text, PRIMARY KEY(username))"
self.conn.execute(tblstmt)
... | [
{
"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 | nsnotif/dbhelper.py | bakyazi/NSNOTIF |
from more.transaction import default_commit_veto
def callFUT(response, request=None):
return default_commit_veto(request, response)
def test_it_true_500():
response = DummyResponse('500 Server Error')
assert callFUT(response)
def test_it_true_503():
response = DummyResponse('503 Service Unavailabl... | [
{
"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 | more/transaction/tests/test_default_commit_veto.py | sgaist/more.transaction |
def falling(n, k):
"""Compute the falling factorial of n to depth k.
>>> falling(6, 3) # 6 * 5 * 4
120
>>> falling(4, 3) # 4 * 3 * 2
24
>>> falling(4, 1) # 4
4
>>> falling(4, 0)
1
"""
"*** YOUR CODE HERE ***"
def sum_digits(y):
"""Sum all the digits of y.
>>> ... | [
{
"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 | CS 61A/Lab/lab01/lab01.py | nekomiao123/learn_more |
import numpy as np
from vis_utils.scene.components import ComponentBase
class SimpleNavigationAgent(ComponentBase):
def __init__(self, scene_object):
ComponentBase.__init__(self, scene_object)
self.controller = scene_object._components["morphablegraph_state_machine"]
self.walk_targets = []... | [
{
"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 | mg_server/simple_navigation_agent.py | eherr/mg_server |
import os
import sys
sys.path.append(os.path.abspath('.'))
def install():
from context_menu import menus
import modules
pyLoc = sys.executable # .replace('python.exe', 'pythonw.exe')
scriptLoc = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'main.py') # Location of ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | src/scripts/reginstall.py | saleguas/freshen-file-sorter |
import synapse.common as s_common
import synapse.lib.socket as s_socket
from synapse.links.common import *
class TcpRelay(LinkRelay):
'''
Implements the TCP protocol for synapse.
tcp://[user[:passwd]@]<host>[:port]/<path>
'''
proto = 'tcp'
def _reqValidLink(self):
host = self.link[... | [
{
"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 | synapse/links/tcp.py | larrycameron80/synapse |
import pytorch_lightning as pl
import pytorch_lightning.callbacks
class ResetOptimizers(pl.Callback):
def __init__(self, verbose: bool, epoch_reset_field: str = "pretrain_epochs"):
super().__init__()
self.verbose = verbose
self.epoch_reset_field= epoch_reset_field
def on_train_epoch_en... | [
{
"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 | econ_layers/callbacks.py | HighDimensionalEconLab/econ_layers |
import pytest
from custom_components.racelandshop.share import SHARE
from custom_components.racelandshop.validate import (
async_initialize_rules,
async_run_repository_checks,
)
@pytest.mark.asyncio
async def test_async_initialize_rules(racelandshop):
await async_initialize_rules()
@pytest.mark.asynci... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/validate/test_async_run_repository_checks.py | racelandshop/integration |
from __future__ import absolute_import
"""
This base config script gets automatically executed for all platforms via
configure if the "dev" sub-configuration is specified (which is the default).
"""
from os import makedirs
from os import path
import shutil
scancode_root_dir = path.dirname(
# etc
path.dirnam... | [
{
"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 | etc/conf/dev/base.py | abhi27-web/scancode-toolk |
from pyhocon import ConfigTree # noqa: F401
from typing import Dict, Optional # noqa: F401
from databuilder.transformer.base_transformer import Transformer
from databuilder.models.table_column_usage import ColumnReader, TableColumnUsage
from databuilder.extractor.bigquery_usage_extractor import TableColumnUsageTuple... | [
{
"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 | databuilder/transformer/bigquery_usage_transformer.py | cpnat/amundsendatabuilder |
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
def requires():
with open("requirements.txt", "r") as f:
return [r.strip() for r in f.readlines()]
setup(name='omamittari',
version='0.9.0',
des... | [
{
"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 | setup.py | mikaraunio/omamittari-py |
from checkov.common.models.enums import CheckCategories
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
class PasswordPolicyLowercaseLetter(BaseResourceValueCheck):
def __init__(self):
name = "Ensure RAM password policy requires at least one lowercase letter"... | [
{
"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 | checkov/terraform/checks/resource/alicloud/PasswordPolicyLowercaseLetter.py | pmalkki/checkov |
from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class MatchScoreNotification(BaseNotification):
def __init__(self, match):
self.match = match
self.event = match.event.get()
sel... | [
{
"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 | notifications/match_score.py | samuelcouch/the-blue-alliance |
import re
import requests
from bs4 import BeautifulSoup
from botutils.constants import IS_URL_REGEX
def get_ffn_url_from_query(query):
ffn_list = []
href = []
url = 'https://www.google.com/search?q=' + \
query+"+fanfiction"
page = requests.get(url)
soup = BeautifulSoup(page.content, 'h... | [
{
"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 | botutils/searchforlinks.py | yashprakash13/Honeysuckle |
import os
import time
class Cleanup:
"""The somewhat automated garbage collection system"""
def __init__(self):
self.max_age_minutes = 20
self.max_calls = 5
self.path = './output'
self.calls = 0
def clean(self):
if (self.calls < self.max_calls - 1):
s... | [
{
"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/cleanup.py | nerdcubed/banhammer |
from midiutil import MIDIFile
def degree_to_note(root, mode, degree):
"""Convert a list of relative degrees to midi note numbers.
Parameters
----------
key - MIDI note number for the root note
mode - a number for the mode (0 - Ionian (major),
1 - Dorian, ..., 5 - Aeolian (minor), ..... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | src/ofold/utils.py | orbitfold/ofold |
# HARVEST_SKIP
from harvest.algo import BaseAlgo
from harvest.trader import BackTester
class BackTest(BaseAlgo):
def config(self):
self.watchlist = ["SPY"]
self.interval = "5MIN"
self.aggregations = []
def main(self):
prices = self.get_asset_price_list()
sma_short = se... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | examples/backtest.py | webclinic017/harvest |
from kivy.uix.button import Button
from kivy.properties import StringProperty, BooleanProperty, NumericProperty, ObjectProperty
from kivy.graphics import Color, Rectangle, RoundedRectangle, Ellipse
from kivy.lang import Builder
Builder.load_string('''
<FlatButton>:
background_normal: ''
background_color: [0,0,... | [
{
"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 | button.py | qodzero/ukivy |
#!/usr/bin/env python3
import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self):
super().__init__()
self.feat1 = nn.Sequential(nn.Flatten(), nn.Linear(50*5*5, 32*5*5), nn.ReLU())
self.feat2 = nn.Sequential(nn.Linear(32*5*5, 32*12), nn.ReLU())
self.linear = nn.Se... | [
{
"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 | models/mlp.py | wang-chen/graph-action-recognition |
from ..apibits import *
from ..endpoints import GeneratorsEndpoint
from ..endpoints import GeneratorRowsEndpoint
class Generator(ApiResource):
@classmethod
def all(cls, params={}, headers={}):
res = cls.default_client().generators().all(params, headers)
return res
@classmethod
def 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_has_docstring",
"question": "Does every function in this file have a docst... | 3 | rainforest/resources/generator.py | apibitsco/rainforestapp-python |
from henrio import *
import unittest
class QueueTest(unittest.TestCase):
def test_queue(self):
try:
l = get_default_loop()
q = HeapQueue(50)
print(q)
async def d():
return await q.get()
async def a(i):
await sl... | [
{
"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 | tests/qtest.py | henry232323/henrio |
import json
import jsonschema
from pkg_resources import resource_filename
schema_dir = resource_filename('nstschema', 'schemas')
resolver = jsonschema.RefResolver('file://' + schema_dir + '/', None)
def validate(instance, schema_name):
"""Validate JSON against schema
Args:
- instance (dict): JSON i... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | nstschema/validate.py | nst-guide/table-schemas |
# Copyright (c) 2019 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
import UM.Qt.QtApplication
from UM.View.RenderPass import RenderPass
## A render pass subclass that renders everything with the default parameters.
#
# This class provides the basic rendering of the objects in the s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | Cura/Uranium/UM/View/DefaultPass.py | TIAO-JI-FU/3d-printing-with-moveo-1 |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
class LockChangeRequest(object):
def __init__(self):
self.requests = None
self.workstationID = None
self.siteID = None
def getRequests(self):
return self.requests
def setRequests(self, requests):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/LockChangeRequest.py | mjames-upc/python-awips |
import pytest
from d3rlpy.algos.crr import CRR
from tests import performance_test
from .algo_test import algo_tester, algo_update_tester, algo_pendulum_tester
@pytest.mark.parametrize("observation_shape", [(100,), (4, 84, 84)])
@pytest.mark.parametrize("action_size", [2])
@pytest.mark.parametrize("q_func_factory", [... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tests/algos/test_crr.py | jamartinh/d3rlpy |
import asyncio
from appdaemon.appdaemon import AppDaemon
class AdminLoop:
def __init__(self, ad: AppDaemon):
self.AD = ad
self.stopping = False
self.logger = ad.logging.get_child("_admin_loop")
def stop(self):
self.logger.debug("stop() called for admin_loop")
self.sto... | [
{
"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 | appdaemon/admin_loop.py | benleb/appdaemon |
import unittest
from common import get_context
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ctx = get_context()
def test_1(self):
buf = self.ctx.buffer(b'abc')
data = bytearray(3)
buf.read_into(data)
self.assertEqual(bytes(data), b'abc... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/test_buffer_read_into.py | asnt/moderngl |
from django.forms import ModelForm
from .models import Application
from django import forms
class ApplicationForm(ModelForm):
class meta:
model = Application
def clean_scopes(self):
scopes = self.cleaned_data['scopes']
if 'user.read' not in scopes:
raise forms.ValidationEr... | [
{
"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 | app/oauth_office365/forms.py | larrycameron80/PwnAuth |
from ..controller_config import ControllerConfig
from ..activities import ActivityName
from ..constants import Constants
class DiningRoomConfig(ControllerConfig):
@property
def has_traffic_lights(self):
return True
@property
def traffic_lights_pins(self):
return list([
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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/configs/dining_room.py | jzucker2/RufusRaspberry |
from channels import Group
import ast
from .models import Chat
def ws_add(message):
print('recibida')
message.reply_channel.send({'accept':True})
Group('chat').add(message.reply_channel)
def ws_message(message):
to_model=ast.literal_eval(message.content['text'])
print(to_model)
md=Chat(nome=to_model['nome'],tex... | [
{
"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 | redly/redweb/consumers.py | redlytcc/redlysite |
from pprint import pprint
class Bit:
ZERO = 0x0000
ONE = 0x0001
TWO = 0x0002
THREE = 0x0004
FOUR = 0x0008
FIVE = 0x0010
SIX = 0x0020
SEVEN = 0x0040
EIGHT = 0x0080
def __init__(self):
self.__value = self.ZERO
def set(self, position):
self.__value |= positi... | [
{
"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 | Bit.py | SmileyJoe/playground_python_bitwise |
from django.http import HttpResponseNotFound, HttpResponseServerError
def test_404(request):
return HttpResponseNotFound()
def test_500(request):
return HttpResponseServerError()
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | selectable/tests/views.py | zeehio/django-selectable |
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string as base_import_string
def is_model_registered(app_label, model_name):
"""Checks whether a given model is registered."""
try:
apps.get_registered_model(app_label, m... | [
{
"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 | thorbanks/loading.py | thorgate/django-thorbanks |
from humans import Anastasis
import random, time, os, re, tweepy
consumer_key = os.environ['TWITTER_CONSUMER_KEY']
consumer_secret = os.environ['TWITTER_CONSUMER_SECRET']
access_token = os.environ['TWITTER_ACCESS_TOKEN']
access_token_secret = os.environ['TWITTER_ACCESS_TOKEN_SECRET']
auth = tweepy.OAuthHandler(consum... | [
{
"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 | empathy.py | agermanidis/Welcome_Programmable_Human |
import os
import torch
class Dictionary(object):
"""Build word2idx and idx2word from Corpus(train/val/test)"""
def __init__(self):
self.word2idx = {} # word: index
self.idx2word = [] # position(index): word
def add_word(self, word):
"""Create/Update word2idx and idx2word"""
... | [
{
"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 | data.py | stanford-oval/word-language-model |
#!/usr/bin/env python3
n = int(input())
d = list(map(int, input().split()))
t = [list(map(int, input().split())) for _ in range(3)]
ivals = [[[0]*n for _ in range(n)] for _ in range(3)]
for p in range(3):
for i in range(n):
curt = 0
for j in range(n):
ivals[p][i][(i+j)%n] = (curt, curt... | [
{
"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 | UICPC/21/nwerc2020all/islandtour/submissions/accepted/per_lazy.py | MilladMuhammadi/Competitive-Programming |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# License: MIT. See LICENSE
import json
import frappe
from frappe.utils.safe_exec import safe_exec
from frappe.model.document import Document
class SystemConsole(Document):
def run(self):
frappe.only_for('System Manager')
try:
... | [
{
"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 | frappe/desk/doctype/system_console/system_console.py | almeidapaulopt/frappe |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def loadFromFile(nameFile):
d = np.load('../data/'+nameFile+name+'array.npy')
print('Reading from' + '../data/'+nameFile+name+'array.npy')
return d
def diff(x, y, y2, name):
newY = abs(y - y2)
fig = plt.figure()
ax = plt.sub... | [
{
"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 | Bluetooth/ble_comm/Scripts/dataAnalysis.py | abdullah-zaiter/Sign-Language-By-Glove |
'''Multimethods for fast Hankel transforms.
'''
import numpy as np
from ._basic import _dispatch
from ._fftlog import fht as _fht
from ._fftlog import ifht as _ifht
from scipy._lib.uarray import Dispatchable
__all__ = ['fht', 'ifht']
@_dispatch
def fht(a, dln, mu, offset=0.0, bias=0.0):
"""fht multimethod."""... | [
{
"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 | scipy/fft/_fftlog_multimethods.py | FranzForstmayr/scipy |
import datetime
from typing import Any, Callable, List, Type, TypeVar, cast
import dateutil.parser
T = TypeVar("T")
def from_str(x: Any, nullable=False) -> str:
try:
assert isinstance(x, str)
except AssertionError as ex:
if nullable:
return from_none(x)
else:
... | [
{
"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 | ynab_sdk/utils/parsers.py | csadorf/ynab-sdk-python |
"""
Replace Emph elements with Strikeout elements
"""
from panflute import *
def action(elem, doc):
if isinstance(elem, Emph):
return Strikeout(*elem.content)
def main(doc=None):
return run_filter(action, doc=doc)
if __name__ == '__main__':
main()
| [
{
"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 | docs/source/_static/emph2strikeout.py | jacobwhall/panflute |
"""
21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists.
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solutio... | [
{
"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 | problem-21-merge-two-sorted-lists/mergetwo.py | starovp/leetcode-sols |
import trisicell as tsc
def binarym_filter_private_mutations(df):
df.drop(df.columns[df.sum() == 1], axis=1, inplace=True)
def binarym_filter_clonal_mutations(df):
x = (df == 1).sum()
x = x[x == df.shape[0]]
df.drop(x.index, axis=1, inplace=True)
def binarym_filter_nonsense_mutations(df, alt_in=2,... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | trisicell/pp/_binary.py | faridrashidi/trisicell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.