Standardize warnings with WARNING ⚠️ ... (#9467)
* Standardize warnings * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
295c5e9d3c
commit
ca9c993d6c
17 files changed
+45
-44
No files matched your search
+8
-2
@@ -4,9 +4,15 @@ utils/initialization
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import platform
|
||||
import threading
|
||||
|
||||
|
||||
def emojis(str=''):
|
||||
# Return platform-dependent emoji-safe version of string
|
||||
return str.encode().decode('ascii', 'ignore') if platform.system() == 'Windows' else str
|
||||
|
||||
|
||||
class TryExcept(contextlib.ContextDecorator):
|
||||
# YOLOv5 TryExcept class. Usage: @TryExcept() decorator or 'with TryExcept():' context manager
|
||||
def __init__(self, msg=''):
|
||||
@@ -17,7 +23,7 @@ class TryExcept(contextlib.ContextDecorator):
|
||||
|
||||
def __exit__(self, exc_type, value, traceback):
|
||||
if value:
|
||||
print(f'{self.msg}{value}')
|
||||
print(emojis(f'{self.msg}{value}'))
|
||||
return True
|
||||
|
||||
|
||||
@@ -38,7 +44,7 @@ def notebook_init(verbose=True):
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from utils.general import check_font, check_requirements, emojis, is_colab
|
||||
from utils.general import check_font, check_requirements, is_colab
|
||||
from utils.torch_utils import select_device # imports
|
||||
|
||||
check_requirements(('psutil', 'IPython'))
|
||||
|
||||
Reference in new issue
Block a user