Skip to content

Commit

Permalink
code quality fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhlongviolin1 committed Jul 18, 2024
1 parent cb88da5 commit ef9457c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions taipy/gui/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,33 +186,33 @@ def my_index(path):

if path == "taipy.status.json":
return self._direct_render_json(self._gui._serve_status(pathlib.Path(template_folder) / path))
if str(os.path.normpath(file_path := ((base_path := static_folder + os.path.sep) + path))).startswith(
if (file_path := str(os.path.normpath((base_path := static_folder + os.path.sep) + path))).startswith(
base_path
) and os.path.isfile(file_path):
return send_from_directory(base_path, path)
# use the path mapping to detect and find resources
for k, v in self.__path_mapping.items():
if (
path.startswith(f"{k}/")
and str(
os.path.normpath(file_path := ((base_path := v + os.path.sep) + path[len(k) + 1 :]))
and (
file_path := str(os.path.normpath((base_path := v + os.path.sep) + path[len(k) + 1 :]))
).startswith(base_path)
and os.path.isfile(file_path)
):
return send_from_directory(base_path, path[len(k) + 1 :])
if (
hasattr(__main__, "__file__")
and str(
os.path.normpath(
file_path := ((base_path := os.path.dirname(__main__.__file__) + os.path.sep) + path)
and (
file_path := str(
os.path.normpath((base_path := os.path.dirname(__main__.__file__) + os.path.sep) + path)
)
).startswith(base_path)
and os.path.isfile(file_path)
and not self.__is_ignored(file_path)
):
return send_from_directory(base_path, path)
if (
str(os.path.normpath(file_path := (base_path := self._gui._root_dir + os.path.sep) + path)).startswith(
(file_path := str(os.path.normpath(base_path := self._gui._root_dir + os.path.sep) + path)).startswith(
base_path
)
and os.path.isfile(file_path)
Expand Down

0 comments on commit ef9457c

Please sign in to comment.