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