|
|
@ -164,7 +164,7 @@ class IterableSimpleNamespace(SimpleNamespace):
|
|
|
|
return getattr(self, key, default)
|
|
|
|
return getattr(self, key, default)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def plt_settings(rcparams={'font.size': 11}, backend='Agg'):
|
|
|
|
def plt_settings(rcparams=None, backend='Agg'):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Decorator to temporarily set rc parameters and the backend for a plotting function.
|
|
|
|
Decorator to temporarily set rc parameters and the backend for a plotting function.
|
|
|
|
|
|
|
|
|
|
|
@ -180,6 +180,9 @@ def plt_settings(rcparams={'font.size': 11}, backend='Agg'):
|
|
|
|
callable: Decorated function with temporarily set rc parameters and backend.
|
|
|
|
callable: Decorated function with temporarily set rc parameters and backend.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if rcparams is None:
|
|
|
|
|
|
|
|
rcparams = {'font.size': 11}
|
|
|
|
|
|
|
|
|
|
|
|
def decorator(func):
|
|
|
|
def decorator(func):
|
|
|
|
"""Decorator to apply temporary rc parameters and backend to a function."""
|
|
|
|
"""Decorator to apply temporary rc parameters and backend to a function."""
|
|
|
|
|
|
|
|
|
|
|
@ -242,7 +245,7 @@ if WINDOWS: # emoji-safe logging
|
|
|
|
LOGGER.addFilter(EmojiFilter())
|
|
|
|
LOGGER.addFilter(EmojiFilter())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def yaml_save(file='data.yaml', data={}):
|
|
|
|
def yaml_save(file='data.yaml', data=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Save YAML data to a file.
|
|
|
|
Save YAML data to a file.
|
|
|
|
|
|
|
|
|
|
|
@ -253,6 +256,8 @@ def yaml_save(file='data.yaml', data={}):
|
|
|
|
Returns:
|
|
|
|
Returns:
|
|
|
|
None: Data is saved to the specified file.
|
|
|
|
None: Data is saved to the specified file.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
if data is None:
|
|
|
|
|
|
|
|
data = {}
|
|
|
|
file = Path(file)
|
|
|
|
file = Path(file)
|
|
|
|
if not file.parent.exists():
|
|
|
|
if not file.parent.exists():
|
|
|
|
# Create parent directories if they don't exist
|
|
|
|
# Create parent directories if they don't exist
|
|
|
@ -603,10 +608,11 @@ def threaded(func):
|
|
|
|
|
|
|
|
|
|
|
|
def set_sentry():
|
|
|
|
def set_sentry():
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Initialize the Sentry SDK for error tracking and reporting. Enabled when sync=True in settings and
|
|
|
|
Initialize the Sentry SDK for error tracking and reporting. Only used if sentry_sdk package is installed and
|
|
|
|
disabled when sync=False. Run 'yolo settings' to see and update settings YAML file.
|
|
|
|
sync=True in settings. Run 'yolo settings' to see and update settings YAML file.
|
|
|
|
|
|
|
|
|
|
|
|
Conditions required to send errors:
|
|
|
|
Conditions required to send errors (ALL conditions must be met or no errors will be reported):
|
|
|
|
|
|
|
|
- sentry_sdk package is installed
|
|
|
|
- sync=True in YOLO settings
|
|
|
|
- sync=True in YOLO settings
|
|
|
|
- pytest is not running
|
|
|
|
- pytest is not running
|
|
|
|
- running in a pip package installation
|
|
|
|
- running in a pip package installation
|
|
|
@ -653,7 +659,12 @@ def set_sentry():
|
|
|
|
is_pip_package() and \
|
|
|
|
is_pip_package() and \
|
|
|
|
not is_git_dir():
|
|
|
|
not is_git_dir():
|
|
|
|
|
|
|
|
|
|
|
|
import sentry_sdk # noqa
|
|
|
|
# If sentry_sdk package is not installed then return and do not use Sentry
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
import sentry_sdk # noqa
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
sentry_sdk.init(
|
|
|
|
sentry_sdk.init(
|
|
|
|
dsn='https://5ff1556b71594bfea135ff0203a0d290@o4504521589325824.ingest.sentry.io/4504521592406016',
|
|
|
|
dsn='https://5ff1556b71594bfea135ff0203a0d290@o4504521589325824.ingest.sentry.io/4504521592406016',
|
|
|
|
debug=False,
|
|
|
|
debug=False,
|
|
|
|