diff --git a/lnbits/bolt11.py b/lnbits/bolt11.py index a7224d88..43288c6f 100644 --- a/lnbits/bolt11.py +++ b/lnbits/bolt11.py @@ -228,7 +228,7 @@ def lnencode(addr, privkey): # both. if "d" in tags_set and "h" in tags_set: raise ValueError("Cannot include both 'd' and 'h'") - if not "d" in tags_set and not "h" in tags_set: + if "d" not in tags_set and "h" not in tags_set: raise ValueError("Must include either 'd' or 'h'") # We actually sign the hrp, then data (padded to 8 bits with zeroes). diff --git a/lnbits/core/services.py b/lnbits/core/services.py index 950e3f32..1e33cd47 100644 --- a/lnbits/core/services.py +++ b/lnbits/core/services.py @@ -449,7 +449,7 @@ async def check_admin_settings(): def update_cached_settings(sets_dict: dict): for key, value in sets_dict.items(): - if not key in readonly_variables + transient_variables: + if key not in readonly_variables: try: setattr(settings, key, value) except: diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index b4ecaf4a..0dd8af5f 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -137,7 +137,7 @@ async def extensions_install( "dependencies": ext.dependencies, "isInstalled": ext.id in installed_exts_ids, "isAvailable": ext.id in all_extensions, - "isActive": not ext.id in inactive_extensions, + "isActive": ext.id not in inactive_extensions, "latestRelease": dict(ext.latest_release) if ext.latest_release else None, diff --git a/lnbits/db.py b/lnbits/db.py index 77f3cf33..985a658b 100644 --- a/lnbits/db.py +++ b/lnbits/db.py @@ -135,7 +135,7 @@ class Database(Compat): if value is None: return None f = "%Y-%m-%d %H:%M:%S.%f" - if not "." in value: + if "." not in value: f = "%Y-%m-%d %H:%M:%S" return time.mktime(datetime.datetime.strptime(value, f).timetuple()) diff --git a/lnbits/decorators.py b/lnbits/decorators.py index 42d2b7a3..17134f86 100644 --- a/lnbits/decorators.py +++ b/lnbits/decorators.py @@ -245,7 +245,7 @@ async def check_user_exists(usr: UUID4) -> User: async def check_admin(usr: UUID4) -> User: user = await check_user_exists(usr) - if user.id != settings.super_user and not user.id in settings.lnbits_admin_users: + if user.id != settings.super_user and user.id not in settings.lnbits_admin_users: raise HTTPException( status_code=HTTPStatus.UNAUTHORIZED, detail="User not authorized. No admin privileges.", diff --git a/lnbits/extension_manager.py b/lnbits/extension_manager.py index 8371aea9..7eff9480 100644 --- a/lnbits/extension_manager.py +++ b/lnbits/extension_manager.py @@ -467,7 +467,7 @@ class InstalledExtensionMiddleware: self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: - if not "path" in scope: + if "path" not in scope: await self.app(scope, receive, send) return diff --git a/lnbits/extensions/bleskomat/helpers.py b/lnbits/extensions/bleskomat/helpers.py index 0b2f3471..f61a5640 100644 --- a/lnbits/extensions/bleskomat/helpers.py +++ b/lnbits/extensions/bleskomat/helpers.py @@ -128,7 +128,7 @@ def unshorten_lnurl_query(query: dict) -> Dict[str, str]: long_tag = rules["tags"][tag] new_query["tag"] = long_tag tag = long_tag - if not tag in rules["params"]: + if tag not in rules["params"]: raise LnurlValidationError(f'Unknown tag: "{tag}"') for key in query: if key in rules["params"][str(tag)]: @@ -142,7 +142,7 @@ def unshorten_lnurl_query(query: dict) -> Dict[str, str]: # Unshorten general keys: short_key = key long_key = rules["query"][short_key] - if not long_key in new_query: + if long_key not in new_query: if short_key in query: new_query[long_key] = query[short_key] else: diff --git a/lnbits/extensions/bleskomat/lnurl_api.py b/lnbits/extensions/bleskomat/lnurl_api.py index bdac5fec..c892cc5a 100644 --- a/lnbits/extensions/bleskomat/lnurl_api.py +++ b/lnbits/extensions/bleskomat/lnurl_api.py @@ -42,7 +42,7 @@ async def api_bleskomat_lnurl(req: Request): # The API key ID, nonce, and tag should be present in the query string. for field in ["id", "nonce", "tag"]: - if not field in query: + if field not in query: raise LnurlHttpError( f'Failed API key signature check: Missing "{field}"', HTTPStatus.BAD_REQUEST, @@ -105,7 +105,7 @@ async def api_bleskomat_lnurl(req: Request): # No signature provided. # Treat as "action" callback. - if not "k1" in query: + if "k1" not in query: raise LnurlHttpError("Missing secret", HTTPStatus.BAD_REQUEST) secret = query["k1"] diff --git a/lnbits/extensions/bleskomat/models.py b/lnbits/extensions/bleskomat/models.py index 6dc88dc0..5aec7969 100644 --- a/lnbits/extensions/bleskomat/models.py +++ b/lnbits/extensions/bleskomat/models.py @@ -85,7 +85,7 @@ class BleskomatLnurl(BaseModel): # Perform tag-specific checks. if tag == "withdrawRequest": for field in ["pr"]: - if not field in query: + if field not in query: raise LnurlValidationError(f'Missing required parameter: "{field}"') # Check the bolt11 invoice(s) provided. pr = query["pr"]