mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Web plugin: add type hint for g.lib
This commit is contained in:
parent
666c412b0e
commit
189fedb008
1 changed files with 13 additions and 1 deletions
|
|
@ -17,9 +17,10 @@
|
|||
import base64
|
||||
import json
|
||||
import os
|
||||
import typing as t
|
||||
|
||||
import flask
|
||||
from flask import g, jsonify
|
||||
from flask import jsonify
|
||||
from unidecode import unidecode
|
||||
from werkzeug.routing import BaseConverter, PathConverter
|
||||
|
||||
|
|
@ -28,6 +29,17 @@ from beets import ui, util
|
|||
from beets.dbcore.query import PathQuery
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
||||
# Type checking hacks
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
|
||||
class LibraryCtx(flask.ctx._AppCtxGlobals):
|
||||
lib: beets.library.Library
|
||||
|
||||
g = LibraryCtx()
|
||||
else:
|
||||
from flask import g
|
||||
|
||||
# Utilities.
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue