16
16
17
17
from UnleashClient .api import register_client
18
18
from UnleashClient .constants import (
19
+ APPLICATION_HEADERS ,
19
20
DISABLED_VARIATION ,
20
21
ETAG ,
21
22
METRIC_LAST_SENT_TIME ,
22
23
REQUEST_RETRIES ,
23
24
REQUEST_TIMEOUT ,
24
25
SDK_NAME ,
25
26
SDK_VERSION ,
26
- APPLICATION_HEADERS ,
27
27
)
28
28
from UnleashClient .events import (
29
29
BaseEvent ,
@@ -312,10 +312,21 @@ def initialize_client(self, fetch_toggles: bool = True) -> None:
312
312
)
313
313
314
314
# Decide mode
315
- mode = (self .experimental_mode or {}).get ("type" ) if self .experimental_mode else None
316
- format_mode = (self .experimental_mode or {}).get ("format" ) if self .experimental_mode else None
315
+ mode = (
316
+ (self .experimental_mode or {}).get ("type" )
317
+ if self .experimental_mode
318
+ else None
319
+ )
320
+ format_mode = (
321
+ (self .experimental_mode or {}).get ("format" )
322
+ if self .experimental_mode
323
+ else None
324
+ )
317
325
318
- if fetch_toggles and (mode is None or (mode == "polling" and (format_mode in (None , "full" )))):
326
+ if fetch_toggles and (
327
+ mode is None
328
+ or (mode == "polling" and (format_mode in (None , "full" )))
329
+ ):
319
330
# Default/full polling
320
331
fetch_headers = {
321
332
** base_headers ,
@@ -348,8 +359,8 @@ def initialize_client(self, fetch_toggles: bool = True) -> None:
348
359
executor = self .unleash_executor_name ,
349
360
kwargs = job_args ,
350
361
)
351
- elif fetch_toggles and mode == "streaming" : # Streaming mode
352
-
362
+ elif fetch_toggles and mode == "streaming" : # Streaming mode
363
+
353
364
stream_headers = {
354
365
** base_headers ,
355
366
"unleash-interval" : self .unleash_refresh_interval_str_millis ,
@@ -367,7 +378,7 @@ def initialize_client(self, fetch_toggles: bool = True) -> None:
367
378
368
379
# Start metrics job only
369
380
self .unleash_scheduler .start ()
370
- else : # No fetching - only load from cache
381
+ else : # No fetching - only load from cache
371
382
job_args = {
372
383
"cache" : self .cache ,
373
384
"engine" : self .engine ,
0 commit comments