1.0.40 (Increased limits on the menu function) and 1.0.41 (Windows "Support")

This commit is contained in:
Firepup Sixfifty 2024-08-30 12:15:36 -05:00
parent 969446bed6
commit 1f13093f38
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48
3 changed files with 230 additions and 169 deletions

View file

@ -1,7 +1,9 @@
# Firepup650 # Firepup650
Package containing various shorthand things I use, and a few imports I almost always use Package containing various shorthand things I use, and a few imports I almost always use
### Change log: ### Change log:
#### v.1.0.39: #### v.1.0.41:
Windows "Support"
#### v.1.0.40:
Add offset mapping all the way up to 10 Billion, which exceeds the integer limit. Add offset mapping all the way up to 10 Billion, which exceeds the integer limit.
#### v.1.0.39: #### v.1.0.39:
Add offset mappings for exceeding 1 Million options, new limit is 10 Million options Add offset mappings for exceeding 1 Million options, new limit is 10 Million options

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "firepup650" name = "firepup650"
version = "1.0.39" version = "1.0.41"
authors = ["Firepup650 <firepyp650@gmail.com>"] authors = ["Firepup650 <firepyp650@gmail.com>"]
description = "Package containing various shorthand things I use, and a few imports I almost always use" description = "Package containing various shorthand things I use, and a few imports I almost always use"
readme = "README.md" readme = "README.md"

View file

@ -1,10 +1,19 @@
"""Firepup650's PYPI Package""" """Firepup650's PYPI Package"""
import os, sys, termios, tty, time, sqlite3, ast, pydoc # type: ignore[import] fkey, termios, tty = None, None, None
import random as r
import fkeycapture as fkey
import fpsql as fql
from warnings import warn as ww from warnings import warn as ww
try:
import termios, tty, fkeycapture as fkey
except ImportError:
ww(
"Warning! This module has reduced functionality on Windows! I hope you know what you're doing!",
stackLevel=2,
)
import os, sys, time, sqlite3, ast, pydoc # type: ignore[import]
import random as r
import fpsql as fql
from typing import NoReturn, TypeVar, Type, Optional, List, Any, Union from typing import NoReturn, TypeVar, Type, Optional, List, Any, Union
from collections.abc import Iterable from collections.abc import Iterable
@ -32,11 +41,15 @@ def alias(func):
return decorator return decorator
__VERSION__ = "1.0.34" __VERSION__ = "1.0.41"
__NEW__ = "Adds methods to hide/show the cursor and a menu system" __NEW__ = 'Windows "Support"'
__LICENSE__ = "MIT" __LICENSE__ = "MIT"
class NotImplementedOnWindowsException(NotImplementedException):
"""Exception raised when a Linux only method is called on a Windows machine"""
def flushPrint(*args) -> None: def flushPrint(*args) -> None:
"""# Function: flushPrint """# Function: flushPrint
Prints and flushes the provided args. Prints and flushes the provided args.
@ -117,6 +130,20 @@ def e(code: Union[str, int, None] = None) -> NoReturn:
sys.exit(code) sys.exit(code)
def gp(
keycount: int = 1,
chars: list = ["1", "2"],
bytes: bool = False,
allowDelete: bool = False,
filler: str = "-",
) -> Union[str, bytes]:
raise NotImplementedOnWindowsException(
"This method is not implemented for Windows machines"
)
if fkey:
def gp( def gp(
keycount: int = 1, keycount: int = 1,
chars: list = ["1", "2"], chars: list = ["1", "2"],
@ -158,6 +185,21 @@ def gp(
return ("".join(keys)).encode() return ("".join(keys)).encode()
def gh(
keycount: int = 1,
chars: list = ["1", "2"],
char: str = "*",
bytes: bool = False,
allowDelete: bool = False,
filler: str = "-",
) -> Union[str, bytes]:
raise NotImplementedOnWindowsException(
"This method is not implemented for Windows machines"
)
if fkey:
def gh( def gh(
keycount: int = 1, keycount: int = 1,
chars: list = ["1", "2"], chars: list = ["1", "2"],
@ -201,6 +243,14 @@ def gh(
return ("".join(keys)).encode() return ("".join(keys)).encode()
def printt(text: str, delay: float = 0.1, newline: bool = True) -> None:
raise NotImplementedOnWindowsException(
"This method is not implemented for Windows machines"
)
if fkey:
def printt(text: str, delay: float = 0.1, newline: bool = True) -> None: def printt(text: str, delay: float = 0.1, newline: bool = True) -> None:
"""# Function: printt """# Function: printt
Print out animated text! Print out animated text!
@ -633,11 +683,12 @@ class console:
# Raises: # Raises:
None""" None"""
ind = 1 ind = 1
while warning in console.__warnings__: warn = warning
warning = f"{warning}({ind})" while warn in console.__warnings__:
warn = f"{warning}({ind})"
ind += 1 ind += 1
console.__warnings__.append(warning) console.__warnings__.append(warn)
ww(warning, class_, 2) ww(warn, class_, 2)
@staticmethod @staticmethod
def error(*args, **kwargs) -> None: def error(*args, **kwargs) -> None:
@ -855,6 +906,14 @@ def hidden(func):
return wrapper return wrapper
def menu(options: dict, title: str = "") -> object:
raise NotImplementedOnWindowsException(
"This method is not implemented for Windows machines"
)
if fkey:
@hidden @hidden
def menu(options: dict, title: str = "") -> object: def menu(options: dict, title: str = "") -> object:
"""# Function: menu """# Function: menu
@ -902,7 +961,7 @@ def menu(options: dict, title: str = "") -> object:
indicatorOffset = -7 indicatorOffset = -7
case ( case (
21 21
): # 1000000000=9999999999 options (Ten Billion rolls over) (This exceeds integer limits, so if we get over this I've got no clue how.) ): # 1000000000-9999999999 options (Ten Billion rolls over) (This exceeds integer limits, so if we get over this I've got no clue how.)
indicatorOffset = -8 indicatorOffset = -8
case _: case _:
raise ValueError( raise ValueError(