@@ -248,7 +248,7 @@ def on_call_check_tokens(request: _Request,) -> _OnCallTokenVerification:
248
248
@_dataclasses .dataclass (frozen = True )
249
249
class FirebaseConfig ():
250
250
"""
251
- A collection of configuration options needed to
251
+ A collection of configuration options needed to
252
252
initialize a firebase App.
253
253
"""
254
254
@@ -265,22 +265,22 @@ def firebase_config() -> None | FirebaseConfig:
265
265
config_file = _os .getenv ("FIREBASE_CONFIG" )
266
266
if not config_file :
267
267
return None
268
- if config_file .startswith ('{' ):
268
+ if config_file .startswith ("{" ):
269
269
json_str = config_file
270
270
else :
271
271
# Firebase Tools will always use a JSON blob in prod, but docs
272
272
# explicitly state that the user can set the env to a file:
273
273
# https://firebase.google.com/docs/admin/setup#initialize-without-parameters
274
274
try :
275
- with open (config_file , 'r' ) as json_file :
275
+ with open (config_file , "r" , encoding = "utf8" ) as json_file :
276
276
json_str = json_file .read ()
277
277
except Exception as err :
278
- raise ValueError ('Unable to read file {}. {}' . format (
279
- config_file , err ))
278
+ raise ValueError (
279
+ f"Unable to read file { config_file } . { err } " ) from err
280
280
try :
281
281
json_data : dict = _json .loads (json_str )
282
282
except Exception as err :
283
283
raise ValueError (
284
- 'FIREBASE_CONFIG JSON string "{0 }" is not valid json. {1}' . format (
285
- json_str , err ))
286
- return FirebaseConfig (storage_bucket = json_data .get (' storageBucket' ))
284
+ f 'FIREBASE_CONFIG JSON string "{ json_str } " is not valid json. { err } '
285
+ ) from err
286
+ return FirebaseConfig (storage_bucket = json_data .get (" storageBucket" ))
0 commit comments