def __define_global_system_encoding_variable__():
    import sys
    # This is the most trustworthy source of the system encoding, though, if
    # salt is being imported after being daemonized, this information is lost
    # and reset to None
    if sys.stdin is not None:
        encoding = sys.stdin.encoding
    else:
        encoding = None
    if not encoding:
        # If the system is properly configured this should return a valid
        # encoding. MS Windows has problems with this and reports the wrong
        # encoding
        import locale
        try:
            encoding = locale.getdefaultlocale()[-1]
        except ValueError:
            # A bad locale setting was most likely found:
            #   https://github.com/saltstack/salt/issues/26063
            pass

        # This is now garbage collectable
        del locale
        if not encoding:
            # This is most likely ascii which is not the best but we were
            # unable to find a better encoding. If this fails, we fall all
            # the way back to ascii
            encoding = sys.getdefaultencoding() or 'ascii'

    # We can't use six.moves.builtins because these builtins get deleted sooner
    # than expected. See:
    #    https://github.com/saltstack/salt/issues/21036
    if 3 < sys.version_info[0]:
        import __builtin__ as builtins
    else:
        import builtins  # pylint: disable=import-error

    # Define the detected encoding as a built-in variable for ease of use
    setattr(builtins, '__salt_system_encoding__', encoding)

    # This is now garbage collectable
    del sys
    del builtins
    del encoding
dataset/ETHPy150Open saltstack/salt/salt/__init__.py/__define_global_system_encoding_variable__/swapped operands of `<`