source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import shutil
json_file = "splitcores.json"
rbf_files = []
rbf_location = "/media/fat"
# fid all rbf files
print("Scanning {} for core files ...".format(rbf_location))
for root,d_names,f_names in os.walk(rbf_location):
for filename in f_names:... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | splitcores.py | christopher-roelofs/GameEventHub |
import os
import unittest
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.arm.base_resource_check import BaseResourceCheck
from checkov.arm.registry import arm_registry as registry
from checkov.arm.runner import Runner
from checkov.runner_filter import RunnerFilter
class ArmCheck(Ba... | [
{
"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 | tests/arm/checks/test_wildcard_entities.py | kylelaker/checkov |
from azure.cosmosdb.table.tableservice import TableService
from azure.cosmosdb.table.models import Entity
import uuid
class PhotoCollectionAzureTable:
_connectionstring = ''
def __init__(self, connectionstring):
self._connectionstring = connectionstring
def fetchall(self):
table_service ... | [
{
"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 | flaskgallery/models/photos_azuretable.py | davidrpk/FlaskGallery |
class Coin:
def __init__(self, name, value):
# Reorganized the order of the attributes. self.name first, then self.value.
self.name = name
self.value = value
# Reorganized the order of each coin so it goes from least valuable to most.
class Penny(Coin):
def __init__(self):
su... | [
{
"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 | dCC_Python_SodaMachine/coins.py | BA-CalderonMorales/repo_DebuggingProject |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from myanmar import converter
def test_uni2zgy_conversion():
try:
path = os.path.join(
os.path.dirname(__file__), 'data', 'uni2zgy-conversion.txt'
)
fil = open(path, 'r', encoding='utf-8')
except Exceptio... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_converter.py | laminko/python-myanmar |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from store.models import Product, Store, TimeStampedModel, Category
# Create your models here.
class Cart(TimeStampedModel):
user = models.ForeignKey(User, verbose_name=_("Customer"), nul... | [
{
"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 | cart/models.py | samaras/bytestore |
# this class is used to generate and send OTP to email and update OTP in the Database.
import math
import random
import smtplib
def generateOTP():
digits = "0123456789"
OTP = ""
for i in range(6):
OTP += digits[math.floor(random.random() * 10)]
return OTP
def sendMail(myDB, 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | hackathon_covid_19_Token_System_Server/SendVerificationEmail.py | Tech-Grave/safeus |
# -*- coding: utf8 -*-
# coding: utf8
from flask_restful import Resource, Api
from werkzeug.exceptions import HTTPException
from flask import request, send_file, json, Response
from __init__ import *
api = Api(app)
class JcNetwork(Resource):
def get(self):
return {
'code': 200,
'm... | [
{
"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 | app_run.py | iverson1234tw/jcnetwork-api |
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
def parse_gcn(i):
import facts.gcn as g
import facts.core as c
G = g.gcn_source(i)
F = c.workflows_for_input(dict(arg=G, arg_type=g.GCNText), output='dict')
logger.info(F)
for p, o in F.items():
pri... | [
{
"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_gcn.py | cdcihub/literature-to-facts |
import unittest
import behave2cucumber
import json
import os
BEHAVE_JSON = os.path.dirname(os.path.realpath(__file__)) + "/fixtures/behave.json"
EXPECTED_JSON = os.path.dirname(os.path.realpath(__file__)) + "/fixtures/expected.json"
AUTORETRY_BEHAVE_JSON = os.path.dirname(os.path.realpath(__file__)) + "/fixtures/autor... | [
{
"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 | tests/test.py | ones0318/behave2cucumber |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayItemGoodsList(object):
def __init__(self):
self._desc = None
self._goods_list = None
@property
def desc(self):
return self._desc
@desc.setter
def d... | [
{
"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 | alipay/aop/api/domain/AlipayItemGoodsList.py | snowxmas/alipay-sdk-python-all |
class MGDHCPSettings(object):
def __init__(self, session):
super(MGDHCPSettings, self).__init__()
self._session = session
def getNetworkCellularGatewaySettingsDhcp(self, networkId: str):
"""
**List common DHCP settings of MGs**
https://developer.cisco.com/meraki/api/... | [
{
"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 | meraki/api/mg_dhcp_settings.py | NoFliesOnYou/dashboard-api-python |
import asyncio
async def coro(delay: int):
try:
print(f"start sleeping for {delay}")
await asyncio.sleep(delay)
print(f"slept without disturbance for {delay}")
except asyncio.CancelledError:
print("sleep disturbed!!")
async def main():
loop = asyncio.get_running_loop()
... | [
{
"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 | echo/cancel_itp.py | infotraining-team/python-asyncio-2021-04-19 |
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
def recurhelper(nums,res,path,target,start):
if target==0:
res.append(path)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | 39-Combination-Sum/solution.py | Tanych/CodeTracking |
import argparse
import base64
import binascii
import json
import msgpack
import sys
__version__ = "0.0.1"
ACTION_VALIDATE = "validate"
ACTION_DECODE = "decode"
actions = (ACTION_DECODE, ACTION_VALIDATE)
parser = argparse.ArgumentParser(description='python msgpack native formatter %s' % __version__)
parser.add_argum... | [
{
"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 | python-msgpack/formatter.py | b1rdex/rdm-native-value-formatters |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import datetime
from flexget import plugin
from flexget.event import event
from flexget.utils.database import Session
log = logging.getLogger('est_movies_... | [
{
"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 | flexget/components/estimate_release/estimators/est_movies_bluray.py | metaMMA/Flexget |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free S... | [
{
"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 | ENV/lib/python3.5/site-packages/pyrogram/api/types/contacts/top_peers_not_modified.py | block1o1/CryptoPredicted |
from ..utils import Object
class CancelUploadFile(Object):
"""
Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined
Attributes:
ID (:obj:`str`): ``CancelUploadFile``
Args:
file_id (:obj:`int`):
... | [
{
"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 | pytglib/api/functions/cancel_upload_file.py | iTeam-co/pytglib |
from keepr.__main__ import run_application
from click.testing import CliRunner
import sys
sys.path.append('..')
def test_install_package():
runner = CliRunner()
result = runner.invoke(run_application, ['install', 'click'])
assert result.exit_code == 0
def test_install_package_req():
runner = CliRun... | [
{
"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 | keepr/tests/test_cli.py | Geek-ubaid/ShopKeepr |
#Embedded file name: ACEStream\Core\exceptions.pyo
class ACEStreamException(Exception):
def __init__(self, msg = None):
Exception.__init__(self, msg)
def __str__(self):
return str(self.__class__) + ': ' + Exception.__str__(self)
class OperationNotPossibleAtRuntimeException(ACEStreamExcepti... | [
{
"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 | acestream/ACEStream/Core/exceptions.py | GrandPaRPi/p2ptv-pi |
"""
warmup.py contains classes for warm up stream operations.
"""
import numpy as np
from iqt.feed.core.base import Stream, T
class WarmUp(Stream[T]):
"""A stream operator for warming up a given stream.
Parameters
----------
periods : int
Number of periods to warm up.
"""
def __ini... | [
{
"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 | iqt/feed/api/generic/warmup.py | yt7589/iching |
from flask import Response, request
from flask_jwt_extended import create_access_token
from database.models import User
from database.db import db
from flask_restful import Resource
from mongoengine.errors import FieldDoesNotExist, NotUniqueError, DoesNotExist, ValidationError
from resources.errors import SchemaValidat... | [
{
"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 | resources/auth.py | ericmtzmtz/OpinionEmpresas |
import requests
import threading
import re
enableips = []
class IsEnable(threading.Thread):
def __init__(self, ip):
super(IsEnable, self).__init__()
self.ip = ip
self.proxies = {
'http': 'http://%s' % ip
}
def run(self):
global enableips
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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | spiderAPI/proxyip.py | hedou/PythonCrawler |
#!/usr/bin/env python
def parseBags(lines: list) -> dict:
lines = [l.split(' contain ') for l in lines]
bags = {}
for line in lines:
outer = line[0][:line[0].index('bags') - 1]
inner = {}
if 'no other' not in line[1]:
for each in line[1].split(','):
each... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | 2020/day07-handy-haversacks/bags.py | rajitbanerjee/advent-of-code |
from enum import Enum, auto
class AutoName(Enum):
def _generate_next_value_(name: str, start, count, last_values): # type: ignore
return name.lower()
class Status(AutoName):
ONLINE = auto()
AWAY = auto()
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | gb_chat/msg/status.py | Cerzon/gb_chat |
from OpenGLCffi.GLX import params
@params(api='glx', prms=['dpy', 'config', 'width', 'height', 'attrib_list'])
def glXCreateGLXPbufferSGIX(dpy, config, width, height, attrib_list):
pass
@params(api='glx', prms=['dpy', 'pbuf'])
def glXDestroyGLXPbufferSGIX(dpy, pbuf):
pass
@params(api='glx', prms=['dpy', 'pbuf', '... | [
{
"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 | OpenGLCffi/GLX/EXT/SGIX/pbuffer.py | cydenix/OpenGLCffi |
# pylint: disable=missing-docstring
from os import path
import pytest
from fava.core.documents import is_document_or_import_file
from fava.core.documents import filepath_in_document_folder
from fava.helpers import FavaAPIException
def test_is_document_or_import_file(example_ledger):
example_ledger.fava_options... | [
{
"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/test_core_documents.py | prafullat/fava |
import unittest
import time
from vika import Vika
from . import TEST_TABLE, TEST_API_BASE, TEST_API_TOKEN
class TestCreateRecords(unittest.TestCase):
def setUp(self):
vika = Vika(TEST_API_TOKEN)
vika.set_api_base(TEST_API_BASE)
self.dst = vika.datasheet(TEST_TABLE)
def test_record_cre... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | test/test_create_records.py | Borye/vika.py |
from common import IssueProcess, Common
from typing import Any, List
import os
# assignee dict which will be assigned to handle issues
_GO_OWNER = {'ArcturusZhang'}
# 'github assignee': 'token'
_ASSIGNEE_TOKEN_GO = {'ArcturusZhang': os.getenv('AZURESDK_BOT_TOKEN')}
class IssueProcessGo(IssueProcess):
pass
cla... | [
{
"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 | scripts/release_helper/go.py | xolve/azure-sdk-for-python |
import random
from django.db import models
from django import forms
from staging.generators import BaseGenerator
class NotInitialized():
pass
class Generator(BaseGenerator):
name = 'Random choice'
slug = 'random-choice'
for_fields = [models.BigIntegerField, models.CharField, models.DecimalField, mod... | [
{
"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 | staging/generators/random_choice.py | Pyromanser/django-staging |
import os
from typing import Union
import click
from plantumlcli import LocalPlantuml
from .base import _check_plantuml, _click_exception_with_exit_code
def _additional_info_for_local(plantuml: LocalPlantuml, duration: float):
click.echo('Java executable : {path}'.format(path=os.path.abspath(plantuml.java)))
... | [
{
"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 | plantumlcli/entrance/local.py | cathiele/plantumlcli |
# Code for paper:
# [Title] - "PAN: Towards Fast Action Recognition via Learning Persistence of Appearance"
# [Author] - Can Zhang, Yuexian Zou, Guang Chen, Lei Gan
# [Github] - https://github.com/zhang-can/PAN-PyTorch
import numpy as np
def softmax(scores):
es = np.exp(scores - scores.max(axis=-1)[..., None])
... | [
{
"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 | PAN-PyTorch/ops/utils.py | Lill98/mmaction_custom_data |
"""
A Custom Runtime Interface for running Python code with Pypy on AWS Lambda
"""
import os
import json
import requests
import importlib
__author__ = "Ulrich Scheller"
__email__ = "mail@ulrich-scheller.de"
__website__ = "www.ulrich-scheller.de"
__status__ = "Prototype"
class RuntimeInterface(object):
def __init... | [
{
"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 | runtime_interface.py | uscheller/aws-lambda-runtime-pypy |
import os
from unittest import TestCase
from hubspot.client import Client
class FieldsTest(TestCase):
def setUp(self):
self.client = Client(os.environ.get('token'))
def test_get_fields(self):
_modules = ['deals', 'companies', 'contacts']
for _module in _modules:
result = se... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test_fields.py | lycanthropystudios/hubspot-python |
import numpy as np
import torch
def get_sinusoid_encoding_table(n_position, d_hid, padding_idx=None):
''' Sinusoid position encoding table '''
def cal_angle(position, hid_idx):
return position / np.power(10000, 2 * (hid_idx // 2) / d_hid)
def get_posi_angle_vec(position):
return [cal_ang... | [
{
"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 | src/onqg/utils/sinusoid.py | WING-NUS/RL-for-Question-Generation |
# Unsure majority of time but more correct then wrong when thinking of
# Requires more data for training
from data import *
from tkinter import *
from keras.models import load_model
import numpy as np
import threading
import time
# Time variables
start_wait = 10000
wait = 2100
# Set dimensions
w = 900
h = 556
root =... | [
{
"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 | data/live_predict.py | Zerwer/EEGMachineLearning |
################################################
# backend.py is part of COVID.codelongandpros.repl.co
# You should have recieved a copy of the three-clause BSD license.
# If you did not, it is located at:
# https://opensource.org/licenses/BSD-3-Clause
# Made by Scott Little, with help from StackOverflow
############... | [
{
"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 | backend.py | CodeLongAndProsper90/COVID |
import torch
from torch import nn
class Metric(nn.Module):
def __init__(self, name=None, **kwargs):
super().__init__()
self.name = name
self.reset_states()
def forward(self, *args, **kwargs):
raise NotImplementedError
def update_state(self):
raise ... | [
{
"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 | graphgallery/nn/metrics/pytorch/metric.py | TobiasSchmidtDE/GraphGallery |
from unittest import mock
from uuid import UUID
from carbonserver.api.infra.repositories.repository_projects import SqlAlchemyRepository
from carbonserver.api.schemas import Project, ProjectCreate
from carbonserver.api.services.project_service import ProjectService
PROJECT_ID = UUID("f52fe339-164d-4c2b-a8c0-f562dfce0... | [
{
"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 | carbonserver/tests/api/service/test_project_service.py | fvaleye/codecarbon |
from pymtl import *
from lizard.util.rtl.interface import Interface, UseInterface
from lizard.util.rtl.method import MethodSpec
from lizard.util.rtl.types import Array, canonicalize_type
from lizard.bitutil import clog2, clog2nz
class MuxInterface(Interface):
def __init__(s, dtype, nports):
s.Data = canonicali... | [
{
"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 | lizard/util/rtl/mux.py | cornell-brg/lizard |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from os import path as op
from .storage import KVStorage
__all__ = ['UnqliteKV']
__version__ = '0.5.1'
class UnqliteKV(object):
"""docstring for Unqlite"""
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(... | [
{
"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 | flask_unqlite/__init__.py | snakeego/flask-unqlite |
from os.path import abspath, dirname, join
from fnmatch import fnmatchcase
from operator import eq
from robot.api import logger
CURDIR = dirname(abspath(__file__))
def output_should_be(actual, expected, **replaced):
actual = _read_file(actual, 'Actual')
expected = _read_file(join(CURDIR, expected), 'Expect... | [
{
"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 | atest/robot/cli/console/expected_output/ExpectedOutputLibrary.py | phil-davis/robotframework |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
from jinja2 import Template
def gen_tensorflow_client_string(generated_tensor_data, model_name):
"""
Generate TensorFlow SDK in Bash.
Args:
generated_tensor_data: Examp... | [
{
"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 | simple_tensorflow_serving/gen_client/gen_bash.py | jnclt/simple_tensorflow_serving |
# Copyright 2020 Thomas Rogers
# SPDX-License-Identifier: Apache-2.0
import os.path
try:
import pkg_resources
def find_resource(name: str):
return pkg_resources.resource_filename(
__name__, os.path.join("resources", name)
)
except ImportError:
def find_resource(name: str):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | bloom/__init__.py | thomasrogers03/bloom |
import os
import subprocess
from charms import layer
from charms.reactive import hook, when_not, remove_state, set_state
from charmhelpers.core.templating import render
@hook('upgrade-charm')
def upgrade_charm():
remove_state('cdk-service-kicker.installed')
@when_not('cdk-service-kicker.installed')
def install_... | [
{
"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/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-kubernetes-master-0/charm/reactive/cdk_service_kicker.py | KellenRenshaw/hotsos |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.base import ConfigurationError
from datadog_checks.mcache.mcache import InvalidConfigError
from .common import HOST, PORT, SERVICE_CHECK
def test_bad_config(check):
"""
... | [
{
"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 | mcache/tests/test_check.py | glasser/integrations-core |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [
{
"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 | tests/serializer/test_serializer_json.py | islavov/tchannel-python |
from absl import logging
import tornado.ioloop
from tornado import queues
import tornado.web
from icubam.db import sqlite
from icubam.messaging import sms_sender
from icubam.messaging import scheduler
from icubam.www import token
class MessageServer:
"""Sends and schedule SMS."""
def __init__(self, config, port=... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | icubam/messaging/server.py | Deathn0t/icubam |
from allocation.allocator import Server, App, Allocator
s1 = Server(32, 16, 1000, name="s1")
s2 = Server(32, 16, 1000, name="s2")
def test_allocate_tasks_servers_single_server_task():
_a = App(12, 12, 500)
alloc = Allocator([s1], [_a])
res = alloc.allocate()
expected = [
{
"node"... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_allocator.py | genged/serverallocator |
import poplib
from ...utils import Timer
class EmailChecker(Timer):
'''WARNING: This uses POP3 and by default deletes the emails it reads!'''
username = None
password = None
server = None
port = None
on_mail = None
delete = None
def __init__(self, username, password, server, port=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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | discooord/extras/examples/email.py | TehBigA/discooord |
# Copyright 2014 OpenStack Foundation
# Copyright 2015 Chuck Fouts
# 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/L... | [
{
"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 | manilaclient/v1/share_type_access.py | Murray-LIANG/python-manilaclient |
"""
Position feed-forward network from "Attention is All You Need"
"""
import torch.nn as nn
import onmt
from onmt.modules.hyperbolic import cLinear
class PositionwiseFeedForward_h(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of i... | [
{
"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 | retroprime/transformer_model/onmt/modules/position_ffn_h.py | wangxr0526/RetroPrime |
import unittest
from credential import Credential
class TestUser(unittest.TestCase):
"""
Test class defining the user credentials
"""
# noinspection PyTypeChecker
def setUp(self) -> object:
"""
Setup method that runs before each test case
"""
self.new_credential = ... | [
{
"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 | credential-test.py | TheCaffeine/password-locker |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | aliyun-python-sdk-ccc/aliyunsdkccc/request/v20170705/GetUserByExtensionRequest.py | ankitdobhal/aliyun-openapi-python-sdk |
"""
eZmax API Definition (Full)
This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501
The version of the OpenAPI document: 1.1.7
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import eZmaxApi
from... | [
{
"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 | test/test_ezsignsigner_response_compound_contact.py | ezmaxinc/eZmax-SDK-python |
# -*- coding: utf-8 -*-
from django.db.models.fields import CharField
from ..forms.fields import TimeZoneInputField
class TimeZoneField(CharField):
"""
A relatively dynamic TimeZone field for Django models.
"""
def __init__(self, *args, **kwargs):
# Note, as of this writing, the max length of... | [
{
"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 | pytz_timezone_field/models/fields.py | mkoistinen/django-pytz-timezone-field |
#!/usr/bin/env python
from __future__ import print_function
from datetime import datetime
from subprocess import call
from mercury206 import commands, communications, config
def update_rrd(path, values):
value = ':'.join(['N'] + map(str, values))
call(['rrdtool', 'update', path, value])
print("Updated"... | [
{
"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 | hard-gists/7ceb3e7ef239e282a9d2/snippet.py | jjhenkel/dockerizeme |
"""
Transforms of aocd raw input text to something more useful for speed-solving.
Every function here needs to accept one positional argument and return the
'massaged' data.
"""
__all__ = ["lines", "numbers"]
def lines(data):
return data.splitlines()
def numbers(data):
return [int(n) for n in data.splitlin... | [
{
"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 | aocd/transforms.py | azuline/advent-of-code-data |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"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 | isi_sdk_8_2_0/test/test_settings_krb5_realms.py | mohitjain97/isilon_sdk_python |
import pytest
from mock import Mock
from dbnd._core.constants import UpdateSource
from dbnd._core.tracking.airflow_dag_inplace_tracking import (
AirflowOperatorRuntimeTask,
AirflowTaskContext,
build_run_time_airflow_task,
)
def af_context_w_context():
task_instance = Mock()
task = Mock()
tas... | [
{
"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 | modules/dbnd/test_dbnd/tracking/test_airflow_dag_inplace_tracking.py | kalebinn/dbnd |
import logging
import multiprocessing
from multiprocessing import Queue
LOG = logging.getLogger('octopus')
class ProcessQueue:
__instance = None
def __new__(cls, *args, **kwargs):
if cls.__instance:
return cls.__instance
else:
obj = super().__new__(cls, *args, **kwarg... | [
{
"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 | octopus/process/process_queue.py | parker-pu/octopus |
# -*- coding: utf-8 -*-
"""Implements a simple wrapper around urlopen."""
from pytube.compat import urlopen
from urllib.request import Request
def get(
url=None, headers=False,
streaming=False, chunk_size=8 * 1024,
):
"""Send an http GET request.
:param str url:
The URL to perform the GET requ... | [
{
"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 | pytube/request.py | YoilyL/pytube |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | [
{
"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 | test/test_get_xrp_ripple_transaction_details_by_transaction_ide401.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python |
import threading
import sys
class ThreadHandler(object):
def __init__(self, name, callable, *args, **kwargs):
# Set up exception handling
self.exception = None
def wrapper(*args, **kwargs):
try:
callable(*args, **kwargs)
except BaseException:
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | eggs/Fabric-1.4.2-py2.7.egg/fabric/thread_handling.py | bopopescu/phyG |
import unittest
import json
import pkg_resources
from spacenet.schemas.hello_world import HelloWorld
from pydantic import ValidationError
class TestHelloWorld(unittest.TestCase):
def test_good_data(self):
good_data = { "message": "Hello World" }
hello = HelloWorld(**good_data)
self.assertE... | [
{
"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 | spacenet/test/test_hello_world.py | Adrian-2002/spacenet |
import pygame
import math
import glob
import os
tilesize = 128 # pixels per tile
def tiletosurface(tile):
pass
def maptosurface(sx,sy,ex,ey,oholmap):
pass
def main(windowsize,tilepipe,OHOLMap):
wt = math.floor(windowsize/tilesize)
cx,cy,first = 0,0,True
if OHOLMap.data != {}:
for x in OHOL... | [
{
"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 | interactive_map.py | webmsgr/OneLifeMapper |
#
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
T = TypeVar('T', bound='EBSRestoreSourceV1')
class EBSRestoreSourceV1:
"""Implementation of the 'EBSRestoreSourceV1' model.
The EBS volume backup to be restored.
Attributes:
backup_id:
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | clumioapi/models/ebs_restore_source_v1.py | clumio-code/clumio-python-sdk |
#
# Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
#
# This file is part of pyd7a.
# See https://github.com/Sub-IoT/pyd7a for further info.
#
# 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 Lice... | [
{
"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 | d7a/alp/operands/indirect_interface_operand.py | L-I-Am/pyd7a |
from django.db import models
from django.contrib.auth.models import AbstractUser
from sellshop.utils.base_models import BaseModel
class Contact(BaseModel):
name = models.CharField(verbose_name="Name", max_length=50)
email = models.EmailField(verbose_name="Email",
null=False, blan... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | sellshop/user/models.py | TalehIlqar/E-commerce |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
'''Allow user to edit their own profile '''
def has_object_permission(self, request, view, obj):
'''Check user is trying to edit their own profile '''
if request.method in permissions.SAFE_METHODS: # e.... | [
{
"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 | profiles_api/permissions.py | erickoziel/profiles-rest-api |
"""
urlresolver XBMC Addon
Copyright (C) 2012 Bstrdsmkr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.... | [
{
"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 | script.mrknow.urlresolver/lib/urlresolver9/plugins/movdivx.py | mrknow/filmkodi |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Contains WithLastComment mixin.
This defines logic to get fields of the last Comment over all
Comments of object.
"""
from ggrc.fulltext import attributes
from ggrc.builder import simple_property
from g... | [
{
"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/ggrc/models/mixins/with_last_comment.py | pbedn/ggrc-core |
# -*- coding: utf-8 -*-
from flask import url_for, request, session
from oleander import app
from gdata.client import Unauthorized as UnauthorizedError
from gdata.gauth import OAuth2Token, Error as ConnectionError, token_to_blob, token_from_blob
from gdata.contacts.client import ContactsClient
from gdata.calendar.cli... | [
{
"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 | oleander/google.py | honzajavorek/oleander |
"""
Basic unit tests for the parser class.
"""
import unittest
from eta.parser import parser
from eta.types import Symbol
from lark.visitors import VisitError
class ParserTest(unittest.TestCase):
def test_basic_expressions(self):
try:
parser.parse("(defun (foo x y) (+ x y))")
pars... | [
{
"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 | eta/t/test_parser.py | lewismj/eta |
import json
import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import words
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
def normalizeUrl(url):
idx = url.find('url=')
url = url[idx+4:]
url = url.replace('%3A', ':')
url = url.replace('%2F', '/')
idx = ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | 3. search_service/mission6/robot/utility.py | yusenjeng/amazon_crawler |
from smartva.rules import fires_child as fires
from smartva.data.constants import *
VA = Child
def test_pass():
row = {
VA.BURN: YES,
VA.INJURY_DAYS: 0,
}
assert fires.logic_rule(row) is True
def test_fail_fires():
row = {
VA.BURN: NO,
VA.INJURY_DAYS: 0,
}
... | [
{
"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 | test/rules/test_fires_child.py | rileyhazard/SmartVA-Analyze-1 |
from flask import Blueprint, current_app
from library_registry.decorators import (
returns_problem_detail,
)
libr = Blueprint('libr', __name__)
@libr.route("/register", methods=["GET", "POST"])
@returns_problem_detail
def register():
return current_app.library_registry.registry_controller.register()
@libr.r... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | library_registry/library_registration_protocol/routes.py | NYPL-Simplified/library-registry |
import numpy as np
class SelfishAgent(object):
def __init__(self, T):
self.T = T
self.policy = np.asarray([
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 2, 2, 0, 0, 0, 0, 0, 0],
[2, 1, 2, 2, 2, 0, 0, 0, 0],
[2, 2, 1, 2, 2, 2, 0, 0, 0],
[2, 2, 2, 1... | [
{
"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 | proof_of_work/multiagent/turn_based/v4/selfishagentv4.py | michaelneuder/parkes_lab_fa19 |
# RUN: %PYTHON %s | FileCheck %s
import gc
import mlir
def run(f):
print("\nTEST:", f.__name__)
f()
gc.collect()
assert mlir.ir.Context._get_live_count() == 0
# CHECK-LABEL: TEST: testUnknown
def testUnknown():
ctx = mlir.ir.Context()
loc = ctx.get_unknown_location()
assert loc.context is ctx
ctx = ... | [
{
"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 | mlir/test/Bindings/Python/ir_location.py | hanzhan1/llvm |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import os
import random
from . import BaseWrapperDataset
from fairseq.data import data_utils
class ShardedDataset(BaseWrap... | [
{
"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 | fairseq/data/sharded_dataset.py | IIP-Sogang/Audio-Visual-Speech-Recognition |
"""ThreatConnect TI Address"""
from ..indicator import Indicator
class Address(Indicator):
"""Unique API calls for Address API Endpoints"""
def __init__(self, tcex, **kwargs):
"""Initialize Class Properties.
Args:
ip (str): The value for this Indicator.
active (bool, ... | [
{
"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 | tcex/threat_intelligence/mappings/indicator/indicator_types/address.py | kdeltared/tcex |
import pytest
from selenium import webdriver
from model.application import Application
def pytest_addoption(parser):
parser.addoption("--browser", action="store", default="firefox", help="browser type")
parser.addoption("--base_url", action="store", default="http://localhost:9080/php4dvd/", help="base URL")
... | [
{
"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 | php4dvd/conftest.py | sargm/selenium-py-traning-barancev |
'''
@author: Dallas Fraser
@id: 20652186
@class: CS686
@date: 2016-04-02
@note: contains a function to create the networkx graphs
'''
import logging
class GraphNode():
index = 0
count = 0
def __init__(self, color=None, index=None, logger=None):
if logger is None:
logging.basicConfig(l... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | inducer/graph/graph_node.py | fras2560/InducedSubgraph |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | [
{
"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 | scripts/optimize_tf_dialect.py | OliverScherf/mlir-emitc |
from netmiko import ConnectHandler
import yaml
from pprint import pprint
def send_show_command(device, show_command):
with ConnectHandler(**device) as ssh:
ssh.enable()
result = ssh.send_command(show_command)
return result
def send_config_commands(device, config_commands):
with ConnectHa... | [
{
"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 | decorator/send_commands_netmiko.py | levs72/pyneng-examples |
from __future__ import absolute_import
import sys
from sentry_sdk.hub import Hub
from sentry_sdk.integrations import Integration
from sentry_sdk.scope import add_global_event_processor
if False:
from typing import Any
from typing import Dict
class ArgvIntegration(Integration):
identifier = "argv"
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | sentry_sdk/integrations/argv.py | Siecje/sentry-python |
import wx
from . import UIManager
from . import UIControllerObject
from . import UIViewObject
from . import MainWindowController
class ToolBarController(UIControllerObject):
tid = 'toolbar_controller'
_singleton_per_parent = True
_ATTRIBUTES = {
'id': {'default_value': wx.ID_ANY,
... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | tool_bar.py | adrianopls/UIManager |
from bitcoinb58 import b58decode, b58encode
from hashlib import sha256
import hashlib
import binascii
def dblsha(b):
return sha256(sha256(b).digest()).digest()
def ripemd160(inp):
h = hashlib.new('ripemd160')
h.update(inp)
return h.digest()
WitnessMagic = b'\xaa\x21\xa9\xed'
def _Address2PKH(add... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | connectrum/script.py | SKlayer/connectrum |
import numpy as np
from .regions import Regions
class SplitRegions:
def __init__(self, regions, offsets):
self._regions = regions
self._offsets = offsets
def get_signals(self, bedgraph):
signals = bedgraph.extract_regions(self._regions)
return signals.join_rows(self._offsets)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | bdgtools/splitregions.py | knutdrand/bdgtools |
import os.path
import tempfile
import unittest
from unittest import mock
def rm(filename):
os.remove(filename)
class RmTestCase(unittest.TestCase):
@mock.patch('__main__.os')
def test_rm(self, mock_os):
rm('/tmp/tmpfile')
mock_os.remove.assert_called_with('/tmp/tmpfile')
if __name__ =... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | unit_test/mock_rm.py | leehosung/pycon-testing |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'button_editor.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObj... | [
{
"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 | storm_control/hal4000/illumination/button_editor_ui.py | shiwei23/STORM6 |
import boto
from pyftpdlib.authorizers import DummyAuthorizer, AuthenticationFailed
class S3Authorizer(DummyAuthorizer):
def __init__(self, *args, **kwargs):
DummyAuthorizer.__init__(self, *args, **kwargs)
self.conn = None
def validate_authentication(self, aws_access_key_id, aws_secret_access_... | [
{
"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 | ftp_s3/S3Authorizer.py | avacariu/ftp-s3 |
"""
Socket.io/Engine.io protocol constructs
"""
PAYLOAD_STRING = const(0)
PAYLOAD_BINARY = const(1)
PACKET_OPEN = const(0)
PACKET_CLOSE = const(1)
PACKET_PING = const(2)
PACKET_PONG = const(3)
PACKET_MESSAGE = const(4)
PACKET_UPGRADE = const(5)
PACKET_NOOP = const(6)
MESSAGE_CONNECT = const(0)
MESSAGE_DISCONNECT = c... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | usocketio/protocol.py | eliclement/uwebsockets |
def distinct_values_bt(bin_tree):
"""Find distinct values in a binary tree."""
distinct = {}
result = []
def _walk(node=None):
if node is None:
return
if node.left is not None:
_walk(node.left)
if distinct.get(node.val):
distinct[node.val] =... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | interviews/distinct_bt/distinct_bt.py | zarkle/data-structures-and-algorithms |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.ans = 0
def maxDepth_bottom_up(self, root: TreeNode) -> int:
if root == None:
return 0
return max((self.... | [
{
"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 | recursion/0104_maximum_depth_of_binary_tree.py | MartinMa28/Algorithms_review |
# coding: utf-8
"""
Kimai 2 - API Docs
JSON API for the Kimai 2 time-tracking software. Read more about its usage in the [API documentation](https://www.kimai.org/documentation/rest-api.html) and then download a [Swagger file](doc.json) for import e.g. in Postman. Be aware: it is not yet considered stable 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | test/test_activity_rate_form.py | MPW1412/kimai-python |
# Abstract Factory Pattern
from abc import ABCMeta, abstractmethod
import random
class AbstractProductX(metaclass=ABCMeta):
@abstractmethod
def get_description(self) -> None:
pass
class AbstractProductY(metaclass=ABCMeta):
@abstractmethod
def get_description(self) -> None:
pass
cl... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | Creational/abstract_factory.py | ofl/design-patterns-for-humans-python |
import json, os
from threading import Thread
from tornado.ioloop import IOLoop
import tornado.web
from hbi.model import Host, Filter
from hbi.server import Service
class RootHandler(tornado.web.RequestHandler):
def get(self):
self.write("boop")
class EntitiesPoster(tornado.web.RequestHandler):
d... | [
{
"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 | hbi/server/tornado_server.py | Glutexo/host-inventory |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "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 | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/jdccs/apis/LastDownsampleRequest.py | Ureimu/weather-robot |
from utils.color import *
from active_projects.eop.reusables.eop_constants import *
def binary(i):
# returns an array of 0s and 1s
if i == 0:
return []
j = i
binary_array = []
while j > 0:
jj = j / 2
if jj > 0:
binary_array.append(j % 2)
else:
... | [
{
"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 | from_3b1b/on_hold/eop/reusables/eop_helpers.py | Tarang74/manim |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.