source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
'''
Module for gathering disk information on Windows
:depends: - win32api Python module
'''
from __future__ import absolute_import
# Import python libs
import ctypes
import string
# Import salt libs
import salt.utils
try:
import win32api
except ImportError:
pass
# Define the modul... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | salt/modules/win_disk.py | bogdanr/salt |
import unittest
def soma(param, param1):
return param + param1
class BasicoTests(unittest.TestCase):
def test_soma(self):
resultado = soma(1, 2)
self.assertEqual(3, resultado)
resultado = soma(3, 2)
self.assertEqual(5, resultado)
if __name__ == '__main__':
unittest.main... | [
{
"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 | testes_basicos.py | renzon/pypraticot2 |
import sqlite3
from abc import ABCMeta, abstractmethod
from model.dao.daoexception import DAOException
class AbstractDAO(object):
__metaclass__ = ABCMeta
def __init__(self, conn):
self._conn = conn
"""
base CRUD operation
"""
# GENERIC CREATE FUNCTION
def _insert(self, request, 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | model/dao/abstractdao.py | ChatNoir76/Championnat |
import typing
def floor_sum(n: int) -> int:
s = 0
i = 1
while i <= n:
x = n // i
j = n // x + 1
s += x * (j - i)
i = j
return s
def main() -> typing.NoReturn:
n = int(input())
print(floor_sum(n))
main()
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | jp.atcoder/abc230/abc230_e/28080338.py | kagemeka/atcoder-submissions |
import tensorflow as tf
from tensorflow.keras import losses
import tensorflow.python.keras.backend as K
class ImageGradientDifferenceLoss(losses.Loss):
def __init__(self):
super().__init__()
def call(self, y_true, y_pred):
# for 5D inputs
gdl = 0
for i in range(y_true.shape[1])... | [
{
"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 | src/factory/loss.py | leelew/HRSEPP |
#!/usr/bin/python3
"""
Flask App that integrates with AirBnB static HTML Template
"""
from flask import Flask, render_template, url_for
from models import storage
import uuid
# flask setup
app = Flask(__name__)
app.url_map.strict_slashes = False
port = 5000
host = '0.0.0.0'
# begin flask page rendering
@app.teardow... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | web_dynamic/3-hbnb.py | Sranciato/AirBnB_clone_v4 |
import pytest
import pyansys
from pyansys import examples
from vtki.plotting import running_xserver
import os
@pytest.mark.skipif(not running_xserver(), reason="Requires active X Server")
def test_show_hex_archive():
examples.show_hex_archive(off_screen=True)
def test_load_result():
examples.load_result()
... | [
{
"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/test_examples.py | guyms/pyansys |
import pytest
from mitmproxy.contentviews import protobuf
from . import full_eval
datadir = "mitmproxy/contentviews/test_protobuf_data/"
def test_view_protobuf_request(tdata):
v = full_eval(protobuf.ViewProtobuf())
p = tdata.path(datadir + "protobuf01")
with open(p, "rb") as f:
raw = f.read()
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | test/mitmproxy/contentviews/test_protobuf.py | 0x7c48/mitmproxy |
# Copyright (c) 2015 Rackspace, 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 agreed to in wr... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/unit/manager/default/test_notification_wrapper.py | satroutr/poppy |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
full_name = models.CharField(max_length=100)
email = models.E... | [
{
"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 | users/models.py | mohilkhare1708/descriptiveAnswerChecker |
from django.db import models
from django.core.urlresolvers import reverse
from accounts.models import Company
class Contact(models.Model):
company = models.ForeignKey(Company)
name = models.CharField(max_length=256)
identification = models.CharField(max_length=256, null=True, blank=True)
phone = models... | [
{
"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 | accountit/contacts/models.py | nicolasmesa/Accountit |
import copy
from bsm.config.util import package_path
from bsm.config.util import check_conflict_package
from bsm.util import safe_mkdir
from bsm.util.config import dump_config
from bsm.operation import Base
from bsm.logger import get_logger
_logger = get_logger()
class InstallPackageConfigError(Exception):
pa... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | bsm/operation/install_package_config.py | bsmsoft/bsm |
import pytest
from runner import ProjectType
from glotter import project_test, project_fixture
from test.utilities import clean_list
invalid_permutations = (
'description,in_params,expected', [
(
'no input',
None,
'Usage: please provide a list of integers (e.g. "8, 3, 1... | [
{
"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 | test/projects/test_maximum_array_rotation.py | jrg94/sample-programs-in-every-language |
from django.db import models
from django.utils import timezone
import datetime
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
# def was_published_recently(self):
# return self.pub_date >= t... | [
{
"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 | E73/framework-tutorial/mysite/polls/models.py | wendy006/Web-Dev-Course |
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.test import TestCase
from postgres_stats import Percentile
from .models import Number
class TestAggregates(TestCase):
def setUp(self):
numbers = [31, 83, 237, 250, 305, 314, 439, 500, 520, 526, 527, 533,
... | [
{
"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_aggregates.py | rtidatascience/django-postgres-power |
from flask import Flask
from flask_graphql import GraphQLView
from models import db_session
from schema import schema, Department
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return '<p> Hello World!</p>'
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view(
'graph... | [
{
"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 | graphql/flask-graphql-basic_example2/app.py | CALlanoR/virtual_environments |
__author__ = 'gkour'
import matplotlib.animation as manimation
class Animation:
def __init__(self, fig, file_name):
FFMpegWriter = manimation.writers['ffmpeg']
metadata = dict(title='Movie Test', artist='Matplotlib', comment='Movie support!')
self.writer = FFMpegWriter(fps=1, metadata=met... | [
{
"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 | Animation.py | kourgeorge/plus-maze-simulator |
from unittest import TestCase
from expects import expect, equal, raise_error
from slender import List
class TestSelect(TestCase):
def test_select_if_func_is_valid(self):
e = List([1, 2, 3, 4, 5])
expect(e.select(lambda item: item > 3).to_list()).to(equal([4, 5]))
def test_select_if_func_is... | [
{
"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 | slender/tests/list/test_select.py | torokmark/slender |
"""Tests for the backend"""
from .tools import logprint, AppTestCase, load_file_to_dict, load_json
class GetConstructsAsGenbankTests(AppTestCase):
endpoint = 'get_constructs_as_genbanks'
defaults = dict(
database_token='',
constructsData={}
)
def test_emma_2_constructs_with_one_combin... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | backend/app/tests/tests.py | Edinburgh-Genome-Foundry/dab |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/openapi3/client/petstore/python-experimental/petstore_api/model/integer_enum_big.py | chanjarster/openapi-generator |
class Decorator:
"""Clase de decorador simple."""
def __init__(self, a,b):
self.a = a
self.b = b
def suma(self):
print(self.a+self.b)
self.c=self.a*self.b
def resta(self):
print(self.c)
elvis=Decorator(10,5)
elvis.resta() | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | pruebas/prueba54.py | elviscruz45/Selenium |
import pytest
from dependency_injector import Scope
from dependency_injector.errors import InvalidScopeError
from ..utils import Context
from . import ioc
class Service1:
pass
class Service2:
def __init__(self, service1: Service1):
self.service1 = service1
def test_inject_transient_into_dependen... | [
{
"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 | test/sync_tests/test_scopes.py | livioribeiro/dependency-injector |
from rest_framework import status
from rest_framework.views import exception_handler as drf_exception_handler
from django.http import JsonResponse
def default_handler(exc, context):
# https://www.django-rest-framework.org/api-guide/exceptions/
# Call REST framework's default exception handler first,
# to ... | [
{
"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 | degvabank/degvabank/core/exception_handler.py | Vixx-X/DEGVABanck-backend |
import os
import signal
import sys
import logging
import time
class Watcher(object):
"""this class solves two problems with multithreaded
programs in Python, (1) a signal might be delivered
to any thread (which is just a malfeature) and (2) if
the thread that gets the signal is waiting, the signal
... | [
{
"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 | grab/tools/watch.py | subeax/grab |
import unittest
from scrubadub.filth import Filth
from scrubadub.exceptions import InvalidReplaceWith, FilthMergeError
class FilthTestCase(unittest.TestCase):
def test_disallowed_replace_with(self):
"""replace_with should fail gracefully"""
filth = Filth()
with self.assertRaises(InvalidRe... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_filth.py | robclewley/scrubadub |
# coding: UTF-8
from __future__ import absolute_import
from datetime import datetime
from flask import current_app
from flask.json import JSONEncoder
from flask.ext.assets import Environment
from flask.ext.migrate import Migrate
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class JSONSerializationM... | [
{
"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 | sisgep1/base.py | ArthurPBressan/sisgep1 |
from transform import Transform
import tensorflow as tf
class StyleTransferTester:
def __init__(self, session, content_image, model_path):
# session
self.sess = session
# input images
self.x0 = content_image
# input model
self.model_path = model_path
# ... | [
{
"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 | style_transfer_tester.py | altonelli/tensorflow-fast-style-transfer |
import contextvars
import gettext
import os.path
from glob import glob
from app.t_string import TString
BASE_DIR = ""
LOCALE_DEFAULT = "en_US"
LOCALE_DIR = "locale"
locales = frozenset(
map(
os.path.basename,
filter(os.path.isdir, glob(os.path.join(BASE_DIR, LOCALE_DIR, "*"))),
)
)
gettext_tr... | [
{
"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 | app/i18n.py | CircuitsBots/discord-i18n |
import numpy as np
def accuracy(y: np.ndarray, y_prediction: np.ndarray) -> np.float32:
"""Calculates accuracy for true labels and predicted labels.
:params y: True labels.
:params y_prediction: Predicted labels.
:return: Accuracy
:raises ValueError: If true labels and predicted labels are not of... | [
{
"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 | privacy_evaluator/metrics/basics.py | mariesig/privacy-evaluator |
from unittest import TestCase
from ddtrace.ext.http import URL
from ddtrace.filters import FilterRequestsOnUrl
from ddtrace.span import Span
class FilterRequestOnUrlTests(TestCase):
def test_is_match(self):
span = Span(name="Name", tracer=None)
span.set_tag(URL, r"http://example.com")
fil... | [
{
"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/tracer/test_filters.py | mbmblbelt/dd-trace-py |
"""Kraken - objects.Attributes.StringAttribute module.
Classes:
StringAttribute - Base Attribute.
"""
from kraken.core.objects.attributes.attribute import Attribute
from kraken.core.kraken_system import ks
class StringAttribute(Attribute):
"""String Attribute. Implemented value type checking."""
def __ini... | [
{
"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 | Python/kraken/core/objects/attributes/string_attribute.py | FabricExile/Kraken |
# https://codeforces.com/problemset/problem/230/B
# ! Only those numbers are T-prime which are perfect sq and their sq. root is also prime
# ? By using the sieve of Eratosthenes algorithm, we are calculating the prime numbers up to 1000000 and checking they are prime or not
# ? Also checking that number is perfect Sq... | [
{
"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 | Codeforces/230B T primes.py | a3X3k/Competitive-programing-hacktoberfest-2021 |
def write(path, content):
with open(path, "a+") as dst_file:
dst_file.write(content + '\n')
def read2mem(path):
with open(path) as f:
content = ''
while 1:
try:
lines = f.readlines(100)
except UnicodeDecodeError:
f.close()
... | [
{
"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 | GDLnotes/src/util/file_helper.py | dachmx/tfnotes |
"""empty message
Revision ID: 98f414e72943
Revises: 4f65c2238756
Create Date: 2019-04-30 23:46:07.283010
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '98f414e72943'
down_revision = '4f65c2238756'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/98f414e72943_.py | ansu5555/mt-backend |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test p2p mempool message.
Test that nodes are disconnected if they send mempool messages when bloom
fi... | [
{
"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 | test/functional/p2p-mempool.py | btclambo/BitcoinLambo |
import unittest
from checkov.terraform.checks.resource.gcp.GoogleCloudSqlDatabaseRequireSsl import check
from checkov.common.models.enums import CheckResult
class GoogleCloudSqlDatabaseRequireSsl(unittest.TestCase):
def test_failure(self):
resource_conf = {'name': ['google_cluster'], 'monitoring_service... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/terraform/checks/resource/gcp/test_GoogleCloudSqlDatabaseRequireSsl.py | cclauss/checkov |
from Element.FlutterFind import FlutterFind
from selenium.common.exceptions import WebDriverException, NoSuchElementException
from Utilitys.WaitUtils import WaitUtils
class FlutterElement(FlutterFind):
def __init__(self, driver):
FlutterFind.__init__(self)
self.driver = driver
self.interva... | [
{
"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 | Element/FlutterElement.py | sunnyyukaige/Automation-core |
import os.path
try:
from bpython._version import __version__ as version
except ImportError:
version = 'unknown'
__version__ = version
package_dir = os.path.abspath(os.path.dirname(__file__))
def embed(locals_=None, args=['-i', '-q'], banner=None):
from bpython.cli import main
return main(args, local... | [
{
"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 | pyramid_bpython_curses.py | iivmok/pyramid_bpython_curses |
from congregation.config.network import NetworkConfig
from congregation.config.codegen import CodeGenConfig, JiffConfig
class Config:
def __init__(self):
self.system_configs = {}
def add_config(self, cfg: [NetworkConfig, CodeGenConfig, JiffConfig]):
self.system_configs[cfg.cfg_key] = cfg
... | [
{
"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 | congregation/config/config.py | CCD-HRI/congregation |
import csv
# ==========================================================
# Function for reading a CSV file into a dictionary format
# ==========================================================
def read_variables_csv(csvfile):
"""
Builds a Python dictionary object from an input CSV file.
Helper function to ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | doepy/Test/doepy/read_write.py | Sigmun/doepy |
from app import db
from datetime import datetime, timedelta
class User(db.Model):
__tablename__ = 'users'
transfer_historys = db.relationship('TransferHistory', backref='users')
login_logs = db.relationship('LoginLog', backref='users')
id = db.Column(db.Integer, primary_key=True)
username = db.Col... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | Backend/models.py | Saboor-Hakimi/WaTF-Bank |
from re import findall, match, sub
from colorifix.colorifix import erase
from pymortafix._getchar import _Getch
def get_sub_from_matching(dictionary, matching):
index = [i for i, group in enumerate(matching.groups()) if group]
matched = list(dictionary)[index[0]] if index else None
return dictionary.get(... | [
{
"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 | pymortafix/utils.py | Mortafix/PyMortafix |
#swatch.py
#by TakHayashi
#execution time measurement module by closure.
#usage: see test code in __main__ of this.
from time import perf_counter,time,process_time
#don't use process_time : resolution > 16ms
def startwatch():
begin = perf_counter()
last = begin
def lap(form=None):
nonlocal begin, l... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | solver/swatch.py | TakHayashi/EnjoyProg |
class NeuralNet():
def __init__(self, game):
pass
def train(self, examples):
"""
This function trains the neural network with examples obtained from
self-play.
Input:
examples: a list of training examples, where each example is of form
... | [
{
"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 | pommerman/NN/neural_net.py | MaxU11/playground |
import cv2
import os,shutil
import numpy as np
from Adb import Adb
import time
class Photo():
'''
提取图片信息,比较图片
'''
def __init__(self,img_path) -> None:
'''
读取图片
'''
self.img = cv2.imread(img_path)
class sourceData():
'''
获取测试数据
'''
def ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | Photo.py | Rougnt/ArkNightAutoClick |
#!/usr/bin/env python
from testcases import gen_random, gen_fake_random
from time import time
begin = time()
RANDOM = True
conf_cnt = 7
if RANDOM:
test_cases = gen_random(10, conf_cnt)
else:
test_cases = gen_fake_random()
def check_valid(colors: list) -> bool:
# check if it's a valid palette
fo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | chapter-1/1-9/src/brute_force.py | yuetsin/beauty-of-programming |
### AGENDA
import os
class Agenda:
# Construtor
def __init__(self):
self.contatos = dict()
self.size = 0
pass
pass
# ToString
def __str__(self):
return str(self.contatos)
def addContato(self, nome, numero):
if nome in self.contatos:
self.c... | [
{
"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 | atividade-lista4/q3-done.py | nartojunior/ppgti0006-atividades |
# 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": "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 | aliyun-python-sdk-baas/aliyunsdkbaas/request/v20180731/SyncFabricChaincodeStatusRequest.py | yndu13/aliyun-openapi-python-sdk |
from io import BytesIO
import PIL.Image
from django.test import TestCase
from django.core.files.images import ImageFile
from wagtail.tests.utils import WagtailTestUtils
from wagtail.images.models import Image
from wagtail_meta_preview.utils import get_focal
# Taken from wagtail.images.test.utils
def get_test_image_... | [
{
"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_utils.py | marteinn/wagtail-meta-preview |
furl = None
try:
from furl import furl
except ImportError:
pass
import six
from sqlalchemy import types
from .scalar_coercible import ScalarCoercible
class URLType(types.TypeDecorator, ScalarCoercible):
"""
URLType stores furl_ objects into database.
.. _furl: https://github.com/gruns/furl
... | [
{
"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 | sqlalchemy_utils/types/url.py | kelvinhammond/sqlalchemy-utils |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1DkY42MwUA1eC9jHNU2MVHqcLqhLvvbxaW(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... | [
{
"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/storage/cases/test_KT1DkY42MwUA1eC9jHNU2MVHqcLqhLvvbxaW.py | juztin/pytezos-1 |
"""Removing settings table
Revision ID: 2932df901655
Revises: 155c6ce689ed
Create Date: 2014-04-03 10:45:09.592592
"""
# revision identifiers, used by Alembic.
revision = '2932df901655'
down_revision = '155c6ce689ed'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_table('settings')
def... | [
{
"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 | holmes/migrations/versions/2932df901655_removing_settings_table.py | scorphus/holmes-api |
import json
from adapters.base_adapter import Adapter
from adapters.adapter_with_battery import AdapterWithBattery
from devices.switch.on_off_switch import OnOffSwitch
# TODO: Think how to reuse the code between classes
class SirenAdapter(Adapter):
def __init__(self):
super().__init__()
self.switch... | [
{
"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 | adapters/generic/siren.py | russdan/domoticz-zigbee2mqtt-plugin |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from threading import Event
import time
from odoo.http import request
class EventManager(object):
def __init__(self):
self.events = []
self.sessions = {}
def _delete_expired_session... | [
{
"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 | addons/hw_drivers/event_manager.py | SHIVJITH/Odoo_Machine_Test |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | aqt/jax/utils.py | DionysisChristopoulos/google-research |
from gosubl import gs
import os
import sublime_plugin
def _stx(v):
old = [
'GoSublime.tmLanguage',
'GoSublime-next.tmLanguage',
]
fn = 'Packages/GoSublime/syntax/GoSublime-Go.tmLanguage'
if not os.path.exists(gs.dist_path('syntax/GoSublime-Go.tmLanguage')):
return
stx = v.settings().get('syntax')
if stx:... | [
{
"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 | GoSublime/gssynforce.py | MiYogurt/my-sublimetext3-plugin |
import socket
from six.moves.urllib.parse import urlparse
from frappe import get_conf
REDIS_KEYS = ("redis_cache", "redis_queue", "redis_socketio")
def is_open(ip, port, timeout=10):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(timeout)
try:
s.connect((ip, int(port)))
s.shutdown(socket... | [
{
"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 | frappe/utils/connections.py | erpnext-tm/frappe |
"""Test ModiscoFile
"""
import pandas as pd
from bpnet.modisco.files import ModiscoFile, ModiscoFileGroup
from bpnet.modisco.core import Pattern, Seqlet
def test_modisco_file(mf, contrib_file):
# contrib_file required for `mf.get_ranges()`
assert len(mf.patterns()) > 0
p = mf.get_pattern("metacluster_0/p... | [
{
"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/modisco/test_modisco_file.py | mlweilert/bpnet |
from typing import Optional
from sqlalchemy.orm import Session
from app.models.actor import Actor
from app.schemas.actor import ActorCreate, ActorInDB
from app.core.exceptions import exceptions
class CRUDActor:
def get_by_name(self, db: Session, name: str) -> Optional[Actor]:
return db.query(Actor).filt... | [
{
"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 | app/crud/crud_actor.py | luovkle/FastAPI-Movie-Manager |
# Importing the base class
from KratosMultiphysics.CoSimulationApplication.base_classes.co_simulation_predictor import CoSimulationPredictor
# Other imports
import KratosMultiphysics.CoSimulationApplication.co_simulation_tools as cs_tools
def Create(settings, solver_wrapper):
cs_tools.SettingsTypeCheck(settings)
... | [
{
"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 | applications/CoSimulationApplication/python_scripts/predictors/linear.py | lkusch/Kratos |
from functools import wraps
from itertools import count
from typing import Callable
from logzero import logger
from chaoslib.types import Journal
counter = None
def initcounter(f: Callable) -> Callable:
@wraps(f)
def wrapped(*args, **kwargs) -> None:
global counter
counter = count()
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/fixtures/controls/dummy_with_decorated_control.py | Mickael-Roger/chaostoolkit-lib |
from machine import ADC , Pin
from Blocky.Pin import getPin
class Light :
def __init__ (self , port , sensitive = 4):
pin = getPin(port)
if (pin[2] == None):
from machine import reset
reset()
self.adc = ADC(Pin(pin[2]))
if (sensitive == 1): self.adc.atten(ADC.ATTN_0DB)
elif (sensitive == 2): self.a... | [
{
"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 | Light.py | curlyz/ESP32_Firmware |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from numpy.testing import assert_allclose
from gammapy.datasets import Datasets
from gammapy.modeling.tests.test_fit import MyDataset
@pytest.fixture(scope="session")
def datasets():
return Datasets([MyDataset(name="test-1"), MyDataset(... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | gammapy/datasets/tests/test_datasets.py | Rishank2610/gammapy |
#cas
def get_infos():
import ti_graphics, ti_system
fnop = lambda : None
screen_w, screen_h, screen_y0, font_w, font_h, poly_set_pixel, poly_fill_rect, poly_draw_ellipse, poly_fill_circle, poly_get_key, poly_draw_string = 320, 210, 30, 10, 15, fnop, fnop, fnop, fnop, ti_system.wait_key, fnop
def poly_fill_... | [
{
"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 | ch05/solar_ce/polysol.py | jabrena/space-math |
from extractor import ActivityExtractor
from fitparse import FitFile
import uuid
import os
from utils import get_base_path
import json
class FitFileActivityExtractor(ActivityExtractor):
PROVIDER_NAME = 'fitfile'
def __init__(self, file_stream):
self.fitfile = FitFile(file_stream)
self.activit... | [
{
"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 | kafka-producer/file/extractor.py | peng-data-minimization/fitness-data-pipeline |
import numpy as np
import pytest
import networkx as nx
import ot
import tw
class TestBuildValidTreeMetric(object):
@pytest.mark.parametrize(
"num_node, edges",
[
(5, [(i % 5, (i + 1) % 5, i + 1) for i in range(5)]),
(3, [(i % 3, (i + 1) % 3, i + 1) for i in range(3)]),
... | [
{
"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 | tests/test_treewasserstein.py | InkToYou/TreeWasserstein |
#
# Custom boto3 session for use with temporary credentials with auto refresh
#
# https://github.com/boto/boto3/issues/443
# https://gist.github.com/jappievw/2c54fd3150fd6e80cc05a7b4cdea60f6
#
# thanks @jappievw https://gist.github.com/jappievw
#
from boto3 import Session
from botocore.credentials import (CredentialPro... | [
{
"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 | zentral/utils/boto3.py | arubdesu/zentral |
import paypalhttp
from urllib.parse import quote # Python 3+
# noinspection PyDictCreation
class OrdersValidateRequest:
"""
Validates a payment method and checks it for contingencies.
"""
def __init__(self, order_id):
self.verb = "POST"
self.path = "/v2/checkout/orders/{order_id}/vali... | [
{
"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 | _sdk/_paypal/orders/orders_validate_request.py | Memberships-Affiliate-Management-API/membership_and_affiliate_api |
from conans import ConanFile, CMake, tools
from os import path
class RoseArrayTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
self.run(path... | [
{
"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 | test_package/conanfile.py | markushedvall/rose-array |
import time
from bitarray import bitarray
from huffman import freq_string, huffCode
def traverse(it, tree):
"""
return False, when it has no more elements, or the leave node
resulting from traversing the tree
"""
try:
subtree = tree[next(it)]
except StopIteration:
return False
... | [
{
"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 | examples/decoding.py | DominicBurkart/bitarray |
"""Abstraction to send a TunnelingRequest and wait for TunnelingResponse."""
from __future__ import annotations
from typing import TYPE_CHECKING
from xknx.knxip import (
CEMIFrame,
CEMIMessageCode,
KNXIPFrame,
TunnellingAck,
TunnellingRequest,
)
from .request_response import RequestResponse
if T... | [
{
"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 | xknx/io/request_response/tunnelling.py | gr0vity-dev/xknx |
"""Functions to deal with hases."""
import hashlib
def read_in_chunks(file_object, chunk_size=1024):
"""
Lazy function (generator) to read a file piece by piece.
Default chunk size: 1k.
borrowed from http://stackoverflow.com/a/519653
Parameters
----------
file_object : file object
... | [
{
"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 | rubberband/utils/hasher.py | ambros-gleixner/rubberband |
import torch
import torch.nn as nn
from torch.nn.functional import mse_loss
class PSNRLoss(nn.Module):
r"""Creates a criterion that calculates the PSNR between 2 images. Given an m x n image, the PSNR is:
.. math::
\text{PSNR} = 10 \log_{10} \bigg(\frac{\text{MAX}_I^2}{MSE(I,T)}\bigg)
where
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | kornia/losses/psnr.py | pmeier/kornia |
from pathlib import Path
from hashlib import sha256
import os
import tarfile
import bldr.util
def targz_pack_atomic(tgz_next_name: Path, tgz_name: Path, source_path: Path):
"""
Atomically create a new .tar.gz by writing to the "next" .tar.gz
and renaming when complete
"""
targz_pack(tgz_next_name,... | [
{
"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 | bldr/gen/history.py | bldr-cmd/bldr-cmd |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAppSilanApigraytwoQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAppSilanApigraytwoQueryResponse, self).__init__()
def parse_response_cont... | [
{
"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 | alipay/aop/api/response/AlipayOpenAppSilanApigraytwoQueryResponse.py | snowxmas/alipay-sdk-python-all |
from custom_components.xiaomi_cloud_map_extractor.common.vacuum import XiaomiCloudVacuum
class XiaomiCloudVacuumV2(XiaomiCloudVacuum):
def __init__(self, connector, country, user_id, device_id, model):
super().__init__(connector, country, user_id, device_id, model)
def get_map_url(self, map_name):
... | [
{
"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 | custom_components/xiaomi_cloud_map_extractor/common/vacuum_v2.py | GuyKh/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor |
from collections import defaultdict
def solution(n, results):
answer = 0
graph = defaultdict(list)
for result in results: # graph dictionary는 "선수 번호" : [해당 선수가 이긴 result들] 로 구성되어 있다.
graph[result[0]].append(result)
for key in range(1, n + 1): # 삼단논법을 통해 확장시킬 수 있는 result들을 확장시킨다.
in... | [
{
"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 | Programmers/rank.py | Park-Young-Hun/Algorithm |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2018 Justin Bewley Lo (justinbewley.com)
#
# 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 limi... | [
{
"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 | pyrcm/terminal/rediscmd_exists.py | booleys1012/redisclustermon |
from flask import g
from app.comm.CompositeOperate import CompositeOperate
from app.comm.SqlExecute import SqlExecute
from app.module_config import table_module_map
class CommentController(CompositeOperate):
def __init__(self, module):
super(CommentController, self).__init__(module)
def after_deal_get... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | blog_server/app/api/general/CommentController.py | szhu9903/flask-react-blog |
import math
#Class for Popularity based Recommender System model
class popularity_recommender_py():
def __init__(self):
self.train_data = None
self.user_id = None
self.popularity_recommendations = None
def smooth_user_preference(self, x):
return math.log(1 + x, 2)
#Create ... | [
{
"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 | rec.py | hngi/lucidblog_hng_ml_team |
from pi_monitor.core import Event
import sendgrid
from sendgrid.helpers.mail import Content, Email, Mail
from python_http_client import exceptions
class Sendgrid:
def __init__(self, config):
config = _process_config(config)
self.api_key = config['api_ky']
self.from_email = config['from_ema... | [
{
"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 | pi_monitor/actions/sendgrid.py | arlenk/pivpn-monitor |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | aliyun-python-sdk-cr/aliyunsdkcr/request/v20181201/DeleteRepoTriggerRequest.py | LittleJober/aliyun-openapi-python-sdk |
import asyncio
from mitmproxy.test.taddons import RecordingMaster
async def err():
raise RuntimeError
async def test_exception_handler():
m = RecordingMaster(None)
running = asyncio.create_task(m.run())
asyncio.create_task(err())
await m.await_log("Traceback", level="error")
m.shutdown()
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | test/mitmproxy/test_master.py | fedosgad/mitmproxy |
import cv2
from libs.ffmpeg_reader import FFMPEG_VideoReader
def mat2bytes(image):
image = image[:, :, ::-1]
return cv2.imencode('.jpg', image)[1].tostring()
class VideoCapture:
def __init__(self, video_source, start_frame=0, shift_time=0):
self.video = FFMPEG_VideoReader(video_source, True)
... | [
{
"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 | libs/video_processing.py | tyommik/rewiever |
class Fighter:
def __init__(self, hp, defense, power):
self.max_hp = hp
self.hp = hp
self.defense = defense
self.power = power
def take_damage(self, amount):
results=[]
self.hp -= amount
if self.hp<0:
results.append({'dead':self.owner})
... | [
{
"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 | components/fighter.py | StormCloud71/tdl-roguelike-tute |
import grpc
from sea.servicer import ServicerMeta, msg2dict, stream2dict
from sea import exceptions
from sea.pb2 import default_pb2
from tests.wd.protos import helloworld_pb2
def test_meta_servicer(app, logstream):
class HelloContext():
def __init__(self):
self.code = None
self.... | [
{
"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 | tests/test_servicer.py | yangtt0509/sea |
"""Zeroconf usage utility to warn about multiple instances."""
from contextlib import suppress
import logging
from typing import Any
import zeroconf
from homeassistant.helpers.frame import (
MissingIntegrationFrame,
get_integration_frame,
report_integration,
)
from .models import HaZeroconf
_LOGGER = l... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | homeassistant/components/zeroconf/usage.py | basicpail/core |
import logging
import requestresponder
from edge.httputility import HttpUtility
class ProxyWriter(requestresponder.RequestResponder):
def __init__(self, configFilePath):
super(ProxyWriter, self).__init__(configFilePath)
def get(self, requestHandler):
super(ProxyWriter, self).get(requestHandle... | [
{
"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 | src/main/python/libraries/edge/writer/proxywriter.py | mayadebellis/incubator-sdap-edge |
def testaArq(arq):
"""
-> Verifica se existe o arquivo arq
:arq: Nome do arquivo a ser testado.
:return: retorna True se o arquivo for encontrado,
caso contrário False
"""
try:
a = open(arq)
except FileNotFoundError: # O arquivo não foi encontrado
print('Arquivo não enco... | [
{
"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 | bibli/arquivo/__init__.py | EduardoPessanha/Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
from Modules.MultiHeadAttention import MultiHeadAttention
class Attention(nn.Module):
def __init__(self, dim):
super(Attention, self).__init__()
self.encoders = self._build_model(dim)
def _build_model(self, dim):
... | [
{
"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 | Modules/Attention.py | drat/Neural-Voice-Cloning-With-Few-Samples |
# This Python file uses the following encoding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import object
import dpaycli as stm
class SharedInstance(object):
"""Singelton for the DPay Insta... | [
{
"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 | dpaycli/instance.py | dpays/dpay-cli |
import tkinter as tk
import pyautogui
import time
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.criar_opcoes()
def criar_opcoes(self):
self.hi_there = tk.Button(self)
s... | [
{
"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 | novo.py | Felipe-Gs/Exerciccios-Python3 |
# coding: utf-8
"""
RadioManager
RadioManager # noqa: E501
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import radiomanager_sdk
from radiomanager_sdk.models.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_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/test_broadcast.py | Pluxbox/radiomanager-python-client |
import os
import sqlite3
class DBRecorder:
def __init__(self, config):
self.config = config
self.conn = None
self.cursor = None
def connect_db(self):
path = os.path.expanduser(self.config['output']['dir'])
if not os.path.exists(path):
os.makedirs(path)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | Recorder.py | shiheyuan/GitGrabber |
import abc
class Writer(abc.ABC):
@abc.abstractmethod
def write_cur_frame(self, frame_info, output):
pass
@abc.abstractmethod
def write_frame_exec(self, frame_info, exec_time, exec_times):
pass
@abc.abstractmethod
def write_add(self, var, val, history, *, action, plural):
... | [
{
"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 | vardbg/output/writer.py | vishal2612200/vardbg |
#!/usr/bin/env python
#from .core import *
import numpy as np
import pandas as pd
import shutil
import urllib
import urlparse
from os.path import splitext, basename
import os
from os import sys, path
from pprint import pprint
import StringIO
import db
from gp import *
from core import *
from IPython.core.debugger 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | database/task_class/annotation.py | cozy9/Metascape |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from xixi.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
pas... | [
{
"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 | xixi/public/forms.py | defbobo/xixi |
"""
The MIT License (MIT)
Copyright (c) 2021 Bang & Olufsen a/s
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, ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | beoremote/events/statusEvent.py | bang-olufsen/beoremote-halo |
import git
import os
import sys
import subprocess
from tools.config import Config
from tools.logger import log_error, log_info
def exit_if_not_executed_in_ide_environment():
'''This part checks if environment variables is set or not.'''
if not ("ICSD_FILESERVER_USER" and "ICSD_FILESERVER_PASSWD") in os.envir... | [
{
"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 | scripts/src/tools/validation.py | iriberri/tools-cobigen |
#!/usr/bin/env python3
import isce
from isceobj.Sensor import createSensor
import shelve
import argparse
import glob
from isceobj.Util import Poly1D
from isceobj.Planet.AstronomicalHandbook import Const
import os
def cmdLineParse():
'''
Command line parser.
'''
parser = argparse.ArgumentParser(descri... | [
{
"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 | uavsar_rtc_mlc/Docker_Install/share/stripmapStack/unpackFrame_UAVSAR.py | sgk0/isce_docker_tools |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.