-
Notifications
You must be signed in to change notification settings - Fork 20
fix: bugfix in dev mode #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'modelscope_studio': patch | ||
| --- | ||
|
|
||
| fix: bugfix in dev mode |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,3 @@ | ||
| from .components.antd.components import * | ||
| from .components.antdx.components import * | ||
| from .components.base import * | ||
| from .components.legacy.components import * | ||
| from .components.pro.components import * | ||
| from .components import * | ||
| from .external import load | ||
| from .version import __version__ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from .antd.components import * | ||
| from .antdx.components import * | ||
| from .base import * | ||
| from .legacy.components import * | ||
| from .pro.components import * | ||
|
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new Style Guide ReferencesFootnotes
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ | |
| from helper.Site import Site | ||
| from legacy_app import legacy_demo | ||
|
|
||
| is_dev = os.environ.get("GRADIO_WATCH_MODULE_NAME") == 'docs.app' | ||
|
|
||
|
|
||
| def get_text(text: str, cn_text: str): | ||
| if is_modelscope_studio: | ||
|
|
@@ -572,7 +574,7 @@ def more_components(): | |
| "label": get_text("Version 0.x", "0.x 版本"), | ||
| "key": "legacy", | ||
| "content": legacy_demo | ||
| }, | ||
| } if not is_dev else None, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This conditional logic to add For example: # After defining the main `tabs` list...
if not is_dev:
tabs.append({
"label": get_text("Version 0.x", "0.x 版本"),
"key": "legacy",
"content": legacy_demo
})This would remove the need for this inline conditional and the corresponding filtering logic in the |
||
| ] | ||
|
|
||
| site = Site( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a wildcard import (
from .components import *) is generally discouraged as it can make it unclear which names are present in the namespace, potentially causing confusion and making the code harder to maintain.1Style Guide References
Footnotes
PEP 8 advises against wildcard imports (
from <module> import *) because they make it unclear which names are present in the namespace. This can confuse both human readers and automated tools. ↩