def send_metadata(self):
        ''' Send the metadata to the package index server.

            Well, do the following:
            1. figure who the user is, and then
            2. send the data as a Basic auth'ed POST.

            First we try to read the username/password from $HOME/.pypirc,
            which is a ConfigParser-formatted file with a section
            [server-login] containing username and password entries (both
            in clear text). Eg:

                [server-login]
                username: fred
                password: sekrit

            Otherwise, to figure who the user is, we offer the user three
            choices:

             1. use existing login,
             2. register as a new user, or
             3. set the password to a random string and email the user.

        '''
        choice = 'x'
        username = password = ''

        # see if we can short-cut and get the username/password from the
        # config
        config = None
        if os.environ.has_key('HOME'):
            rc = os.path.join(os.environ['HOME'], '.pypirc')
            if os.path.exists(rc):
                print 'Using PyPI login from %s'%rc
                config = ConfigParser.ConfigParser()
                config.read(rc)
                username = config.get('server-login', 'username')
                password = config.get('server-login', 'password')
                choice = '1'

        # get the user's login info
        choices = '1 2 3 4'.split()
        while choice not in choices:
            print '''We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: ''',
            choice = raw_input()
            if not choice:
                choice = '1'
            elif choice not in choices:
                print 'Please choose one of the four options!'

        if choice == '1':
            # get the username and password
            while not username:
                username = raw_input('Username: ')
            while not password:
                password = getpass.getpass('Password: ')

            # set up the authentication
            auth = urllib2.HTTPPasswordMgr()
            host = urlparse.urlparse(self.repository)[1]
            auth.add_password('pypi', host, username, password)

            # send the info to the server and report the result
            code, result = self.post_to_server(self.build_post_data('submit'),
                auth)
            print 'Server response (%s): %s'%(code, result)

            # possibly save the login
            if os.environ.has_key('HOME') and config is None and code == 200:
                rc = os.path.join(os.environ['HOME'], '.pypirc')
                print 'I can store your PyPI login so future submissions will be faster.'
                print rc%'(the login will be stored in %s)'
                choice = 'X'
                while choice.lower() not in 'yn':
                    choice = raw_input('Save your login (y/N)?')
                    if not choice:
                        choice = 'n'
                if choice.lower() == 'y':
                    f = open(rc, 'w')
                    f.write('[server-login]\nusername:%s\npassword:%s\n'%(
                        username, password))
                    f.close()
                    try:
                        os.chmod(rc, 0600)
                    except:
                        pass
        elif choice == '2':
            data = {':action': 'user'}
            data['name'] = data['password'] = data['email'] = ''
            data['confirm'] = None
            while not data['name']:
                data['name'] = raw_input('Username: ')
            while data['password'] != data['confirm']:
                while not data['password']:
                    data['password'] = getpass.getpass('Password: ')
                while not data['confirm']:
                    data['confirm'] = getpass.getpass(' Confirm: ')
                if data['password'] != data['confirm']:
                    data['password'] = ''
                    data['confirm'] = None
                    print "Password and confirm don't match!"
            while not data['email']:
                data['email'] = raw_input('   EMail: ')
            code, result = self.post_to_server(data)
            if code != 200:
                print 'Server response (%s): %s'%(code, result)
            else:
                print 'You will receive an email shortly.'
                print 'Follow the instructions in it to complete registration.'
        elif choice == '3':
            data = {':action': 'password_reset'}
            data['email'] = ''
            while not data['email']:
                data['email'] = raw_input('Your email address: ')
            code, result = self.post_to_server(data)
            print 'Server response (%s): %s'%(code, result)
dataset/ETHPy150Open babble/babble/include/jython/Lib/distutils/command/register.py/register.send_metadata/swapped operands of `%`