source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..utils import CreateJacobianDeterminantImage
def test_CreateJacobianDeterminantImage_inputs():
input_map = dict(args=dict(argstr='%s',
),
deformationField=dict(argstr='%s',
mandatory=True,
position=... | [
{
"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 | nipype/interfaces/ants/tests/test_auto_CreateJacobianDeterminantImage.py | sebastientourbier/nipype |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | [
{
"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 | package/spack-lumpy-sv/package.py | ctuning/ck-spack |
import time
import json
import uvloop
import asyncio
from blinker import signal
from elasticsearch.helpers import bulk
from elasticsearch import Elasticsearch
from concurrent.futures import ThreadPoolExecutor
from utils import log
from utils import lpop_redis
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
l... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | service.py | hugoren/es_uvloop |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to implement an AWS Lambda function that publishes messages to an
AWS IoT Greengrass connector.
"""
# snippet-start:[greengrass.python.connector-modbus-rtu-usage.complete]
import json
impo... | [
{
"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 | python/example_code/greengrass/snippets/connector_modbus_rtu_usage.py | iconara/aws-doc-sdk-examples |
import inspect
from numbers import Number
import tensorflow as tf
from six import string_types
from tensorflow.python import keras
def skip_connect(inputs, outputs, mode):
ishape = inputs.shape
oshape = outputs.shape
if len(ishape) != len(oshape):
n = abs(len(ishape) - len(oshape))
# first expand
f... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | odin/networks/skip_connection.py | tirkarthi/odin-ai |
import Foundation
from PyObjCTools.TestSupport import TestCase, min_os_level
class TestNSFileVersion(TestCase):
@min_os_level("10.7")
def testContants10_7(self):
self.assertEqual(Foundation.NSFileVersionAddingByMoving, 1 << 0)
self.assertEqual(Foundation.NSFileVersionReplacingByMoving, 1 << 0)... | [
{
"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 | PyObjCTest/test_nsfileversion.py | linuxfood/pyobjc-framework-Cocoa-test |
"""Cluster restaurants on map"""
import Clustering
import Map
import DataImporter
def create_gaussian_clusters_and_map(restaurants, restaurant_ids_to_topics, my_map, lda, use_human_labels=True):
data = Clustering.create_data_array(restaurants, restaurant_ids_to_topics, my_map)
Clustering.plot_gaussian_cluste... | [
{
"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 | MapClusteringGaussian.py | harinisuresh/yelp-district-clustering |
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from wtforms.validators import Required,Email,EqualTo
from ..models import User,Subscriber
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',validator... | [
{
"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 | app/auth/forms.py | ucynthy12/zuri-s |
# -*- coding:utf-8 -*-
class calc2:
'''
計算を行うクラスです
'''
def mul_(a, b):
'''
掛け算を行う
Parameters
----------
a: float
b: float
Returns
-------
mul_: float
'''
mul_ = a * b
return mul_
def div_(a, b):
... | [
{
"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 | 016_sphinx/src/test02.py | fkubota/rkkubotay-gmail.com |
import torch.utils.data as data
from PIL import Image
import torchvision.transforms as transforms
from torchvision.transforms import InterpolationMode
class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()
def name(self):
return 'BaseDataset'
def initiali... | [
{
"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 | data/base_dataset.py | jaxondl/Recycle-GAN |
from onconet.models.factory import load_model, RegisterModel, get_model_by_name
import math
import torch
import torch.nn as nn
import pdb
import numpy as np
@RegisterModel("mirai_full")
class MiraiFull(nn.Module):
def __init__(self, args):
super(MiraiFull, self).__init__()
self.args = args
... | [
{
"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 | onconet/models/mirai_full.py | harrivle/Mirai |
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
from typing import Any
from doctr.file_utils import is_tf_available, is_torch_available
from .predictor import DetectionPredi... | [
{
"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 | doctr/models/detection/zoo.py | fmobrj/doctr |
"""add stages_authors
Revision ID: cdd8c82b1f69
Revises: d27963ee5cc1
Create Date: 2021-07-03 18:41:41.131811
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cdd8c82b1f69'
down_revision = 'd27963ee5cc1'
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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | alembic/versions/cdd8c82b1f69_add_stages_authors.py | scifanchain/api |
from typing import Any, Dict, Union
import httpx
from ...client import Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
client: Client,
common: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
url = "{}/common_parameters".format(client.base_url)
headers: Dict[str, Any... | [
{
"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 | end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py | oterrier/openapi-python-client |
from __future__ import absolute_import, division, print_function
import ispyb.model.pdb
import mock
import pytest
def test_pdb_values_are_immutable():
P = ispyb.model.pdb.PDB()
with pytest.raises(AttributeError):
P.name = "test"
with pytest.raises(AttributeError):
P.rawfile = "test"
w... | [
{
"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/model/test_pdb.py | rjgildea/ispyb-api |
class Hand:
def __init__(self, *cards):
self.cards = cards
def value(self):
return [value for value in sum(cards) if value <= 21]
| [
{
"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 | blackjack_simulator/hand.py | gonzalezzfelipe/blackjack_simulator |
__author__ = 'simon'
from abstract_update_method import AbstractUpdateMethod
class SimpleUpdate(AbstractUpdateMethod):
"""
Simplest update method where the gradients are applied to the weights using
a constant learning rate.
"""
def __init__(self, learning_rate):
"""
@param learni... | [
{
"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 | Engine/src/algorithms/neuralnetwork/updatemethods/simple_update.py | xapharius/HadoopML |
from __future__ import annotations
import typing as t
from abc import ABC, abstractmethod
from pymenu.listener import GroupListener, Listener, ListenerInterface
from pymenu.triggers import Trigger
from rich import print
class ElementInterface(ListenerInterface, ABC):
@abstractmethod
def render(self) -> None:
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | pymenu/elements.py | feftio/pymenu |
import boto3
import requests
import unittest
import os
class HelloWorldTests(unittest.TestCase):
stack_outputs = None
def get_stack_outputs(self):
if self.stack_outputs is None:
stack_name = "python-serverless-example-{}".format(os.getenv('SERVERLESS_STAGE',
... | [
{
"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 | src/integrationtest/python/HelloWorld_tests.py | dan-hook/python-serverless-example |
from bs4 import BeautifulSoup
import requests
RKI_URL = 'https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Risikogebiete_neu.html'
# THIS CODE IS NOT USED YET BY THE APPLICATION!!!
def main():
rki = requests.get(RKI_URL)
soup = BeautifulSoup(rki.text, 'html.parser')
main_div = soup.find('div... | [
{
"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 | covid19/risikogebiete.py | easystef/covid-analysis |
import json
import os
from pathlib import Path
from sphinx_testing import with_app
@with_app(buildername="needs", srcdir="doc_test/doc_export_id")
def test_export_id(app, status, warning):
app.build()
content = Path(app.outdir, "needs.json").read_text()
assert "filters" in content
content_obj = json... | [
{
"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 | tests/test_export_id.py | David-Le-Nir/sphinxcontrib-needs |
#!/usr/bin/env python
import numpy
def jaccquard_similarity(a, b):
if len(b) == 0 or len(a) == 0: return 0.0
return len(set(a).intersection(b))*1./len(set(a).union(set(b)))
def similarityMatrix(features):
a = numpy.zeros((len(features), len(features)),
dtype=numpy.float)
ids = list(fe... | [
{
"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 | code/density.py | rmit-ir/al-ef |
import numpy as np
import torch.optim as optim
from ast import literal_eval as make_tuple
def cast_optim_params(optim_params):
"""
:param optim_params:
:return:
"""
for k in optim_params.keys():
# check if argument is a parameter tuple
if isinstance(optim_params[k], str) and '(... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | score_following_game/agents/optim_utils.py | CPJKU/score_following_game |
#!/usr/bin/env python3.8
"""
given a number N generate N no of fibonacci numbers
"""
from memoize import memoize
number = 25
fib_list = [None] * (number)
def fibonacci(num):
"""
fibonacci series using iteration
"""
a, b = 0, 1
for i in range(num-1):
fib_list[i], fib_list[i+1] = a, b
a, b = b, a+b
return a... | [
{
"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 | concepts/recursion/fibonacci_sesies.py | dnootana/Python |
from __future__ import print_function, division
from numpy import array, argmax
from pyscf.nao import tddft_iter
class tddft_iter_x_zip(tddft_iter):
""" Iterative TDDFT with a high-energy part of the KS eigenvectors compressed """
def __init__(self, **kw):
from pyscf.nao.m_fermi_dirac import fermi_dirac_occu... | [
{
"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 | pyscf/nao/tddft_iter_x_zip.py | robert-anderson/pyscf |
"""This metric computes the embedding similarity using SBERT model."""
from nltk import word_tokenize
from nltk.translate import bleu_score
from fibber import log
from fibber.metrics.metric_base import MetricBase
logger = log.setup_custom_logger(__name__)
class SelfBleuMetric(MetricBase):
"""This metric compu... | [
{
"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 | fibber/metrics/distance/self_bleu_metric.py | stungkit/fibber |
"""
Slack Invite Flow
Rudimentary workflow to automate slack team invitations
"""
import argparse
import yaml
import activities
import flow
import models
def request_user_stdin(key):
return models.User(
short=raw_input('[{}] short name: '.format(key)),
first=raw_input('[{}] first name: '.format... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | slack_invite_flow/main.py | omaraboumrad/slack-invite-flow |
# -*- coding: utf-8 -*-
from flask import Blueprint, jsonify
from flask_service.swagger import spec
__all__ = ['main_app']
main_app = Blueprint('main_app', __name__)
@main_app.route('/api')
def swagger():
"""
Responds with the OpenAPI specification for this application.
"""
return jsonify(spec.to_d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | flask_service/views.py | mwprog/atomist-flask-microservice |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kubernetes/test/test_v1alpha1_priority_class.py | iguazio/python |
#!/usr/bin/python3
import hashlib
import time
def computeMD5(str):
hasher = hashlib.md5()
hasher.update(str.encode('utf-8'))
return hasher.hexdigest()
def computeSHA512(str):
hasher = hashlib.sha512()
hasher.update(str.encode('utf-8'))
return hasher.hexdigest()
# 백만 개의 MD5 해시 생성 속도를 측정합니다... | [
{
"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 | part1/ch07_hash/hash_performance.py | sorrowhill/17techs |
from functools import singledispatch
from typing import Text
import django
from django.db.models.base import ModelBase
from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor
from django.db.models.fields.related_descriptors import ManyToManyDescriptor
from django.db.models.query_utils import... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/project/utils/xmodels.py | tgrx/obliviscor |
import sys
from django.core.management.commands.migrate import Command as MigrateCommand
from django.db import transaction
from tuiuiu.tuiuiutenant.utils import get_public_schema_name
def run_migrations(args, options, executor_codename, schema_name, allow_atomic=True):
from django.core.management import color
... | [
{
"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 | tuiuiu/tuiuiutenant/migration_executors/base.py | caputomarcos/tuiuiu.io |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class Hidden(nn.Module):
def __init__(self, inplanes, planes, stride=1):
super(Hidden, self).__init__()
def forward(self, x):
out=x.view(x.shape[0],-1)
out = out.... | [
{
"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 | backbone/hidden_for_roi_maxpool.py | Morgan-Gan/2D-3D-SLowFast-TSM--Proj |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import (DataRequired, Regexp, ValidationError, Email, Length, EqualTo)
from models import User
# this method will check if the email already exists
def email_exists(form, field):
if User.select().w... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | forms.py | Gilberthtx/AirDash2 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from ...data import DataStore, ObservationFilter, EventListBase
from ...utils.testing import requires_data
def test_event_filter_types():
for method_str in Observation... | [
{
"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 | gammapy/data/tests/test_filters.py | qpiel/gammapy |
"""
This module reads and writes xyz files.
"""
import os
import numpy as np
def open_xyz(file_location):
# Open an xyz file and return symbols and coordinates.
xyz_file = np.genfromtxt(fname=file_location, skip_header=2, dtype='unicode')
symbols = xyz_file[:,0]
coords = (xyz_file[:,1:])
coor... | [
{
"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 | molecool/io/xyz.py | BBarrow31500/molssi-best-practices |
"""
This is an implementation of `sha256_treehash`, used to calculate
puzzle hashes in clvm.
This implementation goes to great pains to be non-recursive so we don't
have to worry about blowing out the python stack.
"""
from typing import Optional, Set
from clvm import CLVMObject
from venidium.types.blockchain_forma... | [
{
"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 | venidium/types/blockchain_format/tree_hash.py | Venidium-Network/venidium-blockchain |
from queue_with_stacks.stack_and_queue import Stack
class PseudoQueue:
def __init__(self):
self.front=Stack()
self.rear=Stack()
def enqueue(self,value):
if value!= None:
self.front.push(value)
return self.front.top.value
else:
return Fals... | [
{
"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 | challenges/queue_and_stack/queue_with_stacks/queue_with_stacks/queue_with_stacks.py | bayan-alkhatib/data-structures-and-algorithms-401 |
import mysql.connector
class StudentDAO:
db=""
def __init__(self):
self.db = mysql.connector.connect(
host="localhost",
user="root",
password="root",
#user="datarep", # this is the user name on my mac
#passwd="password" # for my mac
database="datarep"
)
def create(self, values):
... | [
{
"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 | labs/9/zstudentDAO.py | G00364778/52957_dataRepresentation |
'''
@author: Sebastian Lapuschkin
@author: Gregoire Montavon
@maintainer: Sebastian Lapuschkin
@contact: sebastian.lapuschkin@hhi.fraunhofer.de, wojciech.samek@hhi.fraunhofer.de
@date: 14.08.2015
@version: 1.2+
@copyright: Copyright (c) 2015-2017, Sebastian Lapuschkin, Alexander Binder, Gregoire Montavon, Klaus-Robert... | [
{
"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 | lrp_toolbox/modules/softmax.py | KushDen/deepimportance_code_release |
"""1026. Maximum Difference Between Node and Ancestor"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def maxAncestorDiff(self, root):
... | [
{
"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 | 1026.py | wilbertgeng/LeetCode_exercise |
"""Each ListNode holds a reference to its previous node
as well as its next node in the List."""
class ListNode:
def __init__(self, value, prev=None, next=None):
self.value = value
self.prev = prev
self.next = next
"""Wrap the given value in a ListNode and insert it
after this node. Note that this no... | [
{
"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 | PYTHON/practice/lru_cache/doubly_linked_list.py | Web-Dev-Collaborative/DS-ALGO-OFFICIAL |
import glob
import pandas as pd
import os
import datetime
class DataMerge:
def __init__(self, directory):
self.directory = directory
self.__data = self.get_data_from(self.directory)
def date_to_int(self, dates):
"""
calculates number of days between 01/01/0001 and each date in... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return ... | 3 | backend/data_merge.py | repeating/stock-analyzer |
# Copyright 2019 Ericsson Software Technology
#
# 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... | [
{
"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 | rally_openstack/task/contexts/network/networking_agents.py | jogeo/rally-openstack |
from collections.abc import MutableMapping
from typing import Dict, Iterator, List, Union
from pdm.formats import flit, poetry
from pdm.pep517.metadata import Metadata
class MutableMetadata(Metadata, MutableMapping):
"""
A subclass of Metadata that delegates some modifying methods
to the underlying toml ... | [
{
"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 | pdm/project/metadata.py | leibowitz/pdm |
"""Initialize Migration
Revision ID: 9ede8d2d7089
Revises:
Create Date: 2020-09-28 00:25:38.033227
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9ede8d2d7089'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands au... | [
{
"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 | migrations/versions/9ede8d2d7089_initialize_migration.py | casio-ka/DailyBlog |
# api: streamtuner2
# title: Stream entry editor
# description: Allows to inspect and modify station/stream entries.
# version: 0.6
# type: feature
# category: ui
# config: -
# priority: core
#
# Editing dialog for stream entries. Available in
# the context and main menu. Most useful for
# changing bookmarks, or even ... | [
{
"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 | channels/streamedit.py | leigh123linux/streamtuner2 |
from datetime import timedelta, datetime
# noinspection PyPackageRequirements
import airflow
# noinspection PyPackageRequirements
from airflow import DAG
# noinspection PyPackageRequirements
from airflow.operators.dummy_operator import DummyOperator
# noinspection PyPackageRequirements
from airflow.operators.python_op... | [
{
"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 | dags/exercise6.py | tisako/airflow-training-skeleton |
from cockatiel.utils.filenames import generate_filename, get_hash_from_name
def test_filename_checksum():
assert generate_filename('foo/bar/baz.html', 'abcdefghijk12345', 13) == 'foo/bar/baz_13_abcdefghijk12345.html'
assert generate_filename('foo/bar/baz', 'abcdefghijk12345', 13) == 'foo/bar/baz_13_abcdefghij... | [
{
"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 | unit_tests/test_utils_filenames.py | raphaelm/django-parrot |
import torch
import torch.nn as nn
class ConditionalInstanceNorm2d(nn.Module):
"""Conditional Instance Normalization
Parameters
num_features – C from an expected input of size (N, C, H, W)
num_classes – Number of classes in the datset.
bias – if set to True, adds a bias term to the emb... | [
{
"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 | fastreid/layers/norm_layers/conditional_instance_norm2d.py | SZLSP/reid2020NAIC |
def add(a: int, b: int) -> int:
return a + b
def subtract(a: int, b: int) -> int:
return a - b
def multiply(a: int, b: int or str) -> int:
return a * b
"""
...
----------------------------------------------------------------------
Ran 3 tests in 0.000s
OK
"""
| [
{
"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 | unittest/code.py | MahanBi/python-tests |
from collections import defaultdict
from twisted.internet import defer
class Listenable(object):
"""Implements basic listener/observer model for derivative classes."""
def __init__(self):
self.listeners = defaultdict(list)
def listen(self, event, callback):
"""
Assign a callback... | [
{
"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 | apns/listenable.py | clydeclements/twisted-apns |
import logging
from .util import get_timestamp
logger = logging.getLogger(__name__)
class Set(object):
def __init__(self, name, sparseDataStrategy='None', unit='', tags=[]):
self.name = name
self.sparseDataStrategy = sparseDataStrategy
self.unit = unit
self.tags = tags
s... | [
{
"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 | libs/statsd/set.py | rbellary-vi/netuitive-statsd |
import pandas as pd
import geopandas
import json
import altair as alt
def make_metrics_df():
GEOJSON = 'geojson/wi_map_plan_{}.geojson'
mm_gaps = []
sl_indices = []
efficiency_gaps = []
plan_number = [i for i in range(1,84)]
for i in range(1,84):
plan = geopandas.read_file(GEOJSON.forma... | [
{
"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 | metrics.py | ian-ludden/redist-vis |
import time
import pytest
from ably import AblyException
from test.ably.restsetup import RestSetup
from test.ably.utils import VaryByProtocolTestsMetaclass, dont_vary_protocol, BaseAsyncTestCase
class TestRestTime(BaseAsyncTestCase, metaclass=VaryByProtocolTestsMetaclass):
def per_protocol_setup(self, use_bin... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/ably/resttime_test.py | jvinet/ably-python |
def include_folders(folders,package):
result= []
for folder in folders:
line = "/I" +package + "/" + folder
result.append(line)
return result
def export_include_folder(folders,package):
result= []
for folder in folders:
line = package + "/" + folder
... | [
{
"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 | bazel_build.bzl | tingbin365/C-Step-Counter |
class UnauthorizedException(Exception):
def __init__(self):
super(UnauthorizedException, self).__init__('User not authenticated.')
class ForbiddenException(Exception):
def __init__(self):
super(ForbiddenException, self).__init__('User not authorized.')
class ConflictException(Exception):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | utils/Exceptions.py | EddyAnalytics/eddy-automl-backend |
import os
import pandas as pd
from openpyxl import load_workbook
data_dir = "."
template = 'chartme_template.xlsx'
new_wkbk = 'chartme_data_added.xlsx'
tab_name = 'data'
ROWS_AXIS = 0
COLS_AXIS = 1
def normalize(series):
"""Accepts a column (a pandas.Series object) and returns a normalized
version. Op... | [
{
"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 | dkr-py310/docker-student-portal-310/course_files/python_for_excel_users/basic_operations/spreadsheet_functions.py | pbarton666/virtual_classroom |
import math
from particle import Particle
#from glfunctions import draw_sprite
from code.constants.common import GOLD_SPINNER_LIFESPAN, TILE_WIDTH, TILE_HEIGHT
from code.controllers.intervalcontroller import IntervalController
class GoldSpinner(Particle):
def __init__(self, x, y, dest_x, dest_y):
Par... | [
{
"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 | code/game/goldspinner.py | LordZagreus/LodeRunner |
# Copyright 2017 - Brocade Communications Systems, Inc.
# Copyright 2018 - 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/lic... | [
{
"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 | mistral/tests/unit/executors/test_server_plugins.py | shubhamdang/mistral |
import rx
from rx import operators as ops
from rx.subject import Subject
from rx.scheduler.mainloop import GtkScheduler
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GLib, Gtk, Gdk
class Window(Gtk.Window):
def __init__(self):
super().__init__()
self.resize(600, 600)
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": t... | 3 | examples/timeflies/timeflies_gtk.py | mmpio/RxPY |
import requests
import json
# Get Current Patch
def getCurrentVersion():
versionResponse = requests.get("https://ddragon.leagueoflegends.com/api/versions.json")
version_patch_RawData = versionResponse.json()
currentVersion = version_patch_RawData[0]
print(currentVersion)
return currentVersion
#cham... | [
{
"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 | FlaskAPI/PullLoLDataAssets.py | ItsViridae/LoLApiWrapper |
import unittest
import pandas as pd
from frds.data.wrds.execucomp import Anncomp
from frds.io.wrds import load
class AnncompLoadTestCase(unittest.TestCase):
def setUp(self) -> None:
self.ANNCOMP = load(Anncomp, use_cache=False, save=False, obs=100)
def test_load_anncomp(self):
self.assertIsIn... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | tests/data/test_wrds_comp_anncomp.py | mgao6767/wrds |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG),
# acting on behalf of its Max Planck Institute for Intelligent Systems and the
# Max Planck Institute for Biological Cybernetics. All rights reserved.
#
# Max-Planck-Gesellschaft zur Förderung der Wissens... | [
{
"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 | src/human_body_prior/tools/configurations.py | zokin/human_body_prior |
'''
Created by auto_sdk on 2020.08.19
'''
from dingtalk.api.base import RestApi
class OapiAtsChannelAccountAddRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.biz_code = None
self.channel_user_identify = None
self.userid = None
def getHttpMethod(self):
return 'POST'
def geta... | [
{
"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 | other/dingding/dingtalk/api/rest/OapiAtsChannelAccountAddRequest.py | hth945/pytest |
#!/usr/bin/env python3
"""
Polyglot v2 node server for WeatherFlow Weather Station data.
Copyright (c) 2018,2019 Robert Paauwe
"""
import polyinterface
import sys
import time
import datetime
import urllib3
import json
import socket
import math
import threading
LOGGER = polyinterface.LOGGER
class WindNode(polyinterfac... | [
{
"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 | nodes/wind.py | JavierRefuerzo/WeatherFlow |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Tests for status bar widgets."""
# Standard library imports
from unittest.mock import Mock
# Thrid party imports
from qtpy.QtCore import Qt
from qtpy.QtWidgets... | [
{
"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 | spyder/plugins/statusbar/widgets/tests/test_status.py | ximion/spyder |
from NewRelicApiParser.Base import BaseNewRelic
class AlertsViolations(BaseNewRelic):
def __init__(self, API_KEY):
super().__init__(API_KEY)
def get_list(self, options: dict = {}) -> dict:
"""
fetch the alert violations for new relic
"""
url = self.BASE_URI + '/alerts_... | [
{
"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 | NewRelicApiParser/REST/AlertsViolations/__init__.py | Bharat23/newrelic-api-parser |
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 fo... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | tests/unit_tests/logic/environment/test_weatherUPBAscom.py | mworion/MountWizzard4 |
import time
from PySide import QtGui, QtCore
from gears import draw
class Clock(object):
"""A clock capable of notifying observers of each tick."""
def __init__(self, interval, *observers):
"""Initialize a clock ticking at the given millisecond :interval:.
Ticks of the clock will start approxim... | [
{
"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": true
},... | 3 | gears/utils.py | BlumenMA/pygears |
from .commandinvocation import CommandInvocation
class CommandSystem(object):
def __init__(self, logger):
super(CommandSystem, self).__init__()
self.logger = logger
self.commands = {}
self.lowercaseCommands = {}
def registerCommand(self, name, command):
self.commands[name] = com... | [
{
"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 | chatbot/commands/commandsystem.py | squahtx/hal9000 |
#!/usr/bin/env python3
# Foundations of Python Network Programming, Third Edition
# https://github.com/brandon-rhodes/fopnp/blob/m/py3/chapter18/rpyc_server.py
# RPyC server
import rpyc
def main():
from rpyc.utils.server import ThreadedServer
t = ThreadedServer(MyService, port = 18861)
t.start()
class My... | [
{
"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 | python/network/Foundations-of-Python-Network-Programming/foundations-of-python-network-programming-14/source/chapter18/rpyc_server.py | bosserbosser/codetest |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class GetIps... | [
{
"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": false
}... | 3 | sdk/python/pulumi_aws/waf/get_ipset.py | JakeGinnivan/pulumi-aws |
from typing import Any, Dict, Optional
import jsonschema
from hypothesis import strategies as st
from hypothesis_jsonschema import from_schema
from .mutations import MutationContext
from .types import Draw, Schema
_VALIDATORS_CACHE = {}
def get_validator(schema: Schema, operation_name: str, location: str) -> jsons... | [
{
"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/schemathesis/specs/openapi/negative/__init__.py | evanmags/schemathesis |
from glue.config import link_function
@link_function(info="Celsius to Fahrenheit",
output_labels=['F'])
def celsius2farhenheit(c):
return c * 9. / 5. + 32
@link_function(info="Fahrenheit to Celsius",
output_labels=['C'])
def farhenheit2celsius(f):
return (f - 32) * 5. / 9.
| [
{
"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 | doc/customizing_guide/scripts/coord_convert.py | areza7/glue |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p, constants as _cs, arrays
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_ARB_texture_storage'
def _f( function ):
return _p.createFunction( function,_p.GL,'GL_ARB_texture_storage',False)
_p.unpack_constan... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | PyOpenGL-3.0.2/OpenGL/raw/GL/ARB/texture_storage.py | frederica07/Dragon_Programming_Process |
class UnionFind:
def __init__(self, values):
self.ids = []
self.weights = []
for i, v in enumerate(values):
self.ids.append(v)
def union(self, p, q):
pid = self.ids[p]
qid = self.ids[q]
for i, val in enumerate(self.ids):
if self.ids[i] =... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | python_algorithms/union_find.py | BhanukaUOM/Data-Structures-and-Algoritms |
from unittest import mock
from unittest.mock import Mock
from bitcaster.utils.django import (activator_factory,
deactivator_factory, toggler_factory,)
def test_toggler_factory():
with mock.patch('bitcaster.utils.django.get_connection'):
func = toggler_factory('test')
... | [
{
"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 | tests/utils/test_utils_django.py | bitcaster-io/bitcaster |
import pytest
from utils import retry
pytestmark = pytest.mark.skip
@pytest.fixture(scope='module')
def masters(syndics, minions):
return [
{
'config': {
"container__config__salt_config__extra_configs": {
"syndic": {
"order_masters"... | [
{
"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 | tests/test_syndic.py | jordimassaguerpla/salt-toaster |
from tkinter import Tk, filedialog
import os
def ask_directory():
root = Tk()
root.withdraw()
root.wm_attributes('-topmost', 1)
folder = filedialog.askdirectory(initialdir=os.path.expanduser("~/Desktop"), title="Klasör Seç")
return folder
def ask_file(file_flags):
# file_flags consists of tu... | [
{
"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 | backend/utils/file_dialog.py | nizarcan/CapacityPlanningDSS-SD |
"""Tests for the proper fractions kata"""
import unittest
from solutions.proper_fractions import proper_fractions
class ProperFractionsTest(unittest.TestCase):
"""Proper fractions test suite"""
def setUp(self):
"""Set up test cases from kata"""
self.kataCases = [(1, 0),
... | [
{
"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 | tests/test_proper_fractions.py | Cluckerino/code-katas-python |
import numpy as np
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import graphviz
import matplotlib
import matplotlib.cm as cm
# define which genes are targets of drugs
rectangles = ['ACVR2A', 'AURKC', 'BRSK1', 'CDK17', 'EGFR', 'FGFR1', ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Code_ppi/Code/graphviz_plotting.py | adamzabek/Drug-Repurposing |
from sklearn.linear_model import LogisticRegression
class MultivariateLogisticOvrModel(object):
def model_and_predict(self, X_train, y_train, X_test):
model = LogisticRegression(dual=True, fit_intercept=True,
multi_class='ovr')
model.fit(X_train, y_train)
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | kaggle/sf-crime/logistic_regressions.py | noelevans/playground |
"""include ml-flag field and language detection
Revision ID: 30108f70cb3b
Revises: 72901249ace9
Create Date: 2021-01-21 16:23:27.650967
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '30108f70cb3b'
down_revision = '72901249ace9'
branch_labels = None
depends_on... | [
{
"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 | alembic/versions/30108f70cb3b_include_ml_flag_field_and_language_.py | HBernigau/StackOverflowAnalysis |
# -*- coding: utf-8 -*-
from flask_json import FlaskJSON
from mongoengine import Document, ReferenceField
def _custom_encoder(o):
if isinstance(o, Document):
"""Encode a mongoengine document"""
result = {}
for f, field in o._fields.items():
if type(field) is ReferenceField:
... | [
{
"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/flasko/json.py | fitiavana07/flasko |
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def create_database():
# connect to default database
conn = psycopg2.connect("host=127.0.0.1 dbname=studentdb user=student password=student")
conn.set_session(autocommit=True)
cur = conn.cursor()
# create sparkif... | [
{
"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 | create_tables.py | FedericoSerini/DEND-Project-1-Song-Play-Analysis-With-RDBMS |
from . import api
from api import lib
class EventFdCallbacks(object):
fd = None
def __init__ (self, fd):
self.fd = fd
def pollEvent(self, fd, revent):
if(self.fd.fileno() != fd):
raise RuntimeException("Different fd in callbacks")
if (revent & select.POLLIN):
... | [
{
"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 | pylibssh/event.py | arisada/pylibssh |
import komand
from .schema import CreateIocThreatInput, CreateIocThreatOutput, Input, Output
# Custom imports below
class CreateIocThreat(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='create_ioc_threat',
description='Create an IOC threat',... | [
{
"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 | sentinelone/komand_sentinelone/actions/create_ioc_threat/action.py | emartin-merrill-r7/insightconnect-plugins |
"""
Kaznet Base Serializers
"""
from rest_framework_json_api import serializers
from tasking.common_tags import TARGET_DOES_NOT_EXIST
from tasking.utils import get_allowed_contenttypes
def validate_parent_field(instance, value):
"""
Check if parent field is valid
"""
return instance is not None and va... | [
{
"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 | kaznet/apps/main/serializers/base.py | onaio/kaznet-web |
from django.shortcuts import render
from django.http import Http404
from Inventory.models import Item
def index(request):
items=Item.objects.exclude(amount=0)
return render(request,'Inventory/index.html',{
'items':items,})
def item_detail(request, id):
try:
item=Item.objects.get(id=id)
except Item.DoesNotExis... | [
{
"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 | Inventory/views.py | DivyaKarunakaran/Inventory |
#
# Copyright (C) 2014 Red Hat, 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... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | nova/cmd/baseproxy.py | ebalduf/nova-backports |
# Dictionary
class Dict_word_jumbler(object):
def __init__(self):
self.dict = self.build_dict()
def build_dict(self):
""""Build a dictionary to hold all of the words/letters"""
dic = {}
f = open("/usr/share/dict/words", "r")
word_list = f.readlines()
for word in ... | [
{
"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 | Code/word_jumbler.py | squeaky1273/CS-1.3-Core-Data-Structures |
import unittest
import xmlrunner
import os
PARENT_FOLDER = os.path.dirname(os.path.realpath(__file__))
PROJECT_ROOT = PARENT_FOLDER
import uio
class MyTest(unittest.TestCase):
def test_dummy(self):
assert True
def test_file_exists(self):
assert uio.file_exists("slalom/__init_... | [
{
"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 | slalom/tests/test_io.py | slalom-ggp/dataops-tools |
import mpmath as mp
import warnings
def zeta_function(s,a = 1,derivative = 0):
"""
Returns the value for hurwitz-zeta function at s
Parameters
----------
s : int, float, complex
denotes the value for which zeta function needs to be calculated
a : int, float, complex, tuple
deno... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/fermulerpy/analytic/riemann.py | sumit-158/fermulerpy |
# !/uer/bin/env python3
# coding=utf-8
import datetime
import logging
import functools
import os
import traceback
import inspect
if "logs" in os.listdir('../'):
pass
else:
os.mkdir('../logs')
now = datetime.datetime.now().strftime('%Y-%m-%d_%H_%M_%S')
_log_fp = "../logs/" + now + ".log"
logging.basicConfig(lev... | [
{
"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 | base/log.py | testtuantuan/appTest |
import abc
from abc import abstractmethod
class Dataset(abc.ABC):
def __init__(
self,
input_params,
with_labels=False,
):
self.batch_size = input_params.batch_size
self.buffer_size = input_params.buffer_size
if with_labels:
self.train_da... | [
{
"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 | gans/datasets/abstract_dataset.py | tlatkowski/gans-2.0 |
import pathlib
from ruamel import yaml
from qhub.schema import verify
from qhub.provider.cicd.linter import comment_on_pr
def create_validate_subcommand(subparser):
subparser = subparser.add_parser("validate")
subparser.add_argument(
"configdeprecated",
help="qhub configuration yaml file (dep... | [
{
"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 | qhub/cli/validate.py | pierrotsmnrd/qhub |
import lue.framework as lfr
import lue_test
import numpy as np
def setUpModule():
lue_test.start_hpx_runtime()
def tearDownModule():
return
lue_test.stop_hpx_runtime()
class D8FlowDirectionTest(lue_test.TestCase):
@lue_test.framework_test_case
def test_overloads(self):
array_shape = ... | [
{
"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 | source/framework/python/test/algorithm/d8_flow_direction_test.py | pcraster/lue |
try:
from better_exceptions import format_exception
except ImportError:
from traceback import format_exception
import sys
class TableExistsError(Exception):
pass
class StopOptimizationError(Exception):
def __init__(self, message, current_status):
super().__init__(message)
self.messag... | [
{
"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 | estimagic/exceptions.py | vishalbelsare/estimagic |
"""
正規表現のサンプルです。
最長一致と最短一致について
"""
import re
from trypython.common.commoncls import SampleBase
from trypython.stdlib.re_ import util
class Sample(SampleBase):
def exec(self):
# ---------------------------------------------
# 正規表現 (最長一致と最短一致)
#
# 正規表現はデフォルトで閉包を表すメタキャラクタ「*」は
... | [
{
"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 | trypython/stdlib/re_/re03.py | devlights/try-python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.