@@ -80,7 +80,7 @@ def quota_scheduler(config: QuotaHandlersConfiguration) -> bool:
8080 for limiter in config .limiters :
8181 try :
8282 quota_revocation (connection , limiter )
83- except Exception as e :
83+ except Exception as e : # pylint: disable=broad-exception-caught)
8484 logger .error ("Quota revoke error: %s" , e )
8585 logger .info ("Quota scheduler sync finished" )
8686 sleep (period )
@@ -89,9 +89,7 @@ def quota_scheduler(config: QuotaHandlersConfiguration) -> bool:
8989 return True
9090
9191
92- def quota_revocation (
93- connection : Any , quota_limiter : QuotaLimiterConfiguration
94- ) -> None :
92+ def quota_revocation (connection : Any , quota_limiter : QuotaLimiterConfiguration ) -> None :
9593 """Quota revocation mechanism."""
9694 logger .info (
9795 "Quota revocation mechanism for limiter '%s' of type '%s'" ,
@@ -100,10 +98,10 @@ def quota_revocation(
10098 )
10199
102100 if quota_limiter .type is None :
103- raise Exception ("Limiter type not set, skipping revocation" )
101+ raise ValueError ("Limiter type not set, skipping revocation" )
104102
105103 if quota_limiter .period is None :
106- raise Exception ("Limiter period not set, skipping revocation" )
104+ raise ValueError ("Limiter period not set, skipping revocation" )
107105
108106 subject_id = get_subject_id (quota_limiter .type )
109107
@@ -184,6 +182,7 @@ def connect(config: QuotaHandlersConfiguration) -> Any:
184182 return connect_pg (config .postgres )
185183 if config .sqlite is not None :
186184 return connect_sqlite (config .sqlite )
185+ return None
187186
188187
189188def connect_pg (config : PostgreSQLDatabaseConfiguration ) -> Any :
@@ -203,7 +202,8 @@ def connect_pg(config: PostgreSQLDatabaseConfiguration) -> Any:
203202 connection .autocommit = True
204203 return connection
205204
206- def connect_sqlite (config : SQLiteDatabaseConfiguration ) -> None :
205+
206+ def connect_sqlite (config : SQLiteDatabaseConfiguration ) -> Any :
207207 """Initialize connection to database."""
208208 logger .info ("Connecting to SQLite storage" )
209209 # make sure the connection will have known state
0 commit comments