source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.db import transaction
class atomic_if_using_transaction:
"""Context manager wraps `atomic` if `using_transactions`.
Replaces code::
if using_transactions:
with transaction.atomic(using=using):
return something()
return something()
"""
def __ini... | [
{
"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 | import_export/utils.py | marksweb/django-import-export |
from __future__ import absolute_import
import pickle
import datetime
from django.test import TestCase
from .models import Group, Event, Happening
class PickleabilityTestCase(TestCase):
def assert_pickles(self, qs):
self.assertEqual(list(pickle.loads(pickle.dumps(qs))), list(qs))
def test_related_f... | [
{
"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 | AppServer/lib/django-1.4/tests/regressiontests/queryset_pickle/tests.py | loftwah/appscale |
import os
import subprocess
import re
import sys
import shutil
import siliconcompiler
####################################################################
# Make Docs
####################################################################
def make_docs():
'''
The OpenFPGALoader is a universal utility for program... | [
{
"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 | siliconcompiler/tools/openfpgaloader/openfpgaloader.py | hohe/siliconcompiler |
"""Base DebugPanel class"""
class DebugPanel(object):
"""
Base class for debug panels.
"""
# name = Base
has_content = False # If content returns something, set to true in subclass
# Panel methods
def __init__(self):
pass
def dom_id(self):
return 'djDebug%sPanel' % (se... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | debug_toolbar/panels/__init__.py | paltman/django-debug-toolbar |
from decimal import Decimal
from pytest import raises
from typedpy import Structure, Positive, DecimalNumber
class PositiveDecimal(DecimalNumber, Positive): pass
class Foo(Structure):
_required = []
a = DecimalNumber
b = DecimalNumber(maximum=100, multiplesOf=5)
c = PositiveDecimal
def test_not_... | [
{
"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 | tests/test_decimal.py | reesmanp/typedpy |
# import tensorflow as tf
from onnx_darknet.handlers.backend_handler import BackendHandler
from onnx_darknet.handlers.handler import onnx_op
@onnx_op("HardSigmoid")
class HardSigmoid(BackendHandler):
@classmethod
def _common(cls, node, **kwargs):
x = kwargs["tensor_dict"][node.inputs[0]]
if "alpha" not ... | [
{
"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 | onnx_darknet/handlers/backend/hard_sigmoid.py | minhoolee/onnx-darknet |
from random import randint
from time import sleep
def sorteia(lista):
print('=-=' * 15)
for c in range(0, 5):
lista.append(randint(1, 10))
print('Sorteando 5 valores da lista: ', end=' ')
for c in lista:
print(f'{c}', end=' ', flush=True)
sleep(0.3)
print()
def somapar(li... | [
{
"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 | ex100.py | arthurfas123/Curso-De-Python |
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | modules/demo/ipc/graph/fa2.py | mzegar/node-rapids |
"""
Test that the build parameters for external modules with dependencies are computed correctly.
"""
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load("//:providers.bzl", "HaxeLibraryInfo")
load("//:utils.bzl", "determine_source_root")
def _haxe_executable_dependency_test_impl(ctx):
... | [
{
"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 | test/haxe_executable_dependency.bzl | kigero/rules_haxe |
from tuprolog import logger
from tuprolog.solve.flags import DEFAULT_FLAG_STORE, FlagStore
from tuprolog.solve.library import libraries, Libraries
from tuprolog.solve.channel import InputChannel, OutputChannel, std_out, std_in, std_err, warn
from tuprolog.theory import theory, mutable_theory, Theory
from tuprolog.solve... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | tuprolog/solve/prolog/__init__.py | DavideEva/2ppy |
import pytest
from aries_cloudagent.core.protocol_registry import ProtocolRegistry
from aries_cloudagent.messaging.base_handler import HandlerException
from aries_cloudagent.messaging.request_context import RequestContext
from aries_cloudagent.messaging.responder import MockResponder
from ...handlers.query_handler im... | [
{
"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 | aries_cloudagent/protocols/discovery/v1_0/handlers/tests/test_query_handler.py | msembinelli/aries-cloudagent-python |
from discord.ext import commands
import os
import traceback
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_command_error(ctx, error):
orig_error = getattr(error, "original", error)
error_msg = ''.join(traceback.TracebackException.from_exception(orig_err... | [
{
"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 | discordbot.py | saikenhou/discordpy-startup |
def fibonacci_numbers_recursion(n):
result = 0
if n == 0:
return result
elif n == 1:
result = 1
return result
else:
result = fibonacci_numbers_recursion(n-1) + fibonacci_numbers_recursion(n-2)
return result
def fibonacci_numbers_iteration(n):
f0, f1 = 0, 1
... | [
{
"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 | Math-tasks/4-FibonacciNumbers.py | YunaAnn/LearningPython |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import os
import pytest
import nump... | [
{
"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 | tests/test_skimp.py | KSaiRahul21/matrixprofile |
import pytest
import sdk_install as install
import sdk_utils as utils
from tests.config import (
PACKAGE_NAME,
DEFAULT_TASK_COUNT
)
def setup_module(module):
install.uninstall(PACKAGE_NAME)
utils.gc_frameworks()
options = {
"service": {
"specification_uri": "https://gist.gith... | [
{
"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 | frameworks/prototype/tests/test_sanity.py | krisis/dcos-commons |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | aliyun-python-sdk-edas/aliyunsdkedas/request/v20170801/GetSubAccountInfoRequest.py | ankitdobhal/aliyun-openapi-python-sdk |
import numpy as np
from modules.imageRW import Image
from typing import Iterator, Optional, List
from __future__ import annotations
class InputException(Exception):
pass
def mean(images: Iterator[Image], group_size: int) -> Iterator[Image|None]:
stackImage: Image|None = None
while True:
try:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | modules/algo.py | Davidyz/AutoStacker |
from django.conf import settings
import requests
def get_headers(access_token):
"""
Build the headers for each authorised request
"""
return {
'Authorization': 'Bearer %s' % access_token,
'Content-Type': 'application/json',
'Accept': 'application/json'
}
def get_user_with... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | buildpackage/utils.py | sfdcale/packagebuilder |
import json
class KeyboardButton:
def __init__(self, button_type: str, payload: dict):
self.type = button_type
self.payload = payload
def get_vk_repr(self):
kb_d = self.__dict__
kb_d['payload'] = json.dumps(self.payload)
color = kb_d.pop('color', None)
vk_dic... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | bot/keyboard.py | cyber-chuvash/garohbot |
import discord
from discord.ext import commands
import json
gamertags = 'gamer_tags.json'
class Gamertag(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def newtag(self, ctx):
with open(gamertags, 'r') as in_file:
data = json.load(in_file)
... | [
{
"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 | cogs/gamertag.py | GeorgeD88/Insomniac |
from pypy.translator.backendopt import graphanalyze
from pypy.rpython.lltypesystem import lltype
class FinalizerError(Exception):
""" __del__ marked as lightweight finalizer, but the analyzer did
not agree
"""
class FinalizerAnalyzer(graphanalyze.BoolGraphAnalyzer):
""" Analyzer that determines wheth... | [
{
"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 | pypy/translator/backendopt/finalizer.py | benoitc/pypy |
# Copyright 2017 Stefan Richthofer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | tests/testhelpers/override_testhelper_err2.py | dbarnett/pytypes |
import numpy as np
from gym_wmgds import utils
from gym_wmgds.envs.mujoco import mujoco_env
class AntEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
mujoco_env.MujocoEnv.__init__(self, 'ant.xml', 5)
utils.EzPickle.__init__(self)
def step(self, a):
xposbefore = self.get_b... | [
{
"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 | gym_wmgds/envs/mujoco/ant.py | ozcell/gym_wmgds_ma |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import logging
import psutil
from . import UI
from .. import event
logger = logging.getLogger(__name__)
def flush_stdin():
try:
import termios # linux
termios.tcflush(sys.stdin, termios.TCIOFLUSH)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true... | 3 | ransomcare/user_interfaces/console.py | Happyholic1203/ransomcare |
from flask import url_for
# to run test
# docker-compose exec website py.test siapp/tests
# to check code coverage
# docker-compose exec website py.test --conv-report term-missing --cov siapp
# running static code analysis
# docker-compose exec website flake8 . --exclude __init__.py
# or docker-compose 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | siapp/tests/static_pages/test_vews.py | saidulislam/siapp-python-crud-template |
def read_user(string):
""" str -> dict """
parts = string.split()
d = {'first': parts[0],
'last': parts[1],
'custId': parts[3],
'username': parts[5],
'password': parts[7]}
return (d)
def read_users(string):
""" str -> list[dict] """
user_strings = string.spl... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | exercises/python_tests/practice.py | JSBCCA/pythoncode |
# coding: utf-8
"""
Copyright 2017 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | test/test_v1_update_modifier_list_request_selection_type.py | shaminmeerankutty/connect-python-sdk |
import discord
from dataclasses import dataclass
@dataclass
class FakeAvatar:
url: str
class FakeUser(discord.Object):
@property
def avatar(self):
return FakeAvatar("https://cdn.discordapp.com/embed/avatars/0.png")
@property
def mention(self):
return f"<@{self.id}>"
@prope... | [
{
"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 | refs/utils.py | muhfahmir/Discord-Bot-GUI |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from contrib.media_router_benchmarks import media_router_cpu_memory_metric
from telemetry.page import legacy_page_test
class MediaRouterCPUMemoryTest(legac... | [
{
"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 | tools/perf/contrib/media_router_benchmarks/media_router_measurements.py | sarang-apps/darshan_browser |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"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 | lib/logs.py | jakerogerz/glazier |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
import inspect
from textwrap import dedent
from typing import Dict, Text, List, Tuple, Type, Sequence, Any
import numpy as np # type... | [
{
"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 | onnx/backend/test/case/base.py | cnheider/onnx |
from contextlib import contextmanager
from unittest import mock
import pytest
from zulu import Timer
parametrize = pytest.mark.parametrize
@contextmanager
def mock_time(epoch):
with mock.patch("time.time", return_value=epoch):
yield
def test_timer_timing():
timer = Timer()
assert timer.stop... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_timer.py | dgilland/zulu |
def load_file(net, filename):
import StringIO
f = open(filename, 'r')
buff = StringIO.StringIO(f.read())
f.close()
net.load_tsv_to_net(buff)
def load_tsv_to_net(net, file_buffer):
import pandas as pd
import categories
lines = file_buffer.getvalue().split('\n')
num_labels = categories.check_categorie... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | clustergrammer/upload_pages/clustergrammer/load_data.py | delosrogers/clustergrammer-web |
#
# Solution to Project Euler problem 231
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import eulerlib
def compute():
N = 20000000
K = 15000000
smallestprimefactor = eulerlib.list_smallest_prime... | [
{
"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 | solutions/p231.py | xianlinfeng/project_euler_python3 |
from blacksheep.server.authorization import auth
from blacksheep.server.controllers import ApiController, post
from domain import Roles
from domain.blobs import BlobsHandler, InitializeUploadInput, InitializeUploadOutput
class BlobsController(ApiController):
def __init__(self, manager: BlobsHandler) -> None:
... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | server/app/controllers/blobs.py | Neoteroi/Torino |
from swift.ipvl.inspect_custom import whoami, whosdaddy
pass # (WIS) print __name__
class StaticLargeObject(object):
"""docstring for StaticLargeObject"""
def __init__(self, app, conf):
pass # (WIS) print "%s %s (%s -> %s)" % (__name__, self.__class__.__name__, whosdaddy(), whoami())
self.... | [
{
"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 | swift/common/middleware/slo.py | IPVL/swift_test |
#
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | voltha/core/config/config_branch.py | Balaji-P/voltha_docker_compose-rsk_tech_CKAD |
def div(func):
def wrapper(*args, **kwargs):
return '<div>'+func(*args, **kwargs)+'</div>'
return wrapper
def article(func):
def wrapper(*args, **kwargs):
return '<article>'+func(*args, **kwargs)+'</article>'
return wrapper
def p(func):
def wrapper(*args, **kwargs):
retur... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | html_decorators.py | ingenio-se/challenge-python-04 |
from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.data.tokenizers import WordTokenizer
from allennlp.models import Model
from allennlp.service.predictors.predictor import Predictor
@Predictor.register('crf-tagger')
class CrfTagge... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | allennlp/service/predictors/crf_tagger.py | pmulcaire/allennlp |
# BSD 3-Clause License
#
# Copyright (c) 2019, Augmented Design Lab
# All rights reserved.
import copy
import random
import time
from agent import Agent
from landscape import Landscape
from lot import Lot
import gc
class Simulation:
def __init__(self, size=200, r1=3, r2=5, r3=10, r4=10, load_filename=None):
self.l... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/simulation.py | julinas/town-sim-py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/4 18:48
# @Author : DaiPuWei
# E-Mail : 771830171@qq.com
# blog : https://blog.csdn.net/qq_30091945
# @Site : 中国民航大学北教25实验室506
# @File : Other.py
# @Software: PyCharm
import pandas as pd
import numpy as np
def Merge(data,row,... | [
{
"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 | Chapter4/Other.py | Daipuwei/Introduction-to-Machine-Learning-Based-on-Mathematical-Principles-with-Python |
#!/usr/bin/env python3
"""PyBluez simple example asyncronous-inquiry.py
Demonstration of how to do asynchronous device discovery by subclassing
the DeviceDiscoverer class
Linux only (5/5/2006)
Author: Albert Huang <albert@csail.mit.edu>
$Id: asynchronous-inquiry.py 405 2006-05-06 00:39:50Z albert $
"""
import select... | [
{
"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 | ThirdParty/pybluez2-macos_fix/examples/simple/asynchronous-inquiry.py | zhaocy14/SmartWalker |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from PySide2.QtCore import QObject, Slot, Signal
from PySide2.QtQml import QQmlApplicationEngine
class CaptchaDialog(QObject):
showWindowCaptcha = Signal(str)
def __init__(self, parent, log=None):
super(CaptchaDialog, self).__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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | scihubeva/captcha_dialog.py | jmuelbert/SciHubEVA |
import re
import ctypes
import math
from optparse import OptionParser
from Bytewriter import Bytewriter
class Label:
def __init__(self, name):
self.name = name
self.raw_lines = []
def push_line(self, line):
# print(self.name)
tokens = line.split()
# print(tokens)
parser = OptionParser()
(options, args) = ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | src/assembler/assembler.py | nickwanninger/stack-vm-in-c |
import os
from pickle import TRUE
from flask import config
class Config:
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://moringa:1234@localhost/blogs'
SECRET_KEY = 'SECRET_KEY'
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOADED_PHOTOS_DEST ='app/static/photos'
MAIL_SERVER = 'smtp.googlemail.com'
... | [
{
"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 | config.py | melodytowett/personal-blog |
# 归并排序
class Solution:
def MergeSort(self, arrayList):
arrayLen = len(arrayList)
# 判断输入参数的正确性
if arrayLen < 1:
return []
# 归并的出口是当分解到长度为1的时候
if arrayLen == 1:
return arrayList
# 获取中间索引值
middleIndex = arrayLen >> 1
# 递归左边部分
... | [
{
"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 | 数据结构/NowCode/A6_MergeSort.py | Blankwhiter/LearningNotes |
class ArchConfigurator(object):
def __init(self, arch_build, arch):
self.arch = arch
self.arch_build = arch_build
def configure(self, params):
params["settings"]["arch_build"] = self.arch_build
params["settings"]["arch"] = self.arch
return params
| [
{
"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 | conan_build_tool/Configurators/ArchConfigurator.py | Av3m/conan_build_tools |
from setuptools import setup, find_packages
import os
import re
def resolve_requirements(file):
requirements = []
with open(file) as f:
req = f.read().splitlines()
for r in req:
if r.startswith("-r"):
requirements += resolve_requirements(
os.path... | [
{
"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 | setup.py | mibaumgartner/hackathon_health |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from builtins import _test_sink, _test_source
def bar():
return _test_source()
def qux(arg):
_test_sink(arg)
def bad(ok, arg):... | [
{
"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 | source/interprocedural_analyses/taint/test/integration/source_sink_flow.py | joehendrix/pyre-check |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1MaVUQornaqYo14VFYrES8voRoUyu5Yzyn_babylon(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = 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 | tests/storage/cases/test_KT1MaVUQornaqYo14VFYrES8voRoUyu5Yzyn_babylon.py | juztin/pytezos-1 |
from .interface import TableDDl
from lib.db.ddl import mysql
class Table(TableDDl):
def __init__(self, table_name, content_name, keyid, suffix='words'):
self._tableName = table_name + '_' + content_name + '_' + suffix
self._keyid = keyid
self.DDLTable = None # type: mysql.DDLBuild
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | lib/tool/table_ddl/split_to_words.py | auho/python-ETL |
from torch.optim.lr_scheduler import LambdaLR
from transformers import get_linear_schedule_with_warmup
from exp import ex
def get_no_scheduler(optimizer, num_warmup_steps, num_training_steps):
def lr_lambda(current_step):
return 1
return LambdaLR(optimizer, lr_lambda)
sched_dict = {
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | code/optimizer/schedulers.py | HS-YN/PanoAVQA |
from polyphony import testbench
def list28(xs):
xs[0] = 10
x0 = xs[0]
xs[0] = 100
xs[1] = 11
x00 = xs[0]
x1 = xs[1]
assert x0 == 10
assert x00 == 100
assert x1 == 11
@testbench
def test():
list28([1, 2, 3])
test()
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/list/list28.py | ktok07b6/polyphony |
import json
import sys
import re
import upf1_to_json
import upf2_to_json
def get_upf_version(file_name):
with open(file_name) as inp:
line = inp.readline()
if "<PP_INFO>" in line:
return 1
elif "UPF version" in line:
return 2
return 0
def parse_upf_from_file(file_name):
ver... | [
{
"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 | apps/upf/upf_to_json.py | dev-zero/SIRIUS |
from Bio import Entrez
from configurations.config import *
# A brief example of how to pull an article abstract based on a key word search.
# Used "fever" as a key word search which returns the article IDs.
# Then used the first article ID to pull out the article title and abstract text as an example.
my_email = mike... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | test_pubmed_pull_test.py | awermenlinger/Milestone2 |
from requests import Request, Session
from twilio.http import HttpClient
from twilio.http.response import Response
from twilio.http.request import Request as TwilioRequest
class TwilioHttpClient(HttpClient):
"""
General purpose HTTP Client for interacting with the Twilio API
"""
def __init__(self, po... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | twilio/http/http_client.py | theDrinkMD/twibbage |
import pygame
import sys
import time
from dots_and_boxes.settings.GUI_settings import *
from dots_and_boxes.settings.colors import *
class GUI:
def __init__(self):
self.exists = SHOW_GUI
if self.exists:
pygame.init()
pygame.display.set_caption("Dots and Boxes")
... | [
{
"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 | dots_and_boxes/classes/GUI.py | marriuss/dots-and-boxes |
import math
#replace with sieve for faster check, but expected small answer
def is_prime(n):
if n == 1:
return False
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n))+1,2))
primes = []
for i in range(1,1000000):
if is_prime(i):
primes.append(i)
def chec... | [
{
"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 | Q50/sol.py | shivamT95/projecteuler |
# define a function
def flow_control(k):
# define a string based on the value of k
if(k==0):
s = "Variable k = %d equals 0." % k
elif(k==1):
s = "Variable k = %d equals 1." % k
else:
s = "Variable k = %d does not eequal 0 or 1." % k
# print the variable
print(s)
# define a main function
def mai... | [
{
"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 | astr-119-hw-2/if_else_control.py | jjohnst6260/astr-119 |
import numpy as np
def layer_init_uniform(*x):
ret = np.random.uniform(-1., 1., size=x) / np.sqrt(np.prod(x))
return ret.astype(np.float32)
def fetch(url):
import requests, os, hashlib, tempfile
fp = os.path.join(tempfile.gettempdir(),
hashlib.md5(url.encode('utf-8')).hexdigest... | [
{
"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 | slowgrad/utils.py | dpstart/slowdl |
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
import tensorflow.keras.backend as K
from MLib.Core.Cells import SIR_Cell
from tensorflow.keras.layers import RNN
class MarkovChainRNN_Model(Model):
def __init__(self, population):
super(MarkovChainRNN_Model, self).__init__()
cell =... | [
{
"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 | MLib/Models/KerasModels.py | rvegaml/SIMLR |
#!/usr/bin/env python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
{
"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 | samples/basic/retry.py | adamjm/pipelines |
# -*- coding: utf-8 -*-
__author__ = 'CubexX'
from datetime import datetime
from app import db
class Message(db.Model):
__table__ = 'messages'
__timestamps__ = False
__fillable__ = ['uid', 'cid', 'date']
@staticmethod
def today_chat_count(cid):
t = datetime.today()
today = int(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 | app/models/message.py | CubexX/confstat-site |
import json
import requests
EDHREC_BASE_URL = 'https://edhrec-json.s3.amazonaws.com/commanders/%s.json'
COMMANDER_PAGE_SLUGS = frozenset([
'w',
'u',
'b',
'r',
'g',
'colorless',
'wu',
'ub',
'br',
'rg',
'gw',
'wb',
'ur',
'bg',
'rw',
'gu',
'wub',
... | [
{
"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 | py/scrapeJson.py | mpaulweeks/edh-obscurity |
"""Host API required Work Files tool"""
import os
from . import lib
from avalon import api
def _active_document():
if len(lib.app().Documents) < 1:
return None
return lib.app().ActiveDocument
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["photoshop"]
def has_unsaved_changes():
... | [
{
"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 | avalon/photoshop/workio.py | Yowza-Animation/avalon-core |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import gettext as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the user objects"""
class Meta:
model = get_user_model()
fields = ('email... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | app/user/serializers.py | storylife/recipe-app-api |
# pylint: disable=missing-function-docstring, missing-module-docstring/
from pyccel.decorators import types
@types('bool', 'bool')
def right_shift_b_b(a, b):
return a >> b
@types('int', 'int')
def right_shift_i_i(a, b):
return a >> b
@types('bool', 'int')
def right_shift_b_i(a, b):
return a >> b
@types(... | [
{
"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/epyccel/modules/bitwise.py | nandiniraja348/pyccel |
from pytos.models.context import Context
class RunCommand(object):
def __init__(self):
self.args = None
# return 0 if no errors
# set self.args to copy args formatted from cmdline
def parse_args(self, args) -> int:
return 0
# only call this post parse_args is called
def run(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 | pytos/models/rc.py | thewisenerd/pytos |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# __author__ = 'Liantian'
# __email__ = "liantian.me+code@gmail.com"
from io import BytesIO
import qrcode
from flask import Flask, render_template, send_file, request
from qrcode.exceptions import DataOverflowError
ecl_map = {
'L': qrcode.constants.ERROR_CORRECT_L,
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | QRCode/main.py | liantian-cn/Deprecated-GAE |
"""
目前的服务主要是请求本地的一个接口,以及微信获取open_id的接口
因此,使用连接池理论上会有更好的性能
tornado没有自带的连接池,只好上aiohttp了
"""
from typing import Optional
import aiohttp
from config import connection_config
from util import UtilError
_client = None
async def init() -> None:
global _client
if _client is not None:
return
# client对象... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | server/util/connector.py | 1214367903/CubeOnline |
import queue
import threading
from GlobalPlayer.player import Player
"""
the thread module provides:
* the global_queue for communication with any GlobalThread object
here, dictionaries with at least an 'action' and a 'response' field
* the GlobalThread class for reacting to user input via the Flask serve... | [
{
"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 | augenkrebs/GlobalPlayer/thread.py | shackspace/augenkrebs |
import pandas as pd
import numpy as np
def load_and_process_data(path):
rawData = pd.read_csv(path, sep=";")
rawData = rawData[rawData.columns[:-2]].dropna().rename(columns={"RH": "Relative Humidity", "AH": "Absolute Humdity", "T": "Temp"})
for col in rawData.columns:
#covert strings into floa... | [
{
"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 | notebooks/project_functions.py | data301-2021-winter1/project-group25-project |
import keras
import keras.backend as K
import tensorflow as tf
smooth = 1.
def dice_coef(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
intersection = K.sum(y_true_f * y_pred_f)
return (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth)
def dice_co... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | loss.py | shubham333/road_segm |
import unittest
from ctypes import *
import _ctypes_test
class ReturnFuncPtrTestCase(unittest.TestCase):
def test_with_prototype(self):
# The _ctypes_test shared lib/dll exports quite some functions for testing.
# The get_strchr function returns a *pointer* to the C strchr function.
dll =... | [
{
"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 | lib-python/2.7/ctypes/test/test_returnfuncptrs.py | clach04/bb_import_jython |
import random
class SkipNode:
ptrs,v,pred=None,None,None
def __init__(self,v,p=None,s=None):
self.v=v
self.ptrs=[None]
if p is not None:
p.ptrs[0]=self
self.pred=p
if s is not None:
self.ptrs[0]=s
s.pred=self
class SkipList:
h... | [
{
"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 | SkipLists.py | FER-NASP/AdvancedAlgorithms |
# 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/kubernetes/apis/SetAutoRepairRequest.py | Ureimu/weather-robot |
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
class AnkiError(Exception):
def __init__(self, type, **data):
self.type = type
self.data = data
def __str__(self):
m = self.type
if 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | anki/anki/errors.py | nadvornix/ankifier |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
ax = fig.add_subplot(111)
N = 10
x = np.random.rand(N)
y = np.random.rand(N)
z = np.random.rand(N)
circles, triangles, dots = ax.plot(x, 'ro', y, 'g^', z, 'b.')
ax.set_ylim(0, 1)
plt.axis('off')
def update(d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | np/reference/ch9code/animation.py | focusunsink/study_python |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.sisf.configure import unconfigure_device_tracking_binding
class TestUnconfigureDeviceTrackingBinding(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
sisf-c9500-21-8-26-2:
... | [
{
"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 | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/sisf/configure/unconfigure_device_tracking_binding/test_api_unconfigure_device_tracking_binding.py | patrickboertje/genielibs |
import heapq
from collections import defaultdict
def dijkstra(start, N, branches):
"""
:param start:
:param N: The number of nodes
:param branches: dictionary, branches[src_node] = [(next_node, cost)]
:return:
"""
distance_heap = [(float('inf'), i) for i in range(N)]
distance_heap[star... | [
{
"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 | src/data/911.py | NULLCT/LOMC |
import subprocess
import shutil
import os
import argparse
from pathlib import Path
from threading import Thread
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output", help="output directory for .html and .txt files")
args = parser.parse_args()
def runcmd(cmd):
if os.name == "nt":
return... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | scripts/compile_mjml.py | whiteowl3/jfa-go |
# Copyright (c) 2020 Anastasiia Birillo, Elena Lyulina
import pandas as pd
from src.main.util.consts import ISO_ENCODING
from src.main.util.file_util import tt_file_condition, get_all_file_system_items
def print_all_unique_values_in_file(file: str, column: str) -> None:
data = pd.read_csv(file, encoding=ISO_ENC... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | src/main/plots/util/plots_helper.py | JetBrains-Research/codetracker-data |
#
# Copyright (c) 2018-2020 Tuukka Norri
# This code is licensed under MIT license (see LICENSE for details).
#
import argparse
import os
import sys
from Bio import SeqIO
parser = argparse.ArgumentParser("Compare the first sequences in two FASTA files.")
parser.add_argument('--lhs', required = True, type = str)
pa... | [
{
"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 | compare_sequences.py | tsnorri/biotools |
import os
import tempfile
from tests.STDF.STDFRecordTest import STDFRecordTest
from STDF import FAR
# File Attributes Record
# Functuion:
# Contains the information necessary to determine
# how to decode the STDF datacontained in the file.
def test_FAR():
far('<')
far('>')
def far(end):
# STDF v4... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | tests/STDF/test_FAR.py | awinia-github/Semi-ATE-STDF |
def test_get(session, organization):
from dispatch.organization.service import get
t_organization = get(db_session=session, organization_id=organization.id)
assert t_organization.id == organization.id
def test_get_all(session, organizations):
from dispatch.organization.service import get_all
t_o... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | tests/organization/test_organization_service.py | Keetmalin/dispatch |
import os, sys, warnings
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'DS', 'tree' ))
from bst import BSTree
inf = 2**31
def obst_cost(k, f, visualise=None):
n = len(k)
cache = [[0]*(n+1) for i in range(n+1)]
p_cache = [[0]*(n+1) for i in range(n+1)]
w = [0]
for i in range(... | [
{
"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 | ALGO/dynamic_programming/dp__optimal_binary_search_tree.py | jainrocky/LORD |
"""
We recover the original divergence-free velocity field via
Ud,new = Ustar - Gphi
"""
import numpy
import pylab
import operator
def do_plots_c(Ud, Unew):
""" plot Ud,new and Ud with zoom on the bug """
pylab.clf()
pylab.cla()
f = pylab.figure()
f.text(.5, .95, r"$U_{\rm d}... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insi... | 3 | homework5_elliptic_PDES/part_c.py | bt3gl/Resources-Numerical_Methods_for_Physics |
import json
import os
from logger import logger
class Settings(object):
DEFAULT = {
"cbmonitor_host_port": "127.0.0.1:8000",
"seriesly_host": "127.0.0.1",
"interval": 10,
"cluster": "default",
"master_node": "127.0.0.1",
"dest_master_node": "127.0.0.1",
... | [
{
"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 | cbagent/settings.py | daverigby/cbagent |
from FeedProofpoint import Client, fetch_indicators_command
from CommonServerPython import FeedIndicatorType
url = "https://example.com"
auth_code = "cool"
client = Client(url, auth_code)
def test_fetch_ips(requests_mock):
ip_path = "./TestData/detailed-iprep.txt"
with open(ip_path) as f:
data = f.re... | [
{
"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 | Packs/FeedProofpoint/Integrations/FeedProofpoint/FeedProofpoint_test.py | ddi-danielsantander/content |
import pytest
from bitgesellx.lib.script import OpCodes, is_unspendable_legacy, is_unspendable_genesis
@pytest.mark.parametrize("script, iug", (
(bytes([OpCodes.OP_RETURN]), False),
(bytes([OpCodes.OP_RETURN]) + bytes([2, 28, 50]), False),
(bytes([OpCodes.OP_0, OpCodes.OP_RETURN]), True),
(bytes([OpC... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | tests/lib/test_script.py | lucasan123/BitgesellX-server |
import numpy as np
from numba import jit
a2 = 0.2
a3 = 0.3
a4 = 0.6
a5 = 1.0
a6 = 0.875
b21 = 0.2
b31 = 3.0 / 40.0
b32 = 9.0 / 40.0
b41 = 0.3
b42 = -0.9
b43 = 1.2
b51 = -11.0 / 54.0
b52 = 2.5
b53 = -70.0 / 27.0
b54 = 35.0 / 27.0
b61 = 1631.0 / 55296.0
b62 = 175.0 / 512.0
b63 = 575.0 / 13824.0
b64 = 44275.0 / 110592.... | [
{
"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 | fmodeling/utils/RungeKutta45.py | lomonosouv/rpsi |
class PanelTypeSetIterator(APIObject, IDisposable, IEnumerator):
"""
An iterator to a panel type set.
PanelTypeSetIterator()
"""
def Dispose(self):
""" Dispose(self: PanelTypeSetIterator,A_0: bool) """
pass
def MoveNext(self):
"""
MoveNext(self: PanelTypeSet... | [
{
"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 | release/stubs.min/Autodesk/Revit/DB/__init___parts/PanelTypeSetIterator.py | YKato521/ironpython-stubs |
from django.db import models
# Create your models here.
class Tipo(models.Model):
codigo = models.CharField(max_length=20)
descripcion = models.CharField(max_length=50)
def __str__(self):
return self.descripcion
class Articulo(models.Model):
nombre = models.CharField(max_length=100)
des... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | store/models.py | jsdgdo/ecomfree |
import pytest
from stock_indicators import indicators
class TestUlcerIndex:
def test_standard(self, quotes):
results = indicators.get_ulcer_index(quotes, 14)
assert 502 == len(results)
assert 489 == len(list(filter(lambda x: x.ui is not None, results)))
r = results... | [
{
"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/test_ulcer_index.py | LeeDongGeon1996/Stock.Indicators.Python |
import logging
from data.logs_model.table_logs_model import TableLogsModel
from data.logs_model.document_logs_model import DocumentLogsModel
from data.logs_model.combined_model import CombinedLogsModel
logger = logging.getLogger(__name__)
def _transition_model(*args, **kwargs):
return CombinedLogsModel(Document... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | data/logs_model/__init__.py | dongboyan77/quay |
from typing import List, Optional, Union
from lnbits.helpers import urlsafe_short_hash
from . import db
from .models import TPoS
async def create_tpos(*, wallet_id: str, name: str, currency: str) -> TPoS:
tpos_id = urlsafe_short_hash()
await db.execute(
"""
INSERT INTO tpos.tposs... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | lnbits/extensions/tpos/crud.py | sidahmedabdelillah/attigoBTC |
from django.contrib import admin
from snippify.snippets.models import Snippet, SnippetComment, SnippetVersion
class SnippetAdmin(admin.ModelAdmin):
exclude = ('author',)
list_display = ('title', 'lexer', 'created_date', 'author')
list_filter = ('lexer', 'author', )
search_fields = ('title', 'body', )
... | [
{
"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 | snippets/admin.py | xarg/snippify |
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>com
#
# Authors: Jean-Emile DARTOIS <jean-emile.dartois@b-com.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/... | [
{
"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 | watcher/tests/applier/messaging/test_trigger_action_plan_endpoint.py | ajaytikoo/watcher |
"""
tests.test_api
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the api
Copyright (c) 2015 Finbarr Brady <https://github.com/fbradyirl>
Licensed under the MIT license.
"""
# pylint: disable=protected-access
import unittest
import openwebif.api
from openwebif.error import OpenWebIfError, MissingParamError
class TestAP... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/test_openwebifpy.py | fbradyirl/openwebifpy |
"""
task - Write a python program to scrape a given wikipedia page
and return the average of 3 letter, 4 letter and 5 letter
words per paragraph.
Observation - Wikipedia stores all the paragraphs in div with id = content
"""
import requests
from bs4 import BeautifulSoup
import math
class wiki:
"... | [
{
"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 | wikipedia.py | mastermanas805/Atlantis_Assement |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.