source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
""" InfluxAlchemy Operations. """
from influxalchemy.operations import Operation
def test_op_init():
op = Operation(" fizz ", " buzz ")
assert op._op == " fizz "
assert op._nop == " buzz "
def test_op_str():
op = Operation(" fizz ", " buzz ")
assert str(op) == " fizz "
def test_op_repr():
... | [
{
"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/operations_test.py | GerasimovRM/influxalchemy |
from django.db import models
class alumno(models.Model):
alum_id = models.AutoField(primary_key=True)
alum_nom = models.CharField(max_length=100, help_text="Nombre del alumno", unique=True)
alum_ape = models.CharField(max_length=100, help_text="Apellido del alumno", unique=True)
def __str__(s... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | Semana10/Dia5/alumnos/alumnos1/models.py | GuidoTorres/codigo8 |
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>.
License: GPL v2
"""
import datetime
from storage import Storage
from html import *
import contrib.simplejson as simplejson
import contrib.rss2 as rss2
def xml_rec(value, key):
if isins... | [
{
"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 | gluon/serializers.py | arsfeld/fog-web2py |
import asyncio
import datetime
import sqlalchemy as sa
from aiopg.sa import create_engine
metadata = sa.MetaData()
now = datetime.datetime.now
tbl = sa.Table(
'tbl', metadata,
sa.Column('MyIDField', sa.Integer, key='id', primary_key=True),
sa.Column('NaMe', sa.String(255), key='name', default='default n... | [
{
"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 | vc_buildserver/test/db_test.py | ddevassy/vc-buildserver |
import numpy as np
class BaseEstimator(object):
X = None
y = None
y_required = True
def _setup_input(self, X, y=None):
"""Ensure inputs to an estimator are in the expected format.
Ensures X and y are stored as numpy ndarrays by converting from an
array-like object if necessar... | [
{
"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 | mla/base/base.py | Sanyambansal76/MLAlgorithms |
"""
Clef OAuth support.
This contribution adds support for Clef OAuth service. The settings
SOCIAL_AUTH_CLEF_KEY and SOCIAL_AUTH_CLEF_SECRET must be defined with the
values given by Clef application registration process.
"""
from social.backends.oauth import BaseOAuth2
class ClefOAuth2(BaseOAuth2):
"""Clef OAut... | [
{
"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 | social/backends/clef.py | hhru/python_social_auth |
import logging
import pytest
import yaml
from xmltotabular.sqlite_db import SqliteDB
@pytest.fixture
def empty_db():
return SqliteDB(":memory:")
@pytest.fixture
def simple_config():
config = """
album:
<entity>: album
<fields>:
name: name
artist: artist
released: re... | [
{
"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/conftest.py | simonwiles/xmltotabular |
from .. import BaseClient
class Client(BaseClient):
REQUIRES_AUTHENTICATION = False
def __init__(self, session):
super().__init__(session)
self._signin_aws = self.session().client('signin_aws')
self._signin_amazon = self.session().client('signin_amazon')
def signin(self, email, ... | [
{
"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 | coto/clients/signin/__init__.py | wvanheerde/coto |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import scrapy
from ..items import DongmanItem
class DongmanSapider(scrapy.Spider):
name = 'dongman'
start_urls = ['http://1122ya.com/xiazaiqu/btdongman', 'http://1122ya.com/xiazaiqu/xunleichangpian',
'http://1122ya.com/xiazaiqu/... | [
{
"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 | spiders/some/some/spiders/dongman.py | goodking-bq/scrapy_workstation |
""" Base Player character """
from pycs.creature import Creature
from pycs.spell import SpellAction
from pycs.races import Human
from pycs.util import check_args
from pycs.constant import Condition
from pycs.constant import DamageType
##############################################################################
clas... | [
{
"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 | pycs/character.py | dwagon/pycs |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | vega/algorithms/hpo/random_hpo.py | wnov/vega |
from crypten.mpc import MPCTensor
from syft.generic.frameworks.hook import hook_args
from syft.generic.tensor import AbstractTensor
from syft.workers.abstract import AbstractWorker
from functools import wraps
from syft.generic.frameworks.hook.trace import tracer
from syft.generic.frameworks.overload import overloaded... | [
{
"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 | syft/frameworks/torch/tensors/crypten/syft_crypten.py | gmuraru/PySyft |
import numpy as np
import math, random
# Generate a noisy multi-sin wave
def sine_2(X, signal_freq=60.):
return (np.sin(2 * np.pi * (X) / signal_freq) + np.sin(4 * np.pi * (X) / signal_freq)) / 2.0
def noisy(Y, noise_range=(-0.05, 0.05)):
noise = np.random.uniform(noise_range[0], noise_range[1], size=Y.shape... | [
{
"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 | pi-pytorch/tutorials/rnn/data.py | tongni1975/stackup-workshops |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_chart_combined05.py | Rippling/XlsxWriter-1 |
import os
from pathlib import Path
from ward.tests.utilities import make_project
from ward import test, using, fixture
from ward.testing import each
from ward.util import (
truncate,
find_project_root,
group_by,
)
@fixture
def s():
return "hello world"
@test("truncate('{input}', num_chars={num_char... | [
{
"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 | ward/tests/test_util.py | mkuyper/ward |
from django.conf import settings
from django.utils import simplejson
import urllib2
class FayeClient(object):
def __init__(self, url=settings.FAYE_URL, fail_silently=True):
self.url = url
self.fail_silently = fail_silently
def publish(self, channel, data):
# TODO: handle errors... | [
{
"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 | bugle_project/common/faye.py | simonw/bugle_project |
from __future__ import unicode_literals
from wtforms.form import Form
from wtforms.validators import ValidationError
from .fields import CSRFTokenField
class SecureForm(Form):
"""
Form that enables CSRF processing via subclassing hooks.
"""
csrf_token = CSRFTokenField()
def __init__(self, form... | [
{
"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 | venv/lib/python3.6/site-packages/wtforms/ext/csrf/form.py | aitoehigie/britecore_flask |
from ..arrays import DocumentArray
from ...proto import jina_pb2
class DocsPropertyMixin:
"""Mixin class of docs property."""
@property
def docs(self) -> 'DocumentArray':
"""Get the :class: `DocumentArray` with sequence `body.docs` as content.
:return: requested :class: `DocumentArray`
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | jina/types/request/mixin.py | slettner/jina |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..registration import DiffeoTask
def test_DiffeoTask_inputs():
input_map = dict(
args=dict(
argstr="%s",
),
environ=dict(
nohash=True,
usedefault=True,
),
fixed_file=dict(
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},... | 3 | venv/Lib/site-packages/nipype/interfaces/dtitk/tests/test_auto_DiffeoTask.py | richung99/digitizePlots |
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
def print_scores(**kw):
print(' Name Score')
print('------------------')
for name,score in kw.items():
print('%10s %d' % (name, score))
print()
print_scores(Adam=99,Lias=88,Bart=77)
data = {
'Adam Lee': 99,
'Lisa S': 88,
'F.Bart... | [
{
"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 | Function/kw_args.py | silence0201/Learn-Python |
from ..utils import Object
class SetChatDescription(Object):
"""
Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights
Attributes:
ID (:obj:`str`): ``SetChatDescription``
Args:
chat_id (:obj:`int`):
Ide... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | pytglib/api/functions/set_chat_description.py | iTeam-co/pytglib |
import unittest
import aiopg
from minos.common.testing import (
PostgresAsyncTestCase,
)
from minos.networks import (
BrokerPublisherSetup,
)
from tests.utils import (
BASE_PATH,
)
class TestBrokerSetup(PostgresAsyncTestCase):
CONFIG_FILE_PATH = BASE_PATH / "test_config.yml"
def setUp(self) -> ... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | tests/test_networks/test_brokers/test_publishers/test_abc.py | Clariteia/minos_microservice_networks |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v1.model_utils import (
ModelNormal,
cached_property,
... | [
{
"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 | code/venv/lib/python3.8/site-packages/datadog_api_client/v1/model/hourly_usage_attribution_response.py | Valisback/hiring-engineers |
#
# 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
# ... | [
{
"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 | heat/db/sqlalchemy/migrate_repo/versions/022_stack_event_soft_delete.py | redhat-openstack/heat |
import pytest
from django.conf import settings
from django.test import RequestFactory
from employee_management_backend.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USE... | [
{
"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 | employee_management_backend/conftest.py | SamwelOpiyo/simple_company_employee_management_backend |
from rest_framework import serializers
from ..models import *
class UserSerializer(serializers.ModelSerializer):
def __init__(self, *args, **kwargs):
kwargs["partial"] = True
super(UserSerializer, self).__init__(*args, **kwargs)
class Meta:
model = User
# fields = "__all__"
... | [
{
"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 | accounts/api/serializers.py | astaqc/django-job-portal |
def add(m, n):
if n == 0:
return m
else:
return add(m, n - 1) + 1
def mult(m, n):
if n == 1:
return m
else:
return add(m, mult(m, n - 1))
def power(x, n):
if n == 1:
return x
else:
return mult(x, power(x, n - 1))
| [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | check1.py | LucienBrule/TribalTeeMaker |
import trollius
from trollius import From
from pprint import pprint
import pygazebo.msg.raysensor_pb2
@trollius.coroutine
def publish_loop():
manager = yield From(pygazebo.connect())
def callback(data):
ray = pygazebo.msg.raysensor_pb2.RaySensor()
msg = ray.FromString(data)
subscriber =... | [
{
"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 | examples/pygazebo_sample/ray_sensor.py | masayoshi-nakamura/CognitiveArchitectureLecture |
import pytest
from jupytext.magics import comment_magic, uncomment_magic, unesc
def test_unesc():
assert unesc('# comment', 'python') == 'comment'
assert unesc('#comment', 'python') == 'comment'
assert unesc('comment', 'python') == 'comment'
@pytest.mark.parametrize('line', ['%matplotlib inline', '#%mat... | [
{
"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 | tests/test_escape_magics.py | XXXalice/jupytext |
from collections import Counter
from itertools import groupby
from math import log2
import numpy as np
def segments_start(array):
return [i for i in range(len(array)) if i == 0 or array[i] != array[i-1]]
def split_sequences(array, start):
end = start[1:] + [len(array)]
return [array[s:e] for s, e in zip... | [
{
"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 | metrics.py | bhigy/discrete-repr |
import asyncio
import websockets
import json
from websockets.exceptions import ConnectionClosedError
from . import communicator
async def websocket_server(websocket, path):
try:
async for message in websocket:
communicator.message_queue.put(json.loads(message))
except ConnectionClosedError... | [
{
"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 | LeapMotionBlender/socket_server.py | DanAmador/Leap-Motion-Blender |
from sqlalchemy import create_engine,Column, Integer, String
from sqlalchemy.dialects.postgresql import UUID,JSON
from sqlalchemy.orm import mapper
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.engine.url import URL
import uuid
import sqlalchemy.types as types
import settings
DeclarativeBas... | [
{
"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 | src/world_traveller_scheduleler/world_traveller_scheduleler/model.py | steny138/WorldTraveller |
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import update_session_auth_hash, login, authenticate
from django.contrib import messages
from django.contrib.auth import logout
from social_django.models import Use... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | hedgehogsRestApi/analytics/views.py | rmarathay/hedgehogs_rcos |
import octosql_py_native
import yaml
from .connection import OctoSQLConnection
class OctoSQL:
def __init__(self):
octosql_py_native.init()
def connect(self, sources):
conf = {
"dataSources": list(map(lambda source: source.generateConfigObject(), sources))
}
config... | [
{
"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 | octosql_py/core/octosql.py | styczynski/octosql.py |
from shapely.geometry import Point
from shapely.geometry.polygon import Polygon
def getOverlappingEntities(canvasDataArray):
overlapCount = 0
for document in canvasDataArray:
loc = getCoordinates(document)
for newDocument in canvasDataArray:
newLoc = getCoordinates(newDocument)
... | [
{
"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 | scoringFunction/OverlappingEntities.py | perazim-io/layout-bot |
#! /usr/bin/env python3
import os
import subprocess
import json
import sys
import time
seconds = '60'
prefix = "/var/tmp"
filename = "mongotopy.json"
def reformat(data):
formatted = []
data = data['totals']
for dbcoll in data:
database, coll = dbcoll.split(".",1)
for op in ["read", "write... | [
{
"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 | mongotopy.py | LaudateCorpus1/mongotopy |
def int2BinStr(num):
if num <= 1:
return str(num)
else:
return int2BinStr(num >> 1) + str(num&1)
# return str(num) if num <= 1 else int2BinStr(num >> 1) + str(num&1)
def bitLen(num):
count = 0
while num != 0:
count += 1
num = num >> 1
return count
... | [
{
"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 | bitManipulations.py | parag2489/Algorithms |
import json
import util
def get_temperature():
fields = {}
fields['cputemp'] = util.check_CPU_temp()
fields['gputemp'] = util.check_GPU_temp()
return fields
def get_cpu():
fields = {}
cpused = util.check_CPU_used()
core = 1
for utilization in cpused:
fields['cpu ' + str(core)] ... | [
{
"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 | pi-stat/measurement.py | RoyAtanu/pi-stat |
from graph.retworkx.api import (
digraph_all_simple_paths,
digraph_find_cycle,
has_cycle,
is_weakly_connected,
weakly_connected_components,
)
from tests.retworkx.conftest import Node, Edge, get_edge_fn, to_str_graph
def test_digraph_all_simple_paths(graph2):
assert digraph_all_simple_paths(gra... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/retworkx/test_api.py | binh-vu/graph |
import psutil
from src.util import namedtuple_to_dict
def get_memory_metrics():
"""
Collects memory metrics and returns a list of objects.
"""
memory_metrics = {}
memory_metrics.update(namedtuple_to_dict(psutil.virtual_memory()))
memory_metrics.update(namedtuple_to_dict(psutil.swap_memory()))... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/metrics.py | abidaan/metrics-monitor |
from motor.motor_asyncio import AsyncIOMotorDatabase
class BaseRepository:
def __init__(self, client: AsyncIOMotorDatabase) -> None:
self._client = client
@property
def client(self) -> AsyncIOMotorDatabase:
return self._client
| [
{
"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 | api/app/db/repositories/base.py | franloza/apiestas |
import hashlib
import skbio
import numpy as np
def add_node_names(tree: skbio.TreeNode, scheme: str = 'md5-xor') \
-> skbio.TreeNode:
HASH_SIZE = 128 // 8
for node in tree.postorder(include_self=True):
if not node.children or node.name is not None:
continue
xor = np.zero... | [
{
"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 | q2_treetime/methods.py | ebolyen/q2-treetime |
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField, SubmitField
from wtforms.validators import Required, Email, ValidationError
from flask_wtf.file import FileField,FileAllowed
from flask_login import current_user
from ..models import User
class CreateBlog(FlaskForm):
title = StringField... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | app/main/forms.py | Koech-code/My-blogPost |
class Result(object):
def __init__(self, result):
self._result = result
self._teams = []
self._scores = []
def parse(self):
"""
Parse a results file entry
Result format is Team_Name Score, Team_Name Score
Parameters:
self.result ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | leaderboard/data.py | ntkleynhans/leaderboard |
# Copyright (c) 2021 PranithChowdary. All rights reserved.
#
# Google Kick Start 2021 Round C - Problem D. Binary Operator
# https://codingcompetitions.withgoogle.com/kickstart/round/0000000000435c44/00000000007ec290
#
# Time: O(N * E^2)
# Space: O(N * E^2)
#
from random import seed, randint
def hash(lookup, x, y):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | Round C/binary_operator2.py | PranithChowdary/Google-KickStart-2021 |
"""Support for Ubee router."""
import logging
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassistant.const import (
CONF_HOST, CONF_PASSWORD, CONF_USERNAME)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = [... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | homeassistant/components/ubee/device_tracker.py | jan--f/home-assistant |
import logging
from pandas import DataFrame
from .abstract import AbstractFeatureGenerator
from ..feature_metadata import FeatureMetadata, R_CATEGORY, R_OBJECT
logger = logging.getLogger(__name__)
# TODO: Not necessary to exist after fitting, can just update outer context feature_out/feature_in and then delete thi... | [
{
"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 | tabular/src/autogluon/tabular/utils/features/generators/drop_unique.py | mseeger/autogluon-1 |
#!/usr/bin/env python
import argparse
import sys
from typing import List
from typed_argparse import TypedArgs
from typing_extensions import Literal
class MyArgs(TypedArgs):
mode: Literal["a", "b", "c"]
def parse_args(args: List[str] = sys.argv[1:]) -> MyArgs:
parser = argparse.ArgumentParser()
parser.... | [
{
"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 | examples/example_choices.py | bluenote10/typed_argparse |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: wxnacy@gmail.com
"""
"""
import json
import os
from flask import Flask
from flask import request
from wush.common.functions import random_int
from wush.common.loggers import create_logger
from wush.wush import Wapi
# import logging
# log = logging.getLogger('... | [
{
"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 | wush/cli/server.py | wxnacy/wush |
"""This module contains the general information for FabricZoneIdUniverse ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class FabricZoneIdUniverseConsts():
pass
class FabricZoneIdUniverse(Manag... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | ucsmsdk/mometa/fabric/FabricZoneIdUniverse.py | anoop1984/python_sdk |
from gwa_maid import bcrypt, fernet
from gwa_maid.models import User
from cryptography.fernet import InvalidToken
def tokenize(id, password):
password_crypt = fernet.encrypt(password.encode('utf-8')).decode('utf-8')
token = f'{id}:{password_crypt}'
return token
def get_user_from_token(token):
token... | [
{
"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 | gwa_maid/helpers.py | laikaah/gwa-maid-backend |
# TODO: REMOVE FROM BRANCH BEFORE MERGE TO MASTER
def assemble_query_string(**kwargs):
query_string = list()
for k,v in kwargs.items():
if v is None:
continue
elif type(v) is bool:
v = str(v).lower()
query_string.append(f'{k}={v}')
output_query_string = '&'.j... | [
{
"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 | test.py | mimartin12/python-harvest_apiv2 |
import transmission_rpc
from bgmi.config import (
TRANSMISSION_RPC_PASSWORD,
TRANSMISSION_RPC_PORT,
TRANSMISSION_RPC_URL,
TRANSMISSION_RPC_USERNAME,
)
from bgmi.downloader.base import BaseDownloadService
from bgmi.utils import print_info, print_warning
class TransmissionRPC(BaseDownloadService):
... | [
{
"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 | bgmi/downloader/transmission.py | op8867555/BGmi |
'''
Learning How To Train Neural Networks in Parallel (The Right Way)
===
Author: Nicholas Geneva (MIT Liscense)
url: https://nicholasgeneva.com/blog/
github: https://github.com/NickGeneva/blog-code
===
'''
from abc import abstractmethod
class Distributed(object):
"""Parent class for distributed comm methods
... | [
{
"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 | parallel-nn/distributed/dist.py | AbsoluteStratos/blog-code |
# Leetcode 844. Backspace String Compare
#
# Link: https://leetcode.com/problems/backspace-string-compare/
# Difficulty: Easy
# Solution using two pointers.
# Complexity:
# O(N) time | where N represent the lenght of the longest input string
# O(1) space
class Solution:
def backspaceCompare(self, s: str, t: s... | [
{
"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 | solutions/backspace-string-compare.py | edab/-LC_StudyPlan_Python |
from sympy import Basic
from sympy.strategies.branch.traverse import top_down, sall
from sympy.strategies.branch.core import do_one, identity
def inc(x):
if isinstance(x, int):
yield x + 1
def test_top_down_easy():
expr = Basic(1, 2)
expected = Basic(2, 3)
brl = top_down(inc)
assert s... | [
{
"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 | sympy/strategies/branch/tests/test_traverse.py | ovolve/sympy |
# SPDX-License-Identifier: MIT
# Copyright (c) 2022 Andriel Ferreira <https://github.com/AndrielFR>
from typing import List, Tuple
from . import conn
async def get_all_words() -> List[Tuple]:
cursor = await conn.execute("SELECT * FROM words")
rows = await cursor.fetchall()
await cursor.close()
retur... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | mews/utils/database/words.py | AndrielFR/AmimeMews |
from energy_supplier.group_member import GroupMember
from config import participants
class Group(object):
"""
The addresses and public keys of the group that belong to the same energy
supplier.
"""
def __init__(self, participants):
self.participants = participants
self.group_member... | [
{
"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 | backend/energy_supplier/group.py | d-VAULT/raspberry-pi-client |
class TransactionOutput:
"""
A transaction output of a noobcash transaction.
Attributes:
transaction_id (int): id of the transaction.
recipient (int): the recipient of the transaction.
amount (int): the amount of nbcs to be transfered.
unspent (boolean): false if this outpu... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | src/transaction_output.py | PanosAntoniadis/noobcash |
from django.contrib.auth.models import User
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.audit.models import AuditLog
class TestSignals(TestCase):
def setUp(self):
self.user = get(
User,
username='test',
)
self.user.set_... | [
{
"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 | readthedocs/audit/tests/test_signals.py | yarons/readthedocs.org |
global_var = 'spam'
def enclosing(p1, p2):
x = 42
local(p1, x, 'foo')
def local(p1, x, p):
def nested():
print(p, x)
print(p1, p) | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | python/testData/refactoring/makeFunctionTopLevel/localFunctionSimple.after.py | jnthn/intellij-community |
# Imports
import torch.nn as nn
from os import path
import torch
import torch.nn.functional as F
class DotProduct_Classifier(nn.Module):
def __init__(self, num_classes=1000, feat_dim=2048, *args):
super(DotProduct_Classifier, self).__init__()
self.fc = nn.Linear(feat_dim, num_classes)
def forw... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | libs/models/DotProductClassifier.py | rahulvigneswaran/TailCalibX |
#!/usr/bin/env python3
import unittest
from src.crawler.iCrawler import iCrawler, UndefinedDatabaseException
from src.data.MetaDataItem import MetaDataItem
from test.mock.MockDataAccessor import MockDataAccessor
class MockCrawler(iCrawler):
def __init__(self):
super().__init__()
def next_downloadabl... | [
{
"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 | test/crawler/testICrawler.py | AutoDash/AutoDash |
class PasswordComplexityManager:
def __init__(self, min_length, min_lower, min_upper, min_digits, min_special):
self.min_length = int(min_length)
self.min_lower = int(min_lower)
self.min_upper = int(min_upper)
self.min_digits = int(min_digits)
self.min_special = int(min... | [
{
"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 | app/lib/base/password_complexity.py | ctxis/crackerjack |
# Copyright 2020 G-Research
#
# 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": "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 | python/test/dgraph_common.py | Debiday/spark-dgraph-connector |
import cv2
import numpy as np
# Gray scale
def BGR2GRAY(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()
# Gray scale
out = 0.2126 * r + 0.7152 * g + 0.0722 * b
out = out.astype(np.uint8)
return out
# emboss filter
def emboss_filter(img, K_size=3):
if len(img.shape) == 3:
H, W... | [
{
"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 | Category_11_20/code_py/emboss_filter.py | zgyangleo/GeneralImageProcessing |
from __future__ import unicode_literals
from model_mommy import mommy
from .functional_base import BaseLiveServer
class CategoryFunctionalTestCase(BaseLiveServer):
def test_create_category(self):
self.create_auth_session()
self.visit('/setup/')
self.browser.click_link_by_partial_href('... | [
{
"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 | django-budget/functional_tests/tests/functional_category.py | eliostvs/django-budget |
import plotly
class Plotter:
def __init__(self):
pass
def plot_metrics(self):
pass
| [
{
"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 | stockgeist/analysis.py | stockgeist/stockgeist-client-python |
# import third party libs
from flask_apispec.annotations import marshal_with, doc, use_kwargs
from flask_apispec.views import MethodResource
# import app libs
from app.api import api
from app.api.errors import error_response
from app.core.vrf_operations import VrfOperations
from app.schemas.response.vrf import VrfResp... | [
{
"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 | app/api/vrf/views.py | briantsaunders/flask-example-app |
from os.path import abspath, dirname, join
from fnmatch import fnmatchcase
from operator import eq
from robot.api import logger
from robot.api.deco import keyword
ROBOT_AUTO_KEYWORDS = False
CURDIR = dirname(abspath(__file__))
@keyword
def output_should_be(actual, expected, **replaced):
actual = _read_file(act... | [
{
"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 | atest/robot/cli/console/expected_output/ExpectedOutputLibrary.py | bhirsz/robotframework |
# qubit number=4
# total number=12
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | data/p4VQE/R4/benchmark/startPyquil505.py | UCLA-SEAL/QDiff |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
from tornado.testing import gen_test
from... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/handlers/test_base_handler_without_unsafe.py | appotry/thumbor |
#!/usr/bin/env python3
import argparse
import sys
import colorama
from exitstatus import ExitStatus
from fact.lib import factorial
def parse_args() -> argparse.Namespace:
"""Parse user command line arguments."""
parser = argparse.ArgumentParser(
description="Compute factorial of a given input.",
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | src/fact/cli.py | nagagopi19/19thAug2020-caswstudy |
from django.shortcuts import render, redirect
from .forms import diarista_form
from .models import Diarista
# Create your views here.
def cadastrar_diarista(request):
if request.method == "POST":
form_diarista = diarista_form.DiaristaForm(request.POST, request.FILES)
if form_diarista.is_valid():
... | [
{
"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 | ediaristas_workshop/web/views.py | lucaslopesx/workshop-treinaweb |
import numpy as np
from prnet.utils.render import vis_of_vertices, render_texture
from scipy import ndimage
def get_visibility(vertices, triangles, h, w):
triangles = triangles.T
vertices_vis = vis_of_vertices(vertices.T, triangles, h, w)
vertices_vis = vertices_vis.astype(bool)
for k in range(2):
... | [
{
"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 | prnet/utils/render_app.py | RonnyLV/PRNet |
from rest_framework.views import APIView
from rest_framework.response import Response
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from bims.api_views.search_version_2 import MAX_PAGINATED_SITES
from bims.models.search_process import SearchProcess
class SiteSearchResult(APIView):
"""
... | [
{
"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 | bims/api_views/site_search_result.py | Christiaanvdm/django-bims |
# 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": "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 | kubernetes/test/test_v1_scale_io_persistent_volume_source.py | iguazio/python |
"""add tick selector index
Revision ID: b601eb913efa
Revises: 16e3115a602a
Create Date: 2022-03-25 10:28:53.372766
"""
from dagster.core.storage.migration.utils import create_tick_selector_index
# revision identifiers, used by Alembic.
revision = "b601eb913efa"
down_revision = "16e3115a602a"
branch_labels = None
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 | python_modules/libraries/dagster-postgres/dagster_postgres/alembic/versions/b601eb913efa_add_tick_selector_index.py | dehume/dagster |
import json
from io import StringIO
class ListResponse(object):
def __init__(self):
self.swaggerTypes = {
'ResponseStatus': 'ResponseStatus',
'Response': 'ResourceList',
'Notifications': 'list<Str>'
}
def _convertToObjectList(self):
'''
Con... | [
{
"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 | src/BaseSpacePy/model/ListResponse.py | menis/basespace-python3-sdk |
from Walkline.WalklineConfig import *
from module import urequests
import ujson
# import urequests
class TCPClient(object):
def __init__(self):
self._response = None
self._status_code = None
self._reason = None
self._text = None
self._json = None
def request(self, command: str, data: str):
url = "{0}/{... | [
{
"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 | WalklineUtility/tcpclient.py | Walkline80/Iot-Platform-SDK |
def run():
from django.conf import settings
from django.test.utils import get_runner
runner = get_runner(settings)()
return runner.run_tests(('mailviews',))
def __main__():
import logging
import sys
logging.basicConfig(level=logging.DEBUG)
sys.exit(run())
if __name__ == '__main__'... | [
{
"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 | mailviews/tests/__main__.py | archchoa/django-mailviews |
from flask import Flask, request, url_for, redirect, render_template
app = Flask (__name__)
# HOME
@app.route('/')
def index():
return render_template("home.html")
# BOOKING PAGE
@app.route('/booking', methods=['GET', 'POST'])
def booking():
if request.method == 'POST':
return redirect(url_for('confi... | [
{
"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 | myapp/app.py | JVPomento/LIS161_final_project |
def preprocess(data):
result = []
for item in data.lstrip().rstrip().split('\n'):
each_result = []
for each in item.split(' '):
each_result.append(int(each))
result.append(each_result)
result.reverse()
return result
def reduce_list(data):
reduced_list = []
fo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | 11-20/18.py | higee/project_euler |
from urllib.parse import urlparse
from syft.workers.model_centric_fl_worker import ModelCentricFLWorker
from syft.federated.fl_job import FLJob
class FLClient:
def __init__(self, url, auth_token, verbose=False):
self.url = url
self.auth_token = auth_token
self.worker_id = None
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | syft/federated/fl_client.py | ribhu97/PySyft |
import shutil
from glob import glob
from pathlib import Path
import pytest
_HERE = Path(__file__).parent
@pytest.fixture()
def test_data_folder():
return _HERE / 'data'
@pytest.fixture(scope='session')
def product_dir(tmp_path_factory):
prod = tmp_path_factory.mktemp('S1A_IW_20150621T120220_DVP_RTC10_G_sa... | [
{
"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/conftest.py | washreve/hyp3-metadata-templates |
#
# The Python Imaging Library
# $Id$
#
# HDF5 stub adapter
#
# Copyright (c) 2000-2003 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#
from PIL import Image, ImageFile
_handler = None
##
# Install application-specific HDF5 image handler.
#
# @param handler Handler object.
d... | [
{
"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 | myvenv/lib/python3.5/site-packages/PIL/Hdf5StubImagePlugin.py | tuvapp/tuvappcom |
# Code adapted from https://github.com/henzler/neuraltexture/blob/master/code/custom_ops/noise/noise.py
from torch import nn
from torch.autograd import Function
import plan2scene.texture_gen.utils.neural_texture_helper as utils_nt
import noise_cuda
import torch
import numpy as np
from torch.autograd import gradcheck
... | [
{
"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 | code/src/plan2scene/texture_gen/custom_ops/noise.py | madhawav/plan2scene |
import argparse
import RDT_3_0
import time
def makePigLatin(word):
m = len(word)
vowels = "a", "e", "i", "o", "u", "y"
if m<3 or word=="the":
return word
else:
for i in vowels:
if word.find(i) < m and word.find(i) != -1:
m = word.find(i)
if m==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 | Server_3_0.py | Logan-Shy/MSU_CSCI_466_Programming_Assignments |
from ..peer import Peer
class QuickButtonSelected:
def __init__(self, json_object):
self.update_id = json_object.get("updateId")
self.dialog = Peer(json_object.get("dialog"))
self.sender = Peer(json_object.get("sender"))
self.metadata = json_object.get("metadata")
@property
... | [
{
"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 | pyAitu/models/update/quick_button_selected.py | waihislam/pyAitu |
import sympy
from sympy import *
def check_weak_prime(n):
if not isprime(n):
return(False)
digits=[int(i) for i in str(n)]
# For each digit location - test all other values to see if
# the result is prime. If so - then this is not a weak prime
for position in range(len(digits)):
di... | [
{
"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 | bent/weakprime.py | rgc-retired/math_puzzles |
#!/usr/bin/env python
# This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2020 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved.
#
... | [
{
"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 | mpas_analysis/shared/containers.py | ytakano3/MPAS-Analysis |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView
from django.views.generic.edit import UpdateView, DeleteView, CreateView
from . import models
class PostListView(ListView):
model = models.Post
template_name = ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | posts/views.py | babu-thomas/social-messaging-app |
#!/usr/bin/env python
import os, shutil
import sys
import subprocess
import yaml
from copy import deepcopy
import time
estims = [('dem','dem_vvs', 'dem_lm'),('p4p',),('upnp','upnp_vvs','upnp_lm')]
exp_dir = 'rose_noNoise'
trans_error = 'te.yaml'
pose_gt = 'cMs.yaml'
pose_raw = 'iMs.yaml'
pose_final = 'ceMs.yaml'
def... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | analyze/rose.py | oKermorgant/singularity_4points |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 30 10:27:00 2016
@author: matvii
"""
from math import *
from astropy.io import fits
from utils import *
def read_fits_date(fitsfile):
fi=fits.open(fitsfile)
date=0
head=fi[0]
try:
date=head.header['MJD-OBS']
except:
date=float('nan')
... | [
{
"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 | Utils/python/fits_utils.py | matvii/adam-asteroid |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
# Import Salt Libs
import salt.utils.platform
# Import Salt Testing Libs
from tests.support.case import SSHCase
from tests.support.unit import skipIf
@skipIf(salt.utils.pla... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/integration/ssh/test_mine.py | fake-name/salt |
"""Added notifications
Revision ID: f0793141fd6b
Revises: 9ecc68fdc92d
Create Date: 2020-05-02 17:17:31.252794
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f0793141fd6b"
down_revision = "9ecc68fdc92d"
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | migrations/versions/f0793141fd6b_added_notifications.py | dyachoksa/flask-microblog |
from autodp.mechanism_zoo import GaussianMechanism
from autodp.dp_bank import get_eps_ana_gaussian
import numpy as np
from absl.testing import absltest
from absl.testing import parameterized
params = [0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0]
def _fdp_conversion(sigma):
delta_list = [0,1e-8, 1e-6, 1e-4, 1e-2,... | [
{
"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 | test/unit_test_fdp_to_approxdp_conversion.py | samellem/autodp |
# Charlie Conneely
# Score Keeper
from player import Player
ranks_file = "rankings.txt"
class ScoreKeeper:
def __init__(self):
self.ranks = []
"""
Check if player score ranks against scores in rankings.txt
"""
def check_ranking(self, p):
self.populate_ranks_array(ranks_file)
... | [
{
"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 | score_system.py | charlieconneely/countdown |
import logging
from datetime import datetime
from dateutil import parser as DatetimeParser
def dicom_name(names: list) -> str:
s = "^".join(names).upper()
return s
def dicom_date(dt: datetime) -> str:
s = dt.strftime("%Y%m%d")
return s
def dicom_time(dt: datetime) -> str:
s = dt.strftime("%H%M... | [
{
"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 | package/diana/utils/dicom/strings.py | thomasyi17/diana2 |
from pyspark.mllib.common import _java2py, _py2java
from pyspark.mllib.linalg import Vectors
from _model import PyModel
"""
Fits an Exponentially Weight Moving Average model (EWMA) (aka. Simple Exponential Smoothing) to
a time series. The model is defined as S_t = (1 - a) * X_t + a * S_{t - 1}, where a is the
smooth... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | python/sparkts/models/EWMA.py | WeiwenRen/spark-timeseries |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.