-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
27,854 additions
and
1,327 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
_build/ | ||
.vscode/ | ||
.vscode/ | ||
.cache/ |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: neo-fun | ||
version: 0.13.1 | ||
version: 0.14.0 | ||
test-dependencies: | ||
- [email protected] using main | ||
readme: README.md | ||
|
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,47 @@ | ||
# /// script | ||
# requires-python = ">=3.8" | ||
# dependencies = [] | ||
# "jinja2", | ||
# ] | ||
# /// | ||
import sys | ||
from typing import Any, Sequence | ||
import jinja2 | ||
import argparse | ||
|
||
|
||
def format_each(iterable: Any, s: str) -> Any: | ||
return (s.format(x) for x in iterable) | ||
|
||
|
||
_GENERATED_FILE_WARNING = """// d8888b. .d88b. d8b db .d88b. d888888b d88888b d8888b. d888888b d888888b | ||
// 88 `8D .8P Y8. 888o 88 .8P Y8. `~~88~~' 88' 88 `8D `88' `~~88~~' | ||
// 88 88 88 88 88V8o 88 88 88 88 88ooooo 88 88 88 88 | ||
// 88 88 88 88 88 V8o88 88 88 88 88~~~~~ 88 88 88 88 | ||
// 88 .8D `8b d8' 88 V888 `8b d8' 88 88. 88 .8D .88. 88 | ||
// Y8888D' `Y88P' VP V8P `Y88P' YP Y88888P Y8888D' Y888888P YP""" | ||
|
||
|
||
def gen_warning(filename: str) -> str: | ||
return f"{_GENERATED_FILE_WARNING}\n\n// This file was GENERATED from {filename}" | ||
|
||
|
||
def main(argv: Sequence[str]) -> int: | ||
parser = argparse.ArgumentParser( | ||
description="Renders a Jinja template from stdin to stdout" | ||
) | ||
parser.parse_args(argv) # No arguments, but throws if arguments are provided | ||
template_str = sys.stdin.read() | ||
env = jinja2.Environment( | ||
line_statement_prefix="#%", | ||
line_comment_prefix="##", | ||
) | ||
env.filters["format_each"] = format_each # type: ignore | ||
tmpl = env.from_string(template_str) | ||
s = tmpl.render(generated_file_notice=gen_warning) | ||
sys.stdout.write(s) | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv[1:])) |
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
Oops, something went wrong.