Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
f564d8ed
Commit
f564d8ed
authored
Aug 29, 2023
by
bluelovers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: refactor function
parent
d83a1ba6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
15 deletions
+6
-15
modules/ui_extra_networks_user_metadata.py
modules/ui_extra_networks_user_metadata.py
+6
-15
No files found.
modules/ui_extra_networks_user_metadata.py
View file @
f564d8ed
...
@@ -10,21 +10,12 @@ from modules import generation_parameters_copypaste, images, sysinfo, errors
...
@@ -10,21 +10,12 @@ from modules import generation_parameters_copypaste, images, sysinfo, errors
from
modules.paths_internal
import
models_path
from
modules.paths_internal
import
models_path
def
windows_to_unix_style
(
path
):
def
exclude_root_path
(
root_path
,
path
):
return
Path
(
path
)
.
as_posix
()
path_object
=
Path
(
path
)
if
path_object
.
is_relative_to
(
root_path
):
path_object
=
path_object
.
relative_to
(
root_path
)
def
exclude_root_path
(
root_path
,
path_to_exclude
):
try
:
return
path_object
.
as_posix
()
relative_path
=
os
.
path
.
relpath
(
path_to_exclude
,
root_path
)
# 如果路径已经在 root_path 之外,relpath 会返回绝对路径
# 所以需要检查路径是否在 root_path 之内
if
not
relative_path
.
startswith
(
'..'
):
return
windows_to_unix_style
(
relative_path
)
except
ValueError
:
pass
# 如果路径无法相对化,或者位于 root_path 之外,则返回原始路径
return
windows_to_unix_style
(
path_to_exclude
)
class
UserMetadataEditor
:
class
UserMetadataEditor
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment