Move classname to Utility.py

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2025-12-13 21:32:18 +08:00
parent 5542500ce1
commit 28fa8c12b3
3 changed files with 5 additions and 12 deletions
+5
View File
@@ -35,6 +35,7 @@ __all__ = [
'Protocol',
'callRateLimited',
'callOnceOnly',
'classname',
'isValidIPAddress',
'parseHostPort',
'runExternalCommand',
@@ -121,6 +122,10 @@ def callOnceOnly(func):
return wrapper
def classname(ob) -> str:
return ob.__class__.__name__
@functools.lru_cache(None)
def isValidIPAddress(address) -> bool:
try:
-3
View File
@@ -281,9 +281,6 @@ class ImportQRCodeOnTheScreenAction(Mixins.CleanupOnExit, AppQAction):
except Exception as ex:
# Any non-exit exceptions
def classname(ob) -> str:
return ob.__class__.__name__
logger.error(f'\'{classname(self)}\' is not supported on this platform')
self.sct = None
@@ -218,9 +218,6 @@ class SubscriptionManager(WebGETManager):
except Exception as ex:
# Any non-exit exceptions
def classname(ob) -> str:
return ob.__class__.__name__
logger.error(f'parse share link from \'{webURL}\' failed: {ex}')
failureArgs.append({'error': classname(ex), **kwargs})
@@ -314,9 +311,6 @@ class TestPingLatencyWorker(QtCore.QObject, QtCore.QRunnable):
except Exception as ex:
# Any non-exit exceptions
def classname(ob) -> str:
return ob.__class__.__name__
self.factory.setExtras('delayResult', classname(ex))
# Extra guard
@@ -367,9 +361,6 @@ class TestTcpingLatencyWorker(QtCore.QObject, QtCore.QRunnable):
except Exception as ex:
# Any non-exit exceptions
def classname(ob) -> str:
return ob.__class__.__name__
self.factory.setExtras('delayResult', classname(ex))
# Extra guard