source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from __future__ import absolute_import
from __future__ import print_function
import os
import numpy as np
from utils.tensorboard_logging import log_scalar
from tensorflow.keras.callbacks import Callback
import tensorflow.keras.backend as K
class LearningRateScheduler(Callback):
"""Learning rate sc... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | callbacks/learning_scheduler.py | 1170300521/MCN |
from pathlib import Path
import pytest
from pydantic import ValidationError
from fastapi_serviceutils.app import collect_config_definition
from fastapi_serviceutils.app import Config
@pytest.mark.parametrize(
'config_path',
[
'tests/configs/config.yml',
'tests/configs/config2.yml',
'... | [
{
"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/base_service_config_test.py | egmkang/fastapi_serviceutils |
"""
Reporter classes.
"""
from datadog import api
class Reporter(object):
def flush(self, metrics):
raise NotImplementedError()
class HttpReporter(Reporter):
def flush_metrics(self, metrics):
api.Metric.send(metrics)
def flush_events(self, events):
for event in events:
... | [
{
"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 | datadog/threadstats/reporters.py | Censio/datadogpy |
class Rectangle:
'''
* Define a constructor which expects two parameters width and height here.
'''
def __init__(self,width,height):
self.area = width*height
'''
* Define a public method `getArea` which can calculate the area of the
* rectangle and return.
'''
def ge... | [
{
"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 | python/0454.rectangle-area.py | Ubastic/lintcode |
from django import forms
from django.core.validators import MinValueValidator
from django.utils.translation import gettext_lazy as _
from .models import DayType, Day
class DayTypeForm(forms.ModelForm):
class Meta:
model = DayType
fields = '__all__'
class DayForm(forms.ModelForm):
class Meta... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | mallenom/workcal/forms.py | crowmurk/mallenom |
# import tensorflow as tf
from onnx_darknet.handlers.backend_handler import BackendHandler
from onnx_darknet.handlers.handler import onnx_op
from onnx_darknet.handlers.handler import darknet_func
from .math_mixin import BasicMathMixin
@onnx_op("Floor")
@darknet_func(tf.floor)
class Floor(BasicMathMixin, BackendHandl... | [
{
"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 | onnx_darknet/handlers/backend/floor.py | minhoolee/onnx-darknet |
from fairness.metrics.Metric import Metric
class Diff(Metric):
def __init__(self, metric1, metric2):
Metric.__init__(self)
self.metric1 = metric1
self.metric2 = metric2
self.name = "diff:" + self.metric1.get_name() + 'to' + self.metric2.get_name()
def calc(self, actua... | [
{
"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 | fairness/metrics/Diff.py | yashwarlord/fairness-comparison |
"""
Collection of Jax device functions, wrapped to fit Ivy syntax and signature.
"""
# global
import os
import jax as _jax
# local
from ivy.core.device import Profiler as BaseProfiler
# Helpers #
# --------#
def _to_array(x):
if isinstance(x, _jax.interpreters.ad.JVPTracer):
return _to_array(x.primal)
... | [
{
"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 | ivy/jax/core/device.py | 792370706/Ivy |
from __future__ import absolute_import
from desicos.abaqus.abaqus_functions import create_sketch_plane
from desicos.abaqus.utils import cyl2rec
class Imperfection(object):
"""Base class for all imperfections
This class should be sub-classed when a new imperfection is created.
"""
def __init__(self):... | [
{
"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 | desicos/abaqus/imperfections/imperfection.py | saullocastro/desicos |
import torch
from torchvision import datasets, transforms
import os
transform = {
"train": transforms.Compose(
[
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(
[0.4914, 0.4821... | [
{
"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 | objifier/data_loader.py | 1chimaruGin/Oject_classifier |
"""empty message
Revision ID: 0017_add_failure_types
Revises: 0016_reply_to_email
Create Date: 2016-05-17 11:23:36.881219
"""
# revision identifiers, used by Alembic.
revision = '0017_add_failure_types'
down_revision = '0016_reply_to_email'
from alembic import op
import sqlalchemy as sa
from alembic import op
imp... | [
{
"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 | migrations/versions/0017_add_failure_types.py | tlwr/notifications-api |
import typing as t
import warnings
class AuthorizationMixin:
def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
warnings.warn(
"'AuthorizationMixin' is deprecated and will be removed in"
" Werkzeug 2.1. 'Request' now includes the functionality"
" directly.",
... | [
{
"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 | virtual/lib/python3.8/site-packages/werkzeug/wrappers/auth.py | Esther-Anyona/mylearner |
import tensorflow as tf
from tensorflow.keras import layers
import tensorflow.keras.backend as K
from .utils import assert_binary_array
"""TF Channels"""
class TFChannel(layers.Layer):
def call(self, input_signal):
NotImplemented
class TFAWGN(TFChannel):
def __init__(self, sigma, **kwargs):
... | [
{
"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 | turbo-codes/archive/src/channels.py | tripods-xai/isit-2022 |
"""
This module is for performance testing of EDA module in github action.
"""
from functools import partial
import pandas as pd
from typing import Any
from ...datasets import load_dataset
from ...eda import create_report
def report_func(df: pd.DataFrame, **kwargs: Any) -> None:
"""
Create report function, us... | [
{
"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 | dataprep/tests/benchmarks/eda.py | Waterpine/dataprep-1 |
# coding: utf-8
from random import randint
from .base import BaseField
from ..api import display, special
class PickoutField(BaseField):
"""select an element randomly from the limited-choices."""
def __init__(self, choices, missing=None, callback=None):
"""PickoutField constructor
:param li... | [
{
"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 | datafactory/fields/pickout.py | righ/datafactory |
from django.test import TestCase
from django.contrib.auth.models import User
from .models import Post
class PostTestCase(TestCase):
def setUp(self):
user = User(username="test user", first_name='test',
last_name='user', email='test@test.com',
password='abc123')
... | [
{
"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 | feed/tests.py | Perkles/a-django-blog |
import difflib
import json
def data_loader():
"""This opens the JSON obj for all the city names."""
with open('apps/data/spellcheck/spell_check_opject2.json', 'r') as myfile:
data = myfile.read()
obj = json.loads(data)
return(obj)
def check_spelling(data, words):
"""This function tak... | [
{
"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 | flask-docker-master/apps/city_spelling_matcher.py | nephylum/city-data-comparison-ds |
import time
from monitoring_system.drivers.sensors.Sensor import Sensor
class SwitchSensor(Sensor):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.__dict__.update(kwargs)
self.pin = self._get_wpi_pin(self.pin)
self._register_pins([], [self.pin])
if kwargs['... | [
{
"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 | monitoring_system/drivers/sensors/SwitchSensor.py | NesterukSergey/Rpi_monitoring_study |
import PIL.Image
import PIL.ImageEnhance
import PIL.ImageOps
import numpy as np
import os
import random
import torch
import unittest
from transforms import *
class TransformsTest(unittest.TestCase):
def setUp(self):
self.pil_img = PIL.Image.open('test_img.jpeg')
self.np_img = np.arra... | [
{
"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 | transforms_test.py | daniel03c1/audio_augment |
from django.test import TestCase
class PollsViewsTestCase(TestCase):
fixtures = ['polls_views_testdata.json']
def test_index(self):
resp = self.client.get('/polls/')
self.assertEqual(resp.status_code, 200)
self.assertTrue('latest_poll_list' in resp.context)
self.assertEqual([p... | [
{
"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 | tdd/polls/tests/test_fixtures.py | nokiadev/django-tdd-dojo |
# coding=utf-8
from bluebottle.test.factory_models.slides import SlideFactory
from tenant_schemas.urlresolvers import reverse
from bluebottle.test.utils import BluebottleAdminTestCase
class SlideAdminTest(BluebottleAdminTestCase):
def setUp(self):
super(SlideAdminTest, self).setUp()
self.news = S... | [
{
"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 | bluebottle/slides/tests/test_admin.py | jayvdb/bluebottle |
"""Test move to well commands."""
from mock import AsyncMock # type: ignore[attr-defined]
from opentrons.protocol_engine.commands import (
MoveToWellRequest,
MoveToWellResult,
)
def test_move_to_well_request() -> None:
"""It should be able to create a MoveToWellRequest."""
request = MoveToWellReques... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | api/tests/opentrons/protocol_engine/commands/test_move_to_well.py | faliester/opentrons |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import json
import time
class Message:
def __init__(self, type: str, data: dict, timestamp: float = None):
self.timestamp = time.time() if timestamp is None else timestamp
self.type = type
self.data = data
self.client_address = None
... | [
{
"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 | LearnNetworkProgramming/message.py | fyabc/Toys |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | src/Products/PluginIndexes/util.py | icemac/Products.ZCatalog |
import logging
from modem.const import CRC16_MAP, CRC32_MAP
from zlib import crc32 as _crc32
# Configure logging
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.DEBUG)
log = logging.getLogger('modem')
def crc16(data, crc=0):
'''
Ca... | [
{
"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": tru... | 3 | modem/tools.py | aaron19950321/ICOM |
from collections import Counter
a = input().strip()
W = 25
H = 6
def get_layers(a, w, h):
total = w * h
layers = []
for i, v in enumerate(a):
if i == 0 or i % total == 0:
layers.append(list())
layers[-1].append(int(v))
return layers
def part1(a, w, h):
layers = get_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 | day8/day8.py | Ps-spectre/advent2019 |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from core.models import UserModel
from recycle.models import Location
from recycle.views.location import LocationDetailsAPIView
from tests.unittests.common import APIFactoryTestCase
class LocationDeta... | [
{
"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 | EasyRecycle/tests/unittests/recycle/views/test_LocationDetailsAPIView.py | YuriyLisovskiy/EasyRecycle |
import os
from gogamechen2 import common
from gopcdn.plugin.alias import BaseCdnAlias
class Alias(BaseCdnAlias):
def alias(self, path, version):
path = os.path.join(path, 'version.txt')
if not os.path.exists(path) or not os.path.isfile(path) or os.path.getsize(path) > 100:
raise ValueE... | [
{
"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 | gogamechen2/plugin/alias.py | lolizeppelin/gogamechen2 |
from insights_analytics_collector import register
@register('config', '1.0', description='CONFIG', config=True)
def config(since, **kwargs):
return {
'version': '1.0'
}
@register('json1', '1.1', description='json1')
def json1(**kwargs):
return {'json1': 'True'}
@register('json2', '1.2', descri... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/functional/collector_module2.py | slemrmartin/insights-analytics-collector |
import unittest
import os
from app import app
import json
from config import client
class BasicTests(unittest.TestCase):
############################
#### setup and teardown ####
############################
# executed prior to each test
def setUp(self):
app.config['TESTING'] = True... | [
{
"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 | test/test_usersData.py | AdamLouly/flask-mongodb-docker |
from __future__ import print_function
import time
import unittest
from flexp.flow.parallel import parallelize
def add_two(x):
return x + 2
class TestParallel(unittest.TestCase):
def test_parallel(self):
count = 50
data = range(0, count)
start = time.clock()
res = list(par... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_parallel.py | seznam/flexp |
"""Test-cases for ODE filters."""
import pytest_cases
from probnum import diffeq, randprocs
import probnum.problems.zoo.diffeq as diffeq_zoo
# logistic.rhs is implemented backend-agnostic,
# thus it works for both numpy and jax
@pytest_cases.case(tags=("numpy", "jax"))
def problem_logistic():
return diffeq_zoo... | [
{
"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 | tests/test_diffeq/test_odefilter/test_odefilter_cases.py | fxbriol/probnum |
import datetime
from django.test import TestCase
from django.utils import timezone
from catalog.forms import RenewBookForm
class RenewBookFormTest(TestCase):
def test_renew_form_date_field_label(self):
form = RenewBookForm()
self.assertTrue(form.fields['renewal_date'].label == None or form.fields... | [
{
"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 | catalog/tests/test_forms.py | lair60/django_local_library |
# coding: utf-8
"""
flyteidl/service/admin.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: version not set
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import... | [
{
"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 | gen/pb_python/flyteidl/service/flyteadmin/test/test_admin_pager_duty_notification.py | SmritiSatyanV/flyteidl |
import unittest
import sys
sys.path.append('..')
import chocolatedistribution.getcuts
class TestScoreMethod(unittest.TestCase):
"""Class with the unit tests.
"""
def test_given(self):
chocolates = [2, 5, 7]
children = [3, 2, 5, 1]
cuts = chocolatedistribution.getcuts.giveChocolate(... | [
{
"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 | tests/test_basic.py | avramidis/chocolate-distribution |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | Support/Fuego/Pythia/pythia-0.5/packages/pyre/pyre/monitors/__init__.py | balos1/PelePhysics |
# Copyright (C) 2017 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | [
{
"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 | Toolkits/VCS/repology__repology-api/repology/fetcher/rsync.py | roscopecoltran/SniperKit-Core |
import unittest
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.clients.polling.telegram.config import TelegramConfiguration
from programy.clients.events.console.config import ConsoleConfiguration
class TelegramClientConfigurationTests(unittest.TestCase):
def test_init(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | test/programytest/clients/polling/telegram/test_config.py | motazsaad/fit-bot-fb-clt |
"""
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
"""
__author__ = 'Danyang'
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
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 | 111 Minimum Depth of Binary Tree.py | scorpionpd/LeetCode-all |
from orchespy import device
from orchespy.devicetype import CUDAGPU, Host, VE
import sys
import pytest
import numpy as np
if "cupy" in sys.modules:
import cupy as cp
if "nlcpy" in sys.modules:
import nlcpy as vp
no_nlcpy = pytest.mark.skipif(
"nlcpy" not in sys.modules, reason=' test require nlcpy. '... | [
{
"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 | tests/device_tests/test_device_args_numpy_module.py | SX-Aurora/orchespy |
import logging
from followthemoney import model
from servicelayer.worker import Worker
from ingestors.manager import Manager
log = logging.getLogger(__name__)
class IngestWorker(Worker):
"""A long running task runner that uses Redis as a task queue"""
def dispatch_next(self, task, entities):
next_s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | services/ingest-file/ingestors/worker.py | adikadashrieq/aleph |
"""
Duo Security Accounts API reference client implementation.
<http://www.duosecurity.com/docs/accountsapi>
"""
import client
class Accounts(client.Client):
def get_child_accounts(self):
"""
Return a list of all child accounts of the integration's account.
"""
params = {}
... | [
{
"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 | duo_client/accounts.py | Shoobx/duo_client_python |
from os.path import basename as _basename
form_name=_basename(__file__).split('.')[0].split('_')[-1]
is_form = {
'gpickle': form_name,
'gpickle.gz': form_name
}
def to_native_Network(item):
from ..classes.api_networkx_Graph import to_native_Network as _networkx_Graph_to_native_Network
tmp_form_au... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kinnetmt/formats/files/api_gpickle.py | uibcdf/NetLabTools |
# Given a graph (adjacency matrix) calculates the minimum distance between each vertex pair
from collections import defaultdict
INF = 999999999
class Graph:
# Constructor
def __init__(self, vertices, directed=True):
# default dictionary to store graph
self.graph = defaultdict(list)
... | [
{
"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 | graph/Python/floyd_warshall.py | teototaro/al-go-rithms |
"""
CLI tests
"""
from tso.tsocli import __main__ as tsocli
import pytest
from unittest.mock import patch, MagicMock, mock_open
mock_configurqation = "{}"
class TestCli:
def test_cli_should_exit_with_no_args(self):
with pytest.raises(SystemExit) as pytest_wrapped_e:
tsocli.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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | src/tso/tsocli/tests/test_cli.py | elijah-ward/TSO |
import tkinter as tk
from tkinter import ttk
class ToggledFrame(tk.Frame):
"""
The ToggledFrame Class creates a expandable box for the grouping of tests
since this is not possible in TK inter
"""
def __init__(self, parent, text="", *args, **options):
tk.Frame.__init__(self, parent, *args,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | NUTS2.0/nuts/testhandling/GUI/ToggledFrame.py | EkoGuandor229/Network-Unit-Testing |
'''
Some examples for LSH
'''
from hashlib import sha1
import numpy as np
from datasketch.minhash import MinHash
from datasketch.weighted_minhash import WeightedMinHashGenerator
from datasketch.lsh import WeightedMinHashLSH, MinHashLSH
data1 = ['minhash', 'is', 'a', 'probabilistic', 'data', 'structure', 'for',
... | [
{
"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 | examples/lsh_examples.py | titusz/datasketch |
"""
LC 111
Find the minimum depth of a binary tree. The minimum depth is the number of nodes along the shortest path from the root node to the nearest leaf node.
"""
from collections import deque
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
def find_minimum_de... | [
{
"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 | grokking-the-coding-interview/bfs/Minimum-Depth-of-a-Binary-Tree-(easy).py | GuardianWang/LeetCode |
class texttobinary:
def __repr__(self):
return 'texttobinary()'
def forward(input):
Dec = list(bytearray(input, "utf8"))
out = [''] * len(input)
for i in range(len(input)):
out[i] = bin(Dec[i]).replace("b", ("0"*(9-len(bin(Dec[i])))))
return out
def backward(input):
return inpu... | [
{
"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 | example/src/texttobinary.py | SeanMabli/aiinpy |
# def yetki_sorgula(page):
# def inner(role):
# if role == "admin" :
# print("{0} rolü {1} sayfasına ulaşabilir." .format(page, role))
# else:
# print("{0} rolü {1} sayfasına ulaşamaz." .format(page, role))
# return inner
# user1 = yetki_sorgula('arayüz')
# print(user1("... | [
{
"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 | returning.py | EnescanAkyuz/Python_Beginner |
#
# This file is part of Orchid and related technologies.
#
# Copyright (c) 2017-2021 Reveal Energy Services. All Rights Reserved.
#
# LEGAL NOTICE:
# Orchid contains trade secrets and otherwise confidential information
# owned by Reveal Energy Services. Access to and use of this information is
# strictly limited and... | [
{
"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 | examples.py | Reveal-Energy-Services/orchid-python-api |
import unittest
from pyats.topology import loader
from genie.libs.sdk.apis.iosxe.interface.configure import configure_interface_span_portfast
class TestConfigureInterfaceSpanPortfast(unittest.TestCase):
@classmethod
def setUpClass(self):
testbed = """
devices:
m4a:
conne... | [
{
"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 | pkgs/sdk-pkg/src/genie/libs/sdk/apis/tests/iosxe/interface/configure/configure_interface_span_portfast/test_api_configure_interface_span_portfast.py | patrickboertje/genielibs |
import re
# '#'があればそれはobjdumpがつけたコメントだとみなしてる
def rm_comment(msg):
try:
msg = msg[0:msg.index("#")]
except:
pass
return msg
# 両端の空白を削除、文中の連続した空白を半角空白1個に置き換え
def rm_consecutive_spaces(msg):
return re.sub(r"\s+", " ", msg).strip()
# objdump -d -M intel ./a.out の出力結果はこれを元に付け加える
def format... | [
{
"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 | peo/util/parse.py | Bigdrea6/peo |
import tensorflow as tf
import numpy as np
tf.enable_eager_execution()
class Node(object):
def __init__(self, observation, action, reward, clock):
self.observation = observation
self.action = action
self.reward = reward
self.clock = clock
class RLAlgorithm(object):
def __init... | [
{
"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 | playground/Non_DAG_with_Energy_rllib/algorithm/DeepJS/DRL.py | kangyifei/CloudSimPy |
# coding: utf-8
"""
Fiddle Options Platform
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | swagger_client_test/test_pn_l_curve.py | kovacicek/fiddleoptions |
from base_filter import BaseFilter
class TableScanFilter(BaseFilter):
""" accepts only if the line contains a nscanned:[0-9] nreturned:[0-9] where the ratio of nscanned:nreturned is > 100 and nscanned > 10000
"""
filterArgs = [
('--scan', {'action':'store_true', 'help':'only output lines which appe... | [
{
"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 | mtools/mlogfilter/filters/tablescan_filter.py | dcoupal/mtools |
# -*- coding: utf-8 -*-
from django import forms
from django.core import validators
from modeltranslation.fields import TranslationField
class TranslationModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(TranslationModelForm, self).__init__(*args, **kwargs)
for f in self._met... | [
{
"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 | third_party/modeltranslation/forms.py | asysc2020/contentbox |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# 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,... | [
{
"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/screen.py | justdanofficial/Ghost |
"""
..
Copyright: 2017 Twinleaf LLC
Author: kornack@twinleaf.com
OriginalDate: March 2017
"""
import struct
import yaml
import tio
from .tl_cmd_conf import *
class TwinleafDevFirmwareInfoController(object):
def __init__(self, dev):
self._dev = dev
def hash(self):
return self._dev._tio.rpc('de... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | tldevice/tl_cmd_devinfo.py | stefanvanherwijnen/tio-python |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Nobilitas Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from binascii import hexlify
f... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | share/rpcauth/rpcauth.py | Mirkolance1/nobilitas |
import json
from flask import make_response
from flask_restful import Resource
class ErrorCode(object):
OK = (0, "OK")
class BaseResource(ErrorCode, Resource):
def build_response(self, err_code, data=None):
params = {
'meta': {
'code': err_code[0],
'mess... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},... | 3 | doom/api/restf/resource.py | iiCodeThings/doom |
class py_solution:
def __init__(self,L):
self.L = L
self.stack = []
self.A = ['(','[','{']
self.B = [')',']','}']
def is_valid_parentheses(self):
for i in self.L :
if i in self.A :
self.stack.append(i)
else :
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | ELAB09/09-04.py | tawanchaiii/01204111_63 |
"""
Model fields for working with trees.
"""
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from mptt.forms import TreeNodeChoiceField, TreeNodeMultipleChoiceField
__all__ = ('TreeForeignKey', 'TreeOneToOneField', 'TreeManyToManyField')
class TreeForeignKey(mo... | [
{
"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 | mptt/fields.py | chicory/django-mptt |
from recyclus import Client
import time
def load(job):
print('saving cyclus.sqlite...')
client.save('cyclus.sqlite', job.jobid)
def wait_for_completion(job):
while True:
time.sleep(2)
resp = job.status()
if resp['status'] != 'ok':
print(f'Error:', resp['message'])
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/run.py | yarden-livnat/recyclus |
from warnings import warn
import numpy as np
from mizani.palettes import rescale_pal
from ..doctools import document
from ..exceptions import PlotnineWarning
from ..utils import alias
from .scale import scale_discrete, scale_continuous
@document
class scale_stroke_continuous(scale_continuous):
"""
Continuou... | [
{
"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 | venv/Lib/site-packages/plotnine/scales/scale_stroke.py | EkremBayar/bayar |
import logging
import logging.config
import os
from celery.utils.log import get_task_logger
from dotenv import load_dotenv
from flask import Flask
from flask_login import LoginManager
from config import config, Config
from .AfricasTalkingGateway import gateway
from .database import db, redis
dotenv_path = os.path.jo... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | app/__init__.py | NewbieTechTeam/USSD-Python-Demo |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Lewin Villar and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.naming import make_autoname
class ConsultaPrivada(Document):
def before_inse... | [
{
"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 | consultas/consultas/dump consultas/doctype/consulta_privada/consulta_privada.py | Lewinta/Consultas |
#!/usr/bin/python
##### ~ http://stackoverflow.com/questions/7960600/python-tkinter-display-animated-gif-using-pil ~
## source of code can be found at the above web page, I have modified the code to suit my needs.
from Tkinter import *
from PIL import Image, ImageTk
class MyLabel(Label):
def __init__(self, mas... | [
{
"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 | loading.py | hawkarcane/Hangman |
import unittest
"""
Leetcode(https://leetcode.com/problems/container-with-most-water/solution/)
"""
def maxArea(height):
ans = 0
left, right = 0, len(height) - 1
while left < right:
ans = max(ans, min(height[left], height[right]) * (right - left))
if height[left] < height[right]:
... | [
{
"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 | assignments/a2/containerWithMostWater.py | jcdiv47/geekbang-algorithms |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from gym.spaces import Space
from gym.spaces import Tuple as GymTuple
class Tuple(GymTuple):
"""A tuple (i.e., p... | [
{
"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 | compiler_gym/spaces/tuple.py | thecoblack/CompilerGym |
"""
Test that the fiftyone core does not depend on Tensorflow or PyTorch.
"""
import sys
import pytest
# raise an ImportError if any of these modules are imported
# https://docs.python.org/3/reference/import.html#the-module-cache
sys.modules["tensorflow"] = None
sys.modules["tensorflow_datasets"] = None
sys.modules[... | [
{
"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/isolated/import_deps_test.py | Vs0923/Voxel51 |
from functools import wraps
from django.http import HttpResponse
from rest_framework.response import Response
from rest_framework import status
from website.constants import WIDGET_NAMES
def user_can_use_web_widget(function):
@wraps(function)
def decorator(request, *a, **k):
if request.user.userpro... | [
{
"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 | annotater/memetext/decorators.py | stricoff92/annotater |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | src/melange/src/soc/modules/gsoc/logic/models/proposal_duplicates.py | MatthewWilkes/mw4068-packaging |
"""
Meta social community forms
"""
from django import forms
from .models import Community
class EditCommunityForm(forms.ModelForm):
"""
Community editing form
"""
def __init__(self, *args, **kwargs):
super(EditCommunityForm, self).__init__(*args, **kwargs)
for key in self.fields:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | community/forms.py | PickBas/meta-social |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"point_num": 1,
"id": "every_function_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 | xlsxwriter/test/comparison/test_chart_data_labels17.py | hugovk/XlsxWriter |
from nose.tools import assert_equal, assert_less, assert_true
from numpy.testing import assert_array_equal
from StringIO import StringIO
import scipy.sparse as sp
from seqlearn.datasets import load_conll
TEST_FILE = """
The Det
cat N
is V
on Pre
the Det
mat N
. Punc
Really Adv
. Punc
"""
def features(w... | [
{
"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 | seqlearn/datasets/tests/test_conll.py | vene/seqlearn |
import random
import string
import datetime
import bcrypt
from sqlalchemy import (
Column,
Integer,
Unicode,
DateTime,
LargeBinary,
)
from sqlalchemy.orm import relationship
from .meta import Base, load_datetime
class User(Base):
"""User Class"""
__tablename__ = 'users'
id = Column(I... | [
{
"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 | baby_tracker/models/user.py | paulsheridan/nap-tracker |
#
"""Defaults for thread-local values
"""
# end_pymotw_header
import random
import threading
import logging
def show_value(data):
try:
val = data.value
except AttributeError:
logging.debug("No value yet")
else:
logging.debug("value=%s", val)
def worker(data):
show_value(data... | [
{
"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 | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/threading/threading_local_defaults.py | webdevhub42/Lambda |
# -*-coding: utf-8 -*-
def array_slip(start, end, clip_length):
"""
将步长为1的数轴按照 clip_length 的长度切分为 n 个段,返回 N个左闭右开区间[x, y),
最后一个片段的右边界为 end + 1。所以,最好当做 左闭右开区间处理使用,[x, y)。
----------------------------------[ DEMO ]----------------------------------
def demo():
# ls = [1, 2, 3, 4, 5, 6, 7, 8, 9, ... | [
{
"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/split_array.py | MaiXiaochai/Tools |
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.status.status_command import StatusCommand
fr... | [
{
"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 | pyopenproject/business/services/command/status/find_by_context.py | webu/pyopenproject |
"""
filename: rig.py
"""
import os
from urllib.parse import urlparse
import yaml
CONFIG = {}
with open('BROWSERS.yaml', 'r') as file:
CONFIG = yaml.load(file)
def extract_ext(url):
"""Extract file extension from url"""
parse = urlparse(url)
_, ext = os.path.splitext(parse.path)
return ext
def... | [
{
"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 | rig.py | osule/wo |
from flask import Flask, render_template, request, redirect
from flaskext.mysql import MySQL
# web application
app = Flask(__name__)
# connect to db
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = '~~keowee.27~~'
app.config['MYSQL_DATABASE_DB'] = 'book_business'
app.... | [
{
"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 | paula_threetiers/paula_crud/updatePub.py | pieperpaula/threetiersPP |
import numpy as np
import tempfile
def snap2model_parser(path_snapshot, path_model=None):
"""convert snapshot to model
:param path_snapshot: str
:param path_model: str, default None
:return: file descriptor (path_model is None) or None (otherwise)
"""
snapshot = np.load(path_snapshot)
mo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | chainer/snap2model.py | fujibo/poseHG |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from nose.tools import raises
from construct import actionparams
from construct.errors import ArgumentError
params_0 = dict()
params_1 = dict(
str_arg={
'label': 'String Argument',
'help': 'A String Argument',... | [
{
"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 | construct/tests/test_actionparams.py | construct-org/construct |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "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 | kubernetes/test/test_core_api.py | woqer/python |
from argparse import ArgumentParser
import numpy as np
import pandas as pd
from pickle import dump
from tqdm import tqdm
AA = ('A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y')
AA_ENCODING = dict((a, 2**i) for i,a in enumerate(AA))
def generate_peptide_tensor(data, aaprops, output, maxl... | [
{
"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 | src/generate_peptide_tensors.py | NCBI-Hackathons/Machine_Learning_Immunogenicity |
# python3
import sys
class Bracket:
def __init__(self, bracket_type, position):
self.bracket_type = bracket_type
self.position = position
def Match(self, c):
if self.bracket_type == '[' and c == ']':
return True
if self.bracket_type == '{' and c == '}':
... | [
{
"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 | data-structures/Starters PA1/check_brackets.py | richardson-souza/coursera-dsa |
# coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
OpenAPI spec version: 0.0.155
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __fu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | sdk/test/test_overdraft_overdraft_fees_charges1.py | bs-yapily/yapily-sdk-python |
from __future__ import annotations
from datetime import datetime
class RefWarning:
NEVER = datetime(9999, 1, 1)
def __init__(self, user_id: int, timestamp: datetime, mod_name: str, reason: str = "",
expiration_time: datetime = NEVER):
self.user_id = user_id
self.timestamp = t... | [
{
"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 | models/warnings_models.py | ichbineinNerd/Referee |
from typing import Any, Callable, List, Optional, Tuple
import gym
import numpy as np
from tianshou.env.worker import EnvWorker
try:
import ray
except ImportError:
pass
class _SetAttrWrapper(gym.Wrapper):
def set_env_attr(self, key: str, value: Any) -> None:
setattr(self.env, key, value)
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | tianshou/env/worker/ray.py | allegro/tianshou |
""" Bu kod MQTT den alir FireBase e atar """
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
import paho.mqtt.client as mqtt
from time import sleep
import json
import sys
Fb_Coll = "color"
def main():
x = open("../ip.json")
data_ = json.load(x)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | MyAwsomeMainCode/send_.py | KJPOUNDY132/mqtt_to_firebase |
from ..utils import Object
class AcceptTermsOfService(Object):
"""
Accepts Telegram terms of services
Attributes:
ID (:obj:`str`): ``AcceptTermsOfService``
Args:
terms_of_service_id (:obj:`str`):
Terms of service identifier
Returns:
Ok
Raises:
... | [
{
"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 | pytglib/api/functions/accept_terms_of_service.py | iTeam-co/pytglib |
import os
import unittest
from app.lib.cache_provider import FileCacheProvider
from app.lib.constants import IMAGE_PATH
from app.lib.constants import IMAGE_CACHE_PATH
class TestCache(unittest.TestCase):
def test_build_path(self):
cache = FileCacheProvider()
cache_path = cache._build_path('imag6.j... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/test_cache.py | nicolageorge/ownimageserver |
from db.models import Server, Channel, get_session
import sqlalchemy
import discord
session = get_session()
class NullError(Exception):
pass
def add_server(serv_id):
s = Server(serv_id=serv_id, channels=[])
session.add(s)
session.commit()
def get_server(serv_id):
s = session.query(Server).filter... | [
{
"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 | app/db/functions.py | Lee-Junhee/PiortBot |
import time
import math
def time_sec():
return int(time.time())
class Progress:
"""
Progress reporting.
Usage:
from jxa.Progress import Progress
from time import sleep
p = Progress(frequency=4)
max = 9000_000
for i in range(0,max,1000):
sleep(1/300)
p.print(i,max... | [
{
"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 | jxa/Progress.py | jkedra/jxa |
from selenium.webdriver.support.wait import WebDriverWait
class MainPage:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(driver, 10)
def open(self):
self.driver.get("http://localhost/litecart")
return self
@property
def choose_item_on_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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | homework/pages/main_page.py | viaviare/MyFirstRepository |
"""
@brief test log(time=200s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import ExtTestCase
from pymyinstall.packaged import small_set
class TestDifference(ExtTestCase):
def test_diff(self):
fLOG(
__file__,
self._testMethodName,
... | [
{
"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 | _unittests/ut_packaged/test_diff.py | sdpython/pymyinstall |
import re
import json
from streamlink.plugin import Plugin
from streamlink.stream import HLSStream
_url_re = re.compile(r"http(?:s)?://(?:\w+\.)?rtl.nl/video/(?P<uuid>.*?)\Z", re.IGNORECASE)
class rtlxl(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)
def _get_strea... | [
{
"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 | resources/lib/streamlink/plugins/rtlxl.py | rrosajp/script.module.streamlink-1 |
from typing import List
from prime_numbers.int import Int
class PrimeNumbers:
def __init__(self, numbers: List[int]):
self._numbers = numbers
def __iter__(self):
for number in self._numbers:
if Int(number).prime():
yield number
| [
{
"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 | prime_numbers/prime_numbers.py | gringonivoli/tdd-own-stuff |
#
# 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... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | airflow/migrations/versions/0101_a3bcd0914482_add_data_compressed_to_serialized_dag.py | npodewitz/airflow |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.