source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Statement pre-processors.
"""
def clean_whitespace(chatbot, statement):
"""
Remove any consecutive whitespace characters from the statement text.
"""
import re
# Replace linebreaks and tabs with spaces
statement.text = statement.text.replace('\n', ' ').replace('\r'... | [
{
"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 | Boilermake2018/Lib/site-packages/chatterbot/preprocessors.py | TejPatel98/voice_your_professional_email |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insi... | 3 | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/EXT/framebuffer_blit.py | ShujaKhalid/deep-rl |
def recall(pycm_obj):
return {key: pycm_obj.TPR[key] if pycm_obj.TPR[key] != "None" else 0. for key in pycm_obj.TPR}
def precision(pycm_obj):
return {key: pycm_obj.PPV[key] if pycm_obj.PPV[key] != "None" else 0. for key in pycm_obj.PPV}
def f1(pycm_obj):
return {key: pycm_obj.F1[key] if pycm_obj.F1[key... | [
{
"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 | claf/metric/classification.py | GMDennis/claf |
"""
CSVLogger writes power values to a csv file.
"""
__author__ = 'Md Shifuddin Al Masud'
__email__ = 'shifuddin.masud@gmail.com'
__license__ = 'MIT License'
from pv_simulator.FileWriter import FileWriter
import csv
from datetime import datetime
import aiofiles
from aiocsv import AsyncWriter
import logging
class CSV... | [
{
"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 | pv_simulator/CSVFileWriter.py | Shifuddin/PV-Simulator-Challenge |
class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.stack1 = []
self.stack2 = []
def push(self, x):
"""
:type x: int
:rtype: void
"""
self.stack1.append(x)
if len(self.stack2) == 0... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | LeetCode/LeetCode_Python-master/LeetCode_Python-master/Algorithm-Easy/155_Min_Stack.py | Sycamore-City-passerby/ML |
from typing import Iterable
EMPTY = "L"
FLOOR = "."
OCCUPIED = "#"
DIRECTIONS = [(-1-1j), (-1+0j), (-1+1j), -1j, 1j, (1-1j), (1+0j), (1+1j)]
with open("inputs/day11.txt", 'r') as f:
input_grid = {x + y*1j: s for y, line in enumerate(f.read().splitlines()) for x, s in enumerate(line)}
def get_adjacent(coord:... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | chris_cunningham/day11.py | techartorg/Advent_of_Code_2020 |
from pymc import *
from numpy import *
from numpy.testing import *
import nose
import sys
from pymc import utils
from pymc import six
xrange = six.moves.xrange
class test_logp_of_set(TestCase):
A = Normal('A',0,1)
B = Gamma('B',1,1)
C = Lambda('C',lambda b=B: sqrt(b))
D = Gamma('D',C,1)
@stochasti... | [
{
"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 | pymc/tests/test_utils.py | neurodebian/pymc |
"""
eZmax API Definition
This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501
The version of the OpenAPI document: 1.1.3
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import eZmaxApi
from eZmaxA... | [
{
"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 | test/test_ezsignformfield_response_compound.py | eZmaxinc/eZmax-SDK-python |
from itertools import islice
from tqdm.auto import tqdm
import glow
def iter_fibs():
prev, cur = 0, 1
while True:
prev, cur = cur, prev + cur
yield cur
@glow.time_this
def fibs(n):
gen = islice(iter_fibs(), n)
gen = tqdm(gen)
return max(x.bit_length() for x in gen)
def test_f... | [
{
"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 | glow/test/test_timer.py | arquolo/ort |
import os.path as osp
try:
import bytejection
_MODULE_INSTALLED = True
except ImportError as ex:
# Fallback to import from source directory
_MODULE_INSTALLED = False
import sys
sys.path.insert(0, osp.abspath(osp.join(osp.dirname(__file__), '..')))
from bytejection import COManipulator
from byt... | [
{
"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 | demo/run_patch_module.py | NaleRaphael/bytejection |
from sys import maxsize
class Group:
def __init__(self, name=None, footer=None, header=None, id=None):
self.name = name
self.footer = footer
self.header = header
self.id = id
def __repr__(self):
return "%s:%s:%s:%s" % (self.id, self.name, self.footer, self.header)
... | [
{
"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 | model/model_group.py | anjel-ershova/python_training |
# -*- coding: UTF-8 -*-
#$ header procedure incr(double) results(double)
def incr(x):
y = x + 1
return y
#$ header procedure decr(double) results(double)
def decr(x):
y = x - 1
return y
| [
{
"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 | src_old/tests/f2py/scripts/incrdecr.py | toddrme2178/pyccel |
from typing import Any
from qtoggleserver.core import api as core_api
from qtoggleserver.core.typing import GenericJSONDict
from .base import Event
# We can't use proper type annotations for ports in this module because that would create unsolvable circular imports.
# Therefore we use "Any" type annotation for Bas... | [
{
"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 | qtoggleserver/core/events/port.py | DigitEgal/qtoggleserver |
#!/usr/bin/env python
"""
More complex demonstration of what's possible with the progress bar.
"""
import threading
import time
from quo.text import Text
from quo.progress import ProgressBar
def main():
with ProgressBar(
title=Text("<b>Example of many parallel tasks.</b>"),
bottom_toolbar=Text("<b... | [
{
"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 | examples/progress/many-parallel-tasks.py | scalabli/quo |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: parser.py
Author: huxuan
Email: i(at)huxuan.org
Description: Simplified parser for m3u8 file.
"""
from urllib.request import urlopen
import os.path
from .constants import patterns
def parse_content_to_lines(content):
"""Universal interface to split content ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | iptvtools/parsers.py | haleez/iptvtools |
from app import lambda_handler
def test_root_returns_html():
event = {
"httpMethod": "GET",
"path": "/"
}
assert "Sorry, the service is unavailable" in lambda_handler(event, None)['body']
def test_url_with_path_returns_html():
event = {
"httpMethod": "GET",
"path": "/... | [
{
"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 | test/test_lambda.py | nationalarchives/tdr-service-unavailable |
class Reader:
async def readline(self): print('readline')
def __aiter__(self): return self
async def __anext__(self):
val = await self.readline()
if val == b'':
raise StopAsyncIteration
return val
async for a in Reader():
print(a)
else:
print('else')
| [
{
"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 | 24/03/0.py | pylangstudy/201707 |
from typing import Optional, Tuple
from ...presenter.presenter import PresenterHandler
from ...shared.interfaces.wsgi import ResponseBody
from ..request import Request
from .base_view import BaseView, route
class PresenterView(BaseView):
"""
The PresenterView receives a bundle of presentations via HTTP and h... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | openslides_backend/http/views/presenter_view.py | peb-adr/openslides-backend |
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
class _MutatioEnvironmentMeta(type):
"""Collects the mutatio tags into Mongo for the admin page."""
def __init__(cls, name, bases, dct):
super(_MutatioEnvironmentMeta, cls).__init__(name, bases, dct)
class Mutatio... | [
{
"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 | demo/flask_mutatio/environment.py | Kazanz/mutatio-python |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitR06_IsolatedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitR06_IsolatedLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
super... | [
{
"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 | GM2AUTOSAR_MM/Properties/unit_contracts/HUnitR06_IsolatedLHS.py | levilucio/SyVOLT |
# -*- coding: utf-8 -*-
"""setup.py."""
import setuptools
def read_file(fname):
"""Read file and return the its content."""
with open(fname, "r") as f:
return f.read()
def get_attr(fname, attr):
"""Read file and return specific "attribute" content."""
lines = read_file(fname)
for line ... | [
{
"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 | setup.py | thobiast/fundosbr |
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# -*- encoding: utf-8 -*-
#
from cgtsclient.common import base
CREATION_ATTRIBUTES = ['cert_path', 'public_path', 'tpm_path']
class Certificate(base.Resource):
def __repr__(self):
return "<certificate %s>" % 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | sysinv/cgts-client/cgts-client/cgtsclient/v1/certificate.py | etaivan/stx-config |
# -*- coding: utf-8 -*-
"""This is a generated class and is not intended for modification!
TODO: Point to Github contribution instructions
"""
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.sms.mt.send.SMSData import SMSData
class SMSMultiBinaryReques... | [
{
"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 | infobip/api/model/sms/mt/send/binary/SMSMultiBinaryRequest.py | bahiamartins/infobip-api-python-client |
import re
import time
import random
import logging
import requests
from base import BaseBot
logger = logging.getLogger(__name__)
MEME_URL = 'http://www.memes.com'
MEME_REGEX = re.compile(r'^!meme')
SCRAPE_REGEX = re.compile(r'<img id="image_\d+" src="([^"]+)"')
def random_meme():
try:
html = requests.ge... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | src/bots/meme.py | orangeblock/slack-bot |
import pytest
from nodels.base import BaseGather
def test_to_dict():
b = BaseGather()
assert b.to_dict() == {}
b2 = BaseGather(data={"foo": "bar"})
assert b2.to_dict() == {"foo": "bar"}
def test_json():
b = BaseGather()
assert b.json() == "{}"
b2 = BaseGather(data={"foo": "bar"})
... | [
{
"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 | tests/test_base.py | revsys/nodels |
class ContextualHelp(object):
"""
Contains the details for how Revit should allow invocation of contextual help for an item added by an application.
ContextualHelp(helpType: ContextualHelpType,helpPath: str)
"""
def Launch(self):
"""
Launch(self: ContextualHelp)
Launches and d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | release/stubs.min/Autodesk/Revit/UI/__init___parts/ContextualHelp.py | YKato521/ironpython-stubs |
import flow
from flow.module import Module, Linear
from flow.optim import SGD
from flow import function as F
import numpy as np
class Net(Module):
def __init__(self):
super().__init__()
self.fc1 = Linear(2, 10)
self.fc2 = Linear(10, 1)
def forward(self, a):
x = self.fc1(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 | example/nonlinear.py | Cjkkkk/Pyflow |
# flake8: noqa I201
from Token import SYNTAX_TOKEN_MAP
from kinds import kind_to_type
class Child(object):
"""
A child of a node, that may be declared optional or a token with a
restricted subset of acceptable kinds or texts.
"""
def __init__(self, name, kind, is_optional=False,
t... | [
{
"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 | utils/gyb_syntax_support/Child.py | marcelofabri/swift |
from torchflare.batch_mixers.mixers import cutmix, mixup, get_collate_fn
import torch
x = torch.randn(4, 3, 256, 256)
targets = torch.tensor([0, 1, 0, 1])
ds = torch.utils.data.TensorDataset(x, targets)
def test_mixup():
dl = torch.utils.data.DataLoader(ds, batch_size=2)
batch = next(iter(dl))
op, y = ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/mixers/test_mixers.py | earlbabson/torchflare |
#!/usr/bin/env python
from __future__ import print_function
from mpi4py import MPI
import numpy
import common
def bcast(comm):
n = 8192
print_mpi = common.create_print_mpi(comm)
# Allocate buffer and set value
if comm.rank == 0:
buf = numpy.arange(n).astype(numpy.float32)
else:
... | [
{
"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 | mpi/python/bcast.py | tyohei/examples |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from deja_vous.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | deja_vous/public/forms.py | Double-O-ren/deja_vous |
# GridPot code
# switch object class for integrating with a GridLAB-D simulation instance
# Author: sk4ld
import logging
import urllib2
logger = logging.getLogger(__name__)
from GL_obj import GL_obj
# base object class for integrating with a GridLAB-D simulation instance
class GL_TRANSFORMER(GL_obj):
def init_p... | [
{
"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 | gridpot-feeder/GL_TRANSFORMER.py | sk4ld/vagrant-skyline-puppet |
import os
import json
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
class Action:
def __init__(self, card, config):
config.pop("action", None)
self.card = card
self.config = config
def env_vars_for_object(self, config, prefix):
env_vars = {}
config.pop("... | [
{
"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 | scanner/actions/action.py | Eerovil/magic-cards |
"""empty message
Revision ID: 5ef0893617c2
Revises:
Create Date: 2021-09-08 18:56:44.000447
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5ef0893617c2'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"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 | migrations/versions/5ef0893617c2_.py | rsteger04/cs501-t1-assessment |
def fermat(num):
"""Runs a number through 1 simplified iteration of Fermat's test."""
if ((2 ** num) - 2) % num == 0:
return True
else: return False
def gen_primes(maxnum):
"""Generates primes using fermat"""
if maxnum % 2 == 0: # finds odd number
maxnum -= 1
num = maxnum
wh... | [
{
"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 | functionalities/prime_test.py | BorekZnovustvoritel/AKR-projekt |
"""empty message
Revision ID: 780c29109b25
Revises: 911cc5d772fc
Create Date: 2020-08-30 15:22:15.026266
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "780c29109b25"
down_revision = "911cc5d772fc"
branch_labels = None
depends_on = None
def... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/780c29109b25_.py | mutalisk999/Flog |
from flask.views import MethodView
from flask import jsonify
from Services.Event.MetuEventsDb import MetuEventsDb
class UpcomingRaw(MethodView):
def get(self):
return jsonify(RawUpcomingEvents=self.getRawUpcomingEvents())
def getRawUpcomingEvents(self):
db = MetuEventsDb()
events = db... | [
{
"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 | src/Services/Event/UpcomingRaw.py | MetuMobile/server-side |
from collections import OrderedDict
import torch
import torchvision
from catalyst import utils
from catalyst.dl import ConfigExperiment
class CIFAR10(torchvision.datasets.CIFAR10):
"""`CIFAR10 <https://www.cs.toronto.edu/~kriz/cifar.html>`_ Dataset."""
def __getitem__(self, index: int):
"""Fetch a ... | [
{
"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 | examples/cifar_stages/experiment.py | baajur/catalyst |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... | [
{
"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 | empower/managers/ranmanager/vbsp/vbspmanager.py | EstefaniaCC/empower-runtime-5g-essence-multicast |
from __future__ import absolute_import, unicode_literals
import logging
import pytest
from psd_tools.api.psd_image import PSDImage
from ..utils import full_name
logger = logging.getLogger(__name__)
@pytest.fixture
def layer_mask_data():
return PSDImage.open(full_name('layer_mask_data.psd'))
def test_layer_m... | [
{
"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 | tests/psd_tools/api/test_mask.py | mrstephenneal/psd-tools2 |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
""" cria e salva um novo usuário"""
if... | [
{
"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 | app/core/models.py | errnanee/recipe-app-api |
from __future__ import (
annotations,
)
from typing import (
Generator,
NoReturn
)
class StdReader:
def __init__(
self,
) -> NoReturn:
import sys
self.buf = sys.stdin.buffer
self.lines = (
self.async_readlines()
)
self.chunks: Generator
def async_readlines(
self,
)... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | src/atcoder/abc012/a/sol_0.py | kagemeka/competitive-programming |
import sys
import numpy as np
import tensorflow as tf
import tf_encrypted as tfe
config = tfe.get_config()
if len(sys.argv) > 1:
#
# assume we're running as a server
#
player_name = str(sys.argv[1])
server = config.server(player_name)
server.start()
server.join()
else:
#
# as... | [
{
"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 | examples/deprecated/inputs.py | yanndupis/tf-encrypted |
# Copyright (c) Anish Acharya.
# Licensed under the MIT License
import numpy as np
from .base_gar import GAR
from scipy import stats
from typing import List
"""
Computes Trimmed mean estimates
Cite: Yin, Chen, Ramchandran, Bartlett : Byzantine-Robust Distributed Learning: Towards Optimal Statistical Rates
"""
class ... | [
{
"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/aggregation_manager/trimmed_mean.py | anishacharya/BGMD |
import torch
import torchvision
from torchvision import models
from collections import namedtuple
class Vgg16(torch.nn.Module):
def __init__(self, requires_grad=False):
super(Vgg16, self).__init__()
vgg_pretrained_features = models.vgg16(pretrained=True).features # 获取预训练vgg网络层
self.slice1 ... | [
{
"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 | models/vgg16.py | lizhipengTouch/CSA-inpainting |
# Generated by Django 3.2.1 on 2021-05-17 04:17
from django.db import migrations
from django.db.models import F
from django.db.models.functions import Upper
from manual.operations.manual_operations import ManualOperation
def one_off_delete_case_sensitive_aliases(apps, schema_editor):
GeneSymbolAlias = apps.get_... | [
{
"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 | genes/migrations/0031_one_off_gene_symbol_alias.py | SACGF/variantgrid |
"""
``name_index`` builds an inverted index mapping words to sets of Unicode
characters which contain that word in their names. For example::
>>> index = name_index(32, 65)
>>> sorted(index['SIGN'])
['#', '$', '%', '+', '<', '=', '>']
>>> sorted(index['DIGIT'])
['0', '1', '2', '3', '4', '5', '6', '... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | 08-def-type-hints/charindex.py | hdcpereira/example-code-2e |
from django.shortcuts import get_object_or_404, render
# Create your views here.
from .models import People
def index(request):
all_people = People.objects.all()
context = {'all_people': all_people}
return render(request, 'people/index.html', context)
def detail(request, name):
person = get_object_or... | [
{
"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 | people/views.py | jasper-muller/personal_finance |
from django.db import models
class Question(models.Model):
enable = models.BooleanField("Question enabled", default=False)
message = models.CharField(max_length=255, null=False)
min_num_chosen = models.IntegerField("Minimum choices that must be chosen", default=1, null=False)
max_num_chosen = models.I... | [
{
"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 | voting/models.py | LouYu2015/voting-server |
"""
A NeuralNet is just a collection of layers.
It behaves a lot like a layer itself, although
we're not going to make it one.
"""
from typing import Sequence, Iterator, Tuple
from .tensor import Tensor
from .layers import Layer
class NeuralNet:
def __init__(self, layers: Sequence[Layer]) -> None:
self.l... | [
{
"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 | src/tensra/nn.py | poghostick/tensra |
import torch
import nvidia_smi
import psutil
class HardwareStats():
def __init__(self):
super().__init__()
self.device = torch.device(
"cuda:0" if torch.cuda.is_available() else "cpu")
nvidia_smi.nvmlInit()
self.handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0)
def... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/utils/hardware_stats.py | LuizPitaAlmeida/image_caption_generator |
import re
from itertools import product, count
from aoc_utils import Vec, dirs4
from aocd import get_data
def part1(inp):
return sum(c1 != c2 and u1 != 0 and u1 <= a2 for (c1, (u1, a1)), (c2, (u2, a2)) in product(inp.items(), repeat=2))
def part2(inp):
mapp = inp.copy()
hole, holecap = next((c, a) for ... | [
{
"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 | 2016/22.py | bernikr/advent-of-code |
# coding: utf-8
import re
class CanonicalPhoneGenerationException(Exception):
pass
def gen_canonical_phone(original_phone, first_number='7', check_code=True):
# удалим все не цифровые символы
phone = re.sub('\D', '', original_phone)
if not (10 <= len(phone) <= 11):
raise CanonicalPhoneGener... | [
{
"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 | swutils/phone.py | Egorka96/sw-python-utils |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#author:DWBH
#Exploit Title : Wordpress N-Media Website Contact Form with File Upload 1.3.4
import sys
import re
def assign(service, arg):
if service == "wordpress":
return True, arg
def audit(arg):
uploader=''
payload='/wp-admin/admin-aja... | [
{
"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 | Bugscan_exploits-master/exp_list/exp-753.py | csadsl/poc_exp |
"""
C preprocessor nodes supported by ctree.
"""
from ctree.nodes import CtreeNode
class CppNode(CtreeNode):
"""Base class for all C Preprocessor nodes in ctree."""
def codegen(self, indent=0):
from ctree.cpp.codegen import CppCodeGen
return CppCodeGen(indent).visit(self)
def label(sel... | [
{
"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 | ctree/cpp/nodes.py | zanellia/ctree |
__version__ = '4.0.0'
from social_core.backends.base import BaseAuth
# django.contrib.auth.load_backend() will import and instanciate the
# authentication backend ignoring the possibility that it might
# require more arguments. Here we set a monkey patch to
# BaseAuth.__init__ to ignore the mandatory strategy argume... | [
{
"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 | social_django/__init__.py | boyd-bit-io/social-app-django |
from ..utils.formats import flatten_dict
DENYLIST_ENDPOINT = ['kms', 'sts']
DENYLIST_ENDPOINT_TAGS = {
's3': ['params.Body'],
}
def truncate_arg_value(value, max_len=1024):
"""Truncate values which are bytes and greater than `max_len`.
Useful for parameters like 'Body' in `put_object` operations.
""... | [
{
"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 | reference/ddtrace/ext/aws.py | stschenk/opentelemetry-python-contrib |
# -*- coding: utf-8 -*-
from flask import template_rendered, url_for
from contextlib import contextmanager
import unittest
from application import create_app
class BaseTestCase(unittest.TestCase):
def __call__(self, result=None):
self._pre_setup()
super(BaseTestCase, self).__call__(result)
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | common/tests.py | jyothishankit/flask-example |
#! /usr/bin/env python
from pyquaternion import Quaternion
import numpy as np
from rclpy.node import Node
from px4_msgs.msg import VehicleGlobalPosition
class PX4PositionFeedback:
def __init__(self, system_state, time_delta):
self.node = Node('position_feedback')
self.system_state = system_state... | [
{
"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 | robot_framework/position_feedback/px4.py | abarcis/robot-framework |
#
# Copyright 2016-2019 Crown Copyright
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | python-shell/src/example_pki.py | sw96411/gaffer-tools |
# -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
import json
import httplib
from conpaas.core import https
def _check(response):
"""Check the given HTTP response, returning the result if everything went
fine"""
code, body = response
if code != httplib.OK:
... | [
{
"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 | conpaas-services/src/conpaas/services/htc/agent/client.py | bopopescu/conpaas |
from firstclasspostcodes.configuration import Configuration
class TestConfigurationClass:
def test_base_url_works_correctly(self):
config = Configuration(protocol='http', host='example.com', base_path='/test')
assert config.base_url() == 'http://example.com/test'
def test_request_params_works... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/test_configuration.py | firstclasspostcodes/firstclasspostcodes-python |
# -*- coding: utf-8 -*-
from zvt.domain import DividendDetail
from zvt.recorders.eastmoney.common import EastmoneyPageabeDataRecorder
from zvdata.utils.time_utils import to_pd_timestamp
class DividendDetailRecorder(EastmoneyPageabeDataRecorder):
data_schema = DividendDetail
url = 'https://emh5.eastmoney.com... | [
{
"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 | zvt/recorders/eastmoney/dividend_financing/dividend_detail_recorder.py | freedom6xiaobai/zvt |
from ..base import CacheBackend
class LocMemCacheBackend(CacheBackend):
scheme = 'locmem'
def __init__(self, **config):
super(LocMemCacheBackend, self).__init__(**config)
self._cache = {}
self.calls = 0
self.hits = 0
self.misses = 0
self.sets = 0
def clea... | [
{
"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 | cio/backends/locmem/backend.py | andreif/content-io |
class MatrixMcls(type):
def __getitem__(cls, data):
return cls(data)
def __repr__(self):
return "M[]"
class M(metaclass=MatrixMcls):
__slots__ = ("data", "shape", "dims", "dtype")
def __init__(self, data):
try:
data = list(data)
except TypeError:
... | [
{
"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 | calcpy/matrix.py | Ricyteach/calcpy |
from google.appengine.ext import webapp
from wsgiref.handlers import CGIHandler
from model import Membership
from model import Group
class WhoHandler(webapp.RequestHandler):
def get(self):
page = self.request.get('p');
if page is None or page == '':
page = 1
else:
page = int(page)
of... | [
{
"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 | who.py | manastech/de-bee |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: Mu yanru
# Date : 2019.3
# Email : muyanru345@163.com
###################################################################
from dayu_widgets3.collapse import MCollapse
from dayu_widgets3.label im... | [
{
"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 | examples/collapse_example.py | muyr/dayu_widgets3 |
'''
Builder for Skills HTML
'''
# ----- Local Imports -----
import importlib
common = importlib.import_module('src.python.common')
# ----- Local Helpers -----
# Build HTML from JSON
def build(fType, fName, j):
t = "skills"
html = f"<script>i.{t} = {str(len(j))};</script><p class='iconHeader'>"+t.capitalize()... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | src/python/skillsBuilder.py | AlexShukhman/alexshukhman.github.io |
import logging
import sys
from pathlib import Path
from dotenv import load_dotenv
from flask import Flask
from code_runner.extensions import db, limiter
from . import code
def create_app(config_object='code_runner.settings'):
"""Creates and returns flask app instance as well as register all the extensions and b... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | code_runner/app.py | thephilomaths/code-runner-as-a-service |
from django.shortcuts import render
from basic_app import forms
def index(request):
return render(request,'basic_app/index.html')
def my_form_view(request):
if request.method == 'POST':
print('psteeeeed')
form = forms.my_form(request.POST)
# print(form)
# print ("name " + form.... | [
{
"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 | django_c/forms_practice/basic_app/views.py | mohammad716e/python_training |
from pathlib import Path
import numpy as np
import librosa
import tensorflow as tf
def load_data():
data_paths = [str(x) for x in Path('.').glob('../data/*.wav')]
for path in data_paths:
y, sr = librosa.load(path)
feature = librosa.feature.mfcc(y=y, sr=sr)
def load_label():
text_paths =... | [
{
"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 | speech.py | Cieeiee/speech_recognition |
from aocd import get_data
directions = [(1, 1), (1, 0), (1, -1), (0, 1), (0, -1), (-1, 1), (-1, 0), (-1, -1)]
def simulate(m, limit, neighbors_function):
rules = {
'.': lambda m, x, y: '.',
'L': lambda m, x, y: '#' if neighbors_function(m, x, y) == 0 else 'L',
'#': lambda m, x, y: 'L' if ... | [
{
"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 | 2020/11.py | bernikr/advent-of-code |
# -*- coding: utf-8 -*-
# a może teraz?
"""
A drop-in replacement for the Mic class that gets input from
named pipe. It can be anny source, by here the goal is to
communicate with www flask server, where voice recognition
is done through chrome browser. We get plain text with
no need for stt engine (chrome browser uses... | [
{
"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/pipe_mic.py | HubertReX/jasper-client |
#copyright openpyxlzip 2010-2018
"""
Excel office art descriptors
"""
from openpyxlzip.xml.constants import REL_NS, DRAWING_NS, DRAWING_16_NS, DRAWING_14_NS
from openpyxlzip.compat import safe_string
from openpyxlzip.xml.functions import Element
from openpyxlzip.descriptors import (
Typed,)
from . import (
M... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | openpyxlzip/descriptors/office_art.py | ankitJoshi03/openpyxlzip |
from typing import Any
import sys
import time
import os
import tempfile
class Logger2():
def __init__(self, file1: Any, file2: Any):
self.file1 = file1
self.file2 = file2
def write(self, data: str) -> None:
self.file1.write(data)
self.file2.write(data)
def flush(self) -> ... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | mlprocessors/consolecapture.py | flatironinstitute/mountaintools |
from functools import wraps
def uses_django_db(f):
"""Ensures Django discards any broken database connections
Django normally cleans up connections once a web request has
been processed. However, here we are not serving web requests
and are outside of Django's request handling logic. We therefore
... | [
{
"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 | lightbus/utilities/django.py | adamcharnock/lightbus |
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import LETTER
class FooterCanvas(canvas.Canvas):
def __init__(self, *args, is_booklet=False, font_name='Times-Roman', **kwargs):
canvas.Canvas.__init__(self, *args, **kwargs)
self.pages = []
self.is_booklet = is_booklet
... | [
{
"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 | footer.py | donkirkby/donimoes |
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from django.utils.translation import get_language
class LanguageCookieMiddleware(MiddlewareMixin):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = ... | [
{
"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 | cms/middleware/language.py | devyntk/django-cms |
import urllib3
import random
import string
from util.conf import CROWD_SETTINGS
from util.api.crowd_clients import CrowdRestClient
from util.project_paths import CROWD_USERS
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
USERS = "users"
DEFAULT_USER_PASSWORD = 'password'
DEFAULT_USER_PREFIX = ... | [
{
"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 | app/util/data_preparation/crowd_prepare_data.py | RaimisJ/dc-app-performance-toolkit |
from fastapi import FastAPI
import uvicorn
import csv
import numpy as np
import pytest
app = FastAPI()
kwh_price = []
grid_fees = []
unit_price = []
hs_splitter = []
zp_cde = []
cty = []
strt = []
def tariff_gen(postal_code, city, street, house_number,ykc ):
file = open('location_prices.csv', encoding="utf-8")
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | main.py | umerkhan1995/testapi |
import unittest
class TestClassUT(unittest.TestCase):
def test__ut_fail(self):
self.fail("Not implemented")
def test__ut_pass(self):
pass
if __name__ == '__main__':
unittest.main()
| [
{
"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 | Python/Tests/TestData/TestExplorerPytest/test_ut.py | techkey/PTVS |
import torch
from torch.autograd import Variable
from scatwave import Scattering1D
from scatwave import fetch_fsdd
import matplotlib.pyplot as plt
from scipy.io import wavfile
import numpy as np
import os
def loadfile(path_file):
sr, x = wavfile.read(path_file)
x = np.asarray(x, dtype='float')
# make it m... | [
{
"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 | kymatio/phaseexp1d/pyscatwave/scatwave/scattering1d/examples/real_signal.py | sixin-zh/kymatio_wph |
"""
An example module for the homework
(hint 1: you can read this comment using: `homeworkmodule.__doc__`)
"""
def func1(param1: int, param2: dict[str, int]):
"""
This function has two parameters
(hint 2: you can read this comment using: `homeworkmodule.func1.__doc__`)
(hint 3: you can read the annota... | [
{
"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 | HW2/EX1/homeworkmodule.py | ShmuelLa/research-algorithms |
class USResident(Person):
"""
A Person who resides in the US.
"""
def __init__(self, name, status):
"""
Initializes a Person object. A USResident object inherits
from Person and has one additional attribute:
status: a string, one of "citizen", "legal_resident",... | [
{
"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 | 6.00.1x/Final Exam/P5Resident.py | MErmanProject/My-Projects |
from flask import Flask, render_template, redirect, abort, send_file
from flaskext.markdown import Markdown
import os.path
from config import config
app = Flask(__name__)
Markdown(app)
site_title=config['site_title']
site_all_notification=config['site_all_notification']
footer='<small class="m-0 text-center text-whi... | [
{
"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 | app.py | tylerhand/cals-floor |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
super().__init__()
'''初始化飞船并设置其初始位置'''
self.screen = screen
self.ai_settings = ai_settings
# 加载飞船图像并获取其外接矩形
self.image = pygame.image.load('../images/ship.png... | [
{
"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 | source/ship.py | seveirbian/Plane-game |
# coding: utf-8
"""
Molecule API Documentation
The Hydrogen Molecule API # noqa: E501
OpenAPI spec version: 1.3.0
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import molecule_api... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | molecule/python/test/test_token_supply_response.py | sumit4-ttn/SDK |
import cv2
import tensorflow as tf
TFRECORD_PATH = '../tfrecord/member.tfrecord'
def main():
data_set = tf.data.TFRecordDataset(TFRECORD_PATH)
data_set = data_set.map(parse_function)
data_set = data_set.shuffle(buffer_size=9)
data_set = data_set.batch(3)
iterator = data_set.make_initializable_ite... | [
{
"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 | 14/record_dataset.py | jason9075/ithome_tensorflow_series |
import argparse
from dataclasses import dataclass
import io
import re
import sys
from typing import Iterator
PYTHON = re.compile(r"(\w+):.*")
GO = re.compile(r"(\w+) +.*")
@dataclass
class CommandLineOptions:
infile: io.TextIOWrapper
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentP... | [
{
"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 | mapargs/command_line.py | conanfanli/mapargs |
from collections import Counter
class Solution:
def permuteUnique(self, nums):
"""
Time complexity: (N - w) * O(Summation of P(N-w, k))
w = number of duplicate elements
P(N - w, k) := permutation of unique elements of k from N - w elements
P(N - w, k) = (N-w)!/(N-... | [
{
"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 | leetcode/google/tagged/medium/permutation_ii.py | alvinctk/google-tech-dev-guide |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-12 20:49
from __future__ import unicode_literals
from django.db import migrations, models
def copy_site_to_sites(apps, schema_editor):
current_database = schema_editor.connection.alias
PageBase = apps.get_model('wizard_builder.PageBase')
for... | [
{
"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 | wizard_builder/migrations/0006_many_sites.py | SexualHealthInnovations/django-wizard-builder |
from sacred import Experiment
from Config import config_ingredient
import tensorflow as tf
import numpy as np
import os
import Datasets
import Utils
import Models.UnetAudioSeparator
ex = Experiment('Waveunet Preprocessing', ingredients=[config_ingredient])
@ex.config
# Executed for training, sets the seed value to t... | [
{
"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 | scripts/preprocess.py | matangover/Wave-U-Net |
import json
import logging
import requests
logger = logging.getLogger(__name__)
class HealthCheck():
def __init__(self, backup_config):
self.backup_name = backup_config['Name']
self.url = backup_config['HealthCheckUrl']
def push(self, initialize=None, failure=None):
logger.debug(
... | [
{
"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 | backup_finalize/healthcheck.py | hwwilliams/backup-tarfile-s3 |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
{
"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 | neptune/new/internal/websockets/websockets_factory.py | neptune-ml/neptune-client |
import json, os
class GarfData:
file = os.path.join(os.getcwd(), "garf_data.json")
token: str
path_to_ffmpeg: str
jokes: list
trigger_words: list
def __init__(self):
with open(self.file, "r") as f:
json_dict = json.loads(f.read())
self.token = json_dict["token"]
... | [
{
"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 | garf_data.py | doesnotsitproperly/garfbot |
import sublime
import os
import sys
DEBUG = None
def set_log_level(log_level):
global DEBUG
DEBUG = log_level
def log_debug(line):
"""
Write debug output, if enabled, to stdout (Sublime console)
"""
global DEBUG
if DEBUG:
sys.stdout.write(line + "\n")
sys.stdout.flus... | [
{
"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 | log.py | jdebug/JDebug |
import os
import time
import boto3
import logging
from botocore.client import Config
from botocore.exceptions import ClientError
from src.config import Config as AppConfig
logger = logging.getLogger("GW:s3")
class S3Client:
def __init__(self, url, access_key, secret_key):
self.url = url
self.s3 =... | [
{
"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 | s3_sync/src/utils/s3_client.py | upworkroozbeh/k8-test-data |
"""The dagster-airflow operators."""
from dagster_airflow.operators.util import invoke_steps_within_python_operator
from dagster_airflow.vendor.python_operator import PythonOperator
class DagsterPythonOperator(PythonOperator):
def __init__(self, dagster_operator_parameters, *args, **kwargs):
def python_ca... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | python_modules/libraries/dagster-airflow/dagster_airflow/operators/python_operator.py | dbatten5/dagster |
from redis import StrictRedis as Redis
from pathlib import Path
import hashlib
import time
lua_script_path = Path(__file__).parent / 'ratelimit.lua'
with open(lua_script_path) as f:
LUA_SCRIPT = f.read()
del lua_script_path # don't want it polluting the module
class RateLimit(object):
def __init__(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | updater/update/ratelimit.py | codl/status.chitter.xyz |
# https://leetcode.com/problems/find-substring-with-given-hash-value/
# Concept : https://www.youtube.com/watch?v=BfUejqd07yo
# Solution : https://www.youtube.com/watch?v=P7dX86HdNqc&t=895s
# Solution : https://www.youtube.com/watch?v=bmX2_mal8YQ&t=611s
class Solution(object):
# Submittted by @Jiganesh
... | [
{
"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 | strings/findSubstringWithGivenHashValue.py | kushvr7/High-On-DSA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.