source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from flask_wtf import Form
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
from app.models import User
class LoginForm(Form):
openid = StringField('openid', validators=[DataRequired()])
remember_me = BooleanField('remember_me', default=False)
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | app/forms.py | Stephanie-Spears/Microblog-Flask |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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 | kubernetes_asyncio/test/test_v2beta2_horizontal_pod_autoscaler_list.py | PidgeyBE/kubernetes_asyncio |
import tensorflow as tf
import cv2 as cv
import numpy as np
from PIL import Image
from core import utils
classesPath = "../../data/coco.names"
modelPath = "../../checkpoint/yolov3_cpu_nms.pb"
IMAGE_H, IMAGE_W = 416, 416
classes = utils.read_coco_names(classesPath)
num_classes = len(classes)
input_tensor, output_tens... | [
{
"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 | detection/yolov3/yolov3.py | benoitLemoine/stage2A |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 IBM 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 ... | [
{
"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 | tests/core_test.py | ToThAc/cpi-breakdown |
from concurrent import futures
import time
import grpc
import app.helloworld_pb2 as helloworld_pb2
import app.helloworld_pb2_grpc as helloworld_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def Greet(self, request, context):
print('Saying `hello` to %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 | app/server.py | betandr/grpcdemo |
import pytest
from thefuck.rules.git_rebase_no_changes import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''Applying: Test commit
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced t... | [
{
"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 | tests/rules/test_git_rebase_no_changes.py | HiteshMah-Jan/thefuck |
from uuid import uuid4
class SpanContext:
def __init__(self, trace_id: str = None, span_id: str = None):
self.__trace_id = trace_id if trace_id else uuid4().hex
self.__span_id = span_id if span_id else uuid4().hex[16:]
@property
def trace_id(self) -> str:
return self.__trace_id
... | [
{
"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 | trace/spancontext.py | iredelmeier/doughknots |
from typing import Generic, TypeVar, List, Optional
T = TypeVar('T')
class Stack(Generic[T]):
def __init__(self):
self.items: List[T] = []
def empty(self) -> bool:
return len(self.items) == 0
def push(self, item: T):
self.items.append(item)
def pop(self) -> T:
retu... | [
{
"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 | stx/utils/stack.py | bakasoft/stx |
"""
The SerialDevice class:
a device that communicates through the serial port.
"""
from device import Device
import serial
import ctypes
from serial.tools import list_ports
__all__ = ['SerialDevice']
class SerialDevice(Device):
'''
A device that communicates through the serial port.
'''
def __init__(... | [
{
"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 | OPTIMAQS/controller/controller/serialdevice.py | jeremyforest/whole_optic_gui |
from airypi.remote_obj import send_to_device
def multi():
send_to_device({'type': 'transaction',
'func': 'begin'})
def execute():
send_to_device({'type': 'transaction',
'func': 'execute'})
def sleep(duration):
send_to_device({'type': 'transaction',
... | [
{
"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 | airypi/action_queue.py | airypi/airypi |
# Copyright (C) 2013-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | [
{
"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 | contrib/gnu/gdb/dist/gdb/testsuite/gdb.perf/skip-prologue.py | TheSledgeHammer/2.11BSD |
# coding=utf-8
"""
The Landinge Page actions API endpoint
Documentation: https://mailchimp.com/developer/reference/landing-pages/
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class LandingPageAction(BaseApi):
"""
Manage your Landing Pages, including publishing and unpub... | [
{
"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 | mailchimp3/entities/landingpageaction.py | michaelwalkerfl/python-mailchimp |
from lemur.plugins.bases import DestinationPlugin
class TestDestinationPlugin(DestinationPlugin):
title = 'Test'
slug = 'test-destination'
description = 'Enables testing'
author = 'Kevin Glisson'
author_url = 'https://github.com/netflix/lemur.git'
def __init__(self, *args, **kwargs):
... | [
{
"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 | lemur/tests/plugins/destination_plugin.py | x-lhan/lemur |
import threading
# Thread running server processing loop
class ServerThread(threading.Thread):
"""
A helper class to run server in a thread.
The following snippet runs the server for 4 seconds and quit::
server = SimpleServer()
server_thread = ServerThread(server)
server_thread.st... | [
{
"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 | pcaspy/tools.py | dchabot/python-pcaspy |
import pymongo
from bson import ObjectId
from src.services import config
collection = config.db.incomes
def search_by_user_email(user_email, itype):
return collection.find({"user_email": user_email, "itype": itype})
def sum_amounts_by_user(user_email, itype):
pipeline = [{"$match": {"user_email": user_ema... | [
{
"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 | src/services/incomesService.py | TTIP-UNQ-Team6/gastapp_back |
import os
import codecs
import re
from setuptools import setup
def read(*parts):
return codecs.open(os.path.join(os.path.dirname(__file__), *parts)).read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
... | [
{
"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 | setup.py | jazzband/django-sorter |
import pandas
import os
path, _ = os.path.split(__file__)
kidera_factors = pandas.read_csv(os.path.join(path, 'kidera.csv'),
header=None,
index_col=0)
symbol_lookup = { 'ALA': 'A', 'ARG': 'R',
'ASN': 'N', 'ASP': 'D',
... | [
{
"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 | Kidera/kidera.py | IdoSpringer/TCR-PEP-Classification |
from invoke import task
@task
def precheck(ctx):
ctx.run("black .")
ctx.run("pre-commit run -a")
ctx.run("interrogate -c pyproject.toml", pty=True)
@task
def clean(ctx):
ctx.run("python setup.py clean")
ctx.run("rm -rf netcfgbu.egg-info")
ctx.run("rm -rf .pytest_cache .pytest_tmpdir .coverag... | [
{
"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 | tasks.py | vivekvashist/demo-beginner-concurrency |
# Copyright (c) 2019 NVIDIA Corporation
import torch
import torch.nn as nn
from nemo.backends.pytorch.nm import LossNM
from nemo.core.neural_types import (NeuralType, AxisType, BatchTag, TimeTag,
ChannelTag)
class CTCLossNM(LossNM):
"""
Neural Module wrapper for pytorch's ... | [
{
"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 | collections/nemo_asr/nemo_asr/losses.py | Giuseppe5/NeMo |
import sys
sys.path.append('../python-mbus')
import pytest
from mbus import MBus
@pytest.fixture
def mbus_tcp():
return MBus.MBus(host="127.0.0.1")
def test_connect(mbus_tcp):
mbus_tcp.connect()
| [
{
"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 | tests/test_MBus_connect.py | droid4control/python-mbus |
class Solution:
# my solution
def prefixesDivBy5(self, A: List[int]) -> List[bool]:
res = []
tmp = 0
for n in A:
tmp = tmp * 2 + n
res.append(tmp % 5 == 0)
return res
# faster solution
# https://leetcode.com/problems/bina... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | LeetCode/easy - Array/1018. Binary Prefix Divisible By 5/solution.py | vincent507cpu/Comprehensive-Algorithm-Solution |
from django.http import HttpResponse
from django.utils.encoding import force_str
from form_designer.contrib.exporters import FormLogExporterBase
try:
import xlwt
except ImportError: # pragma: no cover
XLWT_INSTALLED = False
else: # pragma: no cover
XLWT_INSTALLED = True
class XlsExporter(FormLogExport... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | form_designer/contrib/exporters/xls_exporter.py | kcsry/django-form-designer |
# ============================================================================
# FILE: matcher_full_fuzzy.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
import re
from deoplete.base.filter import Base
from... | [
{
"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 | rplugin/python3/deoplete/filter/matcher_full_fuzzy.py | kazufusa/deoplete.nvim |
import string
import random
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
from otp.chat import ChatGarbler
class ToonChatGarbler(ChatGarbler.ChatGarbler):
animalSounds = {'dog': TTLocalizer.ChatGarblerDog,
'cat': TTLocalizer.ChatGarblerCat,
'mouse': TTLocalizer.ChatGarble... | [
{
"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 | toontown/chat/ToonChatGarbler.py | philicheese2003/ToontownProjectAltisServer |
"""String utilities.
"""
# Author Info
__author__ = 'Vishwajeet Ghatage'
__date__ = '17/07/21'
__email__ = 'cloudmail.vishwajeet@gmail.com'
# Library Imports
import random
import string
from datetime import datetime
# Own Imports
from src import settings
def verification_code() -> str:
"""Generate verification... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | src/utils/string_utils.py | codespacedot/CodeSpaceAPI |
import numpy as np
import haiku as hk
import jax
import jax.numpy as jnp
class Actor(hk.Module):
def __init__(self,action_size,node=256,hidden_n=2):
super(Actor, self).__init__()
self.action_size = action_size
self.node = node
self.hidden_n = hidden_n
self.layer = hk.Linear... | [
{
"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 | haiku_baselines/TD3/network.py | TinkTheBoush/haiku-baseline |
# pass test
import numpy as np
def prepare_input(input_size):
return [np.random.rand(input_size), np.random.rand(input_size)]
def test_function(input_data):
return np.convolve(input_data[0], input_data[1])
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | tests/python/tests/conv/test.py | Ashymad/praca.inz |
from typing import Optional, List
import logging
import torch
logger = logging.getLogger(__name__)
class Batch:
def __init__(
self,
x: torch.Tensor,
y: torch.Tensor,
x_len: Optional[torch.Tensor] = None,
y_len: Optional[torch.Tensor] = None,
paths: Optional[List... | [
{
"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/data/batch.py | marka17/digit-recognition |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | [
{
"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 | contrib/runners/winrm_runner/winrm_runner/winrm_ps_command_runner.py | nickbaum/st2 |
import ciso8601
import dateutil.parser
from cartographer.field_types import SchemaAttribute
from cartographer.utils.datetime import as_utc, make_naive
class DateAttribute(SchemaAttribute):
@classmethod
def format_value_for_json(cls, value):
return as_utc(value).isoformat()
def from_json(self, s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | cartographer/field_types/date_attribute.py | Patreon/cartographer |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from startapp.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... | [
{
"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 | startapp/public/forms.py | samsonpaul/startapp |
from dagster import check
from .system import SystemStepExecutionContext
class StepExecutionContext(object):
__slots__ = ['_system_step_execution_context', '_legacy_context']
def __init__(self, system_step_execution_context):
self._system_step_execution_context = check.inst_param(
system... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | python_modules/dagster/dagster/core/execution/context/step.py | jake-billings/dagster |
"""The tests for day17."""
from days import day17
from ddt import ddt, data, unpack
import unittest
import helpers
@ddt
class MyTestCase(unittest.TestCase): # noqa D101
@data(
[[
'x=495, y=2..7',
'y=7, x=495..501',
'x=501, y=3..7',
'x=498, y=2..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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | test/test_day17.py | frangiz/AdventOfCode2018 |
# encoding: utf-8
from .item import Item
from .mix import ConfigurationMixIn, DeletionMixIn, DescriptionMixIn
class Views(Item):
'''
classdocs
'''
def __init__(self, owner):
'''
Constructor
'''
self.owner = owner
super().__init__(owner.jenkins, owner.url)
... | [
{
"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 | api4jenkins/view.py | pquentin/api4jenkins |
from sys import argv, stdin
def cut(input_file, *args):
options = process_options(*args)
delimiter = d_option(options["-d"])
lines = input_file.readlines()
columns = [item.split(delimiter) for item in lines]
scope = f_option(options["-f"], len(columns[0]))
out_scope = []
for x in scope:
... | [
{
"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 | SandBox/Practicals_05_Cut.py | MichalKyjovsky/NPRG065_Programing_in_Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
# Local script to test.
from fibonacci import fib
class FibonacciTest(unittest.TestCase):
def test(self):
self.assertEqual(0, fib(0))
self.assertEqual(1, fib(1))
self.assertEqual(1, fib(2))
self.assertEqual(2, fib(3))... | [
{
"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 | src/fibonacci_test2.py | skitazaki/python-school-ja |
import quart
from views import city_api
from views import home
from config import settings
import services.weather_service
import services.sun_service
import services.location_service
app = quart.Quart(__name__)
is_debug = True
app.register_blueprint(home.blueprint)
app.register_blueprint(city_api.blueprint)
def co... | [
{
"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 | src/10-async-web/acityscape_api/app.py | NissesSenap/async-techniques-python-course |
__author__ = 'patras'
from domain_searchAndRescue import *
from timer import DURATION
from state import state
def GetCostOfMove(r, l1, l2, dist):
return dist
DURATION.TIME = {
'giveSupportToPerson': 15,
'clearLocation': 5,
'inspectPerson': 20,
'moveEuclidean': GetCostOfMove,
'moveCurved': GetC... | [
{
"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 | problems/SR/auto/problem35_SR.py | sunandita/ICAPS_Summer_School_RAE_2020 |
from typing import Iterable, Optional
from app.integrations.mailchimp import exceptions
from app.integrations.mailchimp.http import MailchimpHTTP
from app.integrations.mailchimp.member import MailchimpMember
from users.models import User
class AppMailchimp:
def __init__(self):
self.http = MailchimpHTTP()... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritan... | 3 | src/app/integrations/mailchimp/client.py | tlgtaa/education-backend |
# swift_build_support/products/indexstoredb.py -------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... | [
{
"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 | utils/swift_build_support/swift_build_support/products/indexstoredb.py | orakaro/swift |
import numpy as np
from unittest import TestCase
from datumaro.components.project import Dataset
from datumaro.components.extractor import DatasetItem
from datumaro.plugins.image_dir import ImageDirConverter
from datumaro.util.test_utils import TestDir, test_save_and_load
class ImageDirFormatTest(TestCase):
def... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/test_image_dir_format.py | detecttechnologies/datumaro |
from unittest.mock import patch
import pytest
from model.agents.student.activities import IdleActivity, StudySessionActivity
__author__ = 'e.kolpakov'
class TestIdleActivity:
@pytest.mark.parametrize("length", [10, 15, 20, 3, 7, 11])
def test_activate_sends(self, student, env, length):
activity = ... | [
{
"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/agents/student/test_activities.py | e-kolpakov/study-model |
from circuit_ring_buffer import RingBuffer
'''
- 2021/12/20 ver.1.00
- Author : emguse
- License: MIT License
'''
class MovingAverage():
def __init__(self, length:int, zero_fill=True) -> None:
self.length = abs(length)
if self.length == 0:
self.length = 1
self.rb =... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | circuit_move_ave.py | emguse/Dec-2021 |
from d2dstore.manager import BaseManager
class StoreManager(BaseManager):
"""
Custom manager store model
"""
def __init__(self, *args, **kwargs):
super(StoreManager, self).__init__(*args, **kwargs)
def get_query_set(self):
query_set = super().get_queryset()
return query_set
| [
{
"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 | apps/stores/manager.py | AJAkimana/py-store |
import unittest
from jackedCodeTimerPY import JackedTiming, _Record, JackedTimingError
class TestCodeTimer(unittest.TestCase):
def test__Record(self):
record = _Record()
record.start()
self.assertTrue(record.started)
record.stop()
self.assertFalse(record.started)
self.assertTrue(len(record.... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests.py | brianpallangyo/jackedCodeTimerPY |
import re
import jieba
import jieba.posseg as pseg
def split2sens(text):
pstop = re.compile(rf'[。!??!…]”*')
sens = []
stoplist = pstop.findall(text)
senlist = []
for sen in pstop.split(text):
if len(sen) == 0:
continue
senlist.append(sen)
for i, sen in enumerate(sen... | [
{
"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 | nbt/splittext/splittext.py | fcoolish/All4NLP |
from re import X
from flask import Flask,render_template,url_for,request
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras import models
import numpy as np
import pickle
french_tokenizer = pickle.load(open('french_tokenize... | [
{
"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 | Model prediction/app.py | choudhury722k/English-to-French-translator |
############################################################################################
# Title: IoT JumpWay Helpers
# Description: Helper functions for IoT JumpWay programs.
# Last Modified: 2018-06-09
############################################################################################
import os, json, 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | Caffe/CaffeNet/components/Helpers.py | BreastCancerAI/IDC-Classifier |
#
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License 2.0;
# you may not use this file except in compliance with the Elastic License 2.0.
#
import multiprocessing
from multiprocessing.queues import Queue
BATCH_SIZE ... | [
{
"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 | ees_sharepoint/connector_queue.py | elastic/enterprise-search-sharepoint-server-2016-connector |
from __future__ import division, generators, print_function
import torch
import torch.nn as nn
import macarico
import macarico.util as util
from macarico.util import Var, Varng
class BOWActor(macarico.Actor):
def __init__(self, attention, n_actions, act_history_length=1, obs_history_length=0):
self.att_d... | [
{
"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 | macarico/actors/bow.py | bgalbraith/macarico |
# coding: utf-8
"""
spoonacular API
The spoonacular Nutrition, Recipe, and Food API allows you to access over 380,000 recipes, thousands of ingredients, 800,000 food products, and 100,000 menu items. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural lang... | [
{
"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 | test/test_inline_response20053_results.py | Lowe-Man/spoonacular-python-api |
import komand
from .schema import DeleteTagInput, DeleteTagOutput, Input, Output, Component
from ...util import project
class DeleteTag(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='delete_tag',
description=Component.DESCRIPTION,
... | [
{
"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 | viper/icon_viper/actions/delete_tag/action.py | killstrelok/insightconnect-plugins |
def sum(a, b):
"""Returns sum
Arguments:
a {int} -- Input 1
b {int} -- Input 2
Returns:
sum -- Sum
"""
return a + b
def difference(a, b):
"""Returns difference
Arguments:
a {int} -- Input 1
b {int} -- Input 2
Returns:
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | YearI/SemesterI/C++/Other/26-07-2019/numbers/main.py | sudiptog81/ducscode |
from netapp.netapp_object import NetAppObject
class DefaultGetIterKeyTd(NetAppObject):
"""
Key typedef for table ntdtest_multiple_with_default
"""
_key_2 = None
@property
def key_2(self):
"""
Field sfield3
"""
return self._key_2
@key_2.setter
def 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | generated-libraries/python/netapp/ntdtest/default_get_iter_key_td.py | radekg/netapp-ontap-lib-get |
#!/usr/bin/env python3
#!/usr/bin/python3
def reciprocal(n):
return 1.0 / n
def main():
v = 1
t = 1
l = t
for n in range(100):
r = reciprocal(t)
t = v + r
if l == t:
break
print(("t = %s" % str(t)))
l = t
main()
| [
{
"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 | python3/continued/continued1.py | jtraver/dev |
#
# VAZ Projects
#
#
# Author: Marcelo Tellier Sartori Vaz <marcelotsvaz@gmail.com>
from functools import partial
import re
from django.template import loader
def linkAttributes( self, tokens, index, options, env ):
'''
Add target and rel attributes to links.
'''
tokens[index].attrSet( 'rel', 'noopener'... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | application/commonApp/markdown_it_extensions.py | Marcelotsvaz/vaz-projects |
import os
from conda_build import api
def test_output_with_noarch_says_noarch(testing_metadata):
testing_metadata.meta['build']['noarch'] = 'python'
output = api.get_output_file_path(testing_metadata)
assert os.path.sep + "noarch" + os.path.sep in output[0]
def test_output_with_noarch_python_says_noarch... | [
{
"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 | tests/test_render.py | Bezier89/conda-build |
import gzip, zlib, base64
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
__copyright__ = """\
(c). Copyright 2008-2020, Vyper Logix Corp., All Rights Reserved.
Published under Creative Commons License
(http://creativecommons.org/licenses/by-nc/3.0/)
restricted to non-... | [
{
"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 | vyperlogix/zlib/zlibCompressor.py | raychorn/chrome_gui |
import re
from dataclasses import dataclass
import parse
INTEGER_REGEX = r'-?[0-9]+(,[0-9]{3})*'
NUMBER_REGEX = rf'({INTEGER_REGEX}(\.[0-9]+)?|infinity|-infinity)'
@parse.with_pattern(NUMBER_REGEX)
def parse_number(text: str) -> float:
number_text = re.compile(NUMBER_REGEX).search(text)
return float(number_... | [
{
"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/harness/cu_pass/dpa_calculator/helpers/parsers.py | NSF-Swift/Spectrum-Access-System |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
{
"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 | lib/surface/container/binauthz/create_signature_payload.py | google-cloud-sdk-unofficial/google-cloud-sdk |
# Django Imports
from django import forms
from django.utils.html import format_html
from django.utils.safestring import mark_safe
# Deprecated in Django 1.11
# forms.widgets.RadioChoiceInput
# https://docs.djangoproject.com/en/2.0/releases/1.11/#changes-due-to-the-introduction-of-template-based-widget-rendering
#clas... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | forms/widgets.py | goztrk/django-htk |
import torch
import numpy as np
def map_per_batch(fun, values, batch_indices):
result = []
for start, stop, value_slice in sliced_per_batch(values, batch_indices):
result.append(fun(start, stop, value_slice))
return torch.cat(result)
def sliced_per_batch(values, batch_indices):
slices = torc... | [
{
"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 | leanai/core/indexed_tensor_helpers.py | penguinmenac3/leanai |
# Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, check out LICENSE.md
import torch.nn as nn
class FeatureMatchingLoss(nn.Module):
r"""Compute feature matching loss"""
def __ini... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | imaginaire/losses/feature_matching.py | hw07216/imaginaire |
from freezegun import freeze_time
from salesforce_timecard.core import TimecardEntry
import pytest
import json
@freeze_time("2020-9-18")
@pytest.mark.vcr()
@pytest.mark.block_network
def test_list_timecard():
te = TimecardEntry("tests/fixtures/cfg_user_password.json")
rs = te.list_timecard(False, "2020-09-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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_timeentry.py | giuliocalzolari/pse_timecard |
#!/usr/bin/env python3
import serial
import re
from flask import Flask
app = Flask(__name__)
@app.route('/')
def return_heartbeat():
try:
data = readHeartbeat()
except Exception as err:
app.logger.error("Error: %s",err)
data = {'heartbeat': 'UNK', 'color': '#007fbf'}
return '''
<h... | [
{
"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 | webserver.py | mikewenk/heartbeat |
# Global Imports
import json
from collections import defaultdict
# Metaparser
from genie.metaparser import MetaParser
# =============================================
# Collection for '/mgmt/tm/cm/device-group' resources
# =============================================
class CmDevicegroupSchema(MetaParser):
sche... | [
{
"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 | src/genie/libs/parser/bigip/get_cm_device_group.py | balmasea/genieparser |
# Copyright (c) 2017-2020 Wenyi Tang.
# Author: Wenyi Tang
# Email: wenyitang@outlook.com
# Update: 2020 - 2 - 7
from importlib import import_module
from ..Backend import BACKEND
__all__ = [
'get_model',
'list_supported_models'
]
def get_model(name: str):
name = name.lower()
try:
if BACKEND == 'pyt... | [
{
"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 | VSR/Model/__init__.py | soufiomario/VideoSuperResolution |
from . import nodes
from ..fields import MongoengineConnectionField
def test_article_field_args():
field = MongoengineConnectionField(nodes.ArticleNode)
field_args = {"id", "headline", "pub_date"}
assert set(field.field_args.keys()) == field_args
reference_args = {"editor", "reporter"}
assert se... | [
{
"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 | graphene_mongo/tests/test_fields.py | pfrantz/graphene-mongo |
"""Solid definitions for the simple_pyspark example."""
import dagster_pyspark
from pyspark.sql import DataFrame, Window
from pyspark.sql import functions as f
from dagster import make_python_type_usable_as_dagster_type, solid
# Make pyspark.sql.DataFrame map to dagster_pyspark.DataFrame
make_python_type_usable_as_d... | [
{
"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 | examples/legacy_examples/dagster_examples/simple_pyspark/solids.py | bitdotioinc/dagster |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | [
{
"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 | learning/katas/python/Core Transforms/CoGroupByKey/CoGroupByKey/task.py | charithe/beam |
# -*- coding: utf-8 -*-
"""
(SHORT NAME EXPLANATION)
>>>DOCTEST COMMANDS
(THE TEST ANSWER)
@author: Yi Zhang. Created on Mon Jul 10 20:12:27 2017
Department of Aerodynamics
Faculty of Aerospace Engineering
TU Delft
#SUMMARY----------------
#INPUTS-----------------
#ESSEN... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | src/tests/Yi/tests/inner_product_between_lobatto_and_gauss.py | Idate96/Mimetic-Fem |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
{
"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 | umbrella/db/sqlalchemy/migrate_repo/versions/003_add_mem_table.py | xww/umbrella |
# coding: utf-8
"""
katib
swagger description for katib # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import katib
from katib.models.v1alpha3_trial_assignment import V1alpha... | [
{
"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 | sdk/python/test/test_v1alpha3_trial_assignment.py | PoornimaDevii/katib |
from typing import Union
from mpfmc.core.config_collection import ConfigCollection
class SlideCollection(ConfigCollection):
config_section = 'slides'
collection = 'slides'
class_label = 'SlideConfig'
def process_config(self, config: Union[dict, list]) -> dict:
# config is localized to an sin... | [
{
"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 | mpfmc/config_collections/slide.py | atummons/mpf-mc |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import sys
# codecov.io project token
import pypandoc
codecov_token = '' or os.environ.get('FORGIVE_DB_CODECOV_TOKEN')
base_dir = os.path.dirname(os.path.abspath(__file__))
sub_commands = {}
def run(*... | [
{
"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 | release.py | hui-z/ForgiveDB |
# -*- coding: utf-8 -*-
import os
import sys
import random
sourceDir = '/data/deresute-face'
trFile = 'train.txt'
teFile = 'test.txt'
mapFile = 'config/classes.py'
if len(sys.argv) != 3:
print ("usage %s trainNum testNum" % (sys.argv[0]))
exit()
datanum = int(sys.argv[1])
testnum = int(sys.argv[2])
def lis... | [
{
"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 | make-test.py | todorokit/tensorflow_cnn_image_sample |
import os
import yaml
import tensorflow as tf
from NMTmodel.NMT.dataset import data_util
cur_dir = os.path.dirname(os.path.abspath(__file__))
par_dir = os.path.dirname(cur_dir)
class DatasetTest(tf.test.TestCase):
def setUp(self):
self.config_file = os.path.join(par_dir, "config.yml")
def test_datas... | [
{
"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 | tests/dataset_test.py | MISStingting/NMTmodel |
"""friends.py: Implementation of class AbstractTwitterFriendCommand
and its subclasses.
"""
from . import AbstractTwitterCommand
from ..parsers import (
parser_user_single,
parser_count_users,
parser_count_users_many,
parser_cursor,
parser_skip_status,
parser_include_user_entities)
# GET frien... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",... | 3 | twmods/commands/friends.py | showa-yojyo/bin |
from enum import Enum
from unittest import TestCase
from marshy import dump, load, get_default_context
from marshy.errors import MarshallError
from marshy.factory.enum_marshaller_factory import EnumMarshallerFactory
class VehicleTypes(Enum):
CAR = 'car'
TRUCK = 'truck'
BIKE = 'bike'
class TestMarshallE... | [
{
"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 | test/test_marshall_enum.py | tofarr/marshy |
from django.test import TestCase
from lxml import html
import pytest
from projects.tests.factories import ProjectFactory, NominationFactory, ClaimFactory
@pytest.mark.django_db
class TestNominationDetailView:
def test_loads(self, client):
response = client.get(NominationFactory().get_absolute_url())
... | [
{
"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 | projects/tests/tests_nomination_views.py | CobwebOrg/cobweb-django |
class Person:
name='zhangsan'
age=20
p = Person()
print(p) # <__main__.Person object at 0x10073e668>
print('⭐️ ' * 20)
class Stu:
name='zhangsan'
age=20
def __str__(self):
return "name: %s; age: %d"%(self.name, self.age)
s = Stu()
print(s) # name: zhangsan; age: 20 | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | Basic-Python/code/test_magic/3.py | johnnynode/AI-LEARNING-MATERIAL |
from nitorch.core.py import make_list
from nitorch.tools.cli import commands
from .main import crop
from .parser import parse, help, ParseError
import sys
def cli(args=None):
f"""Command-line interface for `nicrop`
{help}
"""
# Exceptions are dealt with here
try:
_cli(args)
... | [
{
"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 | nitorch/tools/misc/crop/cli.py | liamchalcroft/nitorch |
from mpi4py import MPI
import matplotlib.pyplot as plt
import numpy as np
import time
def sim_rand_walks_parallel(n_runs):
# Get rank of process and overall size of communicator:
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
# Start time:
t0 = time.time()
# Evenly d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | Labs/Lab 1 Midway RCC and mpi4py/mpi_rand_walk.py | cindychu/LargeScaleComputing_S20 |
import os
import click
from dotenv import load_dotenv
from app import create_app
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
@app.shell_context_processor
def make_shell_context()... | [
{
"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 | mock_server.py | Lameaux/mock_server |
import time
import pcap
import struct
import threading
import subprocess as sp
import Queue
from scapy.all import *
# def parse(tup):
# time, data = tup
# class BtPacket(object):
# @classmethod
# def is_valid(cls, tup):
# return len(tup[1]) == 15+8
# def __init__(tup):
# t, data = ... | [
{
"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 | btsniffer.py | zdavidli/HomeHoneypot |
import numpy as np
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
dataset = load_boston()
X = dataset.data
y = dataset.target
mean = X.mean(axis=0)
std = X.std(axis=0)
X = (X-mean)/std
# print(X)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
n_tr... | [
{
"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 | 1_boston.py | ZXTFINAL/deeplearning |
# -*- coding: utf-8 -*-
"""
Example controller for SSE (server-side events) with gevent.
Builds on the simple SSE controller.
"""
import sys
import time
import gevent.queue
from tg import expose, request, response
from tg import url
from tg.decorators import with_trailing_slash
from eventstream import EventstreamCo... | [
{
"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 | eventstreamexamples/controllers/geventeventstream.py | nh2/eventstreamexamples |
from typing import Any
from district42 import GenericSchema
from district42.types import Schema
from ._abstract_formatter import AbstractFormatter
from ._formatter import Formatter
from ._validation_result import ValidationResult
from ._validator import Validator
from ._version import version
__version__ = version
_... | [
{
"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 | valera/__init__.py | nikitanovosibirsk/valera |
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import call, patch, MagicMock
from piccolo.apps.migrations.commands.new import (
_create_new_migration,
BaseMigrationManager,
new,
)
from piccolo.conf.apps import AppConfig
from piccolo.utils.sync import run_sync
from... | [
{
"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 | tests/apps/migrations/commands/test_new.py | aminalaee/piccolo |
import pytest
from mau.parsers.base_parser import ParseError
from mau.parsers.arguments_parser import ArgumentsParser
from tests.helpers import init_parser_factory
init_parser = init_parser_factory(ArgumentsParser)
def test_named_argument():
p = init_parser("argument1=value1")
p.parse()
assert p.args ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/parsers/test_arguments_parser.py | xrmx/mau |
"""
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by
level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its bottom-up level order traversal as:
[
[15,7],
[9,20],
[3]
]
""... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | 107 Binary Tree Level Order Traversal II.py | scorpionpd/LeetCode-all |
from datetime import datetime
from pydantic.main import BaseModel
from factory import db
from utils.models import OrmBase
from typing import List
class Post(db.Model):
__tablename__ = "post"
id = db.Column(db.Integer, primary_key=True)
text = db.Column(db.UnicodeText)
created = db.Column(db.DateTime... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | API_course/models/post.py | ThiNepo/neps-guide-flask-1 |
"""List options for creating Placement Groups"""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers.vs_placement import PlacementManager as PlacementManager
@click.command()
@environment.pass_env
def cli(env)... | [
{
"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 | SoftLayer/CLI/virt/placementgroup/create_options.py | dvzrv/softlayer-python |
"Profile the performance of downloading fresh chain from peers"
from skepticoin.networking.threading import NetworkingThread
from skepticoin.scripts.utils import (
configure_logging_from_args,
DefaultArgumentParser,
check_chain_dir,
read_chain_from_disk,
)
import cProfile
from datetime import datetime... | [
{
"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 | performance/profile_fresh_chain.py | kryptocurrency/skepticoin |
"""
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
Your algorithm's runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1].
Solution:
- It's a typical binary search with a slight variatio... | [
{
"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 | Python/Binary_Search/med_first_last_sorted.py | animeshramesh/interview-prep |
# -*- coding: UTF-8 -*-
'''
Created on 2020-03-08
@author: daizhaolin
'''
from .config import Config
from .helper import cached_property
from .logging import create_logger
class ScriptEngine(object):
def __init__(self):
self.name = __name__
self.config = Config({
'DEBUG': False
... | [
{
"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 | ScriptEngine/app.py | daizhaolin/scriptengine |
from listener import Listener
class Kudos:
def __init__(self, client):
self.client = client
Listener.register(self.on_message, "on_message")
pass
def on_message(self, ctx):
pass
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/kudos.py | tinlun/Helpdesk-slackbot |
def calc_fuel(mass, recurse=True):
n = mass/3-2
if n <= 0:
return 0
elif recurse:
return n + calc_fuel(n)
else:
return n
def solve(recurse=True):
total = 0
with open('input.txt') as f:
for li in f:
total += calc_fuel(int(li), recurse)
print(total)... | [
{
"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 | 01/01.py | stevenpclark/aoc2019 |
"""Generate emojione data."""
import os
import json
current_dir = os.path.dirname(os.path.abspath(__file__))
LICENSE = """
MIT license.
Copyright (c) http://www.emojione.com
"""
def get_unicode_alt(value):
"""Get alternate Unicode form or return the original."""
return value['unicode_alt']
def parse(repo,... | [
{
"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 | tools/gen_emoji1.py | rkeulemans/pymdown-extensions |
import sys
import time
from ctypes import windll, wintypes, create_unicode_buffer, byref
def file1(n):
for i in range(n):
try:
with open(r'U:\bin\RunRoot\Debug64\dbxsdk\dbxsdkrereg.wixout:aaaa','r') as f:
a = f.read()
pass
except:pass
C... | [
{
"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 | clcache/testfile.py | univert/aclcache |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.