-
Notifications
You must be signed in to change notification settings - Fork 10
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
validator using pypi's rocrate #38
Conversation
@NicolasCARPi Ok, this works:
The current version of the PASTA.eln file should not fail the validator |
from rocrate.model.entity import Entity | ||
from rocrate.model.contextentity import ContextEntity | ||
|
||
success = 0 |
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.
Instead of tracking exit code with success
var, simply do a sys.exit(1)
in the except
block, and otherwise a sys.exit(0)
for the happy path.
from rocrate.model.contextentity import ContextEntity | ||
|
||
success = 0 | ||
for root, _, files in os.walk(".", topdown=False): |
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.
I would suggest using the more modern Pathlib
instead of os
.
success = 0 | ||
for root, _, files in os.walk(".", topdown=False): | ||
for name in files: | ||
if not name.endswith('.eln'): |
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.
instead of checking with a not
and skipping, why not check for a positive condition and execute code, there is no need for else
condition anyway.
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.
or directly search the *.eln files with path.glob(...) method
if not name.endswith('.eln'): | ||
continue | ||
fileName = os.path.join(root, name) | ||
print(f'\n\nTry to parse: {fileName}') |
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.
I'd write: "Trying to parse" instead of "Try to parse"
No description provided.