#wip(py): Errors in base64 done.

This commit is contained in:
KyMAN 2024-05-04 11:13:39 +02:00
parent 3571f6aba7
commit ac82b0a78b
3 changed files with 12 additions and 3 deletions

View File

@ -242,7 +242,7 @@ class Anonymous(MemWeb.Abstracts.Common):
data[processed_key] = self.__get_method(data, subkey) data[processed_key] = self.__get_method(data, subkey)
error |= ( error |= (
(1 << 0 if i else 0) if data[processed_key] == None else (0 if i else 1 << 0) if data[processed_key] == None else
1 << 1 if not callable(data[processed_key]) else 1 << 1 if not callable(data[processed_key]) else
0) << (38 + i * 2) 0) << (38 + i * 2)

View File

@ -10,6 +10,7 @@ from inspect import stack as get_stack
from traceback import format_stack as trace_format_stack from traceback import format_stack as trace_format_stack
from traceback import extract_tb as extract_traceback from traceback import extract_tb as extract_traceback
from time import time as timestamp from time import time as timestamp
from base64 import b64encode as base64_encode
import datetime import datetime
if "common" not in globals(): if "common" not in globals():
@ -530,6 +531,13 @@ class MemWeb:
"line" : stack.lineno "line" : stack.lineno
} }
@staticmethod
def base64_encode(data):
return base64_encode(bytes(
data.to_bytes((data.bit_length() + 7) // 8, byteorder = "big") if isinstance(data, (int, float)) else
data.encode() if isinstance(data, str) else
data.encode("ascii"))).decode()
def _print(self, _type, message, inputs = None, i = 1): def _print(self, _type, message, inputs = None, i = 1):
basic_type = self.get_print_type(_type) basic_type = self.get_print_type(_type)
@ -738,7 +746,8 @@ class MemWeb:
if error_message: if error_message:
own = { own = {
"code" : error, "code" : self.base64_encode(error),
"raw_code" : error,
"end" : "", "end" : "",
**{key : value for subset in (variables if isinstance(variables, (list, tuple)) else (variables,)) for key, value in (subset if isinstance(subset, dict) else {}).items()} **{key : value for subset in (variables if isinstance(variables, (list, tuple)) else (variables,)) for key, value in (subset if isinstance(subset, dict) else {}).items()}
} }

View File

@ -1 +1 @@
0.0.3 0.0.4