source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import random
import unittest
from typing import Tuple
import torch
import numpy as np
from src.utilities import set_random_seed
_RANDOM_SEED: int = random.randint(0, 100)
_TEST_ARRAY_SIZE: Tuple[int, int] = (2, 2)
_TEST_TENSOR_SIZE: Tuple[int, int] = (2, 2)
def _set_random_seed():
set_random_seed(
ra... | [
{
"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 | tests/test_set_random_seed.py | iblamedom/kuenstliche-intelligenz |
# 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-oos/aliyunsdkoos/request/v20190601/DescribeRegionsRequest.py | ankitdobhal/aliyun-openapi-python-sdk |
from enum import IntEnum
class RentIdx(IntEnum):
DEFAULT = ONLY_DEED = RAILROAD_1 = UTILITY_1 = 0
GROUP_COMPLETE_NO_HOUSES = RAILROAD_2 = UTILITY_2 = 1
HOUSE_1 = RAILROAD_3 = 2
HOUSE_2 = RAILROAD_4 = 3
HOUSE_3 = 4
HOUSE_4 = 5
HOTEL = MAX = 6
HOUSE_TO_HOTEL = HOTEL - HOUSE_1 + 1
# Rep... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | monopoly_ai_sim/board.py | dgurjar/monopoly_ai_simulator |
LATEST_VERSION = '4.2.0'
def rule(event):
return (event['name'] == 'pack_it-compliance_osquery_info' and
event['columns']['version'] != LATEST_VERSION and
event['action'] == 'added')
def title(event):
return 'Osquery Version {} is Outdated'.format(
event['columns'].get('versi... | [
{
"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 | osquery_rules/osquery_outdated.py | designing-penguin/panther-analysis |
from django.contrib.auth import get_user_model
from rest_framework import serializers
from rest_framework.generics import CreateAPIView
User = get_user_model()
class SignupSerializer(serializers.Serializer):
error_message = "'{value}' is a registered {field}. Contact admin if you forgets password."
username... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | auth_api/views.py | sodascourse/note-storage |
import unittest
import saspy
from saspy.tests.util import Utilities
class TestSASutil(unittest.TestCase):
def setUp(self):
# Use the first entry in the configuration list
self.sas = saspy.SASsession(cfgname=saspy.SAScfg.SAS_config_names[0])
self.assertIsInstance(self.sas, saspy.SASsession,... | [
{
"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 | saspy/tests/test_sasutil.py | datasciencemonkey/saspy |
# -*- coding: utf-8 -*-
from django.template import engines
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from tests.test_app.models import DummyLink, DummySpacer
from djangocms_text_ckeditor.cms_plugins import TextPlugin
@plugin_pool.register_plugin
class PreviewDisabledPlugin(... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | tests/test_app/cms_plugins.py | beeduino/djangocms-text-ckeditor |
"""
===============
Embedding In Tk
===============
"""
from six.moves import tkinter as Tk
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg, NavigationToolbar2TkAgg)
# Implement the default Matplotlib key bindings.
from matplotlib.backend_bases import key_press_handler
from matplotlib.figure im... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | Packages/matplotlib-2.2.2/lib/mpl_examples/user_interfaces/embedding_in_tk_sgskip.py | NightKirie/NCKU_NLP_2108_industry3 |
from flask import Flask, request, abort
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatureError
)
from linebot.models import *
app = Flask(__name__)
# LINE BOT info
line_bot_api = LineBotApi('QCynFfsDk7My1YN72sVQyvk6ArYkD2TUQW/pUxUQqllnGFNcqjZ8tKC+qMcVa2u4Lg1W... | [
{
"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 | Final_Project/hx711py/lineBotTest.py | tingyo123/IoT_Project |
# 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-imm/aliyunsdkimm/request/v20170906/ListProjectsRequest.py | yndu13/aliyun-openapi-python-sdk |
import torch.nn as nn
from ..functions import F_affine2d, F_affine3d
class STN2d(nn.Module):
def __init__(self, local_net):
super(STN2d, self).__init__()
self.local_net = local_net
def forward(self, x):
params = self.local_net(x)
x_transformed = F_affine2d(x[0], params.view... | [
{
"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 | pywick/modules/stn.py | achaiah/pywick |
# coding: utf-8
"""
Mux Python - Copyright 2019 Mux Inc.
NOTE: This class is auto generated. Do not edit the class manually.
"""
from __future__ import absolute_import
import unittest
import mux_python
from mux_python.models.list_breakdown_values_response import ListBreakdownValuesResponse # noqa: E501
from mux_... | [
{
"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_list_breakdown_values_response.py | moaazsidat/mux-python |
import torch
import numpy as np
from torch.autograd import Variable
class loss_block:
def __init__(self):
super(loss_block, self).__init__()
self.criterion = torch.nn.NLLLoss(size_average=False)
cuda = True if torch.cuda.is_available() else False
if cuda:
self.criterion.... | [
{
"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 | agant/models/pytorch/loss/NLL.py | Sinha-Raunak/gan-toolkit |
# -*- coding: utf-8 -*-
class ML(dict):
def __init__(self, classifier=None, name=''):
"""Init ML object
Keyword arguments:
classifier (object) -- sklearn-like classifier
"""
self.clf = classifier
self.meta = {
'name': name
}
def fit(self... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | waterflow/ml.py | ademilly/dataflow |
import anachronos
from e2e_test.runner import http
class ExceptionResourceTest(anachronos.TestCase):
def setUp(self):
self.http = http.with_path("/api/error")
def test_got500OnInternalServerError(self):
response = self.http.get("")
self.assertEqual(500, response.status_code)
d... | [
{
"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 | e2e_test/tests/test_exception_resource.py | keotl/jivago |
from flask import Flask, Blueprint
from flask_sqlalchemy import SQLAlchemy
class Server():
def __init__(self, ):
self.app = Flask(__name__)
self.blueprint = Blueprint('api', __name__, url_prefix='/api')
self.app.register_blueprint(self.blueprint)
self.app.config['SQLALCHEMY... | [
{
"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 | server/instance.py | elieltonlimeira/desafio-backend |
from config import BaseConfig
import gridfs
class Userdb:
client = BaseConfig.MONGOD_DATABASE_URI
# client = MongoClient('localhost:27017')
db = BaseConfig.DB_NAME
# db = 'users'
def __init__(self, coll):
# self.db = db
self.coll = coll
def conn(self):
return self.cli... | [
{
"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 | common/database.py | perrycharlton/forms |
from typing import List
import functools
import pytest # type: ignore
from strategy_param import Customer, LineItem, Order, Promotion
from strategy_param import fidelity_promo, bulk_item_promo, LargeOrderPromo
from strategy_param import general_discount
@pytest.fixture
def customer_fidelity_0() -> Customer:
re... | [
{
"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 | 10-dp-1class-func/strategy_param_test.py | eumiro/example-code-2e |
from tir import Webapp
import unittest
class ATFA001(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGAATF", "30/06/2020", "T1", "D MG 01 ", "01")
inst.oHelper.Program("ATFA001")
# ================================================... | [
{
"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 | Protheus_WebApp/Modules/SIGAATF/ATFA001TESTCASE.py | 98llm/tir-script-samples |
#!/usr/bin/env python
"""
SHUTDOWN.PY
Shutdown Plugin
(C) 2015, rGunti
"""
import dot3k.lcd as lcd
import dot3k.backlight as backlight
import time, datetime, copy, math, psutil
import sys
import os
from dot3k.menu import Menu, MenuOption
class Shutdown(MenuOption):
def __init__(self):
self.last = self.millis... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | display/plugins/Shutdown.py | rGunti/Yuki-Chan-Music-Player |
from math import exp,sqrt
from random import randrange
class neurone:
def __init__(self,a,b):
self.a=a
self.b=b
def proceed(self,z):
t = z[0]*self.a + z[1]*self.b
return 1/(1+exp(-t))
n = 100
X_app = [(randrange(-500,501)/1000,randrange(-500,501)/1000) for i in range(n)]
Y_app ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | teacher_files/ia_fopera/version sockets (unix only) d'H. Roussille/neurones.py | zomboyd/epi-ml |
"""
This module will take care of any uploading to
the db, through this app.
"""
import subprocess
import click
import isort # noqa: F401
import snoop
from loguru import logger
from mysql.connector import Error, connect
fmt = "{time} - {name} - {level} - {message}"
logger.add("../logs/info.log", level="INFO", format... | [
{
"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 | cli_apps/db_management/add.py | miccaldas/cli_apps |
from gevent import sleep, Greenlet, spawn_raw
class Periodic(object):
def __init__(self, interval, f, *args, **kwargs):
self.interval = interval
self.f = f
self.args = args
self.kwargs = kwargs
self._greenlet = None
def _run(self):
while True:
spawn... | [
{
"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 | jeev/utils/periodic.py | jhgg/jeev |
"""Abstract base model for Neural network"""
from abc import ABC,abstractmethod
from utils.config import Config
class BaseModel(ABC):
"""Abstract model base class that is inherited by all child classes"""
def __init__(self,cfg):
self.config = Config.from_json(cfg)
@abstractmeth... | [
{
"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 | pipeline/model/.ipynb_checkpoints/base_model-checkpoint.py | tomkimpson/ML4L |
from flask import Flask
from flask import request
from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(180)
sense.clear()
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/display', methods=['POST'])
def display():
data = request.get_json()
message = ... | [
{
"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 | messenger/messenger.py | hferentschik/balena-sense |
#!/usr/bin/env python
from ansible.module_utils.basic import * # noqa
DOCUMENTATION = '''
---
module: scan_insights
short_description: Return insights id as fact data
description:
- Inspects the /etc/redhat-access-insights/machine-id file for insights id and returns the found id as fact data
version_added: "2.3"
... | [
{
"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 | awx/plugins/library/scan_insights.py | Avinesh/awx |
#encoding:utf-8
import torch
import numpy as np
from ..utils.utils import model_device,load_bert
class Predicter(object):
def __init__(self,
model,
logger,
n_gpu,
model_path
):
self.model = model
self.logger = logg... | [
{
"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 | Code/HypoBertClas/pybert/test/predicter.py | NinaTian98369/HypoGen |
"""
Copyright (C) 2018, AIMLedge Pte, Ltd.
All rights reserved.
"""
from PyQt5.QtWidgets import QDialog, QApplication
from gui.face_registry_view_ui import Ui_FaceRegistryUI
SAMPLE_FACE_REGISTRIES = ['Demo_face_1', 'Demo_face_2']
class FaceRegistryView(QDialog):
def __init__(self, parent=None, face_recognizer=No... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | face_registry_view.py | Aimledge/pyqt5-face-recognition |
# -*- coding: utf-8 -*-
"""vrmapiのMock
sphinx-apidocで撮る夫くんをビルドするときに,
WindowsのPythonエンジンにvrmapiがないのでModuleNotFoundErrorが出る。
エラーを回避するための最小限のコードを含むガワだけ用意しておくのが目的。
"""
import os
from unittest.mock import MagicMock
def LAYOUT():
return MagicMock()
def SYSTEM():
return VRMSystem()
def LOG(obj):
return
def C... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | vrmapi.py | AKAGI-Rails/vrmnx-toruo |
# coding: utf-8
"""
HashiCorp Vault API
HTTP API that gives you full access to Vault. All API routes are prefixed with `/v1/`. # noqa: E501
OpenAPI spec version: 1.2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
... | [
{
"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 | hashicorp_vault_client/test/test_body68.py | drewmullen/HAC |
"""Support for IKEA Tradfri sensors."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from .base_class import TradfriBaseDevice
from .const import CONF_GATEWAY_ID, DEVICES, DOMAIN, KEY_API
async def async_setup_entry(hass, config_entry, asy... | [
{
"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 | homeassistant/components/tradfri/sensor.py | basicpail/core |
import numpy as np
from autode.units import ang, ha, ha_per_ang, ha_per_a0, ev
from autode.values import (ValueArray, Gradient, Coordinate, Coordinates,
MomentOfInertia)
class TmpValues(ValueArray):
implemented_units = [ha, ev]
def __repr__(self):
return ''
def test_base... | [
{
"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 | tests/test_values.py | skphy/autodE |
import pytest
from red_panda.aws.athena import AthenaUtils
import logging
LOGGER = logging.getLogger(__name__)
@pytest.fixture
def athena_utils(aws_config, athena_result_location, aws_region):
return AthenaUtils(
aws_config, athena_result_location, region_name=aws_region, work_group="primary"
)
de... | [
{
"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/integ/aws/test_athena.py | jucyai/red-panda |
#_*_coding:utf-8_*_
import datetime
import re
from django import template
from django.db.models import Sum
from crm import models
from django.utils.safestring import mark_safe
from django.urls import reverse as url_reverse
register = template.Library()
@register.simple_tag
def get_study_record_count(enroll_obj):
... | [
{
"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": true
... | 3 | taotao-cloud-python/taotao-cloud-oldboy/day84-PerfectCRM/PerfectCRM-master/student/templatetags/stu_tags.py | shuigedeng/taotao-cloud-paren |
# 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-iot/aliyunsdkiot/request/v20180120/GenerateDeviceNameListURLRequest.py | liuzheng/aliyun-openapi-python-sdk |
import logging
import subprocess
import threading
from platypush.plugins.camera.model.writer.image import MJPEGStreamWriter
from platypush.plugins.camera.model.writer.preview import PreviewWriter
class FFplayPreviewWriter(PreviewWriter, MJPEGStreamWriter):
"""
General class for managing previews from camera ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | platypush/plugins/camera/model/writer/preview/ffplay.py | RichardChiang/platypush |
from pymedphys._dev import docs, propagate, tests
def dev_cli(subparsers):
dev_parser = subparsers.add_parser("dev")
dev_subparsers = dev_parser.add_subparsers(dest="dev")
add_docs_parser(dev_subparsers)
add_test_parser(dev_subparsers)
add_lint_parser(dev_subparsers)
add_propagate_parser(dev_s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | lib/pymedphys/cli/dev.py | dg1an3/pymedphys |
#!/usr/bin/env python
# Copyright 2017 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.
"""//testing/scripts wrapper for the network traffic annotations checks.
This script is used to run check_annotations.py on the trybots... | [
{
"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 | testing/scripts/check_network_annotations.py | zipated/src |
# from django.shortcuts import render
from meuapp.models import Pessoa
from django.http import HttpResponse
from rest_framework.generics import ListAPIView, CreateAPIView, UpdateAPIView, DestroyAPIView, RetrieveAPIView
from .serializers import PessoaSerializer
def hello_world(request):
return HttpResponse('Hell... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | temp/views.py | mentoriacompartilhada/helenamagaldi-v0 |
#!/usr/bin/python
import sys
import os
import threading
from threading import Thread
import time
import signal
import subprocess
airsimprocess = subprocess.Popen(["/home/nvagent/Blocks/Blocks.sh"])
exit_flag = False
def exit_properly_runtime_test():
global exit_flag
print("CREATING SUCCESS RESULT FILE... | [
{
"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 | docker/ubuntu-bionic/runtime_test.py | pabloinigoblasco/DroneRescue |
import pytest
import pathlib
import sys
import requests
import io
import zipfile
import tempfile
import pandas as pd
import os
HERE = pathlib.Path(__file__).resolve().parent
# insert at 1, 0 is the script path (or '' in REPL)
# temporary hack until package is published and we can inherit from there:
sys.path.inser... | [
{
"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 | tests/test_db_utils.py | larssl780/thin_wrappers |
# coding: utf-8
"""
Task Execution Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import... | [
{
"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 | libica/openapi/libtes/test/test_task_versions_api.py | umccr-illumina/libica |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtkStructPtsRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | modules/readers/vtkStructPtsRDR.py | chrisidefix/devide |
#!/usr/bin/env python3
from ..approximate_gp import ApproximateGP
class BayesianGPLVM(ApproximateGP):
"""
The Gaussian Process Latent Variable Model (GPLVM) class for unsupervised learning.
The class supports
1. Point estimates for latent X when prior_x = None
2. MAP Inference for X when prior_x... | [
{
"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 | gpytorch/models/gplvm/bayesian_gplvm.py | llguo95/gpytorch |
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.3
Contact: support@ory.sh
Generated by: http... | [
{
"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 | clients/client/python/test/test_ui_node.py | simoneromano96/sdk |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 25 15:21:34 2021
@author: crtjur
"""
import tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
root.title("Title")
root.geometry("280x350")
root.configure(background="black")
class Example(tk.Frame):
def __init__(self, master, *pargs):
tk.Frame.__i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | learning/set-background-image-v2.py | CrtomirJuren/pyfirmata-arduino |
import io
from sdk.db import database
import numpy as np
import matplotlib.pyplot as plt
from numba import jit
from utils import logger
semester_order = ['FA', 'WI', 'SP', 'SU']
def get_section(x):
return (
x.get('semester'),
x.get('year')
)
def filter_function(sections):
d = {}
... | [
{
"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/plotter.py | jzlotek/drexel-tms-parser |
import string
from app.chatterbot import languages
from spacy.lang.zh import Chinese
class LowercaseTagger(object):
"""
Returns the text in lowercase.
"""
def __init__(self, language=None):
self.language = language or languages.ENG
def get_text_index_string(self, text):
return te... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | app/chatterbot/tagging.py | Jack2313/WeChatterBot |
import pytest
#from blogcookiecutter.users.models import User
#from blogcookiecutter.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"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 | blogcookiecutter/conftest.py | saaddine/blogcookiecutt |
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView
from .serializers import SalaSerializer
from .models import Sala
class CreateView(ListCreateAPIView):
queryset = Sala.objects.all()
serializer_class = SalaSerializer
def perform_create(self, serializer):
"""Salv... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | agenda_me/salas/views.py | cleberpereiradasilva/python-django-agendamento |
from fusearch.index import Index
from fusearch.tokenizer import Tokenizer, tokfreq
from pony.orm import *
from fusearch.model import Document
from nose.tools import *
from fusearch.util import compose
class NaiveTokenizer(Tokenizer):
def tokenize(self, x):
return x.split()
def test_query():
index = ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | tests/test_index.py | larroy/fusearch |
from flask import (
render_template,
Blueprint,
Response
)
main = Blueprint('main', __name__)
@main.route('/')
@main.route('/home')
def index():
return render_template('index.html')
@main.route('/projects')
def projects():
return render_template('projects/projects.html', title='Projects')
@ma... | [
{
"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 | davaiops/routes/main.py | barretobrock/davaiops |
from rlbot.utils.structures.game_data_struct import Physics, GameTickPacket, PlayerInfo
from rlbot.agents.base_agent import SimpleControllerState, BaseAgent
from states.state import State
from util.packet import ParsedPacket
class GroundSave(State):
def score(self, parsed_packet: ParsedPacket, packet: GameTickPa... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | FirstChild/src/states/ground_save.py | KrystopherWeeton/RLBot |
from django.shortcuts import render
# Create your views here.
def index(request):
"""
View function for home page.
"""
return render(
request,
'index.html',
context={},
)
def cottage(request):
"""
View function for cottage page.
"""
return render(
... | [
{
"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 | trefechanwen/views.py | HedgehogProductions/trefechanwen |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... | [
{
"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 | isi_sdk_9_0_0/test/test_dataset_workload_extended.py | mohitjain97/isilon_sdk_python |
import asyncio
import sys
import click
from pydantic import SecretStr
from server.application.auth.commands import ChangePassword
from server.config.di import bootstrap, resolve
from server.domain.auth.entities import User
from server.domain.auth.repositories import UserRepository
from server.seedwork.application.mes... | [
{
"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 | tools/changepassword.py | multi-coop/catalogage-donnees |
from ..documents import numbering_level
def read_numbering_xml_element(element):
abstract_nums = _read_abstract_nums(element)
nums = _read_nums(element, abstract_nums)
return Numbering(nums)
def _read_abstract_nums(element):
abstract_num_elements = element.find_children("w:abstractNum")
return 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | mammoth/docx/numbering_xml.py | cockcrow/python-mammoth |
import json
from gpiozero import LED
from time import sleep
from channels.generic.websocket import WebsocketConsumer
from .mailSender import MailSender
class GateTriggerConsumer(WebsocketConsumer):
def connect(self):
sleep(0.5)
self.accept()
def disconnect(self, close_code):
... | [
{
"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 | gateController/consumers.py | Bicskow/rpiGateOpener |
import sys
from os import listdir
from os.path import isfile, join, dirname, realpath
import struct
import gzip
def list_dir(d):
return [f for f in listdir(d) if isfile(join(d, f))]
def store(p, file):
try:
output_file = open(p, "w", encoding="utf-8", errors="xmlcharrefreplace")
output_file.... | [
{
"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 | tools/tags/storage.py | polaretto/topocity |
"""Test variable lookup when stopped in inline functions."""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class InlinesTestCase(TestBase):
mydir = TestBase.compute_mydir(... | [
{
"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 | lldb/packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py | tkf/opencilk-project |
import numpy as np
class DimensionalityError(ValueError):
pass
class LinearDependenceError(ValueError):
pass
def isomorphism(frame1, frame2):
'''
Takes two bases and returns their standard matrix representation.
Args:
frame1: N x N np.ndarray
frame2: N x N np.ndarray
Ret... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 4 | blmath/numerics/linalg/isomorphism.py | metabolize/blmath |
import keyboard
import settings
from key_sender import *
import utils
class HotKey(object):
def __init__(self):
pass
def regist_hotkey(self, hotkey_group, queue_h):
if settings.test:
keyboard.add_hotkey('F10', self.f10_fun)
keyboard.add_hotkey('F11', self.f11_fun)
... | [
{
"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 | send_key_explame/pypiwin32/hot_key.py | Llona/hotkey |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_chart_gradient06.py | hugovk/XlsxWriter |
"""
A ball object to throw.
"""
import numpy as np
from throwable import ThrowableObject
from ..plot import plot_sphere
class Ball(ThrowableObject):
def __init__(self, position, radius, target=False):
"""Ball object that can move, have a velocity, and hit objects
:param position: The position (x... | [
{
"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 | environments/robot_arm/maddux/objects/ball.py | callaunchpad/MOR |
from testpkguno import ClassA
class ClassB(ClassA):
def __init__(self, **kwargs):
pass
# Overwriting one method from ClassA to
# test that ordering of inheritance is
# respected
def banarchy(self, nonsense=True):
return(nonsense)
def hello_there(self, greeting):
pas... | [
{
"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 | integration_tests/test-packages/python/testpkguno/testpkguno/ClassB.py | bburns632/doppel-cli |
from ts_sdk import task
def test_log(input, context: task.Context):
logger = context.get_logger()
logger.log({
"message": "Hello from test function!",
"level": "info"
})
def test_file_operations(input, context: task.Context):
file = context.write_file(b'test-content', input.get('newFil... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | __tests__/integration/mocks/main.py | tetrascience/ts-sdk-python |
import numpy as np
import matplotlib.pyplot as plt
evenR = np.array([1.212,3.368])
oddR = np.array([2.381])
S = evenR.size+oddR.size
prop = np.zeros(S)
tunn = np.zeros(S)
i=0
j=1
a=0.469
def rad(x):
return np.sqrt((1.1*np.pi)**2-x**2)
print (S)
print (prop)
print (tunn)
while i< evenR.size:
prop[2*i] = evenR[i]... | [
{
"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 | index_plot.py | Durabun/QWell |
from unittest import TestCase
import numpy as np
from pyecsca.sca import Trace, trim, reverse, pad
class EditTests(TestCase):
def setUp(self):
self._trace = Trace(np.array([10, 20, 30, 40, 50], dtype=np.dtype("i1")))
def test_trim(self):
result = trim(self._trace, 2)
self.assertIsN... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | test/sca/test_edit.py | scrambler-crypto/pyecsca |
# -*- coding: utf-8 -*-
import docker_registry.core.driver as engine
import tempfile
from ..lib import config
__all__ = ['load']
def temp_store_handler():
tmpf = tempfile.TemporaryFile()
def fn(buf):
tmpf.write(buf)
return tmpf, fn
_storage = {}
def load(kind=None):
"""Returns the r... | [
{
"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 | docker_registry/storage/__init__.py | kirat-singh/docker-registry |
import asyncio
import pytest
from shazamio import Shazam
from shazamio.utils import get_file_bytes
@pytest.fixture(scope="session")
def event_loop():
return asyncio.get_event_loop()
@pytest.fixture
async def song_bytes():
yield await get_file_bytes(file="examples/data/dora.ogg")
@pytest.mark.asyncio(scop... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_recognize.py | asmiyusau/ShazamIO |
"""Downloads prescribed data from the Internet, embed and store it."""
import logging
import numpy as np
import torch
from experiments.scrap import META_PATH
from mem.gen.stages import Extractor
logger = logging.getLogger(__name__)
MATRIX_PATH = 'matrix.npy'
NEW_META_PATH = 'processed_reddit_data.pth'
def main(_... | [
{
"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 | experiments/download.py | stasbel/Meme-Machinery-VKHack2018 |
import re
import time
from django.conf import settings
from django.utils.timezone import make_aware, make_naive, utc
re_pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]+', re.UNICODE)
def sanitize_unicode(u):
# We may not be able to store all special characters thanks
# to MySQL's boneheadedness, so acce... | [
{
"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 | soctrack/utils.py | kcsry/soctrack |
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Changgon Kim, Mingeyong Yang, Taeeun Kim
# @Date: 2021-04-26 17:14
# @Last modified by: Changgon Kim
from __future__ import absolute_import, division, print_function
class LvmIebError(Exception):
"""A custom core LvmIeb exceptio... | [
{
"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": false
... | 3 | python/lvmieb/exceptions.py | sdss/OsuActor |
class NoNodeData(Exception):
pass
class AVLNode(object):
def __init__(self, key=None, value=None) -> None:
"""Initializes the AVL Node.
Args:
data (dict, optional): {Key:Value} pair. Defaults to None.
"""
super().__init__()
self.key = key
self.valu... | [
{
"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 | avltree/AVLNode.py | gpk2000/avl-db |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, date, timedelta
import calendar
def get_month_range(start_date=None):
if start_date is None:
start_date = date.today().replace(day=1)
_, days_in_month = calendar.monthrange(start_date.year, start_date.month)
end_date = st... | [
{
"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 | date_time/date_range.py | jumploop/collection_python |
import deepSI
from deepSI.systems.system import System_ss, System_data
import numpy as np
class NarendraLiBenchmark(System_ss): #https://arxiv.org/pdf/2003.14162.pdf
"""docstring for NarendraLiBenchmark"""
def __init__(self):
'''Noise, system setting and x0 settings'''
super(NarendraLiBenchmark... | [
{
"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 | deepSI/systems/narendra_li_benchmark.py | csutakbalazs/deepSI |
import math
import numpy as np
import torch
import random
# ipt is nparray with dimension (height, width, channel)
# xml is nparray with dimension (height, width)
def addNoise(ipt, miu, std):
noise = np.random.normal(miu, std, ipt.shape)
noise = np.float32(noise)
return ipt + noise
def thAddNoise(ipt, m... | [
{
"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 | linepx/datasets/transforms.py | moliushang/wireframe_ |
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from basicapp.models import UserProfileInfo
@receiver(post_save, sender=User)
def create_profile(sender, instance, created, **kwargs):
if created:
UserProfileInfo.objects.create(... | [
{
"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 | searchBar/basicapp/signals.py | rajvijen/Industry-Visit-Planning-and-Booking |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
import pytest
## PYTEST
from ch02_math.solutions.ex12_primefactors import calc_prime_factors, calc_prime_factors_optimized
def value_and_prime_factors():
return [(8, [2, 2, 2]),
(14, [2, 7]),
(42, [2, ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | Python/zzz_training_challenge/Python_Challenge/solutions/tests/ch02_math/ex12_prime_factors_test.py | Kreijeck/learning |
#!/usr/bin/env https://github.com/Tandelajr/mr.tandela
# MIT License
#
# Copyright (C) 2020, Entynetproject. All Rights Reserved.
#
# 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 re... | [
{
"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 | tools/randomData.py | Tandelajr/mr.tandela |
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=['bcrypt'],deprecated='auto')
def hash(password: str):
return pwd_context.hash(password)
def verify(plain_password,hashed_password):
return pwd_context.verify(plain_password,hashed_password) | [
{
"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 | app/utils.py | kevin-corb/FastAPI |
from regrippy import BasePlugin, PluginResult
class Plugin(BasePlugin):
"""Get the Windows version"""
__REGHIVE__ = "SOFTWARE"
def run(self):
key = self.open_key("Microsoft\\Windows NT\\CurrentVersion")
if not key:
return
value = key.value("ProductName")
yield... | [
{
"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 | regrippy/plugins/version.py | timtaylor3/regrippy |
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import six
from nfv_common.helpers import Constant
from nfv_common.helpers import Constants
from nfv_common.helpers import Singleton
from nfv_vim.nfvi.objects.v1._object import ObjectData
@six.add_metaclass(Singleton)
cla... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | nfv/nfv-vim/nfv_vim/nfvi/objects/v1/_guest_service.py | SidneyAn/nfv |
from typing import Union, cast
import libcst as cst
import libcst.matchers as m
from .util import CodeMod, runner
"""
libcst based transformer to convert 'for x in generator: yield x' to 'yield from generator'.
"""
__author__ = "Gina Häußge <gina@octoprint.org>"
__license__ = "MIT"
class YieldFromGenerator(CodeMo... | [
{
"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 | octoprint_codemods/yield_from_generator.py | OctoPrint/codemods |
from thefeck.rules.ls_all import match, get_new_command
from thefeck.types import Command
def test_match():
assert match(Command('ls', ''))
assert not match(Command('ls', 'file.py\n'))
def test_get_new_command():
assert get_new_command(Command('ls empty_dir', '')) == 'ls -A empty_dir'
assert get_new... | [
{
"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/rules/test_ls_all.py | eoinjordan/thefeck |
# Copyright 2014 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 telemetry.page import page as page_module
from telemetry import story
class MseCasesPage(page_module.Page):
def __init__(self, url, page_set):
s... | [
{
"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 | third_party/webrtc/src/chromium/src/tools/perf/page_sets/mse_cases.py | bopopescu/webrtc-streaming-node |
import sqlite3
import os
def sql_connection():
"""
Establishes a connection to the SQL file database
:return connection object:
"""
path = os.path.abspath('PlaystoreDatabase.db')
con = sqlite3.connect(path)
return con
def sql_fetcher(con):
"""
Fetches all the with the given quer... | [
{
"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 | PlaystoreScraper/display_apps.py | avinashkranjan/PraticalPythonProjects |
"""
Created on Tue Jun 23 20:15:11 2020
@author: sarroutim2
"""
"""Genearates a representation for an image input.
"""
import torch.nn as nn
import torch
import torchvision.models as models
class EncoderCNN(nn.Module):
"""Generates a representation for an image input.
"""
def __init__(self, output_si... | [
{
"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": fals... | 3 | models/encoder_cnn.py | sarrouti/VQG |
from GenObj import *
class GenBelongsTo(GenObj):
def __init__(self, name, stmtIndex):
super(GenBelongsTo, self).__init__(name)
self.stmtIndex = stmtIndex
def getStmtIndex(self):
return self.stmtIndex
def setStmtIndex(self, stmtIndex):
self.stmtIndex = stmtIndex
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | latex2minizinc/GenBelongsTo.py | rafaellc28/Latex2MiniZinc |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class ProfileForm(UserCreationForm):
email = forms.EmailField(widget=forms.TextInput(
attrs = {
'type' : 'email',
'placeholder' : ('Email')
}
))
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | core/forms.py | donnellan0007/blog |
import os.path
import unittest
import hashlib
from tableaudocumentapi import Workbook
TEST_ASSET_DIR = os.path.join(
os.path.dirname(__file__),
'assets'
)
TEST_TWB_FILE = os.path.join(
TEST_ASSET_DIR,
'group_test.twb'
)
TEST_TWB_FILE2 = os.path.join(
TEST_ASSET_DIR,
'add_user_filter_test.twb... | [
{
"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 | test/test_worksheet.py | adrianturcato/document-api-python |
from ...bh_trees import Task
class IsCargoFull(Task):
def __init__(self):
super(IsCargoFull, self).__init__()
def run(self):
object = self._blackboard.get_value('object')
return True if object.get_cargo_space_left()==0 else False
| [
{
"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 | lucia/worker/tasks/is_cargo_full.py | LuxAI-Gamers/LucIA |
# -*- coding: utf-8 -*-
"""
jinja2._ipysupport
~~~~~~~~~~~~~~~~~~
IronPython support library. This library exports functionality from
the CLR to Python that is normally available in the standard library.
:copyright: (c) 2009 by the Jinja Team.
:license: BSD.
"""
from System import DateTime
fr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | nb_third_party/jinja2/_ipysupport.py | djprmf/namebench |
#!/usr/bin/env python
import gzip
import sys
def readConversionFiles(chromosome_accessions):
accession_to_chrom = {}
ip = open(chromosome_accessions, 'r')
for line in ip:
if (line[0] != '#'):
fields = line.strip().split("\t")
if (fields[0] == "MT"):
chrom =... | [
{
"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/convertRefSeqChromosomeNames.py | clb1/CreateCGDB |
async def get_location_count() -> int:
return 234
async def get_locations_used() -> int:
return 230
| [
{
"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 | app/services/storage_service.py | jubbp/maker-hub |
import discord
import requests
import os
my_secret = os.environ['TOKEN']
glow = 'terra1tu9yjssxslh3fd6fe908ntkquf3nd3xt8kp2u2'
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == cl... | [
{
"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 | terra_qry_discord_bot.py | ngmisl/terra-python-query |
"""
An example of a simple worker
Run as follows:
from browser import webworker as ww
w = ww.WorkerParent('web_workers/test_worker.py',[1,2,3],{"test":"Ahoj"})
m = ww.Message('ping',"ahoj")
r = w.post_message(m,want_reply=True)
w.post_message(ww.Message('quit',N... | [
{
"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 | www/src/web_workers/test_worker.py | raspberrypieman/brython |
# -*- coding: utf-8 -*-
# perceptron_primal.py
"""
Created by jin.xia on May 09 2017
@author: jin.xia
"""
import os
import operator
import numpy as np
#
class perceptron_primal():
def __init__(self, learning_rate=1):
self.learning_rate = learning_rate
self.w = []
self.b = 0
def learning(self, training_... | [
{
"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 | dev/statistical_ml/perceptron/perceptron_primal.py | karst87/ml |
import os
import os.path as path
import pytest
import cocotb as ctb
import cocotb_test.simulator as tester
class TB(object):
pass
class MicroBlaze():
pass
@ctb.test()
def controller_test(dut):
pass
tests_dir = path.dirname(__file__)
hdl_dir = path.abspath(path.join(tests_dir, '..', 'hdl'))
... | [
{
"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 | testbench/controller_test.py | DEFAULTTEXHAPb/SampleRateConverter |
class Televisao:
def __init__(self):
self.ligada = False #tv vai começar desligada
self.canal = 5 #canal vai começar no 5
#metodo para ligar a tv
def power(self):
if self.ligada:
self.ligada = False
else:
self.ligada = True
def aumenta_canal(self):
... | [
{
"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 | Metodos funcoes classes/televisao.py | PaulaRegal/Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.