mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-04 18:33:10 +02:00
mypy fix
This commit is contained in:
@@ -42,6 +42,18 @@ StripeStatus = Literal[
|
|||||||
"unknown",
|
"unknown",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Typed map to ensure mypy sees return values as StripeStatus (not plain str)
|
||||||
|
_STRIPE_STATUS_MAP: dict[str, StripeStatus] = {
|
||||||
|
"active": "active",
|
||||||
|
"trialing": "trialing",
|
||||||
|
"past_due": "past_due",
|
||||||
|
"unpaid": "unpaid",
|
||||||
|
"canceled": "canceled",
|
||||||
|
"incomplete": "incomplete",
|
||||||
|
"incomplete_expired": "incomplete_expired",
|
||||||
|
"paused": "paused",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class StripeTerminalOptions(BaseModel):
|
class StripeTerminalOptions(BaseModel):
|
||||||
class Config:
|
class Config:
|
||||||
@@ -465,19 +477,7 @@ class StripeWallet(FiatProvider):
|
|||||||
status = (sub or {}).get("status")
|
status = (sub or {}).get("status")
|
||||||
if not status:
|
if not status:
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
return _STRIPE_STATUS_MAP.get(str(status).lower().strip(), "unknown")
|
||||||
status = str(status).lower().strip()
|
|
||||||
known: set[str] = {
|
|
||||||
"active",
|
|
||||||
"trialing",
|
|
||||||
"past_due",
|
|
||||||
"unpaid",
|
|
||||||
"canceled",
|
|
||||||
"incomplete",
|
|
||||||
"incomplete_expired",
|
|
||||||
"paused",
|
|
||||||
}
|
|
||||||
return status if status in known else "unknown"
|
|
||||||
|
|
||||||
# ---------- Helpers ----------
|
# ---------- Helpers ----------
|
||||||
async def _get_price_id_by_lookup_key(self, lookup_key: str) -> str | None:
|
async def _get_price_id_by_lookup_key(self, lookup_key: str) -> str | None:
|
||||||
|
@@ -154,7 +154,7 @@ function confettiStars() {
|
|||||||
setTimeout(shoot, 200)
|
setTimeout(shoot, 200)
|
||||||
}
|
}
|
||||||
!(function (t, e) {
|
!(function (t, e) {
|
||||||
;(!(function t(e, n, a, i) {
|
!(function t(e, n, a, i) {
|
||||||
var o = !!(
|
var o = !!(
|
||||||
e.Worker &&
|
e.Worker &&
|
||||||
e.Blob &&
|
e.Blob &&
|
||||||
@@ -248,12 +248,12 @@ function confettiStars() {
|
|||||||
function e(e, n) {
|
function e(e, n) {
|
||||||
t.postMessage({options: e || {}, callback: n})
|
t.postMessage({options: e || {}, callback: n})
|
||||||
}
|
}
|
||||||
;((t.init = function (e) {
|
;(t.init = function (e) {
|
||||||
var n = e.transferControlToOffscreen()
|
var n = e.transferControlToOffscreen()
|
||||||
t.postMessage({canvas: n}, [n])
|
t.postMessage({canvas: n}, [n])
|
||||||
}),
|
}),
|
||||||
(t.fire = function (n, a, i) {
|
(t.fire = function (n, a, i) {
|
||||||
if (g) return (e(n, null), g)
|
if (g) return e(n, null), g
|
||||||
var o = Math.random().toString(36).slice(2)
|
var o = Math.random().toString(36).slice(2)
|
||||||
return (g = l(function (a) {
|
return (g = l(function (a) {
|
||||||
function r(e) {
|
function r(e) {
|
||||||
@@ -264,15 +264,15 @@ function confettiStars() {
|
|||||||
i(),
|
i(),
|
||||||
a())
|
a())
|
||||||
}
|
}
|
||||||
;(t.addEventListener('message', r),
|
t.addEventListener('message', r),
|
||||||
e(n, o),
|
e(n, o),
|
||||||
(m[o] = r.bind(null, {data: {callback: o}})))
|
(m[o] = r.bind(null, {data: {callback: o}}))
|
||||||
}))
|
}))
|
||||||
}),
|
}),
|
||||||
(t.reset = function () {
|
(t.reset = function () {
|
||||||
for (var e in (t.postMessage({reset: !0}), m))
|
for (var e in (t.postMessage({reset: !0}), m))
|
||||||
(m[e](), delete m[e])
|
m[e](), delete m[e]
|
||||||
}))
|
})
|
||||||
})(h)
|
})(h)
|
||||||
}
|
}
|
||||||
return h
|
return h
|
||||||
@@ -328,12 +328,12 @@ function confettiStars() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
function k(t) {
|
function k(t) {
|
||||||
;((t.width = document.documentElement.clientWidth),
|
;(t.width = document.documentElement.clientWidth),
|
||||||
(t.height = document.documentElement.clientHeight))
|
(t.height = document.documentElement.clientHeight)
|
||||||
}
|
}
|
||||||
function I(t) {
|
function I(t) {
|
||||||
var e = t.getBoundingClientRect()
|
var e = t.getBoundingClientRect()
|
||||||
;((t.width = e.width), (t.height = e.height))
|
;(t.width = e.width), (t.height = e.height)
|
||||||
}
|
}
|
||||||
function T(t, e, n, o, r) {
|
function T(t, e, n, o, r) {
|
||||||
var c,
|
var c,
|
||||||
@@ -342,10 +342,10 @@ function confettiStars() {
|
|||||||
d = t.getContext('2d'),
|
d = t.getContext('2d'),
|
||||||
f = l(function (e) {
|
f = l(function (e) {
|
||||||
function l() {
|
function l() {
|
||||||
;((c = s = null), d.clearRect(0, 0, o.width, o.height), r(), e())
|
;(c = s = null), d.clearRect(0, 0, o.width, o.height), r(), e()
|
||||||
}
|
}
|
||||||
;((c = b.frame(function e() {
|
;(c = b.frame(function e() {
|
||||||
;(!a ||
|
!a ||
|
||||||
(o.width === i.width && o.height === i.height) ||
|
(o.width === i.width && o.height === i.height) ||
|
||||||
((o.width = t.width = i.width), (o.height = t.height = i.height)),
|
((o.width = t.width = i.width), (o.height = t.height = i.height)),
|
||||||
o.width ||
|
o.width ||
|
||||||
@@ -354,7 +354,7 @@ function confettiStars() {
|
|||||||
d.clearRect(0, 0, o.width, o.height),
|
d.clearRect(0, 0, o.width, o.height),
|
||||||
(u = u.filter(function (t) {
|
(u = u.filter(function (t) {
|
||||||
return (function (t, e) {
|
return (function (t, e) {
|
||||||
;((e.x += Math.cos(e.angle2D) * e.velocity + e.drift),
|
;(e.x += Math.cos(e.angle2D) * e.velocity + e.drift),
|
||||||
(e.y += Math.sin(e.angle2D) * e.velocity + e.gravity),
|
(e.y += Math.sin(e.angle2D) * e.velocity + e.gravity),
|
||||||
(e.wobble += 0.1),
|
(e.wobble += 0.1),
|
||||||
(e.velocity *= e.decay),
|
(e.velocity *= e.decay),
|
||||||
@@ -363,7 +363,7 @@ function confettiStars() {
|
|||||||
(e.tiltCos = Math.cos(e.tiltAngle)),
|
(e.tiltCos = Math.cos(e.tiltAngle)),
|
||||||
(e.random = Math.random() + 5),
|
(e.random = Math.random() + 5),
|
||||||
(e.wobbleX = e.x + 10 * e.scalar * Math.cos(e.wobble)),
|
(e.wobbleX = e.x + 10 * e.scalar * Math.cos(e.wobble)),
|
||||||
(e.wobbleY = e.y + 10 * e.scalar * Math.sin(e.wobble)))
|
(e.wobbleY = e.y + 10 * e.scalar * Math.sin(e.wobble))
|
||||||
var n = e.tick++ / e.totalTicks,
|
var n = e.tick++ / e.totalTicks,
|
||||||
a = e.x + e.random * e.tiltCos,
|
a = e.x + e.random * e.tiltCos,
|
||||||
i = e.y + e.random * e.tiltSin,
|
i = e.y + e.random * e.tiltSin,
|
||||||
@@ -393,12 +393,12 @@ function confettiStars() {
|
|||||||
2 * Math.PI
|
2 * Math.PI
|
||||||
)
|
)
|
||||||
: (function (t, e, n, a, i, o, r, l, c) {
|
: (function (t, e, n, a, i, o, r, l, c) {
|
||||||
;(t.save(),
|
t.save(),
|
||||||
t.translate(e, n),
|
t.translate(e, n),
|
||||||
t.rotate(o),
|
t.rotate(o),
|
||||||
t.scale(a, i),
|
t.scale(a, i),
|
||||||
t.arc(0, 0, 1, r, l, c),
|
t.arc(0, 0, 1, r, l, c),
|
||||||
t.restore())
|
t.restore()
|
||||||
})(
|
})(
|
||||||
t,
|
t,
|
||||||
e.x,
|
e.x,
|
||||||
@@ -420,18 +420,18 @@ function confettiStars() {
|
|||||||
})(d, t)
|
})(d, t)
|
||||||
})).length
|
})).length
|
||||||
? (c = b.frame(e))
|
? (c = b.frame(e))
|
||||||
: l())
|
: l()
|
||||||
})),
|
})),
|
||||||
(s = l))
|
(s = l)
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
addFettis: function (t) {
|
addFettis: function (t) {
|
||||||
return ((u = u.concat(t)), f)
|
return (u = u.concat(t)), f
|
||||||
},
|
},
|
||||||
canvas: t,
|
canvas: t,
|
||||||
promise: f,
|
promise: f,
|
||||||
reset: function () {
|
reset: function () {
|
||||||
;(c && b.cancel(c), s && s())
|
c && b.cancel(c), s && s()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,7 +466,7 @@ function confettiStars() {
|
|||||||
k = p(e, 'scalar'),
|
k = p(e, 'scalar'),
|
||||||
I = (function (t) {
|
I = (function (t) {
|
||||||
var e = p(t, 'origin', Object)
|
var e = p(t, 'origin', Object)
|
||||||
return ((e.x = p(e, 'x', Number)), (e.y = p(e, 'y', Number)), e)
|
return (e.x = p(e, 'x', Number)), (e.y = p(e, 'y', Number)), e
|
||||||
})(e),
|
})(e),
|
||||||
E = d,
|
E = d,
|
||||||
S = [],
|
S = [],
|
||||||
@@ -531,7 +531,7 @@ function confettiStars() {
|
|||||||
return l(function (t) {
|
return l(function (t) {
|
||||||
t()
|
t()
|
||||||
})
|
})
|
||||||
;(i && a
|
i && a
|
||||||
? (t = a.canvas)
|
? (t = a.canvas)
|
||||||
: i &&
|
: i &&
|
||||||
!t &&
|
!t &&
|
||||||
@@ -547,7 +547,7 @@ function confettiStars() {
|
|||||||
)
|
)
|
||||||
})(g)),
|
})(g)),
|
||||||
document.body.appendChild(t)),
|
document.body.appendChild(t)),
|
||||||
r && !d && u(t))
|
r && !d && u(t)
|
||||||
var m = {width: t.width, height: t.height}
|
var m = {width: t.width, height: t.height}
|
||||||
function b() {
|
function b() {
|
||||||
if (s) {
|
if (s) {
|
||||||
@@ -564,9 +564,9 @@ function confettiStars() {
|
|||||||
m.width = m.height = null
|
m.width = m.height = null
|
||||||
}
|
}
|
||||||
function v() {
|
function v() {
|
||||||
;((a = null),
|
;(a = null),
|
||||||
r && e.removeEventListener('resize', b),
|
r && e.removeEventListener('resize', b),
|
||||||
i && t && (document.body.removeChild(t), (t = null), (d = !1)))
|
i && t && (document.body.removeChild(t), (t = null), (d = !1))
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
s && !d && s.init(t),
|
s && !d && s.init(t),
|
||||||
@@ -578,13 +578,12 @@ function confettiStars() {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
(g.reset = function () {
|
(g.reset = function () {
|
||||||
;(s && s.reset(), a && a.reset())
|
s && s.reset(), a && a.reset()
|
||||||
}),
|
}),
|
||||||
g
|
g
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
;((n.exports = E(null, {useWorker: !0, resize: !0})),
|
;(n.exports = E(null, {useWorker: !0, resize: !0})), (n.exports.create = E)
|
||||||
(n.exports.create = E))
|
|
||||||
})(
|
})(
|
||||||
(function () {
|
(function () {
|
||||||
return void 0 !== t ? t : 'undefined' != typeof self ? self : this || {}
|
return void 0 !== t ? t : 'undefined' != typeof self ? self : this || {}
|
||||||
@@ -592,5 +591,5 @@ function confettiStars() {
|
|||||||
e,
|
e,
|
||||||
!1
|
!1
|
||||||
),
|
),
|
||||||
(t.confetti = e.exports))
|
(t.confetti = e.exports)
|
||||||
})(window, {})
|
})(window, {})
|
||||||
|
Reference in New Issue
Block a user