diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-16 08:13:37 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-16 17:56:09 -0500 |
commit | f3f2f2a151ba7cc3251388f8c167b52499527a18 (patch) | |
tree | f5c58e6acc89983376f8f598f8a0959f488131eb /coverage/misc.py | |
parent | 46a511d6207b9386c25a666cc5580af8e1aa9237 (diff) | |
download | python-coveragepy-git-f3f2f2a151ba7cc3251388f8c167b52499527a18.tar.gz |
refactor: filename_suffix() is only used by CoverageData, so move it
Diffstat (limited to 'coverage/misc.py')
-rw-r--r-- | coverage/misc.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/coverage/misc.py b/coverage/misc.py index 5b62fb4e..aaf1bcf7 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -12,9 +12,7 @@ import inspect import locale import os import os.path -import random import re -import socket import sys import types @@ -222,26 +220,6 @@ def output_encoding(outfile=None): return encoding -def filename_suffix(suffix): - """Compute a filename suffix for a data file. - - If `suffix` is a string or None, simply return it. If `suffix` is True, - then build a suffix incorporating the hostname, process id, and a random - number. - - Returns a string or None. - - """ - if suffix is True: - # If data_suffix was a simple true value, then make a suffix with - # plenty of distinguishing information. We do this here in - # `save()` at the last minute so that the pid will be correct even - # if the process forks. - dice = random.Random(os.urandom(8)).randint(0, 999999) - suffix = "%s.%s.%06d" % (socket.gethostname(), os.getpid(), dice) - return suffix - - class Hasher: """Hashes Python data for fingerprinting.""" def __init__(self): |