Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@suppress_all_exceptions('fallback')
def test_exception_fallback():
raise Exception
assert test_exception_fallback() == 'fallback'
@suppress_all_exceptions()
def test_valid():
return 'Everything is OK'
assert test_valid() == 'Everything is OK'
@suppress_all_exceptions()
def test_exception_nofallback():
raise Exception
assert not test_exception_nofallback()
@suppress_all_exceptions()
def success():
_session.result = 'Success'
@suppress_all_exceptions()
def _get_AI_key():
from iotedgedev import __AIkey__ as key
return key
@suppress_all_exceptions()
def fail(exception, summary):
_session.exception = exception
_session.result = 'Fail'
_session.result_summary = summary
@suppress_all_exceptions()
@hash256_result
def _get_hash_mac_address(self):
s = ''
for index, c in enumerate(hex(uuid.getnode())[2:].upper()):
s += c
if index % 2:
s += '-'
s = s.strip('-')
return s
@suppress_all_exceptions()
def add_extra_props(props):
if props is not None:
_session.extra_props.update(props)
@suppress_all_exceptions(fallback_return=None)
def _get_core_version():
from iotedgedev import __version__ as core_version
return core_version
@suppress_all_exceptions()
def _upload_telemetry_with_user_agreement(payload, **kwargs):
# Call telemetry uploader as a subprocess to prevent blocking iotedgedev process
subprocess.Popen([sys.executable, os.path.realpath(telemetryuploader.__file__), payload], **kwargs)