-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added login module + saving access file in a specific path.
- Loading branch information
Showing
5 changed files
with
102 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ | |
|
||
setup( | ||
name="atop", | ||
version="0.1.8-1", | ||
version="0.1.9", | ||
author="Aaarghhh", | ||
author_email="[email protected]", | ||
packages=["atop", "atop.modules"], | ||
package_dir={'':'src'}, | ||
package_dir={"": "src"}, | ||
include_package_data=True, | ||
entry_points={"console_scripts": ["a-ton-of-privacy = atop.atop:run"]}, | ||
url="https://github.com/aaarghhh/a_TON_of_privacy", | ||
|
@@ -30,7 +30,7 @@ | |
"rsa>=4.9", | ||
"soupsieve>=2.5", | ||
"Telethon==1.30.3", | ||
"urllib3>=2.0.5" | ||
"urllib3>=2.0.5", | ||
], | ||
zip_safe=False, | ||
) |
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,63 @@ | ||
import os | ||
import sys | ||
import errno | ||
import math | ||
|
||
ERROR_INVALID_NAME = 123 | ||
|
||
|
||
class Util: | ||
def __init__(self): | ||
pass | ||
|
||
@staticmethod | ||
def is_pathname_valid(pathname: str) -> bool: | ||
""" | ||
`True` if the passed pathname is a valid pathname for the current OS; | ||
`False` otherwise. | ||
""" | ||
try: | ||
if not isinstance(pathname, str) or not pathname: | ||
return False | ||
|
||
_, pathname = os.path.splitdrive(pathname) | ||
root_dirname = ( | ||
os.environ.get("HOMEDRIVE", "C:") | ||
if sys.platform == "win32" | ||
else os.path.sep | ||
) | ||
assert os.path.isdir(root_dirname) | ||
root_dirname = root_dirname.rstrip(os.path.sep) + os.path.sep | ||
|
||
for pathname_part in pathname.split(os.path.sep): | ||
try: | ||
os.lstat(root_dirname + pathname_part) | ||
except OSError as exc: | ||
if hasattr(exc, "winerror"): | ||
if exc.winerror == ERROR_INVALID_NAME: | ||
return False | ||
elif exc.errno in {errno.ENAMETOOLONG, errno.ERANGE}: | ||
return False | ||
except TypeError as exc: | ||
return False | ||
else: | ||
return True | ||
|
||
@staticmethod | ||
def get_file_size(self, path): | ||
return os.path.getsize(path) | ||
|
||
@staticmethod | ||
def get_file_size_human(self, path): | ||
size = self.get_file_size(path) | ||
return self.convert_size(size) | ||
|
||
@staticmethod | ||
def convert_size(self, size_bytes): | ||
if size_bytes == 0: | ||
return "0B" | ||
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") | ||
i = int(math.floor(math.log(size_bytes, 1024))) | ||
p = math.pow(1024, i) | ||
s = round(size_bytes / p, 2) | ||
return "%s %s" % (s, size_name[i]) |