1# Copyright 2021 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4"""Module for tag-related helper functions.""" 5 6from typing import Iterable, Type 7 8from flake_suppressor_common import common_typing as ct 9 10TagUtils = None 11 12 13def SetTagUtilsImplementation(impl: Type['BaseTagUtils']) -> None: 14 global TagUtils 15 assert issubclass(impl, BaseTagUtils) 16 TagUtils = impl() 17 18 19class BaseTagUtils(): 20 def RemoveIgnoredTags(self, tags: Iterable[str]) -> ct.TagTupleType: 21 """Removes ignored tags from |tags|. 22 23 Here we return all the tags as is, since child classes will do the 24 implementation specific filtering. 25 26 Args: 27 tags: An iterable of strings containing tags 28 29 Returns: 30 A tuple of strings containing the contents of |tags| with ignored tags 31 removed. 32 """ 33 return tuple(tags) 34 35 36TagUtils = BaseTagUtils() 37