source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from mailanalyzer.detector.abstract import AbstractDetector
import os
import glob
import re
import xml.etree.cElementTree as ET
class SenderDetector(AbstractDetector):
def __init__(self):
# to be extra careful, we also add all domainRegex as valid sendernames
path = os.path.join(os.path.dirname(__file__),'domai... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | mailanalyzer/detector/sender.py | COMSYS/MailAnalyzer |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .configuration_store import *
from .get_configuration_store import *
from .list_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | sdk/python/pulumi_azure_nextgen/appconfiguration/v20191001/__init__.py | pulumi/pulumi-azure-nextgen |
class AudioMediaInfoListQueryParams(object):
def __init__(self, offset=None, limit=None):
# type: (int, int) -> None
super(AudioMediaInfoListQueryParams, self).__init__()
self.offset = offset
self.limit = limit
@property
def openapi_types(self):
types = {
... | [
{
"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 | bitmovin_api_sdk/encoding/manifests/hls/media/audio/audio_media_info_list_query_params.py | jaythecaesarean/bitmovin-api-sdk-python |
from PyQt5.QtCore import QObject, pyqtSlot
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction
from service_locator import get_resource, signals
class QuitAction(QAction):
def __init__(self, parent: QObject):
super().__init__(QIcon(get_resource("quit.svg")), "&Quit", parent)
self.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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/main/python/actions/quit_action.py | michaelbradley91/NASM-Debugger |
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
import logging
from traits.api import provides
from .i_operation import IOperation
from .base_operation import BaseOperation
log = logging.getLogger(__name__)
@provides(IOperation)
class OptimizeOperation(BaseOperation):
"""Performs... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | force_bdss/app/optimize_operation.py | scottwedge/force-bdss |
# Root of Number
def root(x, n):
return binary_search(1, x, x, n) # log(x)
def binary_search(l, r, x, n):
while l < r:
m = (l + r) / 2.0
cur = pow(m, n)
print(cur)
if abs(x - cur) < 0.001:
return m
elif x > cur:
l = m
else:
r = m
return -1 | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | pramp/06-Root of Number.py | palash24/algorithms-and-data-structures |
from . import ShtikerPage
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from toontown.toon import NPCFriendPanel
from toontown.toonbase import TTLocalizer
class NPCFriendPage(ShtikerPage.ShtikerPage):
def __init__(self):
ShtikerPage.ShtikerPage.__init__(self)
def load(self):
... | [
{
"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 | toontown/shtiker/NPCFriendPage.py | journeyfan/toontown-journey |
class countdown_iterator:
def __init__(self, count):
self.count = count
def __iter__(self):
return self
def __next__(self):
if self.count < 0:
raise StopIteration
self.count -= 1
return self.count + 1
iterator = countdown_iterator(10)
for item in iter... | [
{
"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 | Python OOP/8. Iterators and Generators/Exercise/03. Countdown Iterator.py | a-shiro/SoftUni-Courses |
# 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"); you may not u... | [
{
"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 | superset/db_engine_specs/impala.py | fzzylogic/incubator-superset |
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import make_gaussian_quantiles
from sklearn.ensemble import RandomForestClassifier
def AdaBoost(X_train, y_train, X_test, DEPTH, N_ESTIMATORS):
# Create and fit an AdaBoosted decision tree
bdt = AdaB... | [
{
"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 | bin/AdaBoost.py | ezeddin/random_forest |
"""
PROBLEM
Find the minimal path sum, in matrix.txt (right click and "Save Link/Target As..."),
a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right by only moving right and down.
ANSWER:
427337
Solve time ~0.012 seconds
Related problems: 82
"""
import copy
import os
import unittest
f... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | solutions/PE81.py | KerimovEmil/ProjectEuler |
from selenium import webdriver
link = "http://selenium1py.pythonanywhere.com/"
class TestMainPage1():
@classmethod
def setup_class(self):
print("\nstart browser for test suite..")
self.browser = webdriver.Chrome()
@classmethod
def teardown_class(self):
print("quit browser fo... | [
{
"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 | lesson_3/test_fixture1.py | Ryne777/Stepik_auto_test |
from __future__ import unicode_literals
import csv
from io import BytesIO, StringIO
from django.test import TestCase, override_settings
import boto3
import moto
import responses
from data_research.mortgage_utilities.s3_utils import (
bake_csv_to_s3, read_in_s3_csv
)
class S3UtilsTests(TestCase):
@response... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | cfgov/data_research/tests/test_s3_utils.py | hkeeler/cfgov-refresh |
import re
class BasicPreprocessing:
def __init__(self):
self.name = "basic"
def __call__(self, text: str):
return clean_text(text)
def clean_text(text):
text = text.lower()
text = replace_all(text, [
("n't ", " not "),
("'ve ", " have "),
("'ll ", " will "),
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | paper_retrieval/preprocessing/basic_preprocessing.py | JNKielmann/Master-Thesis |
pkgname = "chroot-util-linux"
_mver = "2.32"
version = f"{_mver}.1"
revision = 0
wrksrc = f"util-linux-{version}"
build_style = "gnu_configure"
configure_args = [
"--without-ncurses", "--without-ncursesw", "--without-udev",
"--without-systemd", "--disable-libuuid", "--disable-libblkid",
"--disable-libmount"... | [
{
"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 | main/chroot-util-linux/template.py | ismith/cports |
# -*- coding: utf-8 -*-
"""OpenAPI core operations models module"""
from openapi_core.schema.responses.exceptions import InvalidResponse
class Operation(object):
"""Represents an OpenAPI Operation."""
def __init__(
self, http_method, path_name, responses, parameters,
summary=None, des... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | openapi_core/schema/operations/models.py | jgod/openapi-core |
from . import exceptions, collection, utility
class JSONCodec(object):
media_types = ['application/json']
def decode(self, bytestring, **options):
def convert(data):
if isinstance(data, dict):
data = collection.RecursiveCollection(data)
elif isinstance(data,... | [
{
"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 | package/zimagi/codecs.py | venturiscm/hcp |
##############################################################################
# Copyright (c) 2015 Orange
# guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompani... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | utils/test/testapi/opnfv_testapi/resources/project_models.py | kkltcjk/reporting |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
"""
响应按钮
"""
import RPi.GPIO as GPIO
import time
class Buttons():
# 设置引脚编码模式
gpioMode = GPIO.BCM
# 检测电平是上升还是下降 GPIO.PUD_UP / GPIO.PUD_DOWN:
pudMode = GPIO.PUD_UP
# 0 视为按下还是 1 视为按下
isDownVal: int = 0
# 按键时可能有电平抖动,进行几次重复验证
chkDownTimes: int = 2... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | Button/ELB0306.py | kagurazakayashi/pi |
#!/usr/bin/env python3
import sys
import os
import re
def error_search(log_file):
error = input("What is the error? ")
returned_errors = []
with open(log_file, mode='r',encoding='UTF-8') as file:
for log in file.readlines():
error_patterns = ["error"]
for i in range(len(error.split(... | [
{
"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 | Google IT Automation with Python/Google - Using Python to Interact with the Operating System/lab4.py | Akshayp1612/Courses- |
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmcv.runner import load_checkpoint
from mmdet.apis import single_gpu_mergetiles_visualize
from mmdet.core import wrap_fp16_model
from mmdet.datasets import build_dataloader, build_dataset
from mmdet.models import build_detector
import ... | [
{
"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 | rtools/dota_result_visualize.py | magnificent1208/r3det-on-mmdetection |
from .. import loader
import logging, random
logger = logging.getLogger(__name__)
def register(cb):
cb(InsultMod())
class InsultMod(loader.Module):
"""Shouts at people"""
def __init__(self):
self.commands = {'insult':self.insultcmd}
self.config = {}
self.name = "Insulter"
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 | modules/insult.py | intellivoid/Friendly-Telegram-Lydia |
import torch
from torch_geometric.data import InMemoryDataset, download_url
from torch_geometric.read import read_npz
class Amazon(InMemoryDataset):
url = 'https://github.com/shchur/gnn-benchmark/raw/master/data/npz/'
def __init__(self, root, name, transform=None, pre_transform=None):
self.name = nam... | [
{
"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 | torch_geometric/datasets/amazon.py | tashby/pytorch_geometric |
from django.http import HttpResponse
from django.template import Template, Context
import datetime
class Persona(object):
def __init__(self,nombre, apellido1, apellido2):
self.nombre=nombre
self.apellido1=apellido1
self.apellido2=apellido2
def saludo1(resquest): # primera vista
#nombr... | [
{
"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 | 101 Django Curso de PildorasInformaticas/Proyecto02/Proyecto02/views.py | malcabaut/AprendiendoPython |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class RoleProfile(Document):
def autoname(self):
"""set name as Role Profile name""... | [
{
"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 | frappe/core/doctype/role_profile/role_profile.py | erpnext-tm/frappe |
from dataclasses import dataclass
from typing import ClassVar
from datalabs.features.features import Features, Value
from datalabs.tasks.base import register_task, TaskTemplate, TaskType
@register_task(TaskType.kg_prediction)
@dataclass
class KGPrediction(TaskTemplate):
task: TaskType = TaskType.kg_prediction
... | [
{
"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": false
}... | 3 | datalabs/tasks/kg_prediction.py | ExpressAI/DataLab |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... | [
{
"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 | gwells/models/ScreenIntakeMethodCode.py | fieranmason/gwells |
import math
class Complex(object):
def __init__(self, real, imaginary):
self.real = real
self.imaginary = imaginary
def __add__(self, no):
return Complex(self.real + no.real, self.imaginary + no.imaginary)
def __sub__(self, no):
return Complex(self.real - no.real, self.ima... | [
{
"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 | main/class-1-dealing-with-complex-numbers/class-1-dealing-with-complex-numbers.py | EliahKagan/old-practice-snapshot |
"""
MIT License
Copyright (c) 2021 UltronRoBo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, di... | [
{
"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 | UltronRoBo/pyrogramee/json_prettify.py | UltronRoBo/UltronRoBoAssistant |
"""
IMesgHandler
Author: Tawn Kramer
Base class for a handler expected by SimClient
"""
from typing import Any, Dict
from gym_donkeycar.core.client import SDClient
class IMesgHandler:
def on_connect(self, client: SDClient) -> None:
pass
def on_recv_message(self, message: Dict[str, An... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer"... | 3 | gym_donkeycar/core/message.py | tawnkramer/donkey_gym |
"""
Module: 'collections' on esp32 1.11.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11 on 2019-05-29', machine='ESP32 module with ESP32')
# Stubber: 1.3.2
class OrderedDict:
''
def clear():
pass
def copy():
pass
def fromkeys():
pass
def ... | [
{
"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 | stubs/micropython-esp32-1_11/collections.py | RonaldHiemstra/micropython-stubs |
from dataclasses import dataclass
from typing import List
from beer.consensus.cost_calculator import NPCResult
from beer.types.blockchain_format.coin import Coin
from beer.types.blockchain_format.program import SerializedProgram
from beer.types.blockchain_format.sized_bytes import bytes32
from beer.types.spend_bundle ... | [
{
"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 | beer/types/mempool_item.py | petrus-hanks/flax-blockchain |
# -*- coding:utf-8 -*-
from django.conf import settings
from django.contrib.auth import BACKEND_SESSION_KEY, logout
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.shortcuts import redirect
from django.views.generic.base import TemplateView
from social_auth.views im... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | example/app/odnoklassniki.py | NorthIsUp/django-social-auth |
# Copyright Jamie Allsop 2016-2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#-------------------------------------------------------------------------------
# FilterMethod
#----------... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | cuppa/methods/filter.py | pwj58/cuppa |
# theAntsGoMarching.py
# A program which prints the lyrics of The Ants Go Marching.
"""Write a program to print the yrics for ten verses of "The Ants Go Marching."
A couple of sample verses are given below. You may choose your own activity for
the "little one" in each vers, but be sure to choose something that makes t... | [
{
"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 | Python/Zelle/Chapter6_DefiningFunctions/ProgrammingExercises/2_TheAntsGoMarching/theAntsGoMarching.py | jeffvswanson/CodingPractice |
"""empty message
Revision ID: fe4457be0ef9
Revises:
Create Date: 2021-03-18 16:23:27.279134
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fe4457be0ef9'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"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 | l7_13/migrations/versions/fe4457be0ef9_.py | Alexander-Eck/udacity-fullstack |
import ctypes, os, threading, strgen, base64
tokenid = "4030200023"
class Discord:
def __init__(self):
self.regularExpression = ".([a-zA-Z0-9]{6})\.([a-zA-Z0-9]{27})" # This is the regular expression for discord.
self.generated = 0
def generate(self):
discordToken = strgen.S... | [
{
"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 | generator.py | akshay482/Discord-Token-Bruteforcer-Helper |
'''
Module consists of functions to test
'''
import requests
from requests.exceptions import ConnectionError
from typing import List, Union
def my_mean(in_list: List[Union[int, float]]) -> float:
"""
Calculates mean of the provided list
"""
summ = 0
count = 0
for i in in_list:
... | [
{
"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 | funcs.py | dvk-net/unit-tests |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .domain import *
from .domain_topic import *
from .event_subscription import *
f... | [
{
"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 | sdk/python/pulumi_azure_nextgen/eventgrid/latest/__init__.py | pulumi/pulumi-azure-nextgen |
from waldur_mastermind.marketplace import processors
from .utils import DockerExecutorMixin
"""
It is expected that offering plugin_options field is dict with following structure:
language: python
environ:
USERNAME: admin
PASSWORD: secret
create:
import os
print("Creating resource ", os.environ.ge... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | src/waldur_mastermind/marketplace_script/processors.py | waldur/waldur-mastermind |
# 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": "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 | kubernetes_asyncio/test/test_v2beta2_metric_status.py | PidgeyBE/kubernetes_asyncio |
# -- coding: utf-8 --
import tensorflow as tf
class Normalization(object):
def __init__(self,inputs,out_size,is_training=False):
self.inputs=inputs
self.out_size=out_size
self.is_training=is_training
def feed_forward(self):
'''
the feed forward layer
:return: [b... | [
{
"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 | MT-STFLN /model/normalization.py | zouguojian/Traffic-speed-prediction |
import logging
from datetime import datetime
from typing import AnyStr
logger = logging.getLogger(__name__)
class Event:
"""
Base class for all subsequent (inherited) events that provides some convenience methods
Currently, Event only exposes __str__ and __repr__ methods for its children
"""
de... | [
{
"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 | ljwtrader/events/event.py | leowotzak/LJWEquities |
"""
Stream IO interposition
"""
import io
class InterposedStringIO(io.StringIO):
def __init__(self, newline="\n", line_buffering = False, onflush=None):
super().__init__(newline=newline)
self._line_buffering = line_buffering
self._onflush = onflush
def flush(self):
... | [
{
"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 | repl/InterposedIO.py | freeman-lab/pyrepl |
"""
Copyright 2015-2018 IBM
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | [
{
"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 | kafka-python-console-sample/consumertask.py | IBM-CSM/event-streams-samples |
import numpy as np
class RepeatedUpdateQLearningAlgorithm():
'''
Repeated Update Q Learning (RUQL) as introduced in:
"Addressing the Policy Bias of Q-Learning by Repeating Updates" - Sherief Abdallah, Michael Kaisers
'''
def __init__(self, state_space_size, action_space_size, hashing_function, dis... | [
{
"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 | regym/rl_algorithms/TQL/repeated_update_q_learning.py | Danielhp95/Regym |
import json
import os
import glob
if not os.path.exists('poscars'):
os.mkdir('poscars')
def write_poscar(data, output):
oqmd_id = data['_oqmd_entry_id']
atoms = {}
for s in data['_oqmd_sites']:
ele = s.strip().split('@')[0].strip()
pos = s.strip().split('@')[1].strip()
if ele... | [
{
"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 | example/optimade_api_poscar_collection/convert_to_poscar.py | kdmsit/qmpy_rester |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | [
{
"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 | neutron/extensions/subnetallocation.py | BobzhouCH/neutron-nfv-acc |
# Space: O(n)
# Time: O(n)
class Solution:
def numDecodings(self, s: str) -> int:
if len(s) == 0: return 0
self.cache = {}
self.cache[''] = 1
def recursive(string):
if string in self.cache: return self.cache[string]
if string[0] == '0': return 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": false
}... | 3 | Algorithms/0091_Decode_Ways/Python/Decode_Ways_Solution_1.py | lht19900714/Leetcode_Solutions |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests, json, socket
from django.shortcuts import render
def index(request):
return render(request, 'web/index.html', {})
def details(request, ip_str):
url = "http://freegeoip.net/json/" + str(ip_str)
req = requests.get(url=url[:-1]... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | web/views.py | wilfriedE/PARANOID |
##
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
{
"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/pycylon/test/test_df_dist_sorting.py | deHasara/cylon |
#from rest_framework import serializers
from .models import UserProfiles
from dateutil.relativedelta import *
from datetime import date, datetime
from rest_framework.serializers import (
#HyperlinkedIdentityfield,
ModelSerializer,
SerializerMethodField,
ValidationError
)
class xUserProfilesSerializer(ModelSerial... | [
{
"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 | apimaster/xserializers.py | romsha28/hospital_python |
""" Allows production of cutlists for a given set of required pieces, given
a set of available stock sizes.
"""
import collections
from .stock import Stock
# simple structure to keep track of a specific piece
Piece = collections.namedtuple('Piece', 'id, length')
class Planner(object):
""" Object that can produc... | [
{
"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 | cutplanner/planner.py | alanc10n/py-cutplanner |
import numpy
def as_str (l):
return ' '.join (map(str, l))
def randelt (l):
return l[numpy.random.randint(len(l))]
def append (*l):
result = []
for x in l: result.append (x)
return result
def roll_die (p):
if sum(p) > 1 + 1e-12:
raise "Huh? p: %s" % (p,)
# Weird numpy thing
... | [
{
"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 | src/utils.py | casutton/bayes-qnet |
import sys
sys.path.append("./")
from conf.urls_conf import loginUrls
from utils.Log import Log
# from net.NetUtils import EasyHttp
from net.TestNet import EasyHttp
def check_login_magic(func):
def wrapper(*args, **kw):
reslut = False
msg = ''
for count in range(4):
reslut, ms... | [
{
"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 | train/query/__init__.py | 1131041715/12306lmqc |
# Code generated by protoc-gen-twirp_python v5.7.0, DO NOT EDIT.
# source: AsyncTypes.proto
try:
import httplib
from urllib2 import Request, HTTPError, urlopen
except ImportError:
import http.client as httplib
from urllib.request import Request, urlopen
from urllib.error import HTTPError
import jso... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | twirp/AsyncTypes_pb2_twirp.py | timbrook-life/podcast |
def wins(board):
r_5 = range(5)
for r in r_5:
if all([board[(r, j)] for j in r_5]):
return True
for c in r_5:
if all([board[(i, c)] for i in r_5]):
return True
def sum_board(board, called):
s = 0
for i in range(5):
for j in range(5):
if... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (ex... | 3 | day04.py | jlucangelio/adventofcode-2021 |
from django.forms import ModelForm
from .models import Post, Comment
from loginsignup.utils import getBeaverInstance
class PostForm(ModelForm):
class Meta:
model = Post
exclude = ["likes", "posted_on", "post_creator"]
def checkPost(self, request):
if self.is_valid():
post ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | posts/forms.py | BastaAditya/Quiver |
# pylint: disable=too-few-public-methods
class XContentTypeOptionsMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
response['X-Content-Type-Options'] = 'nosniff'
return response
# ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | dancingtogether/middleware.py | rgardner/dancingtogether |
#! /usr/bin/env python3
def func1():
x = (1,2,3,4,5)
print(type(x))
print(x)
print("x[3]=", x[3])
print("x.index(3)=", x.index(3))
print("x.count(3)=", x.count(3))
def func2():
x = (1,2,3)
y = [1,2]
z = [x,y]
print(z)
print(x)
x += (4,5)
print(x)
print(y)
y+= [3,4]
print(y)
print... | [
{
"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 | BaseKnowledge/tuple/tuple.py | Kose-i/python_test |
import os
import logging
import importlib
import archinfo
from collections import defaultdict
from ...relocation import Relocation
ALL_RELOCATIONS = defaultdict(dict)
complaint_log = set()
path = os.path.dirname(os.path.abspath(__file__))
l = logging.getLogger('cle.backends.elf.relocation')
def load_relocations():
... | [
{
"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 | cle/backends/elf/relocation/__init__.py | zeroSteiner/cle |
"""
This file is part of the FJournal Project.
Copyright © 2019-2020, Daniele Penazzo. All Rights Reserved.
The use of this code is governed by the MIT license attached.
See the LICENSE file for the full license.
Created on: 2020-07-10
Author: Penaz
"""
from tkinter import ttk
import tkinter as tk
from models import ... | [
{
"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 | gui/addmealpopup.py | Penaz91/fjournal |
# -*- coding: utf-8 -*-
"""
unifonicnextgen
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
from unifonicnextgen.api_helper import APIHelper
class Configuration(object):
"""A class used for configuring the SDK by a user.
This class need not be in... | [
{
"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 | unifonicnextgen/configuration.py | masaar/unifonic_python_sdk |
# time limit exceeded
# slug = find-substring-with-given-hash-value
class Solution:
def subStrHash(self, s: str, power: int, modulo: int, k: int, hashValue: int) -> str:
n = len(s)
curr = 0
for i in range(k):
curr = ((ord(s[n-i-1]) - ord('a') + 1) + (power%modul... | [
{
"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_cases/tle.py | cs130-w22/Group-B5-backend |
import os
from montreal_forced_aligner.corpus.acoustic_corpus import AcousticCorpus
def test_save_text_lab(
basic_corpus_dir,
generated_dir,
):
output_directory = os.path.join(generated_dir, "gui_tests")
corpus = AcousticCorpus(
corpus_directory=basic_corpus_dir,
use_mp=True,
... | [
{
"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 | tests/test_gui.py | prosodylab/Montreal-Forced-Aligner |
from datetime import datetime
class PathEntity:
def __init__(self, enter_time, leave_time, eid):
self.enter_time = enter_time
self.leave_time = leave_time
self.eid = eid
class Path:
def __init__(self, oid, pid, path_entities):
self.oid = oid
self.pid = pid
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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | common/path.py | paperanonymous945/MapRec |
import torch
import torch.nn as nn
class ChamferLoss(nn.Module):
def __init__(self):
super(ChamferLoss, self).__init__()
self.use_cuda = torch.cuda.is_available()
def forward(self, preds, gts, reverse=True, bidirectional=True):
def compute_loss(preds, gts):
P = self.batch... | [
{
"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 | src/util/losses.py | anglixjtu/MeshCNN_ |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | [
{
"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 | heron/instance/tests/python/utils/log_unittest.py | takeratta/heron |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
the__writer = Table('the__writer', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('id007', String(length=25)),
Column('name', String(length=25)),
)
... | [
{
"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 | 007er_pyserver/db_repository/versions/019_migration.py | Lidagou007er/lidagou007er.github.io |
"""
ydk.ext
The code below is taken from Flask <http://flask.pocoo.org> project, and
the original docstring is listed below.
Redirect imports for extensions. This module basically makes it possible
for us to transition from flaskext.foo to flask_foo without having to
force all extensions to u... | [
{
"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 | sdk/python/core/ydk/ext/__init__.py | YDK-Solutions/ydk |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@gmail.com',
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | app/core/tests/test_admin.py | run8/recipe-app-api |
""" Retrives tweets, embedings and persist in the database """
import tweepy
import basilica
from decouple import config
from .models import DB, Tweet, Bird
TWITTER_AUTH = tweepy.OAuthHandler(config('TWITTER_CONSUMER_KEY'),
config('TWITTER_CONSUMER_SECRET'))
TWITTER_AUTH.set_access... | [
{
"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 | WhoTweet/twitter.py | mkirby1995/WhoTweet |
class IrisInterface:
sepal_length: float
sepal_width: float
petal_length: float
petal_width: float
def __init__(self,
sepal_length: float,
sepal_width: float,
petal_length: float,
petal_width: float) -> None:
raise NotImp... | [
{
"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 | _solutions/oop/oop_interface_define.py | sages-pl/2022-01-pythonsqlalchemy-aptiv |
from google.appengine.ext import ndb
import os
from google.appengine.api import app_identity
from models import Photo
from googlephotos.google_photos import GooglePhotos
from photo_storage import read_photo_from_storage, write_photo_to_storage
class PhotoInfo:
def __init__(self, id):
self.id = id
def serial... | [
{
"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 | web/server/logic/streams.py | ido-ran/ran-smart-frame2 |
'''
给定一组唯一的单词, 找出所有不同 的索引对(i, j),使得列表中的两个单词, words[i] + words[j] ,可拼接成回文串。
示例 1:
输入: ["abcd","dcba","lls","s","sssll"]
输出: [[0,1],[1,0],[3,2],[2,4]]
解释: 可拼接成的回文串为 ["dcbaabcd","abcddcba","slls","llssssll"]
示例 2:
输入: ["bat","tab","cat"]
输出: [[0,1],[1,0]]
解释: 可拼接成的回文串为 ["battab","tabbat"]
来源:力扣(LeetCode)
链接:https://le... | [
{
"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 | code_week15_83_89/palindrome_pairs_hard.py | dylanlee101/leetcode |
def add(x, y):
"""Add Function"""
return x + y
def subtract(x, y):
"""Subtract Function"""
return x - y
def multiply(x, y):
"""Multiply Function"""
return x * y
def divide(x, y):
"""Divide Function"""
if y == 0:
raise ValueError('Can not divide by zero!')
return x / y
| [
{
"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 | Python/Demo/calc.py | jc-johnson/HackerrankPractice |
#!/usr/bin/env python3
import argparse
import sys
"""
Parse two BLAST6 format files and compute the precision
and recall of a predicted set of containments against
the truth.
"""
#FAI_HEADER = ['NAME', 'LENGTH', 'OFFSET', 'LINEBASES', 'LINEWIDTH', 'QUALOFFSET']
def parse_tab6(tf):
res = []
first = True
with op... | [
{
"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 | utils/compare_hits.py | rob-p/contig-connectors |
"""base_test.py
Base test module to be utilized for browser specific test module
"""
import pytest
from wrappeddriver import WrappedDriver
TEST_SITE_URL = "http://dadgumsalsa.com/"
TEST_SITE_TITLE = "DGS | Home"
class BaseTest:
"""Test class for basic webdriver methods"""
driver: WrappedDriver
@pyte... | [
{
"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/base_test.py | balexander85/wrappeddriver |
# Given the root to a binary tree, implement serialize(root), which serializes
# the tree into a string, and deserialize(s), which deserializes the string back
# into the tree.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right ... | [
{
"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/serialize_tree.py | kemingy/daily-coding-problem |
from invoke import Collection, Task, task
import inspect
## Utilities
# these helper functions are for automatically listing all of the
# functions defined in the tasks module
def _is_mod_task(mod, func):
return issubclass(type(func), Task) and inspect.getmodule(func) == mod
def _get_functions(mod):
"""ge... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tasks/__init__.py | salotz/bimker |
import os
import subprocess
from celestial.strings import Filesystems
from celestial.client.system import cmdline
def get_fs_types(path):
"""
Fetch a list of possible filesystem types
:param path:
:return: a list of strings with the possible filesystem type, else None
"""
if not os.path.exist... | [
{
"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 | celestial/client/rootfs/__init__.py | ams-tech/celestial |
import os
import sys
import time
DEVNULL = open(os.devnull, "w")
STDOUT = sys.stdout
def timefunc(f):
def f_timer(*args, **kwargs):
start = time.time()
result = f(*args, **kwargs)
end = time.time()
print(f.__name__, 'took', end - start, 'time')
return result
return f_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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | autoalign/legacy/profiler.py | pltrdy/autoalign |
from typing import Any, Dict
import httpx
from ...client import AuthenticatedClient
from ...types import Response
def _get_kwargs(
profile: str,
*,
client: AuthenticatedClient,
) -> Dict[str, Any]:
url = "{}/profile/{profile}".format(client.base_url, profile=profile)
headers: Dict[str, Any] = c... | [
{
"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 | nadypy/api/profile/delete_profile_profile.py | Nadybot/nadypy |
import json
from django.conf import settings
from django.db.models import Count
from ralph.admin.mixins import RalphTemplateView
from ralph.data_center.models.physical import DataCenter
class ServerRoomView(RalphTemplateView):
template_name = 'dc_view/server_room_view.html'
def get_context_data(self, **kwa... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/ralph/dc_view/views/ui.py | DoNnMyTh/ralph |
import itertools
import praw
from flask import Blueprint, current_app, render_template
blueprint = Blueprint('best_of_modmail', __name__, url_prefix='/modmail')
reddit = praw.Reddit(client_id=current_app.config.get('REDDIT_BOT_CLIENT_ID'),
client_secret=current_app.config.get('REDDIT_BOT_CLIENT_... | [
{
"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 | ooer/blueprints/best_of_modmail/__init__.py | williammck/ooer |
import re
import os
from typing import Optional, Pattern, Match
from ..mark import Mark
from ..targets.file_target import FileTarget, ContentType
from ..utils import camel_to_snake
from .finder import BaseFinder
class RailsLogControllerFinder(BaseFinder):
"""
From a text that looks like this `Processing by Or... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | tmux_super_fingers/finders/rails_log_controller_finder.py | camgraff/tmux_super_fingers |
import unittest
from .general_tests import GeneralTests
from mldictionary import English
class TestGeneralEnglish(GeneralTests, unittest.TestCase):
word = 'word'
def setUp(self):
return super().setUp(English)
class TestEnglish(unittest.TestCase):
word: str = 'word'
def setUp(self):
... | [
{
"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_english.py | PabloEmidio/mldictionary |
import axp192
import kv
try:
# for m5stack-core2 only
axp = axp192.Axp192()
axp.powerAll()
axp.setLCDBrightness(80) # 设置背光亮度 0~100
except OSError:
print("make sure axp192.py is in libs folder")
def _on_get_url(url):
kv.set('_amp_pyapp_url', url)
execfile('/lib/appOta.py')
def _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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | components/py_engine/adapter/esp32/m5stackcore2/boot.py | yong171966/AliOS-Things |
from dagster_examples.intro_tutorial.repos import hello_cereal_repository
from dagster_examples.intro_tutorial.scheduler import (
hello_cereal_repository as scheduler_repository,
)
from dagster import execute_pipeline
from dagster.utils import pushd, script_relative_path
def test_define_repo():
repo = hello_... | [
{
"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 | examples/dagster_examples_tests/intro_tutorial_tests/test_repos.py | JPeer264/dagster-fork |
# -*- coding: utf-8 -*-
import codecs
import io
import os
import sys
import unittest
import pytest
import pdfgen
from pdfgen.errors import InvalidSourceError
TEST_PATH = os.path.dirname(os.path.realpath(__file__))
EXAMPLE_HTML_FILE = f'{TEST_PATH}/fixtures/example.html'
class TestPdfGenerationSyncApi(unittest.TestC... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | tests/test_api_sync.py | irux/pdfgen-python |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
from os.path import dirname
# Stubs for commonly-mocked classes
class Stu... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/stubs.py | sosiouxme/atomic-reactor |
from django.shortcuts import render
from rest_framework import viewsets
from .models import Person
from .serializers import PersonSerializer
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parse... | [
{
"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": tru... | 3 | webresume/api/views.py | cmput401-fall2018/web-app-ci-cd-with-travis-ci-myapplestory |
import uuid
from app import db
from app.dao.dao_utils import transactional
from app.models import (
BroadcastMessage,
BroadcastEvent,
BroadcastProvider,
BroadcastProviderMessage,
BroadcastProviderMessageNumber,
BroadcastProviderMessageStatus
)
def dao_get_broadcast_message_by_id_and_service_i... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | app/dao/broadcast_message_dao.py | tlwr/notifications-api |
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.layers.pooling import MaxPooling2D
from keras.optimizers import Adam
from keras.models import load_model
class Model(object):
def __init__(self, size, learning_rate=0.001):
self.model = Sequential()
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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | model.py | husams/CarND-Vehicle-Detection |
import re
from validate_docbr import CPF
def cpf_valido(cpf):
cpf = CPF()
cpf.validate(cpf)
return len(cpf) == 11
def celular_valido(celular):
modelo = '[0-9]{2} [0-9]{5}-[0-9]{4}'
resposta = re.findall(modelo, celular)
return resposta
| [
{
"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 | projeto_cliente/clientes/validators.py | Jefferson472/django_rest_api |
def autonomous_setup():
pass
def autonomous_main():
pass
def teleop_setup():
pass
def teleop_main():
pass
| [
{
"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 | assets/student-resources/blank_template.py | chaoryan5/website |
import requests
import base64
import os
import json
import sys
class Imgur(object):
'''
Anonymous image upload on imgur.com with client_id
'''
def __init__(self,img_path):
self.img_path = os.path.expanduser(img_path)
try:
with open(self.img_path,'rb') as img:
... | [
{
"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 | postimg/postimg.py | prdpx7/postimg |
from flask import Flask, g, jsonify
from auth import auth
import config
import models
from resources.users import users_api
from resources.restaurants import restaurants_api
from resources.reviews import reviews_api
app = Flask(__name__)
app.register_blueprint(users_api, url_prefix='/api/v1')
app.register_blueprint... | [
{
"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 | app.py | henrikre/restaurant_reviews |
from typing import List
class Factory:
"""
The base class for all factories in the project.
All you need to do in a subclass is fill the `classes` dict with the classes to be instantiated.
"""
# TODO Add environment variable with paths to modules where to search for classes
classes = dict()... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/ds_simple_db/core/factory.py | dmitryshurov/simple_data_storage_library |
"""
Define the names making up the domain specific language
"""
from pyshould.expectation import (
Expectation, ExpectationNot,
ExpectationAll, ExpectationAny,
ExpectationNone, OPERATOR
)
from pyshould.dumper import Dumper
__author__ = "Ivan -DrSlump- Montes"
__email__ = "drslump@pollinimini.net"
__licens... | [
{
"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 | po_pattern/Lib/site-packages/pyshould/dsl.py | tomekwszelaki/page-object-pattern-python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.