source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
Premium Question
"""
from collections import deque
__author__ = 'Daniel'
class HitCounter(object):
def __init__(self):
"""
Initialize your data structure here.
calls are being made to the system in chronological order.
It is possible that several hits arrive roughly at the sa... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | 362 Design Hit Counter.py | ChiFire/legend_LeetCode |
class ankiCard:
"""
A class to represent an Anki Flash Card.
Attributes
----------
payload : JSON[]
JSON payload for sending card via AnkiConnect
Methods
-------
addContent(question, answer):
Adds question and answer to
"""
def __init__(self, deck, tag, questi... | [
{
"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 | NotionFlash/ankiservice/ankiCard.py | furiiibond/NotionFlash |
def now():
print('2017-05-31')
now.__name__
f = now
f.__name__
# 定义记录log的装饰器
def log(func):
def wrapper(*args, **kw):
print('call %s():' % func.__name__)
return func(*args, **kw)
return wrapper
@log
def now1():
print('2017-05-31')
# 如果 decorator 需要传入参数,需要编写一个返回 decorator 的高阶函数
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | python01/PythonDecorator.py | zhayangtao/HelloPython |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLES2 import _types as _cs
# End users want this...
from OpenGL.raw.GLES2._types import *
from OpenGL.raw.GLES2 import _errors
from OpenGL.constant import Constant as _C
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GLES2/OVR/multiview_multisampled_render_to_texture.py | JE-Chen/je_old_repo |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
import sys
import os
from qiniu import Auth, put_file, etag, urlsafe_base64_encode
import qiniu.config
from qiniu.compat import is_py2, is_py3
ACCESS_KEY = os.getenv('QINIU_ACCESS_KEY')
SECRET_KEY = os.getenv('QINIU_SECRET_KEY')
BUCKET_NAME = os.getenv('QINIU_BUCKET_NAME'... | [
{
"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 | scripts/upload.py | elvizlai/docs-cn |
from PyQt5 import QtGui
from hackedit.app import settings
from hackedit.api import index, project
from hackedit.api.widgets import PreferencePage
from hackedit.app.forms import settings_page_indexing_ui
class Indexing(PreferencePage):
"""
Preference page to configure indexing.
"""
def __init__(self):... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | Lib/site-packages/hackedit/app/widgets/preference_pages/indexing.py | fochoao/cpython |
from aocd import get_data
from regex import regex
def create_regex(rules):
return regex.compile(r"(?V1)(?(DEFINE){})^(?P>r0)$".format(''.join("(?<r{}>{})".format(k, ''.join(
'|' if t == '|' else t[1] if t[0] == '"' else '(?P>r{})'.format(t) for t in v.split(' '))) for k, v in
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | 2020/19.py | bernikr/advent-of-code |
#!/usr/bin/env vpython3
# *-* coding: utf-8 *-*
import binascii
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.serialization import pkcs12
from asn1crypto import x... | [
{
"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 | examples/cert-info.py | commonism/endesive |
import pytest
# from app import application as flask_app
from app.application import app as flask_app
@pytest.fixture
def app():
yield flask_app
@pytest.fixture
def client(app):
return app.test_client() | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | app/tests/conftest.py | willsower/latex2speech |
import os
import shutil
import subprocess
import urllib2
def installmongo():
mongofileroot = "mongodb-linux-x86_64-3.2.8"
mongofile = "{}.tgz".format(mongofileroot)
mongodir = "mongodb"
if os.path.exists(mongofile):
os.remove(mongofile)
if os.path.exists(mongodir):
shutil.rmtree(mo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | ci-integration/mongowrapper.py | rmay-intwine/volttron |
from django.conf import settings
from django.shortcuts import redirect
from django_otp import user_has_device
class TwoFactorMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = None
if hasattr(self, 'process_req... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | django_social_oauth_two_factor/middleware.py | thethirdbearsolutions/django-social-oauth-twofactor |
import argparse
import librosa
import numpy as np
def make_subclips(audio, sr, clip_size, pad=True):
# Given a list of audio files and corresponding sample rates,
# return a 2D list of subclips, each of size clip_size
# Optional padding takes care of audio files shorter than clip size
clips = []
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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | spider/featurization/load_subclip_audio.py | Rosna/P4ML-UI |
"""
Fyle Platform SDK Class
"""
from .apis import v1beta
from .globals.config import config
from .internals.auth import Auth
class Platform(Auth):
"""The main class which creates a connection with
Fyle APIs using OAuth2 authentication (refresh token grant type).
Parameters:
client_id (str): ... | [
{
"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 | fyle/platform/platform.py | fylein/fyle-platform-sdk-py |
from core.advbase import *
from slot.a import *
def module():
return Elias
class Elias(Adv):
a3 = ('lo',0.4)
conf = {}
conf['slots.paralysis.a'] = RR()+Spirit_of_the_Season()
conf['acl'] = """
`dragon
`s1, fsc
`s3, fsc
`s2, fsc
`s4, fsc
`fs, x=4
... | [
{
"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 | adv/elias.py | slushiedee/dl |
'''Write record to data lake'''
import json
import logging
import os
import boto3
import iso8601
log_level = os.environ.get('LOG_LEVEL', 'INFO')
logging.root.setLevel(logging.getLevelName(log_level)) # type: ignore
_logger = logging.getLogger(__name__)
DATA_LAKE_S3_BUCKET = os.environ.get('DATA_LAKE_S3_BUCKET')
S... | [
{
"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 | handlers/write_record.py | ServerlessOpsIO/wild-rydes-ride-data-lake |
from direct.directnotify import DirectNotifyGlobal
import RingAction
class RingTrack:
notify = DirectNotifyGlobal.directNotify.newCategory('RingTrack')
def __init__(self, actions, actionDurations=None, reverseFlag=0):
if actionDurations == None:
actionDurations = [
1.0 / float... | [
{
"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 | v2.5.7/toontown/minigame/RingTrack.py | TTOFFLINE-LEAK/ttoffline |
from flask import Flask, render_template, request, redirect, url_for, flash, jsonify, send_from_directory
import os
from api.apiapp import api
from web.webapp import web
import yara
from git import Repo
from pathlib import Path
import shutil
app = Flask(__name__, static_folder='static', template_folder='templates')
ap... | [
{
"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 | app.py | vinaynpp/cis |
from shared import *
# Input data is in INPUT_DATA.
# INPUT_DATA = [int(x) for x in INPUT_DATA]
class Line:
def __init__(self, start: complex, end: complex):
self.start: complex
self.start = start
self.end: complex
self.end = end
@property
def vertical(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 | 2021/src/day5.py | pantaryl/adventofcode |
from GameClassOBJ import GameOBJ
class Character(GameOBJ):
def __init__(self, ID, TYPE, MainList, x, y, MainPick, AnimCount, Motion, name, hp,LeftANIM, RightANIM):
GameOBJ.__init__(self, ID, TYPE, MainList, x, y, MainPick, AnimCount)
self.__Name = name
self.__HP = hp
self.__LeftANIM... | [
{
"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 | CharacterModule.py | RouSage/magistrprog |
import os
import wbuild
import drop
import sys
from unittest.mock import patch
from .common import *
@pytest.yield_fixture(scope="session", autouse=True)
def demo_dir(tmpdir_factory):
"""
Directory containing files downloaded from Gagneurlab ready to run the demo pipeline
:param testdirectory: inherits fr... | [
{
"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/conftest.py | nickhsmith/drop |
# -*- coding: utf-8 -*-
from unittest2 import TestCase
from .. import CALLBACKS_MAP
class MailBotTestCase(TestCase):
"""TestCase that restores the CALLBACKS_MAP after each test run."""
def setUp(self):
self.callbacks_map_save = CALLBACKS_MAP.copy()
def tearDown(self):
CALLBACKS_MAP = 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | mailbot/tests/__init__.py | alseageo/mailbot |
pkgname = "upower"
pkgver = "0.99.17"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Ddefault_library=shared", "-Dos_backend=linux",
"-Dsystemdsystemunitdir=no", "-Dintrospection=enabled", "-Dgtk-doc=false"
]
hostmakedepends = [
"meson", "pkgconf", "gettext-tiny-devel", "glib-devel",
"gobject-int... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | main/upower/template.py | RoastVeg/cports |
import moai.utils.engine as mieng
import torch
import omegaconf.omegaconf
import typing
import logging
import inspect
import itertools
log = logging.getLogger(__name__)
__all__ = ['Metric']
class Metric(mieng.Single):
def __init__(self,
metrics: omegaconf.DictConfig,
**kwargs: typing.Mapping[str... | [
{
"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 | moai/validation/single.py | tzole1155/moai |
from main import p, initial_node
from solution import Solution
initial_depth = int(input('please input initial depth:'))
solution = Solution()
def recursive_dls(node, problem, limit):
if problem.goal_test(node.state):
solution.print_goal(node.state)
depth = 0
path = []
while node.... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | p1.py | its-kz-again/AI-project |
from opencmiss.zinc.field import Field
from opencmiss.zinc.glyph import Glyph
class TrackingPointsScene(object):
def __init__(self, master_model):
self._master_model = master_model
def create_graphics(self):
tracking_points_model = self._master_model.get_tracking_points_model()
coor... | [
{
"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 | mapclientplugins/electrodearraydetectorstep/scene/trackingpointsscene.py | mahyar-osn/mapclientplugins.electrodearraydetectorstep |
import json
from pprint import pprint, pformat
from dateutil.parser import parse as parsetimestamp
SILENCE_STATUSES = [
"CREATE_COMPLETE",
"CREATE_IN_PROGRESS",
"DELETE_COMPLETE",
"DELETE_IN_PROGRESS",
"REVIEW_IN_PROGRESS",
"ROLLBACK_COMPLETE",
"ROLLBACK_IN_PRO... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | .cf_status.py | pointtonull/888 |
# pylint: disable=invalid-name,missing-module-docstring,missing-function-docstring
def func(x):
return x + 1
def test_answer():
assert func(3) == 4
| [
{
"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 | test/test_sample.py | gbroiles/tax |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | src/databox/azext_databox/__init__.py | Mannan2812/azure-cli-extensions |
from keras import models, layers
class CNNModel:
@staticmethod
def generateModel(input):
model = models.Sequential()
model.add(layers.Conv2D(filters=32, kernel_size=(5,5), activation='relu', input_shape=input.shape[1:]))
model.add(layers.MaxPool2D(pool_size=(2, 2)))
model.add(la... | [
{
"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 | CNNModel.py | night2wolf/CS490-ML-Lab2 |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""sent when a guild integration is updated."""
from ..core.dispatch import GatewayDispatch
from ..objects.events.guild import GuildIntegrationsUpdateEvent
from ..utils import Coro
from ..utils.conversion import construc... | [
{
"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 | pincer/middleware/guild_integrations_update.py | shivamdurgbuns/Pincer |
# test_increment_decrement_pytest.py
from increment_decrement import decrement
from increment_decrement import increment
def test_increment():
x = 5
expected = 6
actual = increment(x)
assert actual == expected
def test_decrement():
x = 5
expected = 4
actual = decrement(x)
assert actu... | [
{
"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/test_increment_decrement_pytest.py | DahlitzFlorian/test-your-python-code-using-hypothesis-article-snippets |
from indy import did,wallet,crypto, anoncreds
import asyncio
import base64
import random
import json
class Indy_pdp:
def __init__(self):
with open('conf/indy.conf') as f:
conf = json.load(f)
self.acl = conf['acl']
self.password = conf['admin_password']
def create_nonce(sel... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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... | 3 | sl-as-pds/PDS/indy_pdp.py | SOFIE-project/SMAUG-Owner |
# -*- coding: utf-8 -*-
import numpy as np
import pymc3 as pm
from scipy.stats import kstest
from .base_test import _Base
from .physical import ImpactParameter, QuadLimbDark
class TestPhysical(_Base):
random_seed = 19860925
def test_quad_limb_dark(self):
with self._model():
dist = QuadL... | [
{
"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/exoplanet/distributions/physical_test.py | ericagol/exoplanet |
"""add status_as_of column
Revision ID: cce9d107c21a
Revises: 9f8c327dd506
Create Date: 2021-07-08 19:16:15.975527
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "cce9d107c21a"
down_revision = "9f8c327dd506"
branch_labels = None
depends_on = None
def upgrade... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | migrations/versions/cce9d107c21a_add_status_as_of_column.py | ourresearch/journalsdb |
import math
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return '({:.2f}, {:.2f})'.format(self.x, self.y)
p = Point(2.34, 5.67)
print ("%.2f" % p.x)
print ("%.2f" % p.y)
point = Point(-18.5, 13.5)
print(point)
| [
{
"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 | Python-Course/Computational-Geometry/point_and_line/1.py | cmlimm/uni-projects |
class FlumineException(Exception):
"""Base class for Flumine Errors"""
pass
class RunError(FlumineException):
"""Exception raised if error
in `Flumine.run()``
"""
def __init__(self, message):
super(RunError, self).__init__(message)
class ListenerError(FlumineException):
"""Erro... | [
{
"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 | flumine/exceptions.py | betcode-org/flumine |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
"""
Test case, when custom Export, ExportSchema properties contains names,
that will conflict in further data normalization, like:
`userName` and `username`
"""
from unittest.mock import MagicMock
import pytest
from airbyte_cdk.models import SyncMode
from ... | [
{
"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 | airbyte-integrations/connectors/source-mixpanel/unit_tests/test_property_transformation.py | itaseskii/airbyte |
"""
======================================================================
Crossbar.py
======================================================================
"""
from pymtl3 import *
class Crossbar( Component ):
def construct( s, nports, dtype ):
sel_nbits = clog2( nports )
s.in_ = [ InPort ( dtype ) ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | pymtl3/stdlib/rtl/Crossbar.py | mondO/pymtl3 |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = ('... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | app/users/serializers.py | NikolasK88/recipe-app-api |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AdvertItem import AdvertItem
class Advert(object):
def __init__(self):
self._advert_id = None
self._advert_items = None
@property
def advert_id(self)... | [
{
"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 | alipay/aop/api/domain/Advert.py | snowxmas/alipay-sdk-python-all |
"""Euclidean manifold."""
from core.manifolds.base import Manifold
class Euclidean(Manifold):
"""
Euclidean Manifold class.
"""
def __init__(self):
super(Euclidean, self).__init__()
self.name = 'Euclidean'
def normalize(self, p):
dim = p.size(-1)
p.... | [
{
"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 | core/manifolds/euclidean.py | GuodongQi/FSL-OM |
"""
CIFAR-100 classification dataset.
"""
import os
from torchvision.datasets import CIFAR100
from .cifar10_cls_dataset import CIFAR10MetaInfo
class CIFAR100Fine(CIFAR100):
"""
CIFAR-100 image classification dataset.
Parameters:
----------
root : str, default '~/.torch/datasets/cifar100'
... | [
{
"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 | pytorch/datasets/cifar100_cls_dataset.py | naviocean/imgclsmob |
# The MIT License (MIT)
# =====================
#
# Copyright © 2020 Azavea
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the “Software”), to deal in the Software without
# restriction, including without limitation the rights to... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | python/architectures/sentinel2-ndwi.py | geotrellis/deeplab-nlcd |
from typing import Any, Dict, List
import vaa
class Scheme:
"""A base class for implementing a custom validator.
The custom validator should implement `is_valid` method.
The method should return True if the data is valid.
Otherwise, it should set `errors` attribute and return False.
"""
da... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | deal/_schemes.py | life4/deal |
"""empty message
Revision ID: 7829e2406e
Revises: None
Create Date: 2015-07-12 19:11:45.077763
"""
# revision identifiers, used by Alembic.
revision = '7829e2406e'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | [
{
"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 | migrations/versions/7829e2406e_.py | shipperizer/cargo |
from __future__ import annotations
from functools import reduce
from typing import Iterable
class Strategy:
def __init__(self):
self._partitions = None
def get(self, feature: str) -> int:
raise NotImplementedError
def partition_number(self, features: Iterable[str]) -> int:
retur... | [
{
"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 | psyke/regression/strategy.py | psykei/psyke-python |
from fpdf import FPDF
# Author: @NavonilDas
class MyPdf(FPDF):
def header(self):
# Uncomment the line below to add logo if needed
# self.image('somelogo.png',12,10,25,25) # Draw Image ar (12,10) with height = 25 and width = 25
self.set_font("Arial", "B", 18)
self.text(27, 10, "Ge... | [
{
"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 | PDF/header_footer.py | Wish1991/Python |
import site
site.addsitedir('..')
import torch
from pytorch_probgraph import BernoulliLayer
from pytorch_probgraph import InteractionLinear
from pytorch_probgraph import HelmholtzMachine
from itertools import chain
from tqdm import tqdm
class Model_HM_RWS(torch.nn.Module):
def __init__(self):
super().__i... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | examples/Model_HM_RWS.py | kpoeppel/pytorch_probgraph |
try:
# for python newer than 2.7
from collections import OrderedDict
except ImportError:
# use backport from pypi
from ordereddict import OrderedDict
import yaml
# try to use LibYAML bindings if possible
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml i... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | primalsalt/saltyaml.py | rosscdh/primal-salt |
def sieve(m):
l = [True]*(int(m**.5)+2)
l[0], l[1] = False, False
for i in range(2, len(l)):
if not l[i]:
continue
for j in range(i*2, len(l), i):
l[j] = False
return l
def reverse_primes(l):
for i in range(len(l)-1, 1, -1):
if l[i]:
yield... | [
{
"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 | ProjectEuler/0003/solution.py | hvaara/CompetitiveProgramming |
# MIT License
#
# Copyright (c) [2020 - 2021] The yinyang authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | [
{
"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 | yinyang/src/base/Utils.py | rainoftime/yinyang |
class Solution(object):
def minimumAbsDifference(self, arr):
"""
:type arr: List[int]
:rtype: List[List[int]]
"""
if len(arr) < 2:
return []
sa = sorted(arr)
min_diff = sa[1] - sa[0]
res = [[sa[0], sa[1]]]
for i in range(1, len(sa) ... | [
{
"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 | python/hash_table/1200_minimum_absolute_difference.py | linshaoyong/leetcode |
from tkinter import *
class MainFrame(Frame):
def __init__(self, parent):
super().__init__()
self['bd'] = 1
self['relief'] = SOLID
self['padx'] = 5
self['pady'] = 5
self.label_text1 = StringVar()
self.label_text1.set('Digite seu nome')
self.text_text... | [
{
"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 | Aulas/app001/ex18-praticando_frame.py | JonasJF360/Curso_Tkinter |
with open('input.txt') as f:
img_data = f.readline().strip()
img_w = 25
img_h = 6
layer_num_pixels = img_w * img_h
img_num_layers = len(img_data) // layer_num_pixels
print("img_num_layers = %d" % img_num_layers)
layer_data = []
for i in range(img_num_layers):
a, b = layer_num_pixels*i, layer_num_pixels*(i+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 | 2019/8/8.py | pshatov/AoC |
from airbnb_priceforecaster.models import train_model
from airbnb_priceforecaster.models import build_model
from airbnb_priceforecaster.data import AirBnBDataset
import click
@click.group()
def cli():
pass
@cli.command()
@click.option("-y", "--year", default=2020, type=int)
@click.option("-m", "--month", defaul... | [
{
"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 | src/airbnb_priceforecaster/manage.py | andersbogsnes/airbnb_priceforecaster |
import logging
from tangle import Tangled, TreeBuilder, BasicEvaluator
def test_node():
Tangled.set_handlers(TreeBuilder(), BasicEvaluator())
@Tangled.tangled_function
def average(a, b):
""" Decorator ensures that this function can be used in a Tangled graph
"""
return (a + b) /... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | tests/test_general.py | ltron/tangle |
def _get_main(ctx):
if ctx.file.main:
return ctx.workspace_name + "/" + ctx.file.main.path
main = ctx.label.name + ".py"
for src in ctx.files.srcs:
if src.basename == main:
return ctx.workspace_name + "/" + src.path
fail(
"corresponding default '{}' does not appear in... | [
{
"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 | bzl/conda.bzl | thyrgle/plaidml |
# coding=utf-8
# Copyright (c) 2011 - 2017, Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
{
"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 | unittests/test_ui_helpers.py | stepanandr/taf |
def defaults():
return dict(
actor='mlp',
ac_kwargs={
'pi': {'hidden_sizes': (64, 64),
'activation': 'tanh'},
'val': {'hidden_sizes': (64, 64),
'activation': 'tanh'}
},
adv_estimation_method='gae',
epochs=300, # ... | [
{
"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 | rl_safety_algorithms/algs/cpo/defaults.py | liuzuxin/RL-Safety-Algorithms |
from wikipedia2vec import Wikipedia2Vec
import pickle
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', default='robust04', help='dataset name: robust04/clueweb09')
args = parser.parse_args()
def save_obj(obj, name):
with open(name + '.pkl', 'wb') as f:
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | Data/ent2vec.py | CRIPAC-DIG/K-GHRM |
import komand
from .schema import ConnectionSchema
# Custom imports below
import ipahttp
class Connection(komand.Connection):
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
def connect(self, params):
server = params.get('server')
username = params.... | [
{
"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 | freeipa/komand_freeipa/connection/connection.py | emartin-merrill-r7/insightconnect-plugins |
from torch import nn
class GPT2LMHead(nn.Module):
""" Language Model Head for the transformer """
def __init__(self, model_embeddings_weights, config):
super(GPT2LMHead, self).__init__()
self.n_embd = config.n_embd
self.set_embeddings_weights(model_embeddings_weights)
def set_emb... | [
{
"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 | gpt2sqa/gpt2/gpt2lmhead.py | kniazevgeny/GPT2sQA-1 |
from PyQt4 import QtGui,QtCore
import sys
import ui_main
import numpy as np
import pylab
import time
import pyqtgraph
class ExampleApp(QtGui.QMainWindow, ui_main.Ui_MainWindow):
def __init__(self, parent=None):
pyqtgraph.setConfigOption('background', 'w') #before loading widget
super(Exa... | [
{
"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 | go.py | goldtime1987/pyQTGraph |
"""
https://projecteuler.net/problem=1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
"""
def find_multiples(of, below):
return set(of * count for count in range(1, int(belo... | [
{
"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 | problem-001/main.py | denysfarias/project-euler-net |
from neutro.src.trie.trie import Trie
from neutro.src.chain.transaction import Transaction
def test_trie():
txs = []
for i in range(10):
sender = "a" + str(i)
receivers = [str(i)]
amounts = [str(i + 100)]
fee = 100 * i
txs.append(Transaction(sender, receivers, amounts, ... | [
{
"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 | neutro/test/trie/test_trie.py | miserableoracle/Neutro-Blockchain-Prototype |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = (... | [
{
"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": true
}... | 3 | app/user/serializers.py | siddharthisaiah/recipe-app-api |
from pathlib import Path
import nltk
from nltk.tokenize import sent_tokenize
tokenizer = nltk.RegexpTokenizer(r"([A-Z][A-Z0-9.]+|[0-9]+[,.][0-9]+|[cdjlmnst]'|qu'|[\w'-]+|\S)")
class Sentence:
def __init__(self, text, nth):
self.text = text
self.nth = nth
def __len__(self):
return le... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | sampling/text.py | YoannDupont/corpus-sampling |
# -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
import math
import os
import sys
import uuid
def generate_id():
return str(uuid.uuid1())
def combinations(n, m_max, m_min=1):
if m_max > n or m_max <= 0:
m_max = n
if m_min < 1:
m_min = 1
if m_min == 1 and m_max == n:
r... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | hypernets/utils/common.py | qigj/Hypernets |
# asyncio_queue.py
import asyncio
async def consumer(n, _queue):
""":type _queue asyncio.Queue"""
# print('consumer {}: waiting for item'.format(n))
while True:
print('consumer {}: waiting for item'.format(n))
item = await _queue.get()
print('consumer {}: has item {}'.format(n, it... | [
{
"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 | Asyncio/asyncio_queue.py | xlui/PythonExamples |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='royandri.dev@gmail.com',
... | [
{
"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 | app/core/tests/test_admin.py | royandri/recipe-app-api |
class Verdict:
def __init__(self, reconciled: bool=None, verdict: str=None):
self.reconciled = reconciled
self.verdicts = []
if verdict:
self.verdicts.append(verdict)
def __str__(self):
return f'<Verdict / {"reconciled" if self.reconciled else "non-reconciled"} ({... | [
{
"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 | raekwon/schema.py | metheoryt/raekwon |
import uvicorn
from fastapi import FastAPI, File, UploadFile
from starlette.responses import RedirectResponse
app_desc = """<h2>Try this app by demostrating[a,b,c,d,e] data and index for `api/res`</h2>
<h2>Try get/add/modify/delete rest functions and verify return response </h2>
<br>by Aniket Maurya"""
app = Fast... | [
{
"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 | application/server/main.py | yangboz/steganoAAS |
#!/usr/bin/env python3
import json
import time
from random import gauss
from flask import Flask
number_of_devices = 10
number_of_values_per_second = 2
last_request = None
app = Flask(__name__)
@app.route('/')
def index():
return 'Server is running'
def get_time_ms():
return int(time.time() * 1000)
def... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | greengrass-v2/poll-api/artifacts/com.greengrass.FakeApi/1.0.0/app.py | dhwalters423/iot-reference-architectures |
import json
import oss2
import os
def read_config():
config_dir = os.path.join(os.environ['HOME'], '.oss')
config_path = os.path.join(config_dir, 'oss.conf')
# if config file not exist, make blank one
if not os.path.exists(config_path):
print('Config file not found, making blank config file to... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | upload/oss.py | princewang1994/markdown_image_uploader |
import datetime
import json
from json import JSONEncoder
from typing import Any, Dict, Optional
from pygments import highlight, lexers
from pygments.formatters import Terminal256Formatter
from .graphql_lexer import GraphQLLexer
class StrawberryJSONEncoder(JSONEncoder):
def default(self, o: Any) -> Any:
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | strawberry/utils/debug.py | TheVinhLuong102/Strawberry |
import os.path
from django.conf import settings
from django.core.management.base import BaseCommand
from sheerlike.indexer import index
LOCATION = os.environ.get('SHEER_LOCATION', os.getcwd())
ELASTICSEARCH_HOSTS = settings.SHEER_ELASTICSEARCH_SERVER
ELASTICSEARCH_INDEX = settings.SHEER_ELASTICSEARCH_INDEX
class ... | [
{
"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 | cfgov/sheerlike/management/commands/sheer_index.py | atuggle/cfgov-refresh |
class TaskStatus:
def __init__(self, taskId, sequence, status):
self.taskId=taskId
self.sequence = sequence
self.status = status
def __str__(self):
return "Task %s for %s is %s" %(self.taskId, self.sequence, self.status) | [
{
"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 | app/compute/taskstatus.py | rzachariah/bioalign |
import torch
import extlib
try:
import extlib_cuda
except:
print('not loading cuda jagged ops')
from torch.autograd import Function
from torch.nn import Module
import numpy as np
#----------------------
# jagged_log_softmax
#----------------------
class JaggedLogSoftmaxFunc(Function):
@staticmethod
d... | [
{
"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 | rxnebm/proposer/gln_openretro/models/gln_model/gln/mods/torchext/jagged_ops.py | coleygroup/rxn-ebm |
from typing import Dict, List
import mido
from lss.pad import Pad
from lss.utils import open_input, open_output
class BaseLaunchpad:
row_count: int
column_count: int
name: str
pads: Dict[int, "Pad"] = {}
def __init__(self):
self._outport = open_output(self.name + " In", autoreset=True)... | [
{
"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 | lss/devices/launchpad_base.py | turbaszek/nss |
from unittest.mock import patch, mock_open
import argparse
from gita import __main__
from gita import utils
def test_ls(monkeypatch, capfd):
monkeypatch.setattr(utils, 'get_repos',
lambda: {'repo1':'/a/', 'repo2':'/b/'})
monkeypatch.setattr(utils, 'describe', lambda x: x)
__main__.main(['ls']... | [
{
"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 | tests/test_main.py | PabloCastellano/gita |
import logging
from concurrent.futures.process import ProcessPoolExecutor
logger = logging.getLogger(__name__)
def process_pool_factory(num_workers: int):
async def process_pool(app_instance):
logger.debug("Setting up process pool with %r workers", num_workers)
pool = ProcessPoolExecutor(max_wo... | [
{
"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 | nlp_annotator_api/server/signals/process_pool.py | dasaku-ai/nlpmodel-v-h |
''' Various stretch functions. Easy to add more. Room for refinement,
methinks.
'''
import numpy as np
def stretch(x, method='linear', param=None, NR=0, background=None):
# if no noise reduction just use stretch alone
if (NR <= 0) or (background is None):
return stretch_main(x, method=method, par... | [
{
"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 | jocular/stretch.py | MartinCooke/jocular |
import os
from google.cloud import secretmanager
class Secret:
def __init__(self):
# Create the Secret Manager client.
self.client = secretmanager.SecretManagerServiceClient()
self.project_id = os.getenv('GOOGLE_CLOUD_PROJECT')
def get_secret(self, secret_id):
# Build the pare... | [
{
"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 | secret.py | nora0706/gcp_site |
import os
import platform
from pathlib import Path
from sc2.observer_ai import ObserverAI
from sc2 import run_replay
from loguru import logger
class ObserverBot(ObserverAI):
"""
A replay bot that can run replays.
Check sc2/observer_ai.py for more available functions
"""
async def on_start(self)... | [
{
"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 | examples/watch_replay.py | DrInfy/python-sc2 |
import argparse
import torch
import torch.nn.functional as F
from torch.nn import Sequential as Seq, Linear as Lin, ReLU, LeakyReLU
from torch_geometric.nn import DynamicEdgeConv, global_max_pool
from datasets import get_dataset
from train_eval import run
parser = argparse.ArgumentParser()
parser.add_argument('--epoc... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | benchmark/points/edge_cnn_ke.py | KuangenZhang/pytorch_geometric |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.http import HttpResponse
from django.shortcuts import render
def dummy_view(request):
return HttpResponse()
def djnago_template_view(request):
return render(request, 'django.html', {})
def jinja_template_view(req... | [
{
"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 | tests/views.py | christianwgd/django-activeurl |
import cv2
import torch
from Services.NeuralNetwork.tool.torch_utils import do_detect
from Services.NeuralNetwork.tool.darknet2pytorch import Darknet
class NeuralNetwork:
@staticmethod
def isCudaAvailable() -> bool:
return torch.cuda.is_available()
@staticmethod
def getAvailableCa... | [
{
"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 | Services/NeuralNetwork/NeuralNetwork.py | shell-done/Spongo_IHM |
"""
This is the runner of the entire eva.jvc system.
Version 1,
the steps for the entire pipeline are as follows:
1. preprocessor -- get rep indices, save children metadata
2. encoder -- encode video by forcing i-frames (also modify the i-frame skip rate)
3. decoder -- using metadata, select the i-frames you want to ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | eva_storage/jvc/jvc_runner_v2.py | jaehobang/cs7643_project |
### This example code uses: Maker Pi Pico ;; Reference: www.cytron.io/p-maker-pi-pico
"""CircuitPython Essentials NeoPixel example"""
import time
import board
import neopixel
pixel_pin = board.GP28
num_pixels = 1
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False)
def ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | Example Code/CircuitPython/RGBLED-Neopixel/RGBLED-Neopixel.py | crisdeodates/Pi-MAKER-PI-PICO |
def anagram_easy(str1, str2):
str1 = str1.replace(' ', '').lower()
str2 = str2.replace(' ', '').lower()
return sorted(str1) == sorted(str2)
print(anagram_easy('Clint Eastwood', 'old west action'))
def anagram_medium(str1, str2):
str1 = str1.replace(' ', '').lower()
str2 = str2.replace(' ', '').lo... | [
{
"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 | anagrams.py | diop/tweet-generator |
import tltk_mtl as MTL
import tltk_mtl_ext as MTLE
def testNextRule():
preds = {}
preds['pred1'] = MTL.Predicate('pred1', 1, 2)
preds['pred2'] = MTL.Predicate('pred2', 2, 4)
preds['pred3'] = MTL.Predicate('pred3', 4, 8)
assert isinstance(MTLE.parse_mtl('next pred1', preds), MTL.Next), printFail(1)
printPass(1)... | [
{
"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/testNextRule.py | andersonjwan/tltk-mtl-ext |
from datetime import datetime
from RestfulAPI.models.users import Users
from RestfulAPI.service.insfrastructure.user_repo import UsersPG
class AccountService:
def __init__(self):
self.user_pg = UsersPG()
@staticmethod
def is_valid_account(username, password):
user = Users.query.filter_by... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | service/user_account.py | QuiTran86/RestfulAPI |
from backpack.core.derivatives.avgpool1d import AvgPool1DDerivatives
from backpack.core.derivatives.avgpool2d import AvgPool2DDerivatives
from backpack.core.derivatives.avgpool3d import AvgPool3DDerivatives
from backpack.core.derivatives.maxpool1d import MaxPool1DDerivatives
from backpack.core.derivatives.maxpool2d imp... | [
{
"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 | backpack/extensions/secondorder/diag_ggn/pooling.py | jabader97/backpack |
# coding=utf-8
from __future__ import unicode_literals
def get_cars(system_data_dict):
all_markers = system_data_dict.get('marker', [])
all_cars = [car for car in all_markers if car['hal2option']['objectname'] == 'multicitymarker']
return all_cars
def get_license_plate(car):
tooltip = car['hal2op... | [
{
"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 | electric2go/systems/multicity/parse.py | jarek/electric2go |
from .event import Event
class DiancieAltar(Event):
"""
This class is the dianciealtar event.
"""
def __init__(self, player, amount):
"""
here the superclass init is called, and it sets the player and the amount.
:param player: The player who topped off the altar.
:para... | [
{
"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 | ppobyter/events/dianciealtar.py | graatje/highscoresbot |
# 6.00x Problem Set 6
#
# Part 2 - RECURSION
#
# Problem 3: Recursive String Reversal
#
def reverseString(aStr):
"""
Given a string, recursively returns a reversed copy of the string.
For example, if the string is 'abc', the function returns 'cba'.
The only string operations you are allowed to use are ... | [
{
"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 | pset6/ps6_recursion.py | ankgitk/6.001-pset-answers |
from collections import defaultdict
from aoc.util import load_input
def turn(d, fun, sxy, exy):
sx, sy = map(int, sxy.split(","))
ex, ey = map(int, exy.split(","))
for x in range(sx, ex + 1):
for y in range(sy, ey + 1):
d[(x, y)] = fun(d[(x, y)])
def run(data, toggle, turn_on, turn_... | [
{
"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 | python/src/aoc/year2015/day6.py | ocirne/adventofcode |
import pygame as Pg
import CardGameBasicFrame as Cg
players = Cg.give_cards(2, 26)
print('Welcome to the card game War')
Pg.init()
surface=Pg.display.set_mode((100,100))
def main():
def check_cards(index):
p1 = players[0][index][1]
p2 = players[1][index][1]
print("player 1's dr... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer... | 3 | warGame.py | f-forte-carpio/PyCards |
from torch2trt.torch2trt import *
@tensorrt_converter('torch.Tensor.contiguous')
@tensorrt_converter('torch.nn.functional.dropout')
@tensorrt_converter('torch.nn.functional.dropout2d')
@tensorrt_converter('torch.nn.functional.dropout3d')
def convert_functional_identity(ctx):
input = ctx.method_args[0]
input_t... | [
{
"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 | torch2trt/converters/identity.py | nuhpiskin/torch2trt |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | isi_sdk_8_2_1/test/test_auth_id_ntoken_privilege_item.py | mohitjain97/isilon_sdk_python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.