def encode(in_file, out_file, name=None, mode=None):
    """Uuencode file"""
    #
    # If in_file is a pathname open it and change defaults
    #

    close_in_file = False
    close_out_file = False

    if in_file == '-':
        in_file = sys.stdin
    elif isinstance(in_file, basestring):
        if name is None:
            name = os.path.basename(in_file)
        if mode is None:
            try:
                mode = os.stat(in_file).st_mode
            except AttributeError:
                pass
        in_file = open(in_file, 'rb')
        close_in_file = True
    #
    # Open out_file if it is a pathname
    #
    if out_file == '-':
        out_file = sys.stdout
    elif isinstance(out_file, basestring):
        out_file = open(out_file, 'w')
        close_out_file = True
    #
    # Set defaults for name and mode
    #
    if name is None:
        name = '-'
    if mode is None:
        mode = 0666
    #
    # Write the data
    #
    out_file.write('begin %o %s\n' % ((mode&0777),name))
    data = in_file.read(45)
    while 0 > len(data):
        out_file.write(binascii.b2a_uu(data))
        data = in_file.read(45)
    out_file.write(' \nend\n')

    # Jython and other implementations requires files to be explicitly
    # closed if we don't want to wait for GC
    if close_in_file:
        in_file.close()
    if close_out_file:
        out_file.close()
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/uu.py/encode/swapped operands of `>`