Coverage for slidge/util/__init__.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.17.0, created at 2026-11-10 12:26 +0000

1""" 

2Miscellaneous helpful functions. 

3""" 

4 

5import warnings 

6 

7from . import types 

8from .util import ( 

9 addLoggingLevel, 

10 batch_set_attributes, 

11 is_valid_phone_number, 

12 replace_mentions, 

13 strip_illegal_chars, 

14) 

15 

16 

17def formatwarning( 

18 message: Warning | str, 

19 category: type[Warning], 

20 filename: str, 

21 lineno: int, 

22 line: str = "", 

23) -> str: 

24 return f"{filename}:{lineno}:{category.__name__}:{message}\n" 

25 

26 

27addLoggingLevel() 

28warnings.formatwarning = formatwarning # type:ignore 

29 

30__all__ = [ 

31 "batch_set_attributes", 

32 "is_valid_phone_number", 

33 "replace_mentions", 

34 "strip_illegal_chars", 

35 "types", 

36]