-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated readme with citation, added citation reminder for beginning a…
…nd end of programs using SPINEPS
- Loading branch information
1 parent
fc9763b
commit 3dbb54a
Showing
7 changed files
with
64 additions
and
5 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
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,42 @@ | ||
import atexit | ||
import os | ||
|
||
from rich.console import Console | ||
|
||
GITHUB_LINK = "https://github.com/Hendrik-code/spineps" | ||
|
||
ARXIV_LINK = "https://arxiv.org/abs/2402.16368" | ||
|
||
has_reminded_citation = False | ||
|
||
|
||
def citation_reminder(func): | ||
"""Decorator to remind users to cite SPINEPS.""" | ||
|
||
def wrapper(*args, **kwargs): | ||
global has_reminded_citation # noqa: PLW0603 | ||
if not has_reminded_citation: | ||
print_citation_reminder() | ||
has_reminded_citation = True | ||
func_result = func(*args, **kwargs) | ||
return func_result | ||
|
||
return wrapper | ||
|
||
|
||
def print_citation_reminder(): | ||
console = Console() | ||
console.rule("Thank you for using [bold]SPINEPS[/bold]") | ||
console.print( | ||
"Please support our development by citing", | ||
justify="center", | ||
) | ||
console.print( | ||
f"GitHub: {GITHUB_LINK}\nArXiv: {ARXIV_LINK}\n Thank you!", | ||
justify="center", | ||
) | ||
console.rule() | ||
console.line() | ||
|
||
|
||
atexit.register(print_citation_reminder) |