-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace entry_point with activate/deactive function (#68)
* add activate/deactivate_function * Update npe2/manifest/schema.py Co-authored-by: Nathan Clack <[email protected]> * rename Co-authored-by: Nathan Clack <[email protected]>
- Loading branch information
1 parent
c3ba912
commit 1fa80fa
Showing
7 changed files
with
78 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import re | ||
|
||
# how do we deal with keywords ? | ||
# do we try to validate ? Or do we just | ||
# assume users won't try to create a command named | ||
# `npe2_tester.False.if.for.in` ? | ||
_identifier_plus_dash = "(?:[a-zA-Z_][a-zA-Z_0-9-]+)" | ||
_dotted_name = f"(?:(?:{_identifier_plus_dash}\\.)*{_identifier_plus_dash})" | ||
PYTHON_NAME_PATTERN = re.compile(f"^({_dotted_name}):({_dotted_name})$") | ||
DOTTED_NAME_PATTERN = re.compile(_dotted_name) | ||
|
||
|
||
def python_name(name: str) -> str: | ||
"""Assert that `name` is a valid python name: e.g. `module.submodule:funcname`""" | ||
if name and not PYTHON_NAME_PATTERN.match(name): | ||
raise ValueError( | ||
f"{name} is not a valid python_name. A python_name must " | ||
"be of the form `{obj.__module__}:{obj.__qualname__} `(e.g. " | ||
"`my_package.a_module:some_function`). " | ||
) | ||
return name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters