Skip to content

Commit

Permalink
[utils/aoc] make aoc.args and aoc.argparser work like class propertie…
Browse files Browse the repository at this point in the history
…s (disguised getters)
  • Loading branch information
StarlitGhost committed Dec 10, 2024
1 parent a9552bb commit 6e1b999
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Binary file added .aoc_tiles/tiles/2024/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ My solutions to the yearly Advents of Code

<!-- AOC TILES BEGIN -->
<h1 align="center">
Advent of Code - 179/468
Advent of Code - 181/470
</h1>
<h1 align="center">
2024 - 18 ⭐ - Python
2024 - 20 ⭐ - Python
</h1>
<a href="2024/1/script.py">
<img src=".aoc_tiles/tiles/2024/01.png" width="161px">
Expand Down Expand Up @@ -35,6 +35,9 @@ My solutions to the yearly Advents of Code
<a href="2024/9/script.py">
<img src=".aoc_tiles/tiles/2024/09.png" width="161px">
</a>
<a href="None">
<img src=".aoc_tiles/tiles/2024/10.png" width="161px">
</a>
<h1 align="center">
2023 - 47 ⭐ - Python
</h1>
Expand Down
16 changes: 14 additions & 2 deletions utils/GhostyUtils/aoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,25 @@
_args = None


def argparser():
def __getattr__(name):
properties = {
'argparser': _argparser,
'args': _get_args,
}
if name in properties:
return properties[name]()
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")


def _argparser():
global _parser
return _parser


def args():
def _get_args():
global _args
if _args is None:
_args = _parser.parse_args()
return _args


Expand Down

0 comments on commit 6e1b999

Please sign in to comment.