Skip to content

Commit

Permalink
start typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
PanderMusubi committed Sep 22, 2023
1 parent 85dd170 commit 1632dad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flask_bootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import warnings
from typing import NoReturn, ParamSpec

from flask import current_app, Blueprint, url_for
from markupsafe import Markup
from wtforms import BooleanField, HiddenField

P = ParamSpec('P')

CDN_BASE = 'https://cdn.jsdelivr.net/npm'


def is_hidden_field_filter(field):
return isinstance(field, HiddenField)


def raise_helper(message):
def raise_helper(message: str) -> NoReturn:
raise RuntimeError(message)


def get_table_titles(data, primary_key, primary_key_title):
def get_table_titles(data: list, primary_key: str, primary_key_title: str) -> list[tuple[str, str]]:
"""Detect and build the table titles tuple from ORM object, currently only support SQLAlchemy.
.. versionadded:: 1.4.0
Expand Down Expand Up @@ -285,5 +288,5 @@ class SwitchField(BooleanField):
.. versionadded:: 2.0.0
"""

def __init__(self, label=None, **kwargs):
def __init__(self, label: str = None, **kwargs: P.kwargs) -> None:
super().__init__(label, **kwargs)

0 comments on commit 1632dad

Please sign in to comment.