File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,23 @@ def init_bar(self, limit: int) -> None:
254
254
self .bar = ProgressBar (limit = limit )
255
255
self .bar .open ()
256
256
257
+ def is_scope (self , scope : str , category : Categories = None ) -> bool :
258
+ """
259
+ Queries a given scope to check if it exists, and optionally if it matches a given category.
260
+
261
+ If no category is given, will return true if the scope exists. If a category is given, will
262
+ return true if and only if the scope exists and matches the given category.
263
+
264
+ :param scope: the scope to check
265
+ :param category: optional; the category to check for
266
+ :return: whether the scope exists and optionally matches the category
267
+ """
268
+ scope_exists : bool = scope in self ._scopes
269
+ if category is None :
270
+ return scope_exists
271
+ else :
272
+ return scope_exists and self ._scopes [scope ] == category
273
+
257
274
def new (self ,
258
275
message : str ,
259
276
scope : str ,
You can’t perform that action at this time.
0 commit comments