source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import threading
import time
class Timer(object):
def __init__(self, interval, callback_func, oneshot=False, args=None, kwargs=None):
self._interval = interval
self._oneshot = oneshot
self._f = callback_func
self._args = args if args is not None else []
self._kwargs = kwar... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | thym/timer.py | apgeorg/thyme |
from schemdraw import Drawing
from schemdraw import elements as elm
from .input import Input
def draw_void():
drawing = Drawing()
transistor = drawing.add(elm.transistors.JFetP().right().reverse())
drawing += elm.SourceV().at(transistor.drain).up().label('Vdd').reverse()
drawing += elm.Ground().lef... | [
{
"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 | pyelectric/electronic/amplifier/common_drain_polarization_fet/drawing.py | luanws/pyelectric |
#!/usr/bin/env python3
"""
Exercise 13.4 from Serre "Linear Representations of Finite Groups ", 1977.
"""
import sys, os
import numpy
from element import Linear, Z, Q
from action import mulclose
M = Linear(4, Q)
def quaternion(a, b, c, d):
# build matrix representation of quaternion
A = M.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 | bruhat/serre_example.py | punkdit/bruhat |
import astropy.io.fits as fits
from specutils import SpectrumList
from specutils.io.registers import data_loader
from .loaders import FITS_FILE_EXTS, SINGLE_SPLIT_LABEL
GALAH_CONFIG = {
"hdus": {
"0": {"purpose": "science"},
"1": {"purpose": "error_stdev"},
"2": {"purpose": "unreduced_scie... | [
{
"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 | src/ssv/galah.py | einshoe/ssv-py |
# AUTOGENERATED! DO NOT EDIT! File to edit: notebooks/07_gbe.sst.data_provider.ipynb (unless otherwise specified).
__all__ = ['SSTDataProvider']
# Cell
from fastcore.foundation import patch
from ..data_provider import GBEProvider
from ...data_provider import get_efficiently
import numpy as np
# Cell
class SSTDataPro... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | trr265/gbe/sst/data_provider.py | hgzech/trr265 |
from django.db import DatabaseError
from django.forms import ModelForm, Field, ValidationError, BooleanField
from django.forms.widgets import CheckboxInput
from explorer.models import Query, MSG_FAILED_BLACKLIST
_ = lambda x: x
class SqlField(Field):
def validate(self, value):
"""
Ensure that 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | explorer/forms.py | nivasse/django-sql-explorer |
import time
from decorator import decorate
class HighPerformanceTimer(object):
def __init__(self, callback):
self._callback = callback
def _new_timer(self):
return self.__class__(self._callback)
def __enter__(self):
self._start = time.perf_counter_ns()
def __exit__(self, ty... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | src/serenity/utils/metrics.py | dthomp87/serenity |
import datetime
from vit.formatter import DateTime
# TODO: Remove this once tasklib bug is fixed.
from tasklib.serializing import SerializingObject
serializer = SerializingObject({})
class UdaDate(DateTime):
def format(self, dt, task):
if not dt:
return self.markup_none(self.colorize())
... | [
{
"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 | vit/formatter/uda_date.py | kinifwyne/vit |
from abc import ABC, abstractmethod
from typing import Iterable, Tuple, Iterator, List
from .._typing import KeyType, LabelType, ItemType
from ._Binner import Binner
class TwoPassBinner(Binner[KeyType, LabelType], ABC):
"""
Class for binners which require an initial pass over
the set of items being binne... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/wai/bynning/binners/_TwoPassBinner.py | waikato-datamining/bynning |
#!/usr/bin/env python
"""Types-related part of GRR API client library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from typing import Any
from grr_api_client import errors
from grr_api_client import utils
from grr_response_proto import flows_pb2
... | [
{
"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 | api_client/python/grr_api_client/types.py | isabella232/grr |
from docutils.parsers.rst import Directive
from docutils import nodes
from sphinx.util.nodes import set_source_info
import os
import re
def setup(app):
app.add_directive('fp_output', OutputDirective)
class OutputDirective(Directive):
required_arguments = 1
optional_arguments = 1
def run(self):
... | [
{
"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 | docs/fpoutput.py | functionistic/firepyer |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_hyperlink27.py | haiyangd/XlsxWriter |
import pathgraph
import robotsearch
import unittest
class TestGraphMethods(unittest.TestCase):
def test_create_undirected_graph(self):
self.assertTrue(isinstance(pathgraph.graph_by_type("undirected"), pathgraph.UndirectedGraph))
def test_create_directed_graph(self):
self.assertTrue(isinst... | [
{
"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 | python/main.py | jamesGadoury/robot-search |
#!/usr/bin/env python3
#
# Copyright (c) 2018 Roberto Riggio
#
# 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 applicabl... | [
{
"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 | empower/apps/pollers/bincounterpoller.py | paolasoto88/empower-runtime-v17 |
'''input
57
12
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
def is_harshad_number(number):
if number % sum_digit(number) == 0:
return "Yes"
else:
return "No"
def sum_digit(number):
return sum(list(map(int, list(str(number)))))
if __name__ =... | [
{
"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 | ABC/abc051-abc100/abc080/b.py | KATO-Hiro/AtCoder |
# -*- coding: utf-8 -*-
# pylint: disable=undefined-variable,no-name-in-module
from datetime import datetime, timedelta, timezone
import time
UNIX_EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)
def now():
return datetime.now(timezone.utc)
def now_in_millis():
return int(round(time.time() * 1000))
def... | [
{
"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 | client/verta/verta/_internal_utils/time_utils/_time_utils_py3.py | houqp/modeldb |
# coding: utf-8
"""
Hydrogen Nucleus API
The Hydrogen Nucleus API # noqa: E501
OpenAPI spec version: 1.9.5
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nu... | [
{
"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 | atom/nucleus/python/test/test_order_reconcile_return_object.py | AbhiGupta03/SDK |
#! /usr/bin/env python3
import logging
import sys
def analyze(fin):
result = []
for line in fin.readlines():
line = line.strip()
if line == "":
continue
parts = line.split()
if len(parts) != 3:
logging.error("skipping unexpected line '%s'", line)
continue
if parts[2] != "s":
logging.error("... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | tools/analyze-test-timing.py | tacr-iotcloud/base |
import time
def jstype(obj, typ):
__pragma__('js', '{}', '''
var t = typeof(obj)''')
if t == typ:
return True
return False
class PyDate:
'''
Descendants get a self.value property, which is always in sync
with an internal self.ts = unixtime'''
_value = ts = None
def get_value(sel... | [
{
"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 | doc/kendo/src/ch1/tools.py | axiros/transcrypt_material |
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | test/vanilla/AcceptanceTests/test_time.py | Azure/autorest.azure-functions-python |
# -*- coding: utf-8 -*-
from enum import Enum
import numpy as np
class DatasetXY:
class XType(Enum):
ALL = 1 # all points of the plane
RANDOM = 2 # random (gaussian distribution) selected points
def __init__(self, t, x_lims, groups, traing_data_ratio, f):
self.... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | src/datasetxy.py | danielefdf/nene |
import json
import logging.config
import os
default_config = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"simple": {
"format": "%(asctime)s :: %(name)s :: %(levelname)s :: %(message)s"
}
},
"handlers": {
"console": {
"class": "... | [
{
"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 | geeup/config.py | thipokKub/geeup |
class Mobile:
def dial(self, number):
print(f"dialing number {number}")
def ring(self):
print("ringing using built in tones.....")
class SmartMobile(Mobile):
def ring(self):
"""
overriding a Method
"""
print("ringing using custom ring tones .... ") | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | June21/ClassesandObjects/inheritance_101.py | pythonbykhaja/intesivepython |
# Copyright 2009-2010 Yelp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
{
"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 | mrjob/examples/mr_wc.py | cleemesser/mrjob |
from flask import Flask, json
import pyodbc
conn = pyodbc.connect('DRIVER={PostgreSQL Unicode};SERVER=10.4.28.183;DATABASE=postgres;UID=postgres;PWD=developer2020')
app = Flask(__name__)
def random_products(conn):
cnxn = conn.cursor()
cnxn.execute('select categoryid, name from categories c where parentid is... | [
{
"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 | randoms_products/main.py | pechuga22/services-kiero |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class RCNN(nn.Module):
def __init__(self, vocab_size, embed_dim, output_dim, hidden_dim, num_layers, dropout, weight):
super(RCNN, self).__init__()
self.embedding = nn.Embedding(vocab_size, e... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | pytorch/classification/rcnn/model.py | czhongyu/information-extraction |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PriceInformation(object):
def __init__(self):
self._amount = None
self._type = None
@property
def amount(self):
return self._amount
@amount.setter
def am... | [
{
"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 | alipay/aop/api/domain/PriceInformation.py | antopen/alipay-sdk-python-all |
import os
from pathlib import Path
import pytest
from flair.data import Corpus, Token
from flair.models import SequenceTagger
from ner_sample.models.flair_ner import FlairNERModel
from tests.mocks import MockDataLoader
def test_flair_inference_ner_mock_data(pretrained_model, dataset_loader):
_, test = dataset_l... | [
{
"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 | samples/ner_sample/tests/test_flair_ner.py | katyamust/ml-expr-fw |
import os
import unittest
from flask import current_app
from flask_testing import TestCase
from core import masakhane
class TestDevelopmentConfig(TestCase):
def create_app(self):
masakhane.config.from_object('core.config.DevelopmentConfig')
return masakhane
def test_app_is_development(self)... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | src/server/core/tests/test_config.py | Freshia/masakhane-web |
"""Base UptimeRobot entity."""
from __future__ import annotations
from pyuptimerobot import UptimeRobotMonitor
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from .const import ATTR_TARGET, ATTRIBUT... | [
{
"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/uptimerobot/entity.py | FlavorFx/core |
import pytest
import networkx as nx
import scse.controller.miniscot as miniSCOT
from scse.main.cli import MiniSCOTDebuggerApp
_HORIZON = 10
def _create_miniscot():
return miniSCOT.SupplyChainEnvironment(time_horizon = _HORIZON,
asin_selection = 1)
def test_importable()... | [
{
"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/unit/test_supply_chain_simulation_environment.py | bellmast/supply-chain-simulation-environment |
# -*- coding: utf-8 -*-
#
from typing import Optional
from ..category import Category
class Utils(Category):
def check_link(
self,
url: str = None,
**kwargs
) -> dict:
return self._request("checkLink", locals())
def delete_from_last_shortened(
self,
key: ... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | pyvdk/api/categories/utils.py | UT1C/pyVDK |
# Copyright (c) 2020 Manfred Moitzi
# License: MIT License
import ezdxf
def new_doc(pdmode: int, pdsize: float = 1):
doc = ezdxf.new('R2000')
doc.header['$PDMODE'] = pdmode
doc.header['$PDSIZE'] = pdsize
return doc
PDSIZE = 0.5
MODES = [
0, 1, 2, 3, 4,
32, 33, 34, 35, 36,
64, 65, 66, 67,... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | examples_dxf/create_point_examples.py | jpsantos-mf/ezdxf |
""" Pymode utils. """
import os.path
import sys
import threading
import warnings
from contextlib import contextmanager
import vim # noqa
from ._compat import StringIO, PY2
DEBUG = int(vim.eval('g:pymode_debug'))
warnings.filterwarnings('ignore')
@contextmanager
def silence_stderr():
""" Redirect stderr. """
... | [
{
"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 | bundle/vim-python-mode/pymode/utils.py | ninegrid/dotfiles-vim |
from zeeguu.core.test.rules.article_rule import ArticleRule
from zeeguu.core.test.rules.base_rule import BaseRule
from zeeguu.core.test.rules.language_rule import LanguageRule
from zeeguu.core.test.rules.url_rule import UrlRule
from zeeguu.core.model.text import Text
class TextRule(BaseRule):
"""A Rule testing cl... | [
{
"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 | zeeguu/core/test/rules/text_rule.py | mircealungu/Zeeguu-API-2 |
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand, CommandError
from zerver.lib.actions import do_delete_old_unclaimed_attachments
from zerver.models import get_old_unclaimed_attachments
class Command(BaseCommand):
help = """Remove unclaimed attachmen... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | zerver/management/commands/delete_old_unclaimed_attachments.py | cozyrohan/zulip |
"""
This module contains the logic of the plugin
in charge of creating fake nodes returning
the the data inside an input directory
"""
from typing import Dict, List
from suzieq.poller.worker.inventory.inventory import Inventory
from suzieq.poller.worker.nodes.files import FileNode
class InputDirInventory(Inventory)... | [
{
"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 | suzieq/poller/worker/inventory/dir.py | LucaNicosia/suzieq |
#!/user/bin/python
'''Fibonacci Number Modulo m
Compute the nth Fibonacci number modulo m.
Input: Integers 0 <= n <= 10^18 and 2 <= m <= 10^5
Output: nth Fibonacci number modulo m, F(n) mod m.
To compute F(n) mod m, calculate the remainder of n mod length...
...
A Pisano... | [
{
"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 | 01-algorithmic-design-and-techniques/week-2/fibonacci-huge.py | andrewnachtigal/UCSD-Algorithms |
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2016-2019 Datadog, Inc.
from checks import AgentCheck
from common import assert_init_config_init, assert... | [
{
"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 | pkg/collector/py/tests/kwargs_init_signature.py | arminioa/datadog-agent |
from dataclasses import dataclass
from mchqr.detector import Detector
from mchqr.dev import NotOverriden, subclasses_dict
from mchqr.image import ImageList
from mchqr.solution import AlgoSolution
from multiprocessing import Pool
from time import perf_counter_ns
@dataclass
class BaseAlgorithm:
detector: Detector
imag... | [
{
"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 | source/mchqr/algo.py | Matej-Chmel/parallel-qr-code-scanner |
import requests, time
from pythontools.core import logger, tools
def uploadToHastebin(content):
url = 'https://hastebin.com'
data = ""
if type(content) == str:
data = content
elif type(content) == list:
for i in content:
data += str(i) + "\n"
else:
logger.log("§... | [
{
"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 | pythontools/dev/dev.py | CrawlerCode/PythonTools |
from selfdescribing import SelfDescribing
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
class Matcher(SelfDescribing):
"""A matcher over acceptable values.
A matcher is able to describe itself to give feedback when it fails.
Matcher implement... | [
{
"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 | src/hamcrest/core/matcher.py | pexip/os-pyhamcrest |
# coding: utf-8
"""
Talend Management Console Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import abs... | [
{
"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 | pytmcapi/test/test_plans__executions_api.py | mverrilli/tmc-api-clients |
from numpy.testing import assert_array_almost_equal
from .test_carsons import ABCN_line_z_primitive
from carsons.carsons import CarsonsEquations
def test_compatibility_with_dict_of_phases():
class BackwardsCompatibleModel():
def __init__(self):
self.resistance = {
"A": 0.00011... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | tests/test_dict_compatibility.py | kdheepak/carsons |
import pytest
import wave.data.likeness as likeness
class TestLikenessFDS:
def testRoundedLikenessFDS(self):
likeness_instance = likeness.WaveLikeness(
base=[i for i in range(64)],
comparison=[0 for i in range(64)],
ceiling=64
)
assert 31.46 == likeness_... | [
{
"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 | tests/test_likeness.py | herbeeg/famitracker-instrument-generator |
#!/usr/bin/python
import os
import sys
import json
if sys.version_info[0] < 3:
import thread
else:
import _thread
import threading
class AbstractConnector():
def __init__(self, local_device):
self.Protocol = None
self.Adaptor = None
self.LocalDevice = local_device
# Flags
self.IsConnected = False
#... | [
{
"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 | MkSAbstractConnector.py | MakeSenseCorp/mksdk-py |
from ...models import UserProfile
from django.core.management.base import BaseCommand
def list_organization_names():
orgs = []
user_profiles = UserProfile.objects.all()
for up in user_profiles:
if up.organization_name:
orgs.append(up.organization_name)
return orgs
class Command(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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | apps/accounts/management/commands/get_all_organizations.py | dtisza1/bluebutton-web-server |
from django import forms
#from django.contrib.auth.models import User
from users.models import User
from products.models import Product
from categories.models import Category
class RegisterForm(forms.Form):
username = forms.CharField(label='Nombre de Usuario',required=True, min_length=4, max_length=50,widget=form... | [
{
"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 | MarvelLA/forms.py | IvanLezcano/TrabajoPracticoFinalPoloticDjango |
from os import path
from flask import Flask, render_template, send_from_directory, jsonify
from flask_webpack import Webpack
from version import __version__
import fabfile
import fabric
import time
here = path.abspath(path.dirname(__file__))
app = Flask(__name__)
webpack = Webpack()
app.config["WEBPACK_MANIFEST_PATH... | [
{
"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 | pyreact/__init__.py | bzhou/pyreact |
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
PACKAGE = 'logrotate'
PACKAGE_BINARY = '/usr/sbin/logrotate'
def test_logrotate_package_installed(host):
"""
Tests if logrotate packag... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | molecule/default/tests/test_default.py | darkwizard242/ansible-role-logrotate |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C
imp... | [
{
"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 | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/WGL/EXT/extensions_string.py | JE-Chen/je_old_repo |
import click
import psycopg2 as pg2
from flask import current_app, g
from flask.cli import with_appcontext
from psycopg2.extras import DictCursor
def get_db():
if 'db' not in g:
g.db = pg2.connect(
**current_app.config['DATABASE'],
)
g.db.cursor_factory = DictCursor
retu... | [
{
"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 | abrv/db.py | shwnchpl/abrv |
import bisect
from typing import List, Sequence, TypeVar, Union, overload
from seqtk._helper import slice_to_indices
_T = TypeVar("_T")
class concatenate(Sequence[_T]):
def __init__(self, sequences: Sequence[Sequence[_T]]):
self._sequences = sequences
self._cumulative_sizes = self._calculate_cum... | [
{
"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 | seqtk/_concatenate.py | yuyu2172/seqtk |
from fosscord.ext import tasks
import fosscord
class MyClient(fosscord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# an attribute we can access from our task
self.counter = 0
# start the task to run in the background
self.my_background... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer... | 3 | examples/background_task.py | Random-Access-Exomemory/fosscord.py |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import unittest
import os
from PIL import Image
from pytest import raises
from kraken.pageseg import segment
from kraken.lib.exceptions import KrakenInputException
thisfile = os.path.abspath(os.path.dirname(__file__))
resource... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | tests/test_pageseg.py | UB-Mannheim/kraken |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Crap class
but make code more compact. lmao
WARNING! WARNING!
HIGH CONCENTRATION OF SHIT!
and in future here will be adding more and more methods and classes
but i'm not shure
"""
import os
def success(message):
return '<div class="alert... | [
{
"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 | web_audio/helpers.py | SaxAlien/crap-code |
from __future__ import print_function
from sys import argv
from pprint import pformat
from twisted.internet.task import react
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
def cbRequest(response):
print('Response version:', response.version)
print('Response code... | [
{
"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 | docs/web/howto/listings/client/responseBody.py | hawkowl/twisted |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import time
from datetime import datetime
def get_timestamp():
return int(time.time())
def throttle_period_expired(timestamp, throttle):
if not timestamp:
return True
elif isinstance(timestamp, datetime):
return (datetime.utc... | [
{
"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 | website/util/time.py | DanielSBrown/osf.io |
class Graph():
def __init__(self):
self.vertex = {}
# for printing the Graph vertexes
def printGraph(self):
print(self.vertex)
for i in self.vertex.keys():
print(i,' -> ', ' -> '.join([str(j) for j in self.vertex[i]]))
# for adding the edge beween two vertexes
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | Graph/P02_DepthFirstSearch.py | Abhishekkumar001/Data-Structures-using-Python-master |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"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 | designate/tests/unit/sink/test_service.py | mrlesmithjr/designate |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager
class UserProfileManager(BaseUserManager):
"""Manager for user profiles"""
def create_user(self, email, name, pas... | [
{
"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 | profiles_api/models.py | Davit2018/profiles-rest-api |
#!/usr/bin/python3
import pytest
def test_weight(WBTC, WETH, accounts, SwapRouter, NonfungiblePositionManager, CellarPoolShareContract):
ACCURACY = 10 ** 6
SwapRouter.exactOutputSingle([WETH, WBTC, 3000, accounts[0], 2 ** 256 - 1, 10 ** 7, 2 * 10 ** 18, 0], {"from": accounts[0], "value": 2 * 10 ** 18})
WB... | [
{
"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 | tests/test_05_weight.py | VolumeFi/somm-wbtc-eth-test-cellar |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def add(self, data):
node = Node(data)
# if list is empty
if not self.head:
self.head = node
else:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | python/hash_table/linked_list.py | samuelclark907/data-structures-and-algorithms |
#!/usr/bin/env python3
#
# Copyright (C) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | tensorflow_toolkit/text_detection/tools/create_dataset.py | morkovka1337/openvino_training_extensions |
#!/usr/bin/python3
import os.path
import sys
import unittest
import devpipeline_core.toolsupport
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "common"))
import mockconfig
_TOOL_FNS = {"bar": (lambda: None, "bar")}
class TestToolBuilder(unittest.TestCase):
def test_tool_exists(self):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | test/toolsupport/test_toolbuilder.py | dev-pipeline/devpipeline-core |
import logging
import argparse
import blink.main_dense as main_dense
logger = logging.getLogger(__name__)
class EntityLinker:
def __init__(self, model_path, logger=None):
self.logger = logger
self.models_path = model_path
self.config = {
"test_entities": None,
... | [
{
"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 | qakgc/linker/linker.py | pbmstrk/odqa |
import cv2
import numpy as np
class sharpening:
def __init__(self):
pass
def sharp(self,image):
# Create sharpening kernel
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
# applying the sharpening kernel to the input image & displaying it.
sharpened = cv2.filter2D(image, -1, kernel)
# Noise... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | sharpening.py | adityaRakhecha/Image-Filters |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"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 | jax/_src/scipy/stats/chi2.py | mariogeiger/jax |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..preprocess import Erode
def test_Erode_inputs():
input_map = dict(
args=dict(argstr='%s', ),
debug=dict(
argstr='-debug',
position=1,
),
dilate=dict(
... | [
{
"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 | nipype/interfaces/mrtrix/tests/test_auto_Erode.py | vferat/nipype |
import pytest
from rethinkdb import utils_common
@pytest.fixture
def parser():
opt_parser = utils_common.CommonOptionsParser()
opt_parser.add_option(
"-e",
"--export",
dest="db_tables",
metavar="DB|DB.TABLE",
default=[],
type='db_table',
action="append")... | [
{
"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 | tests/test_utils_common.py | jayvdb/rethinkdb-python |
from pygame import Rect
# noinspection PyPackageRequirements
from OpenGL import GL
from albow.openGL.GLViewport import GLViewport
class GLOrtho(GLViewport):
"""
GLOrtho provides an OpenGL drawing area with an orthographic projection.
Using a GLOrtho widget is the same as using a GLViewport, except tha... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | albow/openGL/GLOrtho.py | hasii2011/albow-python-3 |
"""
Given a graph, a source vertex in the graph and a number k,
find if there is a simple path (without any cycle) starting
from given source and ending at any other vertex that is greater than k.
"""
import math
from gfg.graphs.ds import GraphM # type: ignore
def path_greater(graph: list, source: int, k: int, vert... | [
{
"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 | gfg/graphs/path_length_greater_than_k.py | rrwt/daily-coding-challenge |
"""User models"""
# Django
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator
# Utilities
from cride.utils.models import CRideModel
class User(CRideModel, AbstractUser):
"""User model.
Extend from Django's Abstract User, change... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | cride/users/models/users.py | MkAngelo/cride |
#!/usr/bin/env python
import os
PATH_TO_BRENDA = ''
def run_blast(querys, evalue_cutoff, identity_cutoff, threads, db_path=PATH_TO_BRENDA):
"""
"""
blast_cmd = f"blastp -query {querys} -db {db_path} -out {querys}_vs_brenda.txt -evalue {evalue_cutoff} -outfmt 6 -num_threads {threads}"
os.system(blas... | [
{
"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 | gpse/helper.py | JinyuanSun/GASSER |
'''A class for estimator names.
'''
from dmrg_helpers.extract.tuple_to_key import tuple_to_key
from sqlite3 import register_adapter, register_converter
class EstimatorName(object):
"""A class to store estimator names into the database.
You use this function to handle estimator names inside the databasesel... | [
{
"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 | dmrg_helpers/extract/estimator_name.py | iglpdc/dmrg_helpers |
import pixelsort.util as util
def lightness(pixel):
return util.lightness(pixel)
def intensity(pixel):
return pixel[0] + pixel[1] + pixel[2]
def hue(pixel):
return util.hue(pixel)
def saturation(pixel):
return util.saturation(pixel)
def minimum(pixel):
return min(pixel[0], pixel[1], pixel[... | [
{
"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 | pixelsort/sorting.py | petarnguyen/pixelsort |
import numpy as np
def turn(n):
"""Formula from WIkipedia.
n could be numpy array of integers
"""
return (((n & -n) << 1) & n) != 0
def dragon(N):
"""Generate dragon curve
Returns a pair of integer arrays, (x,y), each 2^N elements long
"""
t = turn(np.linspace(0, 2*... | [
{
"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 | dragon.py | dmishin/fft-image-experiments |
# -*- coding: utf-8 -*-
from . import Base
import sqlalchemy as db
class JobAlternateTitle(Base):
__tablename__ = 'jobs_alternate_titles'
uuid = db.Column(db.String, primary_key=True)
title = db.Column(db.String)
nlp_a = db.Column(db.String)
job_uuid = db.Column(db.String, db.ForeignKey('jobs_ma... | [
{
"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 | api_sync/v1/models/jobs_alternate_titles.py | robinsonkwame/skills-airflow |
def test_termination(instance, workspace, run):
instance.launch_run(run.run_id, workspace)
assert instance.run_launcher.terminate(run.run_id)
assert not instance.run_launcher.terminate(run.run_id)
def test_missing_run(instance, workspace, run, monkeypatch):
instance.launch_run(run.run_id, workspace)
... | [
{
"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 | python_modules/libraries/dagster-aws/dagster_aws_tests/ecs_tests/launcher_tests/test_termination.py | asamoal/dagster |
# Copyright 2018, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
{
"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 | .venv/lib/python3.8/site-packages/opencensus/stats/measurement.py | MarkusMeyer13/graph-teams-presence |
# -*- coding: utf-8 -*-
# import cvxpy as cvx
from typing import Optional, Tuple, Union
import numpy as np
from lmi_solver.lmi0_oracle import lmi0_oracle
from lmi_solver.lmi_oracle import lmi_oracle
Arr = Union[np.ndarray]
Cut = Tuple[Arr, float]
class mle_oracle:
def __init__(self, Sig: Arr, Y: Arr):
"... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | src/corr_solver/mle_corr_oracle.py | luk036/corr-solver |
import numpy as np
def euclidean_distance(p1,p2):
"""
returns euclidean distance between matrices
@params:
p1, p2: np.ndarray
matrices to perform operation to.
"""
return np.sqrt(np.sum((p1-p2)**2, axis=1))
def entropy(p):
"""
Will be our measurement for uncertainty in our construction
of descisio... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | utils/data_operations.py | spitzc32/CropMe |
# coding=UTF-8
from operators.op import op
from camera.TCPCamera import TCPCamera
from camera.socket.SocketCamera import SocketCamera
from SocketCamerasHandler import SocketCamerasHandler
class TCPSocketCamera(SocketCamera, TCPCamera):
'''
# TCP Socket Camera
inherits from ```BaseSocketCamera``` and ```... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 4 | digital-twin/deviceManager/camera/socket/TCPSocketCamera.py | matbmoser/SOTA |
import os
import sys
import json
from .version import __version__
from satsearch import Search
from satstac import Items
from satsearch.parser import SatUtilsParser
import satsearch.config as config
def main(items=None, printmd=None, printcal=False, found=False,
save=None, download=None, requestor_pays=Fals... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | satsearch/main.py | lishrimp/sat-search |
class ObjectFactory:
def __init__(self):
self._builders={}
def register_builder(self, key , builder):
self._builders[key] = builder
def create(self, key, **kwargs):
builder = self._builders.get(key)
if not builder:
raise ValueError(key)
return builder(**... | [
{
"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 | pattern/object_factory.py | FurfurV/DistributedSystems |
'''
lab8
'''
#3.1
def count_words(input_str):
return len(input_str.split())
#3.2
demo_str = 'Hello World!'
print(count_words(demo_str))
#3.3
def find_min_num(input_list):
min_item = input_list[0]
for num in input_list:
if type(num) is not str:
if min_item>= ... | [
{
"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 | lab8.py | ConAllen3/ia241 |
from Data import Data
import scoring.dictionary.SSS93 as dictionary
class SSS93(Data):
scores = {'raw' : None }#
def scoring_raw(self, score):
option_numbers = dictionary.option_numbers
score.set(dictionary.factors_names,0)
for i, item in self.items():
try:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | scoring/SSS93.py | majazeh/risloo-samples |
import requests
import asyncio
import aiohttp
from requests.exceptions import ConnectionError
from my_fake_useragent import UserAgent
import random
def get_page(url, options={}):
try:
ua = UserAgent()
except:
pass
try:
base_headers = {
'User-Agent': ua.random(),
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | proxypool/utils.py | WiseJason/proxy |
# Python
import os
import sys
import traceback
# Pycompss
from pycompss.api.task import task
from pycompss.api.parameter import FILE_IN, FILE_OUT
# Adapters commons pycompss
from biobb_adapters.pycompss.biobb_commons import task_config
# Wrapped Biobb
from biobb_chemistry.babelm.babel_convert import BabelConvert # Imp... | [
{
"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 | biobb_adapters/pycompss/biobb_chemistry/babelm/babel_convert.py | bioexcel/biobb_adapters |
#coding:utf8
'''
Created on 2013-10-25
@author: lan (www.9miao.com)
'''
PLAYER_PLAYER =1
PLAYER_PET = 2
MONSTER_MONSTER =1
MATRIXLIST = [100001,100002,100003,100004,100005,100006,100007,100008,100009]
class BattleSide(object):
'''战斗方类'''
def __init__(self,character):
'''初始化战斗方
'''
... | [
{
"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 | server/src/project_n/app/game/core/fight/battleSide.py | isuhao/gamein9miao |
'''
Function:
define the darknet
Author:
Charles
'''
import torch
import torch.nn as nn
'''define darknet53'''
class Darknet53(nn.Module):
def __init__(self, **kwargs):
super(Darknet53, self).__init__()
'''forward'''
def forward(self, x):
pass | [
{
"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 | modules/backbones/darknet.py | DetectionBLWX/YOLOv3 |
import os, logging
from flask import Flask, request
from werkzeug.serving import run_simple
from galaxylearning.utils.utils import return_data_decorator, LoggerFactory
app = Flask(__name__)
BASE_MODEL_PATH = os.path.join(os.path.abspath("."), "res", "models")
logger = LoggerFactory.getLogger(__name__, logging.INFO)
... | [
{
"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 | galaxylearning/core/communicate_client.py | ZJU-DistributedAI/GalaxyLearning |
import RPi.GPIO as GPIO
from time import sleep
import sys
#Set warnings off (optional)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
#Set Button and LED pins
JOYSTICK_BUTTON = 12
MAIN_SWITCH = 22
LED = 6
class button():
'''
A simple Push-Button class
'''
def __init__(self, pin, pud_up_down):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | pet_mk_viii/UnitTest/push_button.py | Pet-Series/Pet-Mk-VII |
# Copyright 2019 BlueCat Networks (USA) Inc. and its affiliates
#
# 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... | [
{
"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 | tests/context.py | haihuynh-bluecat/trouble_shooting_ui |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"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 | kubernetes/test/test_v1_event_series.py | L3T/python |
#!
from datetime import date
import os
from os import listdir, path
import shutil
import logging
logging.basicConfig(level=logging.INFO, format='%(message)s')
#
# path utils
#
def this_folder():
return os.path.dirname(os.path.abspath(__file__))
def par_folder():
return path.joi... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | collect_themes.py | rockonedege/markdown-cv |
from fastapi import Depends, HTTPException, status, Header
from fastapi.security import OAuth2PasswordBearer
from pydantic import ValidationError
from jose import jwt
from webapi.db.config import async_session
from webapi.db import models, schemas
from webapi.db.dals.user_dal import UserDAL
from webapi.setting import ... | [
{
"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 | webapi/utils/dependencies.py | xqhgit/fastapi-vue-blog |
# https://www.runoob.com/python/python-object.html
# !/usr/bin/python
# -*- coding: UTF-8 -*-
class Parent: # 定义父类
parentAttr = 100
def __init__(self):
print("调用父类构造函数")
def parentMethod(self):
print('调用父类方法')
def setAttr(self, attr):
Parent.parentAttr = attr
def getAt... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": fals... | 3 | Python高级编程/0面向对象 继承调用顺序.py | shao1chuan/pythonbook |
min_x = 0
min_y = 0
def init_game():
global min_x, min_y
min_x = 0
min_y = 0
def get_position_middle(max, current):
return int(abs((max - current) / 2))
def get_position_middle_reversed(min, current):
result = get_position_middle(min, current)
if result == 0:
result = 1
return ... | [
{
"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 | python/binary_search/game_binary_search.py | alfreddagenais/kilukru-dev-articles |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_configuration.py | qwordy/autorest.python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.