source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from tatau_core.models import TaskDeclaration
from tatau_core.models.task import ListEstimationAssignments
from tatau_core.utils.ipfs import Directory
class Estimator:
@staticmethod
def get_data_for_estimate(task_declaration):
dataset = task_declaration.dataset
ipfs_dir = Directory(dataset.tra... | [
{
"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 | tatau_core/node/producer/estimator.py | makar21/core |
"""Run the simple SAT solver on the binary case of van der waerden's problem.
This problem asks for the smallest number n so that a binary number of n digits
that contains either j digits 0 or k digits 1, for given integers j and k.
"""
from __future__ import division
def _van_der_waerden_helper(j, n, sign):
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | simplesat/examples/van_der_waerden.py | msfschaffner/sat-solver |
import httplib
from django.core.urlresolvers import reverse
from oscar_testsupport.factories import create_order
from oscar_testsupport.testcases import WebTestCase
class TestAnAnonymousUser(WebTestCase):
def test_gets_a_404_when_requesting_an_unknown_order(self):
path = reverse('customer:anon-order', ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/functional/customer/order_status_tests.py | endgame/django-oscar |
"""Create your api serializers here."""
import numpy as np
from django.core.serializers.json import DjangoJSONEncoder
from rest_framework import serializers
class NpEncoder(DjangoJSONEncoder):
"""Encoder for numpy object."""
def default(self, o):
"""Serialize implementation of NpEncoder serializer.
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | api/serializers.py | PrynsTag/oneBarangay |
import glob
import logging
from importlib import import_module
from os.path import basename, isdir, isfile
from pathlib import Path
from aiogram import Dispatcher
class ModuleManager:
def __init__(self, dp: Dispatcher):
self.dp = dp
self.root = Path(__file__).parent.parent
def load_path(sel... | [
{
"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 | app/misc/modular.py | Cicadadenis/999 |
import pandas as pd
from plotly import graph_objects as go
from expenses_report.chart_builder import ChartBuilder
from expenses_report.config import config
from expenses_report.preprocessing.data_provider import DataProvider
from expenses_report.visualizations.i_visualization import IVisualization
class TransactionB... | [
{
"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 | expenses_report/visualizations/transaction_bubbles_visualization.py | kircher-sw/expenses-tracker |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...chartsheet import Chartsheet
class TestInitialisation(unittest.TestCase):
"""
... | [
{
"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 | xlsxwriter/test/chartsheet/test_initialisation.py | haiyangd/XlsxWriter |
from nose.tools import assert_equals
from framework.pages.loginPage import loginPage
from framework.pages.headerPage import headerPage
from framework.core.webdriverfactory import WebDriverFactory
from framework.core.configuration import webdriver_configuration
class testLogin():
baseUrl = "http://twiindan.python... | [
{
"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 | 04_Selenium/framework/tests/testLogin.py | twiindan/selenium_lessons |
import unittest
import warnings
from dataclasses import dataclass
from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir
@dataclass
class FakeOriginalTokenizer:
vocab_file: str
class ConvertSlowTokenizerTest(unittest.TestCase):
def test_spm_convert... | [
{
"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 | tests/utils/test_convert_slow_tokenizer.py | manuelciosici/transformers |
import os
from flask import Flask, send_file, abort
# Imports and stuff.
webserver = Flask(__name__)
# Defines the web server.
@webserver.route("/")
def acc_denied():
return "You cannot browse this subdomain."
# Denies access if user tries to browse the subdomain.
@webserver.route("/<path:imageid>")
... | [
{
"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 | i_server.py | JakeMakesStuff/aurorame.me |
"""
Subdivide Cells
~~~~~~~~~~~~~~~
Increase the number of triangles in a single, connected triangular mesh.
The :func:`pyvista.PolyDataFilters.subdivide` filter utilitizes three different
subdivision algorithms to subdivide a mesh's cells: `butterfly`, `loop`,
or `linear`.
"""
from pyvista import examples
import pyv... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | examples/01-filter/subdivide.py | whophil/pyvista |
def selection_sort(input_list):
if not isinstance(input_list, list):
raise TypeError('input needs to be a list')
def find_lowest_value_index(start_index):
lowest_value_index = start_index
for i, x in enumerate(input_list[start_index:]):
if x < input_list[lowest_value_index]:... | [
{
"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 | pyImplementations/selection_sort/index.py | veekas/thinkDataStructures |
#version 15:38
import random
import string
#name = 'zzz'
set_off = 23
def convert(name):
for i in range(len(name)):
if name[i].lower() == 'i' or name[i].lower() == 'y' or name[i].lower() == '9':
name = list(name)
name[i] = 'g'
name = ''.join(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": fal... | 3 | 21-fs-ias-lec/16-nicknames-forward/subChat/Colorize.py | paultroeger/BACnet |
# pylint: disable=redefined-outer-name
import asyncio
import time
import pytest
DEFAULT_MAX_LATENCY = 10 * 1000
@pytest.mark.asyncio
async def test_slow_server(host):
if not pytest.enable_microbatch:
pytest.skip()
A, B = 0.2, 1
data = '{"a": %s, "b": %s}' % (A, B)
time_start = time.time()... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/integration/api_server/test_microbatch.py | theopinard/BentoML |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2020 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | python/coroutines/cofollow.py | ASMlover/study |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Apr, 2019
@author: Nathan de Lara <ndelara@enst.fr>
"""
from typing import Optional, Union
import numpy as np
from sknetwork.utils.check import check_seeds
def stack_seeds(n_row: int, n_col: int, seeds_row: Optional[Union[np.ndarray, dict]],
... | [
{
"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 | sknetwork/utils/seeds.py | altana-tech/scikit-network |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from typing import Any, Dict, List, Optional
from fbpcp.entity.container_instance import ContainerIns... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | fbpcs/common/entity/pcs_mpc_instance.py | hche11/fbpcs |
from pathlib import Path
def dir_touch(path_file) -> None:
Path(path_file).mkdir(parents=True, exist_ok=True)
def file_touch(path_file) -> None:
p = Path(path_file)
p.parents[0].mkdir(parents=True, exist_ok=True)
p.touch()
def index_or_default(lst, val, default=-1):
return lst.index(val) if va... | [
{
"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/tools.py | r3w0p/memeoff |
"""Tests for `democritus_pypi` module."""
from democritus_pypi import pypi_package_data, pypi_packages_new, pypi_packages_all_names, pypi_packages_recent
def test_pypi_package_data_1():
results = pypi_package_data('ioc-finder')
assert results['info']['author'] == 'Floyd Hightower'
assert results['info'][... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_democritus_pypi.py | democritus-project/d8s-pypi |
from deeply.datasets.util import image_mask
from tensorflow_datasets.core import (
Version,
GeneratorBasedBuilder
)
_DATASET_HOMEPAGE = "https://polyp.grand-challenge.org/CVCClinicDB/"
_DATASET_KAGGLE = "achillesrasquinha/cvcclinicdb"
_DATASET_DESCRIPTION = """
CVC-ClinicDB is a database of frames ext... | [
{
"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/deeply/datasets/colonoscopy/cvc_clinic_db.py | achillesrasquinha/deeply |
class Robaczek:
def __init__(self, x, y, krok):
self.x=x
self.y=y
self.krok=krok
def zmien_robaczka(self, x1, y1, krok1):
self.x=x1
self.y=y1
self.krok=krok1
def gora(self, ile):
self.y += ile*self.krok
def dol(self, ile):
... | [
{
"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 | cw4_wd_zadania/z7.py | KamilMarkusz96/wizualizacja-danych |
"""safe name
Revision ID: 9332f05cb7d6
Revises: 30228d27a270
Create Date: 2020-05-24 23:49:06.195432
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9332f05cb7d6'
down_revision = '30228d27a270'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/9332f05cb7d6_safe_name.py | maiorano84/ctaCompanion |
# *******************************************************************************
#
# Copyright (c) 2020-2021 David Briant. All rights reserved.
#
# *******************************************************************************
import sys
if hasattr(sys, '_TRACE_IMPORTS') and sys._TRACE_IMPORTS: print(__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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | src/std/coppertop/std/files.py | DangerMouseB/coppertop |
# coding: utf-8
from datetime import date, timedelta
import pandas as pd
from rescuetime.api.service import Service
from rescuetime.api.access import AnalyticApiKey
def get_apikey():
with open("apikey", "r") as fileo:
key = fileo.read()
return key
apikey = get_apikey()
def get_efficiency():
... | [
{
"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 | rescuetime_wrapper.py | psorianom/rescuescore |
# Copyright 2021 Alibaba Group Holding Limited. All Rights Reserved.
import numpy as np
import torch
from .registry import TRANSFORMS
def to_tensor(data):
if isinstance(data, torch.Tensor):
return data
elif isinstance(data, np.ndarray):
return torch.from_numpy(data)
elif isinstance(data,... | [
{
"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 | essmc2/transforms/tensor.py | huang-ziyuan/EssentialMC2 |
# -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_readConnectionLost -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTestCase.test_readConnectionLost}
to test that IHalfCl... | [
{
"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 | twisted/test/stdio_test_halfclose.py | djmitche/Twisted |
import json
import discord.ext
reactionMessageIDs = {
}
openGames = {
}
openLobbies = {
}
playersInGame = {
}
playersInLobby = {
}
def channelInGame(channelID):
if channelID in openGames.keys(): return True
else: return False
def channelHasLobby(channelID):
if channelID in openLobbie... | [
{
"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 | storage/globalVariables.py | SuperSmay/Uno2 |
"""
Code illustration: 5.06
@Tkinter GUI Application Development Blueprints
"""
class Model:
def __init__(self):
self.__play_list = []
@property
def play_list(self):
return self.__play_list
def get_file_to_play(self, file_index):
return self.__play_list[file_index]
def... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | Chapter 05/5.06/model.py | ACsBlack/Tkinter-GUI-Application-Development-Blueprints-Second-Edition |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | logging/tests/unit/handlers/transports/test_base.py | rodrigodias27/google-cloud-python |
# -*- coding: utf-8 -*-
try:
import django
except ImportError as e:
django = None
django_import_error = e
def check_django_import():
if django is None:
raise django_import_error
class django_required(object):
def __call__(self, func):
def wrapper(self, *args, **kwargs):
... | [
{
"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 | aserializer/django/utils.py | orderbird/aserializer |
# counter.py
def inc(x):
"""
Increments the value of x
>>> inc(4)
5
"""
return x + 1
def dec(x):
"""
Decrements the value of x
>>> dec(5)
4
"""
return x - 1
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | counter.py | lmerchant/ucsd-ext-put-final |
#!\usr\bin\python
from numpy import array
from scipy.special import erf
from scipy.optimize import minimize
from math import pi, sin, cos, exp, sqrt
#import dicom
line_array = [] ## global
def read_line (file_name ):
with open( file_name ) as f:
for line in f:
line_array.append( [float( lin... | [
{
"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 | minimize/retic_xmm_2gauss/2minimize_4mv.py | oustling/dicom_profile_fitting |
from dp_excel.ExcelRowOptions import ExcelRowOptions
from dp_excel.ExcelCell import ExcelCell
class ExcelRowTemplate:
def __init__(self):
self.rows = []
def __get_current_row(self):
return self.rows[-1]
def add_column(self, value, options=None, is_empty=False):
cell = ExcelCell(v... | [
{
"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 | dp_excel/ExcelRowTemplate.py | DmitryPaschenko/python_excel_writer |
# coding=utf-8
import unittest
from pyprobe.sensors.sensors.LinuxSensorsParser import LinuxSensorsParser
__author__ = 'Dirk Dittert'
SAMPLE_OUTPUT = u"""\
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +46.0°C (high = +82.0°C, crit = +100.0°C)
Core 1: +45.0°C (high = +82.0°C, crit = +100.0°C)
Core 2: ... | [
{
"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 | tests/sensors/sensors/LinuxSensorsParserTest.py | dittert/pyprobe |
from urllib.parse import parse_qs
class Request:
GET = {}
POST = {}
def __init__(self, environ: dict):
self.build_get_params_from_dict(environ.get('QUERY_STRING'))
self.build_post_params_dict(environ.get('wsgi_input').read())
def build_get_params_from_dict(self, raw_params: str):
... | [
{
"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 | flack/request.py | LeikoDmitry/web |
from pip.locations import build_prefix, src_prefix
from pip.util import display_path, backup_dir
from pip.log import logger
from pip.exceptions import InstallationError
from pip.commands.install import InstallCommand
class BundleCommand(InstallCommand):
name = 'bundle'
usage = '%prog [OPTIONS] BUNDLE_NAME.pyb... | [
{
"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 | vendor/pip-1.2.1/pip/commands/bundle.py | hmoody87/heroku-buildpack-python-ffmpeg-lame |
# -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from .fake_webapp import EXAMPLE_APP
class IsTextPresentTest(object):
def test_is_text_present(self):
"should verify if tex... | [
{
"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 | tests/is_text_present.py | jsfehler/splinter |
from currency_exchanger.currencies.models import Currency
from currency_exchanger.wallets.models import Wallet
from django.db import models
class Stock(models.Model):
symbol = models.CharField(max_length=10)
currency = models.ForeignKey(Currency, on_delete=models.CASCADE, related_name="stocks")
price = mo... | [
{
"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 | backend/currency_exchanger/stocks/models.py | norbertcyran/currency-exchanger |
import numpy as np
from prob import VRPDGLDataset
from dgl.dataloading import GraphDataLoader
import torch
from attention_model.attention_utils.functions import load_routing_agent
from solver.absolver import ABSolver
class amVRP:
def __init__(self, size=20, method="greedy"):
"""
args:
... | [
{
"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 | solver/am_vrp_solver.py | lin-bo/RL_back2depot_VRP |
from typing import Union
class StorageMap:
def __init__(self, context, prefix: Union[bytes, str]):
from boa3.builtin.interop.storage.storagecontext import StorageContext
self._context: StorageContext
self._prefix: Union[bytes, str]
def get(self, key: Union[str, bytes]) -> bytes:
... | [
{
"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 | boa3/builtin/interop/storage/storagemap.py | DanPopa46/neo3-boa |
import torch
import torch.nn as nn
import torch.nn.functional as F
class MyAwesomeModel(nn.Module):
def __init__(self, n_classes):
super(MyAwesomeModel, self).__init__()
self.feature_extractor = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=6, kernel_size=4, stride=1),
... | [
{
"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 | src/models/model.py | schibsen/MLops_exercises_organized |
import Algorithmia
# API calls will begin at the apply() method, with the request body passed as 'input'
# For more details, see algorithmia.com/developers/algorithm-development/languages
def apply(input):
return "hello {}".format(str(input))
# Here is an example of an advanced form of an algorithm function,
# wh... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | languages/anaconda3/template/src/Algorithm.py | algorithmiaio/langpacks |
import warnings
from typing import List, Callable, Union
from sharpy.plans.require.methods import merge_to_require
from sharpy.plans.require import RequireBase
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sharpy.knowledges import Knowledge
class Any(RequireBase):
"""Check passes if any of the con... | [
{
"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 | sharpy-sc2/sharpy/plans/require/any.py | etzhang416/sharpy-bot-eco |
import sys
sys.path.append('..')
from dread.base import BaseResource
from dread.json import JSONDispatcher
from dread.auth import BasicAuth
from werkzeug.exceptions import NotFound
class User(BaseResource):
PROTECTED_ACTIONS = [
'create', 'update', 'delete'
]
def __init__(self):
self.us... | [
{
"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 | examples/basicauth.py | rugginoso/dread |
from graphql.language.location import SourceLocation as L
from graphql.validation.rules import UniqueInputFieldNames
from .utils import expect_fails_rule, expect_passes_rule
def duplicate_field(name, l1, l2):
return {
'message': UniqueInputFieldNames.duplicate_input_field_message(name),
'location... | [
{
"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 | graphql/validation/tests/test_unique_input_field_names.py | phil303/graphql-core |
#Import sessions for session handling
import webapp2
from webapp2_extras import sessions
#This is needed to configure the session secret key
#Runs first in the whole application
session_config = {}
session_config['webapp2_extras.sessions'] = {
'secret_key': 'my-super-secret-key-somemorearbitarythingstosay'... | [
{
"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 | session_module.py | zapstar/gae-facebook |
#!/usr/bin/env python
import os
import glob
import subprocess
passed = []
failed = []
def execTest(testfile):
cmd = "./glslc %s" % testfile
ret = subprocess.call(cmd, shell=True)
if ret:
return False
return True
def stat():
global passed
global failed
n = len(passed) + le... | [
{
"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 | glsl/test_runner.py | avr-aics-riken/SURFACE |
# Copyright (c) 2018 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 applicable law or agreed to 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | yardstick/network_services/traffic_profile/landslide_profile.py | upfront710/yardstick |
from __future__ import unicode_literals
import json as jsonencode
from datetime import datetime
import pytz
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag(takes_context=True)
def abs... | [
{
"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 | utils/templatetags/common.py | ntucker/django-common-utils |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_2
from i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | isi_sdk_8_2_2/test/test_cluster_firmware_status_node.py | mohitjain97/isilon_sdk_python |
import psycopg2, psycopg2.extras
import time
import numpy as np
import pandas as pd
from datetime import timedelta, date
def date_range(start_date, end_date):
for n in range(int((end_date - start_date).days)):
yield start_date + timedelta(n)
def generate_by_month():
conn = psycopg2.connect(**eval(open('aut... | [
{
"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 | midprice_profit_label/profit_evaluate/data_generate.py | ianpan870102/neural-network-on-finance-data |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
"""
Built-in value transformers.
"""
import datetime as dt
from typing import Any, Sequence
from datadog_checks.base import AgentCheck
from datadog_checks.base.types import ServiceCheckStatus
from datadog... | [
{
"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 | rethinkdb/datadog_checks/rethinkdb/document_db/transformers.py | remicalixte/integrations-core |
#import ibm_db
#import ibm_db_dbi as db
from typing import Any, Dict, Optional
from airflow.hooks.dbapi_hook import DbApiHook
from airflow.models.connection import Connection
class DB2Hook(DbApiHook):
"""
General hook for DB2 access.
"""
conn_name_attr = 'db2_conn_id'
default_conn_name = 'db2_def... | [
{
"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 | airflow_provider_db2/hooks/db2_hook.py | fmilagres/airflow-provider-db2 |
import Structures.Polynomial
import Structures.Integers
from Algorithms.HenselLifting import hensel_full_lifting, squarefree_charzero
from Algorithms.Kronecker import full_kronecker
from Algorithms.SortPolynomials import lexicografic_mon
class IntegerPolynomial(Structures.Polynomial.Polynomial):
def __init__(se... | [
{
"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 | Structures/IntegerPolynomial.py | Galieve/algebra_computacional |
from typing import Dict, Optional
from marshmallow import fields, validate
from tortuga.node.state import ALLOWED_NODE_STATES
from tortuga.types.base import BaseType, BaseTypeSchema
NodeStateValidator = validate.OneOf(
choices=ALLOWED_NODE_STATES,
error="Invalid node state '{input}'; must be one of {choices... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/installer/src/tortuga/node/types.py | sutasu/tortuga |
# Copyright (c) Microsoft 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 applicable law or agreed to in wri... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | tests/sync/test_request_fulfill.py | rayshifu/playwright-python |
from modules.lib.reporter import Reporter
from modules.lib.report import Report
from modules.lib.alarm_machine import AlarmMachine
class TemperatureReporter(Reporter):
def data_type(self):
return 'temperature'
def report(self):
with open('/sys/class/thermal/thermal_zone0/temp') as file:
... | [
{
"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 | Armadillo-IoT_GW/modules/reporters/temperature_reporter.py | naomitodori/Azure-IoT-samples |
"""
custom_components.light.test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mock switch platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.const import STATE_ON, STATE_OFF
from tests.helpers import MockToggleDevice
DEVICES = []
def init(empty=False):
""" (re-)ini... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/config/custom_components/light/test.py | hemantsangwan/home-assistant |
"""
The MIT License (MIT)
Copyright (c) 2015 <Satyajit Sarangi>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | [
{
"point_num": 1,
"id": "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 | tests/first.py | ssarangi/python_type_inference |
import numpy as np
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
### --- Gather Dataset --- ###
n = 100
X, y = make_blobs(n_samples = n, centers = 2)
y = y[:, np.newaxis]
### --- Build Model --- ###
def sigmoid(z):
return 1.0 / (1.0 + np.exp(-z))
class LogisticRegression:
def ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | logistic_regression/logistic_regression.py | ryanirl/ml-basics |
# -*- coding:utf-8 -*-
"""
Author:
Weichen Shen,wcshen1994@163.com
"""
from tensorflow.python.keras.layers import Layer, Concatenate
class NoMask(Layer):
def __init__(self, **kwargs):
super(NoMask, self).__init__(**kwargs)
def build(self, input_shape):
# Be sure to call this somewhere... | [
{
"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 | deepctr/layers/utils.py | osljw/keras_tf |
# 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 the Li... | [
{
"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 | warehouse/migrations/versions/8fd3400c760f_cascade_user_deletion_to_gpg_keys.py | matt-land/warehouse |
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | st2actions/st2actions/resultstracker/config.py | saucetray/st2 |
import unittest
from unittest.mock import MagicMock
from scraper.scraper import get_table_with_data, row_not_loaded, \
reload_table_rows, get_coin_name, get_coin_symbol, \
get_coin_price, get_coin_change24h, get_coin_change7d, \
get_coi... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test.py | alexd-conf/coinmarketcap-scraper |
from sympy import Symbol, I
from qnet.algebra.core.operator_algebra import (
LocalSigma, rewrite_with_operator_pm_cc, OperatorPlusMinusCC)
from qnet.algebra.library.fock_operators import Destroy, Create
from qnet.algebra.core.hilbert_space_algebra import LocalSpace
from qnet.printing import srepr
def test_simple... | [
{
"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/algebra/test_operator_plus_minus_cc.py | amitkumarj441/QNET |
import numpy as np
from .SudokuSquare import SudokuSquare
from .SudokuLine import SudokuLine
def build_squares(matrix, symbols, dimension=3):
"""Split the matrix into a (dim x dim) list of SudokuSquare"""
rows = []
for row in range(dimension):
cols = []
row_index = row * dimension
row_slice = slice(row_index,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | src/sudoku/builders.py | ognibit/sudoku-solver |
from datetime import datetime, timedelta
import jwt
key = "#KEY_TO_BE_REPLACED#"
def handler(event, context):
if event.get('Records') is not None:
return process_cf_request(event)
return generate_token(event)
def generate_token(event):
uri = event['uri']
if uri[0] is not '/':
uri =... | [
{
"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 | lambda/main.py | helionagamachi/S3Share |
import time
from PyQt5 import QtGui, QtCore
from ui.room_item import Ui_Form
from PyQt5.QtWidgets import QWidget
class Room_Item(QWidget,Ui_Form):
def __init__(self,parent=None,room_data=None):
super(Room_Item,self).__init__(parent)
self.setupUi(self)
self.data = room_data
self.se... | [
{
"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": true
},
... | 3 | TestProject/app/view/RoomItem.py | ChinSing00/ChatChat |
# Copyright 2015 Ciara Kamahele-Sanfratello
#
# 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": "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 | simulator/Planners/Planner.py | ciarakamahele/sasy |
import insightconnect_plugin_runtime
from .schema import GetDeviceSoftwareInput, GetDeviceSoftwareOutput, Input, Output, Component
# Custom imports below
class GetDeviceSoftware(insightconnect_plugin_runtime.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="get_device_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 | plugins/automox/icon_automox/actions/get_device_software/action.py | lukaszlaszuk/insightconnect-plugins |
import os
import tensorflow as tf
from app.storage_service import weights_filepath, dictionaries_dirpath
def test_local_storage():
local_filepaths = [
weights_filepath("local"),
os.path.join(dictionaries_dirpath("local"), "dic.txt"),
os.path.join(dictionaries_dirpath("local"), "dic_s.txt"),
]
for file... | [
{
"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 | test/storage_service_test.py | zaman-lab/brexitmeter-py |
from neomodel import config, StructuredNode, StringProperty, install_all_labels, install_labels
from neomodel.core import get_database_from_cls
db = get_database_from_cls(None)
config.AUTO_INSTALL_LABELS = False
class NoConstraintsSetup(StructuredNode):
name = StringProperty(unique_index=True)
class TestAbstra... | [
{
"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": false... | 3 | test/test_label_install.py | moengage/neomodel |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | tests/unit/bokeh/io/test_doc.py | brendancol/bokeh |
from flask import request, jsonify
from jdxapi.utils.logger_resource import LoggerResource
from jdxapi.app import api, DB
from jdxapi.models import Pipeline
from jdxapi.utils.functions import RequestHandler, ResponseHandler
from jdxapi.utils.error import ApiError
from sqlalchemy.orm.exc import NoResultFound, MultipleRe... | [
{
"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 | jdxapi/routes/preview.py | jobdataexchange/jdx-api |
"""Rename action._type to action.type_
Revision ID: 45024170cf6
Revises: 337978f8c75
Create Date: 2014-06-18 14:21:37.202030
"""
# revision identifiers, used by Alembic.
revision = '45024170cf6'
down_revision = '337978f8c75'
from alembic import op
import sqlalchemy as sa
from evesrp.models import ActionType
def u... | [
{
"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/evesrp/migrate/versions/45024170cf6_rename_action__type_to_action_type_.py | paxswill/evesrp |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from packaging.version import InvalidVersion, Version
from internal_backend.utilities.register import PantsReleases
def _branch_name(revision_str: str) -> str:
return ... | [
{
"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 | pants-plugins/src/python/internal_backend/utilities/releases_test.py | viktortnk/pants |
'''
AM2315 Temp/Humidity Sensor Driver (using Silta bridge)
Based on the Adafruite Arduino driver
https://github.com/adafruit/Adafruit_AM2315
'''
import time
import tca9548a
AM2315_ADDR = 0xB8
class AM2315:
def __init__(self, bridge, mux_channel=3):
self.bridge = bridge
self.mux = tca9548a.TCA... | [
{
"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 | sw/examples/drivers/am2315.py | nilkemorya/silta |
def find_common_left(strings):
"""
:param list[str] strings: list of strings we want to find a common left part in
:rtype: str
"""
length = min([len(s) for s in strings])
result = ''
for i in range(length):
if all([strings[0][i] == s[i] for s in strings[1:]]):
result += strings[0][i]
else:
break
retur... | [
{
"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 | cyberspace/find_common.py | idin/cyberspace |
import io
import jax
import requests
import PIL
from PIL import ImageOps
import numpy as np
import jax.numpy as jnp
from dall_e_jax import get_encoder, get_decoder, map_pixels, unmap_pixels
target_image_size = 256
def download_image(url):
resp = requests.get(url)
resp.raise_for_status()
return PIL.Ima... | [
{
"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 | examples/pure_jax.py | kingoflolz/DALL-E |
from os import getenv
import tenacity
from flask import Flask
from py_eureka_client import eureka_client
def get_db_path():
return '{}+{}://{}:{}@{}:{}/{}'.format(
getenv('DB_DIALECT'),
getenv('DB_DRIVER'),
getenv('DB_USERNAME'),
getenv('DB_PASSWORD'),
getenv('DB_HOST'),
... | [
{
"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 | timesheet_utils/base.py | MR6996/timesheet-utils |
import sys
import subprocess
from unittest import TestCase
from unittest.mock import patch
diffview = sys.modules["DiffView"]
BzrHelper = diffview.util.vcs.BzrHelper
class test_BzrHelper(TestCase):
def setUp(self):
self.dummy_process = DummyProcess()
def test_init(self):
bzr_helper = BzrHel... | [
{
"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 | tests/test_bzr_helper.py | rkoval/SublimeDiffView |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def cylinder():
radius = int(input('Введите радиус цилиндра: '))
height = int(input('Введите высоту цилиндра: '))
def circle():
print('Площадь полной поверхности цилиндра: ',
2 * 3.14 * radius * height + 2 * 3.14 * radius ** 2)
prin... | [
{
"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 | tasks/z2.py | nbobrov8/laba10 |
# -*- coding: utf-8 -*-
## @package pycv_tutorial.color_space
#
# 画像処理: 色空間の変換
# @author tody
# @date 2016/06/27
import cv2
import matplotlib.pyplot as plt
# RGB画像の表示
def showImageRGB(image_file):
image_bgr = cv2.imread(image_file)
image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)
plt... | [
{
"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 | opencv/pycv_tutorial/color_space.py | OYukiya/PyIntroduction |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.http import Http404
class StaffRequiredMixin(object):
@classmethod
def as_view(self, *args, **kwargs):
view ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/products/mixins.py | bopopescu/django-estore |
"""
github3.gists.comment
---------------------
Module containing the logic for a GistComment
"""
from github3.models import BaseComment
from github3.users import User
class GistComment(BaseComment):
"""This object represents a comment on a gist.
Two comment instances can be checked like so::
c1... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"a... | 3 | github3/gists/comment.py | kbakba/github3.py |
import numpy as np
import pytest
import pyswallow as ps
import pyswallow.handlers.boundary_handler as psbh
class TestMOSwallow:
@pytest.fixture
def swallow(self):
bounds = {
'x0': [-50.0, 50.0],
'x1': [-50.0, 50.0]
}
swallow = ps.MOSwallow(bounds, n_obj=2)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/swallows/test_mo_swallow.py | danielkelshaw/PySwallow |
import sentencepiece as spm
s = spm.SentencePieceProcessor('data/jpa_wiki_100000.model')
#file1 = open('jyp_train.txt', 'r')
#Lines = file1.readlines()
# for i in Lines:
# print(i)
path_input_eng = 'data/eng.txt'
path_output_eng = 'data/eng_train_1000.txt'
path_input_jyp = 'data/jyp.txt'
path_output_jyp = 'da... | [
{
"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 | tokenize/tokenize.py | khoauit99/open-NMT-test |
"""
Swaprs token1, for token2 in the sentence
token2 should belong in sentence for this to work
"""
def swap(token1, token2, sentence):
index = token2.idx
length = len(token2.text)
if index == 0:
prepend = ''
else:
prepend = sentence[:(index)]
append = sentence[(index + length):]
... | [
{
"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 | src/utilities/string_functions.py | seadavis/StoryNode |
from __future__ import print_function
import subprocess
from distutils.command.build import build as distutils_build #pylint: disable=no-name-in-module
from setuptools import setup, find_packages, Command as SetupToolsCommand
VERSION = '0.1.dev0'
with open('requirements.txt', 'r') as f:
install_requires = f.readlin... | [
{
"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 | code_search/src/setup.py | dimara/kubeflow-examples |
from numericalmethods.ode import euler_explicit, euler_implicit, rk4
def test_euler_explicit():
ans = [1.0, 1.1, 1.22, 1.3620, 1.5282, 1.7210, 1.9431, 2.1974, 2.4872, 2.8159]
assert [round(sol, 4) for sol in euler_explicit(f=lambda x, y: x+y, y0=1, t0=0, t=1, h=0.1)][:-1] == ans
# TODO: check why this fai... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_ode.py | LuisGMM/CharliePY |
from devices import network_devices
from napalm import get_network_driver
from pprint import pprint
def open_napalm_connection(device):
"""Funtion to open napalm connection and return connection object"""
# Copy dictionary to ensure original object is not modified
device=device.copy()
# Pop "platform"... | [
{
"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 | day3/linting/exercise1.py | austind/pyplus-ons |
import os
from wpkit.basic import PowerDirPath
pkg_dir=PowerDirPath(os.path.dirname(__file__))
pkg_data_dir=pkg_dir+'/data'
pkg_scripts_dir=pkg_data_dir+'/shell_scripts'
pkg_documents_dir=pkg_data_dir+'/documents'
def is_linux():
import sys
pf=sys.platform
if pf=='linux':
return True
return Fal... | [
{
"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 | wpkit/pkg_info.py | Peiiii/wpkit |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import unittest
from assemble_workflow.bundle_url_location import BundleUrlLocation
class TestBundleUrlLocation(unittest.Tes... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/tests_assemble_workflow/test_bundle_url_location.py | rishabh6788/opensearch-build |
import unittest
from masonite.helpers import Dot, config
from config import database
class TestConfig(unittest.TestCase):
def setUp(self):
self.config = config
def test_config_can_get_value_from_file(self):
self.assertEqual(self.config('application.DEBUG'), True)
def test_config_can_... | [
{
"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 | tests/helpers/test_config.py | STejas6/core |
import cv2
from pupil_labs.realtime_api.simple import discover_one_device
def main():
# Look for devices. Returns as soon as it has found the first device.
print("Looking for the next best device...")
device = discover_one_device(max_search_duration_seconds=10)
if device is None:
print("No de... | [
{
"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 | examples/simple/stream_scene_camera_video.py | pupil-labs/realtime-python-api |
from __future__ import absolute_import, unicode_literals
import datetime, json
from sqlalchemy import (
Column,
Integer,
Text,
DateTime,
ForeignKey,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship,... | [
{
"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-project/testproject/models.py | RedTurtle/sqlalchemy-datatables |
import pandas as pd
import numpy as np
import os
def target(df_exp_train, path=""):
path_validation = os.path.join(path, "test.csv")
df_val = pd.read_csv(path_validation, escapechar="\\")
df_exp_train = df_exp_train.merge(df_val[['record_id', 'linked_id']], how='left', left_on='queried_record_id', right_on... | [
{
"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 | features/target.py | teomores/Oracle_HPC_contest |
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.permissions import (
IsAuthenticated,
)
from .serializers import (
CreateRoomSerializer,
RoomSerializer,
)
from .models import RoomMember, Room
from rest_framework.reverse import reverse
from rest_frame... | [
{
"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 | main/online/views.py | MahanBi/Back-End |
'''
Make sure orbit plotting can still occur after chopping chains.
'''
import orbitize
from orbitize import driver, DATADIR
import multiprocessing as mp
def verify_results_data(res, sys):
# Make data attribute from System is carried forward to Result class
assert res.data is not None
# Make sure the da... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_chop_chains_with_plotting.py | jorgellop/orbitize |
import requests
from pyquery import PyQuery as pq
import json
def get_one_page(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
}
res = requests.get(url, headers=headers)
text = res.te... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | python_demo_v2/zhihu_data.py | renhongl/python_demo |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.