asserts in folder reflex/ not allowed anymore
This commit is contained in:
parent
c721227a06
commit
e692b11e85
@ -93,13 +93,13 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
lint.isort.split-on-trailing-comma = false
|
lint.isort.split-on-trailing-comma = false
|
||||||
lint.select = ["B", "D", "E", "F", "I", "SIM", "W"]
|
lint.select = ["B", "D", "E", "F", "I", "SIM", "W", "S101"]
|
||||||
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"]
|
lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"]
|
||||||
lint.pydocstyle.convention = "google"
|
lint.pydocstyle.convention = "google"
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
"__init__.py" = ["F401"]
|
"__init__.py" = ["F401"]
|
||||||
"tests/*.py" = ["D100", "D103", "D104", "B018"]
|
"tests/*.py" = ["D100", "D103", "D104", "B018", "S101"]
|
||||||
"reflex/.templates/*.py" = ["D100", "D103", "D104"]
|
"reflex/.templates/*.py" = ["D100", "D103", "D104"]
|
||||||
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
|
"*.pyi" = ["D301", "D415", "D417", "D418", "E742"]
|
||||||
"*/blank.py" = ["I001"]
|
"*/blank.py" = ["I001"]
|
||||||
|
@ -46,7 +46,7 @@ def asset(
|
|||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
FileNotFoundError: If the file does not exist.
|
FileNotFoundError: If the file does not exist.
|
||||||
ValueError: If subfolder is provided for local assets.
|
ValueError: If subfolder is provided for local assets or the module is not found.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The relative URL to the asset.
|
The relative URL to the asset.
|
||||||
@ -69,7 +69,8 @@ def asset(
|
|||||||
frame = inspect.stack()[_stack_level]
|
frame = inspect.stack()[_stack_level]
|
||||||
calling_file = frame.filename
|
calling_file = frame.filename
|
||||||
module = inspect.getmodule(frame[0])
|
module = inspect.getmodule(frame[0])
|
||||||
assert module is not None
|
if module is None:
|
||||||
|
raise ValueError(f"Module {frame[0]} not found.")
|
||||||
|
|
||||||
external = constants.Dirs.EXTERNAL_APP_ASSETS
|
external = constants.Dirs.EXTERNAL_APP_ASSETS
|
||||||
src_file_shared = Path(calling_file).parent / path
|
src_file_shared = Path(calling_file).parent / path
|
||||||
|
Loading…
Reference in New Issue
Block a user