-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ShellJob
: Change the signature of custom parser functions
The current required signature for parser functions is: def parser(self: Parser, dirpath: pathlib.Path) -> dict[str, Data]: In most use cases, the `Parser` instance is not really necessary and it is really the `dirpath` that is the most important. On top of that, it being called `self` does not really make it very clear what it is. The reason for it being called `self` was historical since in an early implementation the custom parser function was actually dynamically added as a member method of the parser instance. However, currently it is simply called as a standalone function. Since the most common use cases would just require the `dirpath`, it is made possible to define a parser as follows: def parser(dirpath: pathlib.Path) -> dict[str, Data]: In cases where the `Parser` instance is desirable, the code also accepts functions that define that as the second argument: def parser(dirpath: pathlib.Path, parser: Parser) -> dict[str, Data]: The argument is also renamed from `self` to `parser` to make it more evident as to what it refers to.
- Loading branch information
Showing
6 changed files
with
100 additions
and
12 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
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