REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.31 KB
Close
/opt/imunify360/venv/lib/python3.11/site-packages/pycares/utils.py
Text
Base64
try: import idna as idna2008 except ImportError: idna2008 = None def ascii_bytes(data): if isinstance(data, str): return data.encode('ascii') if isinstance(data, bytes): return data raise TypeError('only str (ascii encoding) and bytes are supported') def maybe_str(data): if isinstance(data, str): return data if isinstance(data, bytes): try: return data.decode('ascii') except UnicodeDecodeError: return data raise TypeError('only str (ascii encoding) and bytes are supported') def is_all_ascii(text): for c in text: if ord(c) > 0x7f: return False return True def parse_name_idna2008(name): parts = name.split('.') r = [] for part in parts: if is_all_ascii(part): r.append(part.encode('ascii')) else: r.append(idna2008.encode(part)) return b'.'.join(r) def parse_name(name): if isinstance(name, str): if is_all_ascii(name): return name.encode('ascii') if idna2008 is not None: return parse_name_idna2008(name) return name.encode('idna') if isinstance(name, bytes): return name raise TypeError('only str and bytes are supported') __all__ = ['ascii_bytes', 'maybe_str', 'parse_name']
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2026-05-27 11:04:31
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
errno.py
1.01 KB
lrw-r--r--
2026-04-14 09:45:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
utils.py
1.31 KB
lrw-r--r--
2026-04-14 09:45:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_cares.cpython-311-x86_64-linux-gnu.so
186.25 KB
lrwxr-xr-x
2026-04-14 09:45:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
_version.py
23 B
lrw-r--r--
2026-04-14 09:45:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
29.06 KB
lrw-r--r--
2026-04-14 09:45:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__main__.py
2.73 KB
lrw-r--r--
2026-04-14 09:45:17
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).