diff --git a/README.md b/README.md index 9afd9cf..f1e6e8c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Firepup650 Package containing various shorthand things I use, and a few imports I almost always use ### Change log: +#### v.1.0.45: +Added an explode function (dangerous!!) #### v.1.0.44: Added a getRandomNumber function (xkcd 221) #### v.1.0.43: diff --git a/package/README.md b/package/README.md index 9afd9cf..f1e6e8c 100644 --- a/package/README.md +++ b/package/README.md @@ -1,6 +1,8 @@ # Firepup650 Package containing various shorthand things I use, and a few imports I almost always use ### Change log: +#### v.1.0.45: +Added an explode function (dangerous!!) #### v.1.0.44: Added a getRandomNumber function (xkcd 221) #### v.1.0.43: diff --git a/package/pyproject.toml b/package/pyproject.toml index 72bcaa8..2180f25 100644 --- a/package/pyproject.toml +++ b/package/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "firepup650" -version = "1.0.44" +version = "1.0.45" authors = ["Firepup650 <firepyp650@gmail.com>"] description = "Package containing various shorthand things I use, and a few imports I almost always use" readme = "README.md" diff --git a/package/src/firepup650/__init__.py b/package/src/firepup650/__init__.py index af4db5f..26bfe03 100644 --- a/package/src/firepup650/__init__.py +++ b/package/src/firepup650/__init__.py @@ -41,8 +41,8 @@ def alias(func): return decorator -__VERSION__ = "1.0.42" -__NEW__ = "Small typo fix" +__VERSION__ = "1.0.45" +__NEW__ = "Added an explode function (dangerous!!)" __LICENSE__ = "MIT" @@ -1007,3 +1007,37 @@ def getRandomNumber() -> int: None""" return 4 # chosen by fair dice roll. # garunteed to be random. + + +class YouDoNotKnowWhatYouAreDoing(Exception): + """Exception raised when a Linux only method is called on a Windows machine""" + + +def explode(*_, iKnowWhatIAmDoingLetMeRunTheStupidFunction: bool) -> NoReturn: + """# Function: explode + Causes a BSoD on Windows, and hangs Linux for a while. + This function is not a joke! Be careful of what you're doing. + # Inputs: + *_ - If any positonal arguments are passed, throws a TypeError + iKnowWhatIAmDoingLetMeRunTheStupidFunction: bool - If True, then executes the dangerous code. otherwise raises a "You don't know what you're doing" exception + + # Returns: + NoReturn + + # Raises: + TypeError - caused if positional arguments are passed + YouDoNotKnowWhatYouAreDoing - caused if iKnowWhatIAmDoingLetMeRunTheStupidFunction is not True + """ + if _ != (): + raise TypeError( + f"explode() takes 0 positional arguments but {len(_)} were given" + ) + if iKnowWhatIAmDoingLetMeRunTheStupidFunction != True: + raise yYuDoNotKnowWhatYouAreDoingException("Let me save you from yourself.") + sys.setrecursionlimit(2**31 - 1) + + def recur(): + recur() + + recur() + raise NotImplementedError("This code is impossible to reach.")