py416
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.53 | ||
| Version: 0.54 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "py416" | ||
| version = "0.53" | ||
| version = "0.54" | ||
| authors = [ | ||
@@ -10,0 +10,0 @@ { name="Ezio416", email="ezezio416@gmail.com" }, |
| Metadata-Version: 2.1 | ||
| Name: py416 | ||
| Version: 0.53 | ||
| Version: 0.54 | ||
| Summary: don't question my methods | ||
@@ -5,0 +5,0 @@ Author-email: Ezio416 <ezezio416@gmail.com> |
@@ -5,4 +5,4 @@ ''' | ||
| Created: 2022-08-15 | ||
| Updated: 2022-11-09 | ||
| Version: 0.53 | ||
| Updated: 2022-11-10 | ||
| Version: 0.54 | ||
@@ -12,3 +12,3 @@ A collection of various functions | ||
| from .general import * | ||
| __version__ = 0, 53 | ||
| __version__ = 0, 54 | ||
| v = __version__ |
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2022-08-16 | ||
| | Updated: 2022-10-06 | ||
| | Updated: 2022-11-10 | ||
@@ -855,2 +855,3 @@ - Functions for filesystem and path string manipulation | ||
| - reads text from a file | ||
| - wraps `open() <https://docs.python.org/3/library/functions.html#open>`_ | ||
@@ -857,0 +858,0 @@ Parameters |
+40
-1
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2022-08-18 | ||
| | Updated: 2022-11-09 | ||
| | Updated: 2022-11-10 | ||
@@ -15,2 +15,41 @@ - Functions for various things | ||
| def bytesize(byte: int, si: bool = False) -> str: | ||
| ''' | ||
| - scales a number of bytes to a prefixed format | ||
| Parameters | ||
| ---------- | ||
| byte: int | ||
| - number of bytes to scale | ||
| si: bool | ||
| - whether to use SI units (1000^x bytes: KB, MB, GB) | ||
| - default: False (1024^x bytes: KiB, MiB, GiB) | ||
| Returns | ||
| ------- | ||
| str | ||
| - bytes in prefixed format, rounded to 2 decimal places | ||
| - i.e.: | ||
| - 1200000 => '1.20MB' | ||
| - 1253656678 => '1.17GiB' | ||
| ''' | ||
| byte = int(byte) | ||
| if byte < 0: | ||
| raise ValueError(f'bytes can\'t be negative; invalid: {byte}') | ||
| if si: | ||
| factor = 1000 | ||
| units = ('', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') | ||
| else: | ||
| factor = 1024 | ||
| units = ('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi') | ||
| if byte < factor: # less than 1000 or 1024 bytes | ||
| return f'{byte}B' | ||
| for unit in units: | ||
| if byte < factor: | ||
| return f'{byte:.2f}{unit}B' | ||
| byte /= factor | ||
| return f'{byte*factor:.2f}{unit}B' # user passed in stupidly large number | ||
| def gettype(thing) -> str: | ||
@@ -17,0 +56,0 @@ ''' |
| ''' | ||
| | Author: Ezio416 | ||
| | Created: 2022-10-11 | ||
| | Updated: 2022-10-12 | ||
| | Updated: 2022-11-10 | ||
@@ -24,3 +24,3 @@ - Functions for getting basic system information | ||
| ''' | ||
| gets info on the CPU | ||
| - gets info on the CPU | ||
@@ -112,3 +112,3 @@ Parameters | ||
| ''' | ||
| gets all system info programmed into this module | ||
| - gets all system info programmed into this module | ||
@@ -150,4 +150,4 @@ Parameters | ||
| ''' | ||
| gets the RAM usage data | ||
| all byte values are in GiB (1024^3 bytes) | ||
| - gets the RAM usage data | ||
| - all byte values are in GiB (1024^3 bytes) | ||
@@ -188,3 +188,3 @@ Parameters | ||
| ''' | ||
| gets various system info such as boot time | ||
| - gets various system info such as boot time | ||
@@ -237,3 +237,3 @@ Parameters | ||
| ''' | ||
| Gets a list of users currently logged in | ||
| - gets a list of users currently logged in | ||
@@ -240,0 +240,0 @@ Parameters |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
147340
0.83%1453
2.47%