From 6183da6d8adfa88d996891c5c743189f91148e57 Mon Sep 17 00:00:00 2001 From: Lendemor Date: Wed, 20 Nov 2024 20:53:05 +0100 Subject: [PATCH] typing init and utils --- reflex/__init__.py | 5 ++++- reflex/compiler/utils.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/reflex/__init__.py b/reflex/__init__.py index 3941542f2..9ce38bee0 100644 --- a/reflex/__init__.py +++ b/reflex/__init__.py @@ -84,6 +84,9 @@ In the example above, you will be able to do `rx.list` from __future__ import annotations +from types import ModuleType +from typing import Any + from reflex.utils import ( compat, # for side-effects lazy_loader, @@ -365,7 +368,7 @@ getattr, __dir__, __all__ = lazy_loader.attach( ) -def __getattr__(name): +def __getattr__(name: ModuleType | Any): if name == "chakra": from reflex.utils import console diff --git a/reflex/compiler/utils.py b/reflex/compiler/utils.py index 29398da87..a95e2c450 100644 --- a/reflex/compiler/utils.py +++ b/reflex/compiler/utils.py @@ -495,7 +495,7 @@ def empty_dir(path: str | Path, keep_files: list[str] | None = None): path_ops.rm(element) -def is_valid_url(url) -> bool: +def is_valid_url(url: str) -> bool: """Check if a url is valid. Args: