source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
This module contains helper functions which dispatch
the creation of appropriate generators depending on
the input types.
"""
__all__ = ['Integer', 'Timestamp']
from .base import TohuBaseGenerator
from .primitive_generators import Integer as IntegerPrimitive, Timestamp as TimestampPrimitive
from .derived_generato... | [
{
"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 | tohu/v6/generator_dispatch.py | maxalbert/tohu |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kubernetes/test/test_v1_session_affinity_config.py | woqer/python |
from PyQt5.QtWidgets import QWidget, QSlider, QHBoxLayout
from PyQt5.QtCore import QMargins
from PyQt5.QtCore import QObject, pyqtSignal
class EditorSlider(QWidget):
# widget containig the slider
# direct subclassing of QSlider leads to errors
valueChanged = pyqtSignal(int)
def __init__(self, vmin, ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | gui/prototxt_editor/editor_slider.py | anglebinbin/Barista-tool |
import pytest
from drydock_provisioner import objects
class TestPostgres(object):
def test_result_message_insert(self, populateddb, drydock_state):
"""Test that a result message for a task can be added."""
msg1 = objects.TaskStatusMessage('Error 1', True, 'node', 'node1')
msg2 = objects.T... | [
{
"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 | python/tests/integration/postgres/test_postgres_results.py | Vjrx/airship-drydock |
import gym
from core.common.types import StepDict
from core.environment.environment import Environment
class FakeGymEnv(Environment):
def __init__(self, task_name: str):
super(FakeGymEnv, self).__init__(task_name)
self._render = False
self._env = gym.make(task_name)
self._info["a... | [
{
"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 | environment/fake_gym/fake_gym.py | id9502/RLFrame |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
{
"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 | utilities/diskimage_unittesting/tests/skipsetup_test.py | timgates42/pymacadmin |
weight=1
a=_State('a', name='var1', shared=True)
def run():
@_do
def _():
print(a.val)
sleep(10)
a.val = 5
@_do
def _():
print(a.val)
sleep(10)
a.val = 8
@_do
def _():
print(a.val)
| [
{
"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 | robots/test/strategies/run_tests/tests/test_sharing/test_share/t1.py | memristor/mep2 |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: 874681044@qq.com
@Software: PyCharm
@File: Cosine.py
@Time: 19-6-26 下午9:43
@Overview: Implement Cosine Score for speaker identification!
Enrollment set files will be in the 'Data/enroll_set.npy' and the classes-to-index file is 'Data/enroll_clas... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Score/Cosine_Score.py | Wenhao-Yang/DeepSpeaker-pytorch |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | ooobuild/lo/sdb/x_row_set_change_broadcaster.py | Amourspirit/ooo_uno_tmpl |
CONSTANTS = [
"SYS_EXIT equ 1",
"SYS_READ equ 3",
"SYS_WRITE equ 4",
"STDIN equ 0",
"STDOUT equ 1",
"True equ 1",
"False equ 0"
]
DATA_SEG = [
"segment .data"
]
BSS_SEG = [
"segment .bss",
" res RESB 1"
]
TEXT_SEG =[
"section .text",
" global _start"
]
PRINT_SUBROUTINE = [
"print:",
" PUSH EBP",
" MOV EBP, ... | [
{
"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 | assembler.py | martimfj/VBA-Compiler |
def for_W():
for row in range(6):
for col in range(5):
if (col==0 or col==4) or ( row>2 and (row+col==5 or row-col==1)):
print("*",end=" ")
else:
print(end=" ")
print()
def while_W():
i=0
while i<6:
j=0
wh... | [
{
"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 | Alp/cap_alp/W.py | Ashokkommi0001/patterns |
# coding=utf-8
from __future__ import unicode_literals
from api_x.zyt.biz import cheque
from api_x.zyt.biz.models import ChequeType
def draw_cheque(channel, from_id, amount, order_id=None, valid_seconds=1800, cheque_type=ChequeType.INSTANT,
info='', client_notify_url=''):
return cheque.draw_chequ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | api_site/src/api_x/application/cheque.py | webee/pay |
from django.db import models
from binder.models import BinderModel
from binder.websocket import trigger
from django.db.models.signals import post_save
# Some of our fictitious animals actually wear clothes/costumes...
# Each costume is unique to an animal (one to one mapping)
class Costume(BinderModel):
class Meta(B... | [
{
"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 | tests/testapp/models/costume.py | Bilonan/django-binder |
"""Environment file for behave
Selenium grid may be set here too.
TODO: This is deactivated for Alpha-5"""
import logging
LINE_LENGTH = 42
PASSED = "passed"
FAILED = "failed"
def before_all(context):
# Setup logging for SLAYER, according to behave API reference:
# http://python-behave.readthedocs.io/en/latest... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | slayer/deactivated_environment.py | FrancoLM/slayer-automation |
import core
from component import Component
import asyncio
class Oneshot(Component):
async def start(self):
core.core.delete_component(self)
await asyncio.sleep(5)
print("End start")
def stop(self):
super().stop()
print("Closed") | [
{
"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 | components/oneshot.py | Yooooomi/my-car |
# -*- coding: utf-8 -*-
"""
EauDouce.utils.aes_cbc
~~~~~~~~~~~~~~
AES加密的实现模式CBC。
CBC使用密码和salt(起扰乱作用)按固定算法(md5)产生key和iv。然后用key和iv(初始向量,加密第一块明文)加密(明文)和解密(密文)。
:copyright: (c) 2017 by Mr.tao.
:license: MIT, see LICENSE for more details.
"""
from Crypto.Cipher import AES
from binascii import b2a_... | [
{
"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 | src/utils/aes_cbc.py | iicc/EauDouce |
class Users(object):
def __init__(self, client):
self.client = client
#UNTESTED
def search(self, **kwargs):
"""
Returns the Enrollment User's details matching the search parameters
/api/system/users/search?{params}
PARAMS:
username={username}
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than cl... | 3 | pyairwatch/system/users.py | jprichards/PyVMwareAirWatch |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
{
"point_num": 1,
"id": "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_documentation_eager.py | burgerkingeater/io |
import collections
import unittest
from typing import List
import utils
target = (1, 2, 3, 4, 5, 0)
swaps = [
[1, 3],
[0, 2, 4],
[1, 5],
[0, 4],
[1, 3, 5],
[2, 4],
]
# BFS, shortest path.
class Solution:
def slidingPuzzle(self, board: List[List[int]]) -> int:
cur = tuple(cell fo... | [
{
"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": false
}... | 3 | problems/test_0773.py | chrisxue815/leetcode_python |
from typing import Optional
from TagScriptEngine import Context, Block
class CooldownBlock(Block):
"""
Redirects the tag response to either the given channel, the author's DMs,
or uses a reply based on what is passed to the parameter.
**Usage:** ``{redirect(<"dm"|"reply"|channel>)}``
**Payload:... | [
{
"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 | plugins/tags/blocks/cooldown.py | Friskytool/command-handler |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | proxy/core/tls/certificate.py | fisabiliyusri/proxy |
from debugprov.navgiation_strategy import NavigationStrategy
from debugprov.node import Node
from debugprov.validity import Validity
class SingleStepping(NavigationStrategy):
def navigate(self):
self.recursive_navigate(self.exec_tree.root_node)
self.finish_navigation()
return self.exec... | [
{
"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 | debugprov/single_stepping.py | romerlrl/debugprov |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import os
import pytest
import ezdxf
BASEDIR = os.path.dirname(__file__)
DATADIR = "data"
@pytest.fixture(params=["Leica_Disto_S910.dxf"])
def filename(request):
filename = os.path.join(BASEDIR, DATADIR, request.param)
if not os.path.exists(filena... | [
{
"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 | integration_tests/test_leica_disto_r12.py | jkjt/ezdxf |
from mycroft import MycroftSkill, intent_handler
import subprocess
class BluetoothSpeakers(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
def initialize(self):
subprocess.Popen(['bash', self.root_dir + '/scripts/connect_bluetooth_speakers.sh'])
@intent_handler('con... | [
{
"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 | __init__.py | blue1stone/bluetooth-speakers-skill |
class UwUFilePathFucked(self):
"""Exception thrown when host cant be reached
Attr: objName
"""
def __init__(self, objName, message=''):
self.objName = objName
self.message = message
super().__init__(message)
def __str__(self):
return f'{self.objName} ... | [
{
"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 | uwupy/file_operations.py | justnat3/uwupy |
# Under MIT License, see LICENSE.txt
class Field():
def __init__(self, ball):
self.ball = ball
def move_ball(self, position, delta):
self.ball.set_position(position, delta)
| [
{
"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 | RULEngine/Game/Field.py | wonwon0/RobocupStrategyIA |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | pythia/pyre/geometry/pml/parser/Vector.py | willic3/pythia |
# -*- coding:utf-8 -*-
from logging.handlers import RotatingFileHandler
import logging
from celery import Celery
from flask import Flask
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__, instance_relative_config=True)
# Load the default configuration
app.config.from_object('c... | [
{
"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 | application/app.py | oceanio/flask-boot |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file acc... | [
{
"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 | src/sagemaker_containers/_process.py | uditbhatia/sagemaker-containers |
def kill_door():
Driftwood.script["rumble.py"].end_rumble()
Driftwood.tick.register(kill_door_callback1, once=True, delay=1.0)
Driftwood.tick.register(kill_door_callback2, once=True, delay=2.0)
Driftwood.tick.register(kill_door_callback3, once=True, delay=3.0)
def kill_door_callback1(seconds_past):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | ring7.py | Driftwood2D/blue |
class LocustError(Exception):
pass
class ResponseError(Exception):
pass
class CatchResponseError(Exception):
pass
class MissingWaitTimeError(LocustError):
pass
class InterruptTaskSet(Exception):
"""
Exception that will interrupt a User when thrown inside a task
"""
def __init__(... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | locust/exception.py | masonCaminer/locust |
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty,\
ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
from random import randint
class PongBall(Widget):
velocity_x = NumericProperty(0)
velocity_y = Numeri... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | Blob Rage App/random/PongBall.py | povellesto/blobydouche |
# -*- coding: utf-8 -*-
"""
Created on 2021/3/18 7:05 下午
---------
@summary:
---------
@author: Boris
@email: boris_liu@foxmail.com
"""
from feapder.utils.webdriver import WebDriverPool, WebDriver
import threading
def test_webdirver_pool():
webdriver_pool = WebDriverPool(
pool_size=2, load_images=False, ... | [
{
"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 | tests/test_webdriver.py | ibryang/feapder |
from numpy import float32
import tensorflow as tf
import constants as c
def _parse_example(example_proto):
features = {
"sequence": tf.io.FixedLenFeature((), tf.string, default_value=""),
"ss3": tf.io.VarLenFeature(tf.int64),
"ss8": tf.io.VarLenFeature(tf.int64)
}
parsed_features = ... | [
{
"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 | dataset/ss3.py | ibivu/protein-glue |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
{
"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 | tests/contrib/hooks/test_nomad_hook.py | YotpoLtd/incubator-airflow |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMsaasMediarecogAftscvpayTransactionInitializeResponse(AlipayResponse):
def __init__(self):
super(AlipayMsaasMediarecogAftscvpayTransactionInitializeResponse, self).__in... | [
{
"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 | alipay/aop/api/response/AlipayMsaasMediarecogAftscvpayTransactionInitializeResponse.py | snowxmas/alipay-sdk-python-all |
import os
import argparse
def get_head_tail(args):
head, tail = None, None
with open(args.head) as f: head = f.read()
with open(args.tail) as f: tail = f.read()
return head, tail
def main(args):
tex = []
head, tail = get_head_tail(args)
tex.append(head)
sections = os.listdir(args.code)
sections.sor... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | ansi-common-lisp-code-book/gen.py | ismdeep/ansi-common-lisp-practice |
import sys
import numpy as np
import scipy as sp
from robo.maximizers.base_maximizer import BaseMaximizer
class DifferentialEvolution(BaseMaximizer):
def __init__(self, objective_function, lower, upper, n_iters=20, rng=None):
"""
Parameters
----------
objective_function: acquisi... | [
{
"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 | robo/maximizers/differential_evolution.py | lebrice/RoBO |
# Copyright (c) 2017-2018 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | petastorm/cache.py | cclauss/petastorm |
"""Add network table.
Revision ID: a61092f784b7
Revises: 37e174f84517
Create Date: 2020-01-13 07:31:21.905820
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a61092f784b7"
down_revision = "37e174f84517"
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | shakenfist/alembic/versions/a61092f784b7_add_network_table.py | bradh/shakenfist |
from twisted.web import server, resource
from twisted.internet import reactor, task, threads
from sys import argv
from Ping import Ping
class StatusResource(resource.Resource):
isLeaf = True
def render_GET(self, request):
request.setHeader("context-type", "text/plain")
return "8.8.8.8,AVAILABLE"
pinger = Pi... | [
{
"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 | main.py | iachievedit/pypingd |
import torch
from a_star.neighbor_utils import NeighborUtils
from model.feature_extractor.fe_factory import get_feature_extractor
from model.wh_model import WHModel
from utils.collections import ModelSolution
class DNWA(WHModel):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.w_ext... | [
{
"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 | model/dnwa.py | archettialberto/neural_weighted_a_star |
from aioscpy.commands import BaseRunSpiderCommand
from aioscpy.exceptions import UsageError
class Command(BaseRunSpiderCommand):
requires_project = True
def syntax(self):
return "[options] <spider>"
def short_desc(self):
return "Run a spider"
def run(self, args, opts):
if 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | aioscpy/commands/crawl.py | ihandmine/aioscpy |
from api import free_dictionary_api, reverso_api, anki_connect_api
import config
def search_new_word(query):
wordcard = free_dictionary_api.search_a_word(query)
if not wordcard:
return False
else:
examples_from_reverso = reverso_api.get_examples(query, quantity_in_one_step=config.number_of... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | main.py | windupb1rd/make_anki_cards |
import shutil
import os
import sys
from .base import CommandBase, str2camel
class BabelCommand(CommandBase):
"""
i18n翻译
"""
# 命令
command_str = "babel"
# 命令描述
command_desc = ["add: 生成翻译文件", "run: 编译翻译文件"]
@classmethod
def execute(cls, action):
if action == "add":
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | core/manager/babel_cmd.py | Wr490046178/fast-api-frame |
from django.apps import apps
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.state import StateApps
from django.test import TestCase
# Use this TestCase class in order to test migrations
# migrate_from – the name of the migration where the test st... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | src/chains/migrations/tests/utils.py | tharsis/safe-config-service |
# -*- coding: utf-8 -*-
"""API view decorators for response headers"""
from __future__ import unicode_literals
from h.views.api import API_VERSION_DEFAULT
from h.views.api.helpers.media_types import media_type_for_version, version_media_types
def version_media_type_header(wrapped):
"""View decorator to add resp... | [
{
"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 | h/views/api/decorators/response.py | julien-cheng/h |
"""
每日任务
"""
from .azurlane import AzurLaneControl
import numpy as np
import cv2 as cv
from simulator.image_tools import get_match, cv_crop, load_map
from config_loader import logging, config
logger = logging.getLogger(__name__)
filter_kernel = np.array([[-4, -2, -4], [-2, 24, -2], [-4, -2, -4]])
class Daily(AzurL... | [
{
"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 | Autodroid/azurlane/daily.py | AutumnSun1996/GameTools |
# MIT License
#
# Copyright (c) 2017 Tom Oakley
#
# 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, p... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | arraylib.py | blokeley/forcelib |
# Global Imports
import json
from collections import defaultdict
# Metaparser
from genie.metaparser import MetaParser
# =============================================
# Collection for '/mgmt/tm/ltm/monitor/postgresql' resources
# =============================================
class LtmMonitorPostgresqlSchema(MetaPars... | [
{
"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 | src/genie/libs/parser/bigip/get_ltm_monitorpostgresql.py | balmasea/genieparser |
import json
from notebook.base.handlers import APIHandler
from notebook.utils import url_path_join
import tornado
class RouteHandler(APIHandler):
# The following decorator should be present on all verb methods (head, get, post,
# patch, put, delete, options) to ensure only authorized user can request the
... | [
{
"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 | experiments/notebook-download-button/notebook_download_button/handlers.py | crosscompute/jupyterlab-crosscompute |
import unittest
from queue import Queue
from modi.module.input_module.ir import Ir
class TestIr(unittest.TestCase):
"""Tests for 'Ir' package."""
def setUp(self):
"""Set up test fixtures, if any."""
self.send_q = Queue()
mock_args = (-1, -1, self.send_q)
self.ir = Ir(*mock_ar... | [
{
"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 | tests/module/input_module_tests/test_ir.py | drecali/pymodi |
# Copyright 2014 OpenStack Foundation
#
# 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 ... | [
{
"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 | neutron/db/migration/alembic_migrations/versions/157a5d299379_ml2_binding_profile.py | ksshanam/neutron-dvr |
import pytest
from unittest import mock
from aiogear import Worker, PacketType
@pytest.fixture(scope='function')
def worker():
w = Worker()
w.get_task = mock.Mock()
return w
def test_register_function_connected(worker):
written = None
def _write(data):
nonlocal written
written =... | [
{
"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 | tests/test_worker_registration.py | agronick/aiogear |
from seabreeze.pyseabreeze.features._base import SeaBreezeFeature
# Definition
# ==========
#
# TODO: This feature needs to be implemented for pyseabreeze
#
class SeaBreezeFastBufferFeature(SeaBreezeFeature):
identifier = 'fast_buffer'
def get_buffering_enable(self):
raise NotImplementedError("imple... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/seabreeze/pyseabreeze/features/fastbuffer.py | moritzj29/python-seabreeze |
import tkinter as tk
from PIL import Image, ImageTk
# The Custom Variable Widgets
class MyBar(tk.Canvas) :
def __init__(self, master:object, shape:object, value=0, maximum=100,
bg="#231303", trough_color='#8a7852', bar_color='#f7f4bf'):
"""Creating the alpha mask and creating a custom wid... | [
{
"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 | Scripts/mybar.py | jovanzac/Captain |
cipher = [75, 203, 190, 126, 184, 169, 27, 74, 35, 83, 113, 65, 207, 193, 27, 137, 37, 98, 0, 68, 219, 113, 21, 180, 223, 135, 5, 129, 189, 200, 245, 100, 117, 62, 192, 101, 239, 92, 182, 136, 159, 235, 166, 90, 74, 133, 83, 78, 6, 225, 101, 103, 82, 78, 144, 205, 130, 238, 175, 245, 172, 62, 157, 176]
key = b"SECCON20... | [
{
"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 | reversing/pyast64++.rev/solver/solve.py | SECCON/SECCON2021_online_CTF |
"""
Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the
sidebar.
Loosely based on https://github.com/astropy/astropy/pull/347
"""
import os
import warnings
__licence__ = 'BSD (3 clause)'
def get_github_url(app, view, path):
return '{root_url}/{project}/{view}/{branch}/{prefix}/{path}'.form... | [
{
"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 | docs/sphinx/_ext/edit_on_github.py | manics/ome-model |
import ifcfg
from . import util
from .core import *
from .iw import *
from .wpasup import *
def get_ifaces(*ifaces):
avail = ifcfg.interfaces()
matches = util.matches(ifaces, avail)
return {iface: avail[iface] for iface in matches}
def get_aps(*ifaces):
'''List available APs for an interface.'''
... | [
{
"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 | netswitch/__init__.py | beasteers/netswitch |
import os
import io
import struct
import bson
class Packet:
def __init__(self, packet_id=0, status_code=0, packet_name="", body_type=0, body=b""):
self.packet_id = packet_id
self.status_code = status_code
self.packet_name = packet_name
self.body_type = body_type
self.body_... | [
{
"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 | kakaopy/packet.py | smartwe/bot |
"""
Test parsers
"""
from __future__ import print_function
import unittest
import filecmp
import sys
import os
import glob
import json
import shutil
from mock import patch, Mock, mock_open
from pyingest.parsers import aps
from pyingest.parsers import arxiv
from pyingest.parsers import atel
from pyingest.parsers impor... | [
{
"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 | pyingest/tests/test_parsers_feedback.py | csgrant00/adsabs-pyingest |
from logging import log
import dash
import dash_leaflet as dl
import dash_leaflet.express as dlx
from dash.dependencies import Input, Output
from dash_extensions.javascript import assign, arrow_function
import pandas as pd
import dash_html_components as html
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWL... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | essai polygon.py | PnMercantour/suivi_zh |
# -*- Python -*-
# license
# license.
# ======================================================================
import logging; module_logger = logging.getLogger(__name__)
# ----------------------------------------------------------------------
def encode(name):
for char in "% :()!*';@&=+$,?#[]": # the samae as i... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answe... | 3 | py/obsolete/encode_name.py | acorg/acmacs-py |
import pyttsx3
import webbrowser
import smtplib
import random
import speech_recognition as sr
import wikipedia
import datetime
import wolframalpha
import os
import sys
import weather
engine = pyttsx3.init('sapi5')
client = wolframalpha.Client('Your_App_ID')
voices = engine.getProperty('voices')
en... | [
{
"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 | home.py | lucifer19807/Terrigenous |
import numpy as np
class Subclone:
"""
Initializes a Subclone Population.
:attr label: Either A, B or S
:attr fitness: Current fitness
:attr prop: Current Proportion
"""
def __init__(self, lbl, c, alpha, prop=0.333, parent=None, birthtime=None, color=None):
... | [
{
"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 | simulation/subclone.py | shubhomb/clonal_evolution |
#!/usr/bin/env python3.7
import logging
from obfuscapk import obfuscator_category
from obfuscapk.obfuscation import Obfuscation
class NewSignature(obfuscator_category.ITrivialObfuscator):
def __init__(self):
self.logger = logging.getLogger('{0}.{1}'.format(__name__, self.__class__.__name__))
su... | [
{
"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 | src/obfuscapk/obfuscators/new_signature/__init__.py | binaryflesh/Obfuscapk |
#/usr/bin/env python
"""Unit tests for condor_ce_router_defaults"""
import imp
import os
import re
import unittest
EXTATTR_FILE_PATH = 'extattr_table.txt'
UID_FILE_PATH = 'uid_table.txt'
DEFAULTS_PATH = os.path.join('..', 'src', 'condor_ce_router_defaults')
defaults = imp.load_source('condor_ce_router_defaults', DEF... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/test_condor_ce_router_defaults.py | lfield/htcondor-ce |
from factory import vectorizer_factory
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
from lime.lime_text import LimeTextExplainer
class VectorTransformer(TransformerMixin):
def __init__(self, vectorizer_name):
self.vectorizer_name = vectorizer_name
def fit(self,... | [
{
"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 | interpretation/instance_explanation.py | opennlp/Large-Scale-Text-Classification |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# from http://zetcode.com/gui/pyqt5/
import sys
import os
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
"""QMainWindow skeleton
"""
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.initUI()
def init... | [
{
"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 | sandbox/qt/basic_qapp.py | rboman/progs |
import os
import pytest
from silvera.run import compile
from silvera.utils import get_root_path
@pytest.fixture
def example_path():
example_path = os.path.join(get_root_path(), "tests", "examples",
"schematic")
return example_path
def test_schematic(example_path):
compile... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | tests/examples/schematic/test_schematic.py | alensuljkanovic/silvera |
''' Compute on ANVIL GTEX files'''
# IMPORTS
import sys
import json
from fasp.runner import FASPRunner
# The implementations we're using
from fasp.loc import Gen3DRSClient
from fasp.workflow import GCPLSsamtools
from fasp.loc import anvilDRSClient
class localSearchClient:
def __init__(self):
# edit the follo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | fasp/scripts/FASPScript15.py | lifebit-ai/fasp-scripts |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from .imdb import imdb
from .pascal_voc import pascal_voc
from .pascal3... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | fast-rcnn/lib/datasets/__init__.py | litingfeng/FasterSubCNN |
# -*- coding: utf-8 -*-
""" Module summary description.
More detailed description.
"""
from math import ceil
# __all__ = []
# __version__ = '0.1'
__author__ = 'Benjamin Pillot'
__copyright__ = 'Copyright 2018, Benjamin Pillot'
__email__ = 'benjaminpillot@riseup.net'
def flatten(alist):
""" Return a list of it... | [
{
"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 | gistools/utils/toolset/list.py | benjaminpillot/gis-tools |
from . import ExcelFormulaParser, ExcelFormulaLexer
import struct
from .antlr import ANTLRException
class Formula(object):
__slots__ = ["__s", "__parser", "__sheet_refs", "__xcall_refs"]
def __init__(self, s):
try:
self.__s = s
lexer = ExcelFormulaLexer.Lexer(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 | desktop/core/ext-py/tablib-0.10.0/tablib/packages/xlwt3/ExcelFormula.py | t3hi3x/hue |
import yaml
class HdcpSource:
def __init__(self, conf_yaml):
f = open(conf_yaml, "r")
conf = yaml.load(f)
f.close()
def process_request(req):
msg_type, msg = req
if __name__ == "__main__":
HdcpSource("yaml/rx1.yaml")
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/hdcp_source.py | imamotts/hdcp_test |
from django.apps.registry import apps
from django.views.generic.base import View
from intouch.queryset_csv.shortcuts import queryset_as_csv_response
from django.core.exceptions import PermissionDenied
class ModelAsCsvView(View):
def get(self, request, app, model):
Model = apps.get_model(app, m... | [
{
"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 | intouch/queryset_csv/views.py | intouch-smartwater/queryset-csv |
class Point:
def __init__(self, x, y, z):
self.__x, self.__y, self.__z = x, y, z
def getx(self): return self.__x
def gety(self): return self.__y
def getz(self): return self.__z
def setx(self, x): self.__x = x
def sety(self, y): self.__y = y
def setz(self, z):... | [
{
"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 | realpractice/sept14Point.py | iambrianbui/CPSC386 |
from analyst.converters import LowerCaseAlphaNumConverter, IPV4Converter
def test_lowercasealphanumconverter_good():
value = "NotAlphaNum 123!"
converter = LowerCaseAlphaNumConverter()
assert converter.convert(value) is None
def test_lowercasealphanumconverter_bad():
value = "IsAlphaNum-123"
con... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_converters.py | jobscry/soc-analyst |
import brownie
import pytest
from brownie import ZERO_ADDRESS
from ..addresses import *
def test_lp_pool_override(curve_registry_override):
curve_registry_override.setPoolForLp(
threeCrvPoolAddress, sushiswapLpTokenAddress # random pool
)
override_pool = curve_registry_override.poolByLp(sushiswa... | [
{
"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/registries/test_curve_override.py | pmdaly/yearn-lens |
""" The post and put tests require the app context and are found in api-client """
from datetime import datetime
from unittest.mock import patch
from rfidsecuritysvc.api import RECORD_COUNT_HEADER
from rfidsecuritysvc.api import sounds as api
from rfidsecuritysvc.model.sound import Sound as Model
@patch('rfidsecuri... | [
{
"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/api/test_sounds.py | bcurnow/rfid-security-svc |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMerchantOrderUnlimitedQueryModel(object):
def __init__(self):
self._biz_no = None
self._buyer_id = None
self._order_id = None
@property
def bi... | [
{
"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 | alipay/aop/api/domain/AlipayMerchantOrderUnlimitedQueryModel.py | articuly/alipay-sdk-python-all |
# coding=utf-8
from ...rpc import corp_client
def subscribe_handler(request, message):
openid = message.source
entry = corp_client.corpenv(request.env)
info = entry.client.user.get(openid)
info['gender'] = int(info['gender'])
env = request.env()
rs = env['wx.corpuser'].sudo().search( [('userid... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | addons/oejia_wx/controllers/handlers/event_handler.py | marionumza/vocal_v12 |
#!/usr/bin/env python
"""
Renames files or directories with "module-triple-here" in their names to use
the indicated module triples instead.
"""
from __future__ import print_function
import os
import platform
import shutil
import sys
if len(sys.argv) < 3:
print('Too few args to ' + sys.argv[0])
print('Usage:... | [
{
"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 | test/CrossImport/Inputs/rewrite-module-triples.py | ApolloZhu/swift |
from typing import Optional
from ltransf.definitions.tokentype import TC, TT
class TokenClass:
def __init__(self, tokentype: Optional[TT] = None):
self.tokenType = tokentype
self.__operators = [TT.PLUS, TT.MINUS, TT.MULTI, TT.DIVID, TT.POWER]
self.__parentheses = [TT.LPAREN, TT.RPAREN]
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | src/ltransf/definitions/tokenclass.py | tgashwinkumar/ltransf |
import random
from .bot_base import Bot
class RandomBot(Bot):
def __init__(self, dim, name='random_bot'):
super().__init__(dim, name)
""" Example bot that runs randomly. """
def choose_action(self, state):
x = random.randrange(0, self.dim)
y = random.randrange(0, self.dim)
... | [
{
"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 | player/random_bot.py | Abluceli/ConnectSix |
""" One of the helpers for the gui application.
Similar modules: class:`.NativeArgsSaver`, :class:`.ParameterSaver`,
:class:`.UiLoader`, :class:`.Worker`, :class:`.DataProvider`
"""
from pathlib import Path
import os.path
from shutil import copyfile
from idact.detail.environment.environment_impl import Environ... | [
{
"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 | gui/helpers/configuration_provider.py | intdata-bsc/idact-gui |
# flake8: noqa
import wirepas_messaging
from default_value import *
def test_generate_parse_request():
# Clear a scratchpad
request = wirepas_messaging.gateway.api.GetScratchpadStatusRequest(
SINK_ID, REQUEST_ID
)
request2 = wirepas_messaging.gateway.api.GetScratchpadStatusRequest.from_paylo... | [
{
"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 | wrappers/python/tests/gateway/test_get_scratchpad_status.py | vvalkonen/backend-apis |
import torch
def prepare_obs(obs, done, fstack):
assert obs.dtype == torch.uint8
assert obs.shape[2] == 1
if fstack > 1:
obs = stack_frames(obs, fstack)
done_stacked = stack_frames(done, fstack)
obs = obs * obs_mask(done_stacked)
return obs.float() / 128 - 1
def stack_frames... | [
{
"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 | atari/dqn/prepare_obs.py | neevparikh/lwm |
#!/usr/bin/env python3
import argparse
from data import read_texts_csv, strip_words
from plot import save_plot
from static_vocabulary import StaticVocabulary
from dynamic_vocabulary_2q import DynamicVocabulary2Q
VOCABSIZE = 110000
FILLVOCAB = 10000000
RUNTESTON = 100000000
PLOTEVERY = 2000000
def plot_unknown_word... | [
{
"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 | words_stat.py | grinya007/streaming_rnn |
from abc import ABC, abstractmethod
class AbstractStatistcs(ABC):
@abstractmethod
def __init__(self, *args):
# Args can be used for building from dumped strings.
# Init needs to implement load from string.
pass
@abstractmethod
def __str__(self):
pass
@abstractmeth... | [
{
"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 | models/abstract_statistics.py | Yokto13/Sphinx |
# type: ignore
import logging
import colorlog
import pytest
logger = logging.getLogger(__name__)
handler = colorlog.StreamHandler()
handler.setFormatter(
colorlog.ColoredFormatter(
"(%(asctime)s) [%(log_color)s%(levelname)s] | %(name)s | %(message)s [%(threadName)-10s]"
)
)
# get root logger
logger =... | [
{
"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 | tests/conftest.py | ashwoods/gst-py-awesome-mix-vol-1 |
import os
import shutil
import tempfile
import time
class TemporaryDirectory():
def __init__(self, remove: bool=True, prefix: str='tmp'):
self._remove = remove
self._prefix = prefix
def __enter__(self) -> str:
if 'KACHERY_STORAGE_DIR' in os.environ:
storage_dir = os.getenv... | [
{
"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 | kachery/_temporarydirectory.py | flatironinstitute/kachery |
import emoji
import string
class Tweet():
def __init__(self, text: str):
self.text = text.lower()
self.hashtags = self.find("#", forbidden="@")
self.cleanTag()
self.tags = self.find("@", forbidden="#")
def find(self, prefix, forbidden):
ret = []
_text = self.tex... | [
{
"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 | crawler/tweet.py | EliasSchramm/TwitterDB |
from scipy.misc import imread, imresize
import numpy as np
def detect_ingrs(recipe, vocab):
#去重
try:
ingr_names = [ingr['text'] for ingr in recipe['ingredients'] if ingr['text']]
except:
ingr_names = []
print ("Could not load ingredients! Moving on...")
detected = set(... | [
{
"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 | scripts/proc.py | pansiyuan123/im2recipe-Pytorch |
"""Test around scalar constructors and scalar methods."""
import riptable as rt
import numpy as np
import pytest
from numpy.testing import assert_almost_equal, assert_warns
class TestScalarConstructor(object):
# Type-coercion from strings test cases adapted from numpy/core/tests/test_scalar_ctors.py.
... | [
{
"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 | riptable/tests/test_scalar.py | 972d5defe3218bd62b741e6a2f11f5b3/riptable |
# -*- coding: utf-8 -*-
from flask import jsonify
from . import bp_api
@bp_api.errorhandler (404)
def not_found (e):
return jsonify ({'error': 'not found'}), 404
@bp_api.errorhandler (405)
def not_found (e):
return jsonify ({'error': 'not allowed'}), 405
| [
{
"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 | db/app/api/errors.py | lanig35/smart |
from urgent.parser_gen import *
from urgent import ast
from rbnf_rts.rts import Tokens, State
from rbnf_rts.routine import DQString
__all__ = ['parse']
co = mk_parser.__code__
requires = co.co_varnames[:co.co_argcount]
ctx = {}
ctx['DQString'] = DQString
for each in requires:
if each not in ctx:
ctx[each... | [
{
"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 | urgent/parser_wrap.py | SenZhangAI/urgent-lang |
# -*- coding: utf-8 -*-
__author__ = "Daniel1147 (sxn91401@gmail.com)"
__license__ = "Apache 2.0"
# pypi/conda library
import uvicorn
from fastapi import FastAPI, HTTPException, Response, status
# scip plugin
from eureka.model.application_model import ApplicationModel
from eureka.model.applications_model import Appl... | [
{
"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 | eureka/server/app.py | haribo0915/Spring-Cloud-in-Python |
"""basic ding-dong bot for the wechaty plugin"""
from typing import Union
from wechaty import Message, Contact, Room, FileBox
from wechaty.plugin import WechatyPlugin
class DingDongPlugin(WechatyPlugin):
"""basic ding-dong plugin"""
@property
def name(self):
"""name of the plugin"""
retur... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | src/wechaty_plugin_contrib/ding_dong_plugin.py | huangaszaq/python-wechaty |
# Copyright (C) 2019-2021 HERE Europe B.V.
# SPDX-License-Identifier: Apache-2.0
"""This module will test platform api module."""
import pytest
from requests_oauthlib import OAuth1
from here_location_services.platform.apis.aaa_oauth2_api import AAAOauth2Api
from here_location_services.platform.apis.api import Api as P... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_platform_api.py | jain-aayush1123/here-location-services-python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.