Beispiel #1
0
def test_encoding():
    assert base36.encode(0) == '0'
    assert base36.encode(1) == '1'
    assert base36.encode(9) == '9'
    assert base36.encode(10) == 'A'
    assert base36.encode(11) == 'B'
    assert base36.encode(35) == 'Z'
    assert base36.encode(36) == '10'
    assert base36.encode(36 + 10) == '1A'
    assert base36.encode(36 * 10) == 'A0'
    assert base36.encode(36 * 36) == '100'
Beispiel #2
0
def test_encoding():
    assert base36.encode(0) == "0"
    assert base36.encode(1) == "1"
    assert base36.encode(9) == "9"
    assert base36.encode(10) == "A"
    assert base36.encode(11) == "B"
    assert base36.encode(35) == "Z"
    assert base36.encode(36) == "10"
    assert base36.encode(36 + 10) == "1A"
    assert base36.encode(36 * 10) == "A0"
    assert base36.encode(36 * 36) == "100"
Beispiel #3
0
def test_encoding():
    eq_(base36.encode(0), '0')
    eq_(base36.encode(1), '1')
    eq_(base36.encode(9), '9')
    eq_(base36.encode(10), 'A')
    eq_(base36.encode(11), 'B')
    eq_(base36.encode(35), 'Z')
    eq_(base36.encode(36), '10')
    eq_(base36.encode(36 + 10), '1A')
    eq_(base36.encode(36 * 10), 'A0')
    eq_(base36.encode(36 * 36), '100')
Beispiel #4
0
    def run(self, user):
        self.user = User.get(user)

        print 'Generating logger id...',
        m = hashlib.md5()
        m.update(str(user))
        self.logger_id = base36.encode(int(m.hexdigest(), 16))[0:3]
        print self.logger_id

        self.export_sessions(user)
Beispiel #5
0
    def run(self, user):
        self.user = User.get(user)

        print 'Generating logger id...',
        m = hashlib.md5()
        m.update(str(user))
        self.logger_id = base36.encode(int(m.hexdigest(), 16))[0:3]
        print self.logger_id

        self.export_sessions(user)
Beispiel #6
0
def parse_logger_id(line):
    # non IGC loggers may use more than 3 characters as unique ID.
    # we just use the first three, currently no model is known which
    # really uses more than 3 characters.

    if line[1:4] == 'FIL':
        # filser doesn't respect the IGC file specification and
        # stores the unique id as base 10 instead of base 36.
        match = afil_re.match(line)
        if match and match.group(1):
            return base36.encode(int(match.group(1)))
    else:
        return import_alnum(line[4:7]).upper()