source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
def credit(valor):
return ('Valor créditado R${:.2f}'.format(valor))
def debit(valor):
return('Valor debitado R${:.2f}'.format(valor))
| [
{
"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 | Curso Python Completo - Udemy/py/MeusModulos/ContaCorrente.py | Cauenumo/Python |
from django.test import TestCase
from adminplus.sites import AdminSitePlus
class AdminPlusTests(TestCase):
def test_decorator(self):
"""register_view works as a decorator."""
site = AdminSitePlus()
@site.register_view(r'foo/bar')
def foo_bar(request):
return 'foo-bar'... | [
{
"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 | adminplus/tests.py | TabbedOut/django-adminplus |
#!/usr/bin/env python3
from requests import get
from os import environ
root = environ.get("SERVICE_ROOT", "http://localhost:3000")
def test_hello():
assert get("%s/hello" % root).text \
== "Dead kittens and suffering"
def test_ping():
assert "pong" in get("%s/ping" % root).text
def test_nonexis... | [
{
"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 | 5-webbisovellukset/nosetests/test_routes.py | pkalliok/python-kurssi |
import unittest
from flapi_schema.types import AnyOf
class AnyOfTest(unittest.TestCase):
def test_any_of(self):
rule = AnyOf(lambda _: True, lambda _: False)
self.assertTrue(rule({}))
def test_fails(self):
rule = AnyOf(lambda _: False, lambda _: False)
self.assertFalse(rule({... | [
{
"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 | tests/types/test_any_of.py | manoadamro/flapi-schema |
# -*- coding: utf-8 -*-
# Copyright 2018 by dhrone. All Rights Reserved.
#
import pytest
import json
from python_jsonschema_objects import ValidationError
from pyASH.exceptions import *
from pyASH.pyASH import pyASH
from pyASH.objects import Request
# Imports for v3 validation
import jsonschema
from jsonschema im... | [
{
"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 | test/test_exceptions.py | dhrone/pyASH |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import generators
from __future__ import nested_scopes
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import with_statement
from django.http import HttpResponse... | [
{
"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 | Django/saver.py | JOHNKYON/Data_save |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = None
orig_stderr = None
wrapped_stdout = None
wrapped_stderr = None
atexit_done = False
def reset_all():
if AnsiToWin32 is... | [
{
"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 | TimeWrapper_JE/venv/Lib/site-packages/pip/_vendor/colorama/initialise.py | JE-Chen/je_old_repo |
"""String-related Templatetags"""
from django import template
# pylint: disable=invalid-name
register = template.Library()
@register.filter("padded_slice", is_safe=True)
def padded_slice_filter(value, page_number):
"""
Templatetag which takes a value and returns a padded slice
"""
try:
bits =... | [
{
"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": fals... | 3 | open_connect/connect_core/templatetags/string.py | lpatmo/actionify_the_news |
"""
DOCSTRING
The models store information on the players and their individual games.
"""
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class Player(Base):
"""
A t... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | src/db/models.py | IsakJones/space_invaders |
import re
import hangups
def isEventNotification(update):
if update.event_notification:
return True
return False
def isMessageEvent(update):
if isEventNotification(update):
event = update.event_notification.event
if event.event_type == hangups.hangouts_pb2.EVENT_TYPE_REGULAR_CHAT_MESSAGE:
return True
re... | [
{
"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 | pearl/nacre/handle.py | dynosaur72/pearl |
class Take(object):
def __init__(self, stage, unit, entity,
not_found_proc, finished_proc):
self._stage = stage
self._unit = unit
self._entity = entity
self._finished_proc = finished_proc
self._not_found_proc = not_found_proc
def enact(self):
if ... | [
{
"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 | arctia/tasks/take.py | unternehmen/arctia |
import discord
async def get_role_based_on_reputation(self, guild, ranked_amount):
if ranked_amount >= 10:
return await get_role_from_db(self, "experienced_mapper", guild)
elif ranked_amount >= 1:
return await get_role_from_db(self, "ranked_mapper", guild)
else:
return await get_ro... | [
{
"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 | seija/reusables/verification.py | MapsetManagementServer/Seija |
import pandas as pd
def add_data(df, algorithm, data, elapsed, metric):
time_col = (data.name, 'Time(s)')
metric_col = (data.name, data.metric)
try:
df.insert(len(df.columns), time_col, '-')
df.insert(len(df.columns), metric_col, '-')
except:
pass
df.at[algorithm, time_col... | [
{
"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 | python/benchmarks/utils/file_utils.py | zeyiwen/gbdt |
import unittest
from passwords import Password
class TestAccount(unittest.TestCase):
def setUp(self):
"""
Set up method to run before each test cases
"""
self.new_password = Password("Instagram", "yahyanoor", "1234")
# The first test
def test_init(self):
... | [
{
"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 | passwords_test.py | yahyasaadi/passwordLocker |
#!/usr/bin/env python3
import utils, os, random, time, open_color, arcade
utils.check_version((3,7))
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 1000
SCREEN_TITLE = "Sprites Example"
class MyGame(arcade.Window):
def __init__(self):
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
file_path ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | main4.py | Annuvian/E04a-Sprites |
import abc
class DBWriter(metaclass=abc.ABCMeta):
@abc.abstractmethod
async def store(self, message_box, message) -> bool:
raise NotImplementedError
@abc.abstractmethod
async def flush(self, flush_all=False) -> None:
raise NotImplementedError
| [
{
"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 | circle_core/writer/base.py | glucoseinc/CircleCore |
import string
def find_all_lines(file_path):
with open("text.txt", "r") as file:
all_lines = file.read().split("\n")
return all_lines
def find_count_letters(current_line):
count = 0
for char in current_line:
if char.isalpha():
count += 1
return count
def find_count_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | Python Advanced/File Handling/Exercise/line_numbers.py | DonikaChervenkova/SoftUni |
# TvNorm.py
import torch
import torch.nn as nn
class TvNorm(nn.Module):
"""
normalization using the total variation; idea is to normalize pixel-wise by the length of the feature vector, i.e.,
MATLAB notation:
z = diag( 1/ sqrt( sum(x.^2,3)+eps)) x
Attributes:
eps: small float s... | [
{
"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 | modules/TvNorm.py | EmoryMLIP/DynamicBlocks |
import traceback
import logging
import pkg_resources
from sqlalchemy.exc import SQLAlchemyError
from dispatch.plugins.base import plugins, register
logger = logging.getLogger(__name__)
# Plugin endpoints should determine authentication # TODO allow them to specify (kglisson)
def install_plugin_events(api):
"""... | [
{
"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 | src/dispatch/common/utils/cli.py | sfc-gh-pkommini/dispatch |
from typing import TYPE_CHECKING, Optional
from app.models import TimestampedModel, models
from studying.models import Study
if TYPE_CHECKING:
from chains.models.chain import Chain
class ProgressQuerySet(models.QuerySet):
def get_last_progress(self, chain: 'Chain', study: Study) -> Optional['Progress']:
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | src/chains/models/progress.py | tough-dev-school/education-backend |
import pytest
from django.urls import resolve, reverse
from ginger_arxiv.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{... | [
{
"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 | ginger_arxiv/users/tests/test_urls.py | pjhoberman/ginger-arxiv |
import os
import math
from PIL import Image
import requests
from io import BytesIO
from torchvision import transforms, utils
class DataLoader():
def __init__(self):
pass
def load(self, url, size):
try:
response = requests.get(url)
img = Image.open(BytesIO(resp... | [
{
"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 | autoPyTorch/data_management/data_loader.py | mens-artis/Auto-PyTorch |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/client/petstore/python-experimental/test/test_another_fake_api.py | therockstorm/openapi-generator |
import psutil
def cpu(locacao):
cpu_freq = psutil.cpu_freq() # 0-Freq atual 1-min 2-max
cpu_percent = psutil.cpu_percent(interval=0.1) # porcentagem de uso do processador
cpu_status = (str(int(cpu_freq[0]))+ ' Ghz' , str(int(cpu_freq[1]))+ ' Ghz', str(int(cpu_freq[2]))+ ' Ghz'... | [
{
"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 | Codigo Fonte/Func_monitor.py | Kaioguilherme1/Monitor_de_processos_Pyside2 |
import six
if six.PY3:
long = int # pragma: PY3
else:
long = long # pragma: PY2
def b(arg):
"""Convert `arg` to bytes."""
if isinstance(arg, six.text_type):
arg = arg.encode("latin-1")
return arg
def u(arg):
"""Convert `arg` to text."""
if isinstance(arg, six.binary_type):
... | [
{
"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 | src/AuthEncoding/compat.py | gocept/AuthEncoding |
#!/usr/bin/env python
import fileinput
DELTAS = {
'U': (0, 1),
'D': (0, -1),
'L': (-1, 0),
'R': (1, 0),
}
def trace(path):
x, y = 0, 0
grid = {}
n = 1
for direction, d in path:
dx, dy = DELTAS[direction]
for i in range(0, d):
x += dx
y += dy
... | [
{
"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 | day3.py | danvk/advent2019 |
import os
import sys
import platform
import datetime
from pathlib import Path
import skimage.color
import imageio
import sunpy.io.fits
BITFACTOR = 255
def get_created_time(path_to_file):
if platform.system() == 'Windows':
return os.path.getctime(path_to_file)
else:
stat = os.stat(path_to_fil... | [
{
"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 | convert_all_to_fits.py | harshmathur1990/CollegeLevelSpectrograph |
import pytest
@pytest.fixture(scope="session")
def setupSession2():
print("\nSetting up Session 2")
@pytest.fixture(scope="module", autouse=True)
def setupModule2():
print("\nSetting up Module 2")
@pytest.fixture(scope="function", autouse=True)
def setupFunction2():
print("\nSetting up Function 2")
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | python/test_file2.py | anbansal/TDD |
import time
import unittest
from signage_air_quality.air_quality_packet import AirQualityPacket
class TestAirQualityPacket(unittest.TestCase):
def test_to_bytes(self):
now = time.strptime("Mon Jan 13 21:00:00 2020")
timestamp = int(time.mktime(now))
packet = AirQualityPacket(56, 'O3', time... | [
{
"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 | test/test_air_quality_packet.py | ulfmagnetics/signage_air_quality |
######################################################################
# Copyright (c)
# John Holland <john@zoner.org>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
#
###########################################... | [
{
"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 | pyx12/error_visitor.py | arenius/pyx12 |
class GitManager:
def __init__(self, executor):
self.executor = executor
def clone(self, host, remote_url, target_dir):
self.executor.execute(host, f"git clone {remote_url} {target_dir}")
def fetch(self, host, target_dir, remote="origin"):
self.executor.execute(host, f"git -C {targ... | [
{
"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 | osbenchmark/builder/utils/git_manager.py | engechas/opensearch-benchmark |
import os.path
import numpy as np
import librosa
from pydub import AudioSegment
def chunk(incoming, n_chunk):
input_length = incoming.shape[1]
chunk_length = input_length // n_chunk
outputs = []
for i in range(incoming.shape[0]):
for j in range(n_chunk):
outputs.append(incoming[i,... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | pop_music_highlighter/lib.py | ka5par/MIR |
import os
import datetime
import hashlib
import pexpect
from config import *
from common import openssl, jsonMessage, gencrl
from OpenSSL import crypto
# 通过证书文件吊销证书
def revokeFromCert(cert):
# 读取证书数据
try:
x509_obj = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
# get_serial_number返回10进制的s... | [
{
"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 | revoke.py | jarviswwong/openssl-ca-server |
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class ModeldbGetExperimentRunByNameResponse(BaseType):
def __init__(self, experiment_run=None):
required = {
"experiment_run": False,
}
self.experiment_run = experiment_run
for k, v in required.items():
... | [
{
"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 | client/verta/verta/_swagger/_public/modeldb/model/ModeldbGetExperimentRunByNameResponse.py | stefan-petrov-toptal/modeldb |
from functools import wraps
from django.http import HttpResponseRedirect
from .utils import get_dropbox_auth_flow
from .views import DROPBOX_ACCESS_TOKEN
def require_dropbox_session(next_url=None):
"""
Any view that is wrapped with this will redirect to the dropbox authorization site if the user does not
... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | corehq/apps/dropbox/decorators.py | dimagilg/commcare-hq |
def identity(x):
return x
def always_false(x):
return False
def always_true(x):
return True
def add(x, y):
return x + y
| [
{
"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/functions.py | apragacz/functoolsplus |
import logging
from subprocess import Popen, PIPE, STDOUT
from lib.parse.sen_ascii_parse import SenAsciiParse
class SenBinParse:
def __init__(self):
self.ascii_parser = SenAsciiParse()
def parse_packet(self, packet, with_header=True):
if len(packet) < 10:
return
length = ... | [
{
"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 | tools/grafana/daemon/lib/parse/sen_bin_parse.py | Flowm/move-on-helium-sensors |
import os
import pytest
from xebec.src import _validate as vd
def test_validate_table(data_paths, tmp_path):
err_biom = os.path.join(tmp_path, "err.biom")
with open(err_biom, "w") as f:
f.write("kachow")
with pytest.raises(ValueError) as exc_info:
vd.validate_table(err_biom)
exp_err... | [
{
"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 | xebec/tests/test_validate.py | gibsramen/xebec |
import torch.nn as nn
import torch.nn.functional as F
class RNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(RNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, args.rnn_hidden_dim)
self.rnn = nn.GRUCell(args.rnn_hidden_dim, args.rnn_hidd... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src_convention/modules/agents/rnn_agent.py | halleanwoo/AGMA |
from copy import deepcopy
import factory.random
import pytest
from api.factories import DeliveryLogFactory
from common.tests.mock_data import QURIIRI_SMS_RESPONSE
from django.contrib.auth.models import AnonymousUser
from freezegun import freeze_time
from rest_framework.authtoken.models import Token
from rest_framework... | [
{
"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 | common/tests/conftest.py | City-of-Helsinki/notification-service-api |
import ast
from typing_extensions import final
from wemake_python_styleguide.types import AnyFunctionDef
from wemake_python_styleguide.violations.consistency import (
MultilineFunctionAnnotationViolation,
)
from wemake_python_styleguide.visitors.base import BaseNodeVisitor
from wemake_python_styleguide.visitors.d... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | wemake_python_styleguide/visitors/ast/annotations.py | KJagiela/wemake-python-styleguide |
from __future__ import annotations
from dataclasses import dataclass
from abc import abstractmethod
import sys
from typing import Dict, Tuple, Iterable, List
from typeguard import typechecked
from Data import DataPipelineOutput
_SURVEYPIPELINE = Dict[str, any] = {}
def register_surveypipeline(name):
"""Decora... | [
{
"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 | Surveys/__init__.py | EleutherAI/adaptive-hit |
import argparse
import discretisedfield as df
def convert_files(input_files, output_files):
for input_file, output_file in zip(input_files, output_files):
field = df.Field.fromfile(input_file)
field.write(output_file)
def main():
parser = argparse.ArgumentParser(
prog='ovf2vtk',
... | [
{
"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 | discretisedfield/ovf2vtk.py | minrk/discretisedfield |
import cv2
def mean(image):
return cv2.medianBlur(image, 5)
def gaussian(image):
return cv2.GaussianBlur(image, (5, 5), 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_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | viewer/images/edits/blur.py | Lukasz1928/DICOM-viewer |
from math import ceil, sqrt
def my_sqrt(input_num):
return ceil(sqrt(input_num))
def is_divisible(dividend, divisor):
return dividend % divisor == 0
def is_prime(input_num):
return True
| [
{
"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/tdd/math/prime.py | xanderyzwich/Playground |
#!/usr/bin/env python3
# -*- config: utf-8 -*-
from functools import lru_cache
import timeit
@lru_cache
def fib(n):
if n == 0 or n == 1:
return n
else:
return fib(n - 2) + fib(n - 1)
@lru_cache
def factorial(n):
if n == 0:
return 1
elif n == 1:
return 1
else:
... | [
{
"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 | zadanie1.2.py | Alba126/Laba11 |
import abc
class PipelineStepBase(metaclass=abc.ABCMeta):
def take_pipeline(self, left, right):
pass
@abc.abstractmethod
def has_left(self) -> bool:
raise NotImplementedError("Abstract method not implemented!")
@abc.abstractmethod
def has_right(self) -> bool:
... | [
{
"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 | pstep_base.py | Team-Audio/synth-processor |
from graphgallery.sequence import FullBatchSequence
from graphgallery import functional as gf
from graphgallery.gallery import PyTorch
from graphgallery.gallery import Trainer
from graphgallery.nn.models import get_model
@PyTorch.register()
class TrimmedGCN(Trainer):
def process_step(self,
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | graphgallery/gallery/gallery_model/pytorch/experimental/trimmed_gcn.py | Aria461863631/GraphGallery |
from fastkde import fastKDE
import numpy as np
"""
Fast 2D Kernel Density Estimation with simple point evaluation
"""
class KDEEstimation2D(object):
def __init__(self, X):
self.pdf, self.axes = fastKDE.pdf(X[:, 0], X[:, 1])
def evaluate_points(self, X):
m = X.shape[0]
values = np.a... | [
{
"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 | build/lib/oddstream/kde_estimation.py | tartaruszen/oddstream |
import unittest
'''This test file is intended to test the database and the gui to a good extent.
This should:
- create random entries with somewhat random timestamps.
- Save entries to a text file for comparison.
- Enter each entry into the database
- search for some of the random terms.
- Remove database af... | [
{
"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 | test/test.py | Ghalko/noteTaker |
from flask import Flask, render_template, redirect
import pymongo
from flask_pymongo import PyMongo
import scrape_mars
app = Flask(__name__)
# Setup mongo connection
mongo = PyMongo(app, uri="mongodb://localhost:27017/mars_db")
@app.route("/")
def index():
# Find one record of data from the mongo database
m... | [
{
"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 | Instructions/Missions_to_Mars/app.py | nguyenkevn/web-scraping-challenge |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) Victor M. Mendiola Lau - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by Victor M. Mendiola Lau <ryuzakyl@gmail.com>, February 2017
import pylab
from datasets.nir_sugarcane ... | [
{
"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 | datasets/nir_sugarcane/demos.py | ryuzakyl/data-bloodhound |
import json
from .oauth import OAuth2Test
class AmazonOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.amazon.AmazonOAuth2'
user_data_url = 'https://api.amazon.com/user/profile'
expected_username = 'FooBar'
access_token_body = json.dumps({
'access_token': 'foobar',
'token_... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | social_core/tests/backends/test_amazon.py | rameshananth/social-core |
import multiprocessing
import pandas as pd
def lofo_to_df(lofo_scores, feature_list):
importance_df = pd.DataFrame()
importance_df["feature"] = feature_list
importance_df["importance_mean"] = lofo_scores.mean(axis=1)
importance_df["importance_std"] = lofo_scores.std(axis=1)
for val_score in range... | [
{
"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 | lofo/utils.py | aerdem4/lofo-importance |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | [
{
"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 | parl/env/tests/continuous_wrappers_test.py | lp2333/PARL |
import vtk
class BacklightHandleWidget(vtk.vtkHandleWidget):
def __init__(self, color, handle_size):
self.CreateDefaultRepresentation()
self.GetHandleRepresentation().GetProperty().SetColor(color)
self.GetHandleRepresentation().SetHandleSize(handle_size)
self._initialize_point_wid... | [
{
"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 | SplineMeasurement/engine/vtk_widgets/backlight_handle_widget.py | TiNezlobinsky/SplineLV |
import datetime
def parse_ymd(date):
'''
Convert string to `datetime.datetime` object.
Args:
date: string contains year, month, day, split by `-`
Returns:
`datetime.datetime` object
'''
return datetime.datetime(*map(int, date.split('-')))
def next_date(date):
'''Get next... | [
{
"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 | novel/analysis/utils.py | rrcgat/novel-info |
import discord
from discord.ext import commands
from clever_chat import AsyncClient
client = commands.Bot(command_prefix='amogus')
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.channel.id == 854342237461676073:
response = await As... | [
{
"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 | Cleverchat-api/async-tests/discord-implementation.py | DevInfinix/Clever-chat |
# Protean
from protean.core.field.basic import String
from protean.utils.container import BaseContainer
class CustomBaseContainer(BaseContainer):
def __new__(cls, *args, **kwargs):
if cls is CustomBaseContainer:
raise TypeError("CustomBaseContainer cannot be instantiated")
return super... | [
{
"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 | tests/container/elements.py | nadirhamid/protean |
from portfolios.factories.skill_factory import create_skills_with_factory
from django.db import transaction
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Generates dummy data"
def _generate_dummy_data(self):
# Create dummy data
create_skills_with_fact... | [
{
"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 | backend/utils/management/commands/generate_dummy_skills.py | NumanIbnMazid/numanibnmazid.com |
import educative.course1.stacks_queues.stack as s
input_data = [23, 60, 12, 42, 4, 97, 2]
expected_output_data = [2, 4, 12, 23, 42, 60, 97]
# This solution uses a second stack
# 1. until input stack is not empty, we pop the top value and compare it
# with the top value of the second stack
# 2. if value > top of s... | [
{
"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 | educative/course1/stacks_queues/ch5_sort_stack_1.py | liveroot/ambition2020 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod, abstractproperty
import logging
# https://stackoverflow.com/questions/13646245/is-it-possible-to-make-abstract-classes-in-python
class BaseFilter:
__metaclass__ = ABCMeta
def __init__(self, filterConfig):
self.fil... | [
{
"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 | filters/baseFilter.py | tharnatoz/PokeKaio |
class Restaurant():
"""A simple Restaurant class."""
def __init__(self, name, cuisine_type):
"""Initialize restaurant name and cuisine type attributes."""
self.restaurant_name = name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
"""Print restaurant descri... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | crash_course/ch09/exec/ice_cream_stand.py | dantin/python-by-example |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from lyrics.config import Config
from lyrics.player import Player
from lyrics.window import Window
import sys
import curses
def ErrorHandler(func):
def wrapper(*args, **kwargs):
try:
curses.wrapper(func)
except KeyboardInterrupt:
... | [
{
"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 | lyrics/lyrics_in_terminal.py | nisiddharth/lyrics-in-terminal |
from enum import Enum
from typing import Optional, Dict, Any
from pydantic import BaseModel
class Granularity(str, Enum):
"""
Time Series Granuality
"""
seconds = "seconds"
minutes = "minutes"
hours = "hours"
class TimeSeriesConfig(BaseModel):
"""
Time Series Collection config
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | beanie/odm/settings/timeseries.py | paul-finary/beanie |
"""
Given a sorted array (sorted in non-decreasing order) of positive numbers, find the smallest positive integer value that cannot be represented as sum of elements of any subset of given set.
Expected time complexity is O(n).
Examples:
Input: arr[] = {1, 3, 6, 10, 11, 15};
Output: 2
Input: arr[] = {1, 1, 1, 1};
... | [
{
"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 | notes/algo-ds-practice/problems/array/smallest_not_subset_sum.py | Anmol-Singh-Jaggi/interview-notes |
import torch
import torch.nn as nn
import torchvision
class NonLocalBlock(nn.Module):
def __init__(self, channel):
super(NonLocalBlock, self).__init__()
self.inter_channel = channel // 2
self.conv_phi = nn.Conv2d(in_channels=channel, out_channels=self.inter_channel, kernel_size=1, stride=1... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | models/Attention/NonLocalBlock.py | Dou-Yu-xuan/deep-learning-visal |
#!/usr/bin/env python3
"""
Possible string formats:
<author(s)> <title> <source> <year>
"""
import re
import pdf
CRED = '\033[91m'
CGREEN = '\33[32m'
CYELLOW = '\33[33m'
CBLUE = '\33[34m'
CVIOLET = '\33[35m'
CBEIGE = '\33[36m'
CWHITE = '\33[37m'
CEND = '\033[0m'
def extract_references_list_by_keyword(text, keyw... | [
{
"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 | parse_reference.py | Dewdis/scholar_tree |
import logging
import functools
log = logging.getLogger('decorators')
log.setLevel(logging.INFO)
decorated = set()
def deflog(f):
log.debug('decorating function: %s', f.__name__)
decorated.add(f.__name__)
@functools.wraps(f)
def wrapped(*args, **kwargs):
log.debug('calling function: %s', f... | [
{
"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 | python/tests/decorators.py | levinsamuel/rand |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os, re, xml.dom.minidom
#errorXMLInfo = [['zh_TW', '3', 's0101m.mul1.xml'],
# ['zh_TW', '3', 's0102m.mul2.xml'],
# ['zh_TW', '5', 's0102m.mul6.xml'],
# ['zh_TW', '3', 's0102m.mul8.xml'],
# ['zh_TW', '3', 's... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | docs/obsoleted/pytools/fixFirefoxXMLParsingError.py | sup6/pali |
import ecc
import random
import itertools
def concat(chunks):
return bytearray(itertools.chain.from_iterable(chunks))
def test_random():
r = random.Random(0)
x = bytearray(r.randrange(0, 256) for i in range(16 * 1024))
y = ecc.encode(x)
x_ = concat(ecc.decode(y))
assert x_[:len(x)] == x
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | test_ecc.py | RagnarDanneskjold/amodem |
import pkg_resources
try:
import click
except ImportError:
raise Exception('Missing CLI dependencies. To use WASH from CLI, please run following command:/n'
'pip install wash-lang-prototype[cli]')
@click.group()
@click.option('--debug', default=False, is_flag=True, help="Debug/trace outpu... | [
{
"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 | wash_lang_prototype/cli/__init__.py | Tim6FTN/JSD |
from src.actions.action import Action
from src.mapfeatures.intersection import Intersection
from src.playerprofile import PlayerProfile
from typing import Dict
class BuildRoad(Action):
def __init__(self, destination_id: int):
self.destination_id = destination_id
def __repr__(self):
return f'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 | src/actions/buildroad.py | MarinVlaic/AIBG |
from __future__ import print_function
from .generalized import Scraper
class DuckDuckGo(Scraper):
"""Scrapper class for DuckDuckGo"""
def __init__(self):
Scraper.__init__(self)
self.url = 'https://duckduckgo.com/html'
self.defaultStart = 0
self.startKey = 's'
self.name... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | app/scrapers/duckduckgo.py | souravbadami/query-server |
import unittest
from plugins.lyrics import lyrics
# TODO: add tests for PyLyricsClone
class Lyrics_Test(unittest.TestCase):
def setUp(self):
self.song_name = "everybody dies"
self.artist_name = "ayreon"
self.complete_info = "everybody dies-ayreon"
self.wrong_info = "everybody die... | [
{
"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 | jarviscli/tests/test_auto/test_lyrics.py | InEdited/Jarvis |
from direct.distributed.ClockDelta import *
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
from direct.task import Task
import random
from . import TreasurePlannerAI
class RegenTreasurePlannerAI(TreasurePlannerAI.TreasurePlannerAI):
notify = DirectNotifyGlobal.directNot... | [
{
"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 | toontown/safezone/RegenTreasurePlannerAI.py | TheFamiliarScoot/open-toontown |
import time
import torch
from torchtext.experimental.datasets import AG_NEWS
from torchtext.experimental.vectors import FastText as FastTextExperimental
from torchtext.vocab import FastText
def benchmark_experimental_vectors():
def _run_benchmark_lookup(tokens, vector):
t0 = time.monotonic()
for ... | [
{
"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 | benchmark/experimental_vectors.py | guyang3532/text |
""" This is a test file used for testing the pytest plugin. """
def test_function_passed(snapshot):
""" The snapshot for this function is expected to exist. """
snapshot.assert_match(3 + 4j)
def test_function_new(snapshot):
""" The snapshot for this function is expected to exist, but only one assertion ... | [
{
"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 | tests/test_plugins/pytester_example_dir/test_file_1.py | MORSECorp/snappiershot |
import uuid
from django.contrib.auth import get_user_model
from django.db import models
# Create your models here.
from django.urls import reverse
class Book(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
title = models.CharField(max_length=250)
author = model... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | books/models.py | Toluwalemi/django-bookstore-app |
def getDB(log, config):
'''Factory method for getting specific DB implementation'''
supported_dbms = {}
try:
from .aCTDBSqlite import aCTDBSqlite
supported_dbms['sqlite'] = aCTDBSqlite
except:
pass
try:
from .aCTDBMySQL import aCTDBMySQL
supported_dbms['mysq... | [
{
"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 | src/act/db/aCTDBMS.py | bryngemark/aCT |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2010 HDE, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of t... | [
{
"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 | tools/cleanlydb.py | GOMYWAY-NETWORKS-LLC/karesansui |
import datetime
from decimal import Decimal
from typing import Optional, NamedTuple
from enum import Enum, unique
@unique
class Signal(Enum):
UNKNOWN = 0
SELL = 1
UNDERPERFORM = 2
NEUTRAL = 3
HOLD = 4
OUTPERFORM = 5
BUY = 6
@classmethod
def from_text(cls, value: str) -> Enum:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | stockrec/model.py | mrunesson/stockrec |
import json
from django import forms
from histonets.collections.models import Collection
class CollectionForm(forms.ModelForm):
images = forms.CharField(widget=forms.Textarea)
class Meta:
model = Collection
fields = ['label', 'description']
def clean_images(self):
try:
... | [
{
"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 | histonets/collections/forms.py | sul-cidr/histonets-arch |
#!/usr/bin/python
"""
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation... | [
{
"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 | pymata-aio/blink.py | hevangel/arduino_examples |
from src.harness.agentThread import AgentThread
class Task:
def __init__(self):
self.loc = None
self.assignId = None
self.taskId = None
class DefaultName(AgentThread):
def __init__(self, config, motion_config):
super(DefaultName, self).__init__(config, motion_config)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | GeneratedPython/tasks.py | cyphyhouse/KoordLanguage |
import discord
from discord.ext import commands
class List(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name = 'listCommands', aliases = ['List', 'list'])
async def listCommands(self, ctx):
await ctx.send("List of Command:\n1. Ban: Can be used to ban a... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | cogs/list.py | Shiv10/Kuwu |
"""
This is taken from "Simple Usage" page in the docs:
http://sanic-jwt.readthedocs.io/en/latest/pages/simpleusage.html
"""
from sanic import Sanic, response
from sanic_jwt import exceptions
from sanic_jwt import Initialize, protected
class User:
def __init__(self, id, username, password):
self.user_id ... | [
{
"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 | example/basic_with_user_secrets.py | jekel/sanic-jwt |
"""Test for the deprecation helper"""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
import pytest
from imblearn.utils.deprecation import deprecate_parameter
class Sampler:
def __init__(self):
self.a = "something"
self.b = "something"
def test_deprecate_parameter():
... | [
{
"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 | imblearn/utils/tests/test_deprecation.py | cdchushig/imbalanced-learn |
#!/usr/bin/python3
import os
import json
class Config:
def __init__(self, filename):
self.filename = filename
self.data = dict()
# read config file, return true when success
def success(self):
try:
with open(self.filename) as f:
self.data = json.load(f)... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | 04_vnc_instance/config.py | Eudaemonal/AWS |
# Natural Language Toolkit: API for Language Models
#
# Copyright (C) 2001-2014 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
# should this be a subclass of ConditionalProbDistI?
class ModelI(object):
"""
A processing interface... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | api.py | curtislb/ReviewTranslation |
"""Support for local control of entities by emulating a Philips Hue bridge."""
import asyncio
import logging
from .config import Config
from .hass import HomeAssistant
from .hue_api import HueApi
from .upnp import UPNPResponderThread
_LOGGER = logging.getLogger(__name__)
class HueEmulator:
"""Support for local ... | [
{
"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 | emulated_hue/__init__.py | amahlaka/hass_emulated_hue |
from pypy.interpreter.pyparser.asthelper import get_atoms
from pypy.interpreter.pyparser.grammar import Parser
from pypy.interpreter.pyparser import error
from fakes import FakeSpace
def test_symbols():
p = Parser()
x1 = p.add_symbol('sym')
x2 = p.add_token('tok')
x3 = p.add_anon_symbol(':sym')
x4... | [
{
"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 | pypy/interpreter/pyparser/test/test_parser.py | camillobruni/pygirl |
# -*- coding: utf-8 -*-
import pytest
from rest_framework.exceptions import ValidationError
@pytest.mark.django_db
def test_event_cannot_have_deprecated_keyword(event, keyword):
keyword.deprecated = True
keyword.save()
event.keywords.set([keyword])
with pytest.raises(ValidationError):
event.sa... | [
{
"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 | events/tests/test_event.py | ezkat/linkedevents |
class Pessoa:
def __init__(self, nome=None, idade=35):
self.idade = idade
self.nome = nome
def cumprimentar(self):
return f'Olá {id(self)}'
if __name__ == '__main__':
p = Pessoa('Luciano')
print(Pessoa.cumprimentar(p))
print(id(p))
print(p.cumprimentar())
print(p.n... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer... | 3 | oo/pessoa.py | Flavio123Fal/pythonbirds |
from __future__ import absolute_import, division, print_function, unicode_literals
import torch
import torch.nn.functional as F
from tests.utils import jitVsGlow
import unittest
class TestAdaptiveAvgPool2d(unittest.TestCase):
def test_adaptive_avg_pool2d_basic(self):
"""Basic test of PyTorch adaptive_av... | [
{
"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 | torch_glow/tests/nodes/adaptive_avg_pool2d_test.py | YonginKwon/glow |
def resolve():
'''
code here
'''
from functools import lru_cache
N = int(input())
@lru_cache(maxsize=10000000)
def fina(n):
if n == 0:
return 1
if n == 1:
return 1
return fina(n-1) + fina(n-2)
print(fina(N))
if __name__ ==... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | chapter_11/B/resolve_lru_cashe.py | staguchi0703/ALDS1 |
from django.conf import settings
from pipeline import manifest
class StaticManifest(manifest.PipelineManifest):
def cache(self):
if getattr(settings, "PIPELINE_ENABLED", None) or not settings.DEBUG:
for package in self.packages:
if self.pcs:
filename = self... | [
{
"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 | bilgisayfam/entry/manifest.py | tayfun/bilgisayfam |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from gaiatest import GaiaTestCase
from gaiatest.apps.clock.app import Clock
class TestClockSetAlarmRepeat(GaiaTestCase)... | [
{
"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 | tests/python/gaia-ui-tests/gaiatest/tests/functional/clock/test_clock_set_alarm_repeat.py | BReduardokramer/gaia |
import os, sys, inspect
import subprocess
from . import version
__version__ = version.get_current()
def get_current_dir_for_jupyter():
"""Get the current path for jupyter"""
return getCurrentDir(os.getcwd())
def get_current_dir(current_file):
"""Get the current path"""
current_dir = os.path.dirna... | [
{
"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 | my_happy_python_utils/path_utils.py | ggservice007/my-happy-python-utils |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false... | 3 | source/sphinx_extensions/question.py | HelenHip/docs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.