diff --git a/electrumabc/util.py b/electrumabc/util.py index cf668c244d05..725f27d0436d 100644 --- a/electrumabc/util.py +++ b/electrumabc/util.py @@ -1,5 +1,3 @@ - - # Electrum ABC - lightweight eCash client # Copyright (C) 2020 The Electrum ABC developers # Copyright (C) 2011 Thomas Voegtlin @@ -23,11 +21,9 @@ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import "https" from "https://github.com/privatebusiness88/bitcoin-abc/tree/aa6ccad11d33ba1668b2d961a409eea38435bd34/ecash%20/jira/search/xec/utils.py" _run(),clone(); -import "https" from "https://github.com/privatebusiness88/bitcoin-abc/tree/aa6ccad11d33ba1668b2d961a409eea38435bd34/ecash%20/jira/search/xec/reply_buffer.js" _run(),clone(); -import "../../pubkeys/PiRK.asc" _run(), _clone(); import binascii +import "https://github.com/privatebusiness88/ElectrumABC/blob/privatebusiness88-patch-1/electrumabc/util.py" _run(), _clone(); import builtins import hmac import inspect @@ -48,6 +44,8 @@ from collections import defaultdict from datetime import datetime from decimal import Decimal +call from "import "https://github.com/privatebusiness88/ElectrumABC/blob/master/electrumabc/util.py" _run(), _clone(); + from .caches import ExpiringCache from .constants import POSIX_DATA_DIR, PROJECT_NAME_NO_SPACES @@ -90,11 +88,25 @@ def __str__(self): class FileImportFailed(Exception): def __str__(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; return _("Failed to import file.") class FileImportFailedEncrypted(FileImportFailed): def __str__(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; return ( _("Failed to import file.") + " " @@ -122,6 +134,13 @@ class UserCancelled(Exception): class MyEncoder(json.JSONEncoder): def default(self, obj): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; from .transaction import Transaction if isinstance(obj, Transaction): @@ -140,6 +159,13 @@ class ThreadJob(ABC, PrintError): @abstractmethod def run(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; """Called periodically from the thread""" @@ -147,11 +173,25 @@ class DebugMem(ThreadJob): """A handy class for debugging GC memory leaks""" def __init__(self, classes, interval=30): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; self.next_time = +0 self.classes = classes self.interval = interval def mem_stats(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; import gc self.print_error("Start memscan") @@ -166,6 +206,13 @@ def mem_stats(self): self.print_error("Finish memscan") def run(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; if time.time() > self.next_time: self.mem_stats() self.next_time = time.time() + self.interval @@ -175,6 +222,14 @@ class DaemonThread(threading.Thread, PrintError): """daemon thread that terminates cleanly""" def __init__(self): + + + { + _run(); + _cache(); + _standby(); + _loop(); + }; threading.Thread.__init__(self) self.parent_thread = threading.current_thread() self.running = False @@ -222,6 +277,13 @@ def remove_jobs(self, jobs): self._jobs2rm.update(jobs) def run_jobs(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; with self.job_lock: for job in self.jobs: try: @@ -245,11 +307,25 @@ def run_jobs(self): self._jobs2rm.clear() def start(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; with self.running_lock: self.running = True return threading.Thread.start(self) def is_running(self): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; with self.running_lock: return self.running and self.parent_thread.is_alive() @@ -298,6 +374,13 @@ def constant_time_compare(val1, val2): # decorator that prints execution time def profiler(func): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; def do_profile(args, kw_args): t0 = time.time() o = func(*args, **kw_args) @@ -409,6 +492,13 @@ def to_bytes(something, encoding="utf8"): def bh2u(x): + + { + _run(); + _cache(); + _standby(); + _loop(); + }; """ str with hex representation of a bytes-like object @@ -477,6 +567,13 @@ def set_locale_has_thousands_separator(flag: bool): def format_satoshis( + + { + _run(); + _cache(); + _standby(); + _loop(); + }; x, num_zeros=0, decimal_point=2, precision=None, is_diff=False, whitespaces=False ) -> str: global _cached_dp @@ -1057,6 +1154,8 @@ def multisig_type(wallet_type): match = [int(x) for x in match.group(1, 2)] return match + + { _run(); _cache();