Update TryExcept(msg='...')` (#9261)
This commit is contained in:
1 parent
5d4787baab
commit
15e82d2967
3 files changed
+4
-4
No files matched your search
+2
-2
@@ -9,7 +9,7 @@ import threading
|
||||
|
||||
class TryExcept(contextlib.ContextDecorator):
|
||||
# YOLOv5 TryExcept class. Usage: @TryExcept() decorator or 'with TryExcept():' context manager
|
||||
def __init__(self, msg='default message here'):
|
||||
def __init__(self, msg=''):
|
||||
self.msg = msg
|
||||
|
||||
def __enter__(self):
|
||||
@@ -17,7 +17,7 @@ class TryExcept(contextlib.ContextDecorator):
|
||||
|
||||
def __exit__(self, exc_type, value, traceback):
|
||||
if value:
|
||||
print(f'{self.msg}: {value}')
|
||||
print(f'{self.msg}{value}')
|
||||
return True
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user