"from foo import bar" type syntax.
"""
- if f.__module__ == '__main__':
+ if f.__module__ == "__main__":
from pathlib import Path
import __main__
module = __main__.__file__
module = Path(module).stem
- return f'{module}:{f.__name__}'
+ return f"{module}:{f.__name__}"
else:
- return f'{f.__module__}:{f.__name__}'
+ return f"{f.__module__}:{f.__name__}"
-if __name__ == '__main__':
+if __name__ == "__main__":
import doctest
doctest.testmod()
import io
import logging
import os
+import re
import sys
from logging.config import fileConfig
from logging.handlers import RotatingFileHandler, SysLogHandler
from pyutils import function_utils
identifier = function_utils.function_identifier(f)
+
+ # Get rid of module paths, e.g. pyutils.ansi:bg -> ansi:bg which
+ # is what we're going to need below.
+ identifier = re.sub(r"[^\.]+\.", "", identifier)
squelched_logging_counts[identifier] = squelch_after_n_repeats
return f