mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-22 23:08:08 +03:00
Improve Python code readability
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -1013,7 +1013,6 @@ class DesktopApplication(ApplicationRunner, SingletonApplication):
|
|||||||
return ApplicationRunner.ExitCode.ExitSuccess.value
|
return ApplicationRunner.ExitCode.ExitSuccess.value
|
||||||
|
|
||||||
pluginRegistry = self.addEnviron()
|
pluginRegistry = self.addEnviron()
|
||||||
|
|
||||||
self._cleanupStack.register('plugins', pluginRegistry.shutdown)
|
self._cleanupStack.register('plugins', pluginRegistry.shutdown)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1029,6 +1028,7 @@ class DesktopApplication(ApplicationRunner, SingletonApplication):
|
|||||||
self._cleanupStack.register(
|
self._cleanupStack.register(
|
||||||
'mixin-owned resources', Mixins.CleanupOnExit.cleanupAll
|
'mixin-owned resources', Mixins.CleanupOnExit.cleanupAll
|
||||||
)
|
)
|
||||||
|
|
||||||
self._initializeControllers()
|
self._initializeControllers()
|
||||||
self._cleanupStack.register('controllers', self._cleanupControllers)
|
self._cleanupStack.register('controllers', self._cleanupControllers)
|
||||||
|
|
||||||
@@ -1041,6 +1041,7 @@ class DesktopApplication(ApplicationRunner, SingletonApplication):
|
|||||||
self._cleanupStack.register('theme detection', self._stopThemeDetection)
|
self._cleanupStack.register('theme detection', self._stopThemeDetection)
|
||||||
|
|
||||||
self.aboutToQuit.connect(self.cleanup)
|
self.aboutToQuit.connect(self.cleanup)
|
||||||
|
|
||||||
self._initializeSystemIntegration()
|
self._initializeSystemIntegration()
|
||||||
|
|
||||||
self._initializeUI()
|
self._initializeUI()
|
||||||
|
|||||||
@@ -387,9 +387,12 @@ class EndpointInfoService(QtCore.QObject):
|
|||||||
self._cached = False
|
self._cached = False
|
||||||
self._requestInFlight = False
|
self._requestInFlight = False
|
||||||
self._countryHint = ''
|
self._countryHint = ''
|
||||||
|
|
||||||
self.httpClient.cancelAll()
|
self.httpClient.cancelAll()
|
||||||
|
|
||||||
self._setState(EndpointInfoState.Loading)
|
self._setState(EndpointInfoState.Loading)
|
||||||
self._publishResult(EndpointInfo())
|
self._publishResult(EndpointInfo())
|
||||||
|
|
||||||
self._startLookup()
|
self._startLookup()
|
||||||
|
|
||||||
def requestIfNeeded(self):
|
def requestIfNeeded(self):
|
||||||
|
|||||||
@@ -583,6 +583,7 @@ class _LatencyScheduler(QtCore.QObject):
|
|||||||
self.discardTcpingJobs(
|
self.discardTcpingJobs(
|
||||||
lambda job: job.target.subscriptionSource in subscriptionIds
|
lambda job: job.target.subscriptionSource in subscriptionIds
|
||||||
)
|
)
|
||||||
|
|
||||||
self.scheduleDrain()
|
self.scheduleDrain()
|
||||||
|
|
||||||
def discardTcpingJobs(self, predicate):
|
def discardTcpingJobs(self, predicate):
|
||||||
@@ -1391,6 +1392,7 @@ class ProfileTestManager(QtCore.QObject):
|
|||||||
def reconcileProfiles(self):
|
def reconcileProfiles(self):
|
||||||
"""Refresh current identity once and proactively invalidate stale work."""
|
"""Refresh current identity once and proactively invalidate stale work."""
|
||||||
self._targets = _currentTargets(self._profilesProvider())
|
self._targets = _currentTargets(self._profilesProvider())
|
||||||
|
|
||||||
self._latencyScheduler.reconcileProfiles()
|
self._latencyScheduler.reconcileProfiles()
|
||||||
self._serialDownloadScheduler.reconcileProfiles()
|
self._serialDownloadScheduler.reconcileProfiles()
|
||||||
self._concurrentDownloadScheduler.reconcileProfiles()
|
self._concurrentDownloadScheduler.reconcileProfiles()
|
||||||
@@ -1419,6 +1421,7 @@ class ProfileTestManager(QtCore.QObject):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._shuttingDown = True
|
self._shuttingDown = True
|
||||||
|
|
||||||
self._latencyScheduler.shutdown()
|
self._latencyScheduler.shutdown()
|
||||||
self._serialDownloadScheduler.cancelAll()
|
self._serialDownloadScheduler.cancelAll()
|
||||||
self._concurrentDownloadScheduler.cancelAll()
|
self._concurrentDownloadScheduler.cancelAll()
|
||||||
|
|||||||
@@ -552,7 +552,6 @@ class SubscriptionManager(HttpGetManager):
|
|||||||
jobId = getattr(outcome, 'jobId', -1)
|
jobId = getattr(outcome, 'jobId', -1)
|
||||||
|
|
||||||
self._preparationJobs.pop(jobId, None)
|
self._preparationJobs.pop(jobId, None)
|
||||||
|
|
||||||
fallbackPayload = self._preparationPayloads.pop(jobId, None)
|
fallbackPayload = self._preparationPayloads.pop(jobId, None)
|
||||||
context = getattr(outcome, 'context', {})
|
context = getattr(outcome, 'context', {})
|
||||||
|
|
||||||
@@ -1089,7 +1088,6 @@ class SubscriptionManager(HttpGetManager):
|
|||||||
operations = []
|
operations = []
|
||||||
|
|
||||||
self._nextBatchId += 1
|
self._nextBatchId += 1
|
||||||
|
|
||||||
batchId = self._nextBatchId
|
batchId = self._nextBatchId
|
||||||
|
|
||||||
for unique, subscription in batch:
|
for unique, subscription in batch:
|
||||||
|
|||||||
@@ -347,10 +347,13 @@ class TrafficStatsManager(
|
|||||||
"""Stop statistics work without changing the connection lifecycle."""
|
"""Stop statistics work without changing the connection lifecycle."""
|
||||||
self._sampleTimer.stop()
|
self._sampleTimer.stop()
|
||||||
self._generation += 1
|
self._generation += 1
|
||||||
|
|
||||||
self._cancelCurrentQuery()
|
self._cancelCurrentQuery()
|
||||||
self._monitor = None
|
self._monitor = None
|
||||||
|
|
||||||
self._resetSamples()
|
self._resetSamples()
|
||||||
self._beginConnectionUsage()
|
self._beginConnectionUsage()
|
||||||
|
|
||||||
self.statisticsUnavailable.emit()
|
self.statisticsUnavailable.emit()
|
||||||
|
|
||||||
@QtCore.Slot(bool)
|
@QtCore.Slot(bool)
|
||||||
@@ -514,10 +517,13 @@ class TrafficStatsManager(
|
|||||||
self._connected = False
|
self._connected = False
|
||||||
self._sampleTimer.stop()
|
self._sampleTimer.stop()
|
||||||
self._generation += 1
|
self._generation += 1
|
||||||
|
|
||||||
self._cancelCurrentQuery()
|
self._cancelCurrentQuery()
|
||||||
self._monitor = None
|
self._monitor = None
|
||||||
|
|
||||||
self._resetSamples()
|
self._resetSamples()
|
||||||
self._beginConnectionUsage()
|
self._beginConnectionUsage()
|
||||||
|
|
||||||
self.statisticsUnavailable.emit()
|
self.statisticsUnavailable.emit()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
|||||||
@@ -583,6 +583,7 @@ class ConnectionStartupAsyncTest(TestCase):
|
|||||||
'Global',
|
'Global',
|
||||||
deepcopy=False,
|
deepcopy=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
succeeded = []
|
succeeded = []
|
||||||
operation.succeeded.connect(succeeded.append)
|
operation.succeeded.connect(succeeded.append)
|
||||||
|
|
||||||
|
|||||||
@@ -831,12 +831,14 @@ class ProfileTestServiceTest(unittest.TestCase):
|
|||||||
|
|
||||||
activeLatency.finish('stale')
|
activeLatency.finish('stale')
|
||||||
processQtEvents()
|
processQtEvents()
|
||||||
|
|
||||||
self.assertEqual(retained.metadata.latency, '')
|
self.assertEqual(retained.metadata.latency, '')
|
||||||
self.assertEqual(len(pool.started), 2)
|
self.assertEqual(len(pool.started), 2)
|
||||||
|
|
||||||
otherLatency = pool.started[1]
|
otherLatency = pool.started[1]
|
||||||
otherLatency.finish('9ms')
|
otherLatency.finish('9ms')
|
||||||
processQtEvents()
|
processQtEvents()
|
||||||
|
|
||||||
otherDownload = next(
|
otherDownload = next(
|
||||||
worker
|
worker
|
||||||
for worker in _ControlledDownloadWorker.instances
|
for worker in _ControlledDownloadWorker.instances
|
||||||
|
|||||||
@@ -1073,6 +1073,7 @@ class SubscriptionManagerTest(TestCase):
|
|||||||
self.assertTrue(started.wait(2))
|
self.assertTrue(started.wait(2))
|
||||||
|
|
||||||
handled = []
|
handled = []
|
||||||
|
|
||||||
QtCore.QTimer.singleShot(0, lambda: handled.append(True))
|
QtCore.QTimer.singleShot(0, lambda: handled.append(True))
|
||||||
processQtEvents(1)
|
processQtEvents(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user