~ubuntu-branches/ubuntu/maverick/bzr/maverick

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_py.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-03-24 22:27:38 UTC
  • mfrom: (1.4.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100324222738-5lsc0gdzmtcdp1vp
Tags: 2.1.1-1
* Remove bob2 from uploaders. Closes: #573427
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
34
34
 
35
35
    def __init__(self, *args):
36
36
        """Create a new 'StaticTuple'"""
 
37
        num_keys = len(args)
 
38
        if num_keys < 0 or num_keys > 255:
 
39
            raise TypeError('StaticTuple(...) takes from 0 to 255 items')
37
40
        for bit in args:
38
41
            if type(bit) not in (str, StaticTuple, unicode, int, long, float,
39
42
                                 None.__class__, bool):
40
43
                raise TypeError('StaticTuple can only point to'
41
44
                    ' StaticTuple, str, unicode, int, long, float, bool, or'
42
45
                    ' None not %s' % (type(bit),))
43
 
        num_keys = len(args)
44
 
        if num_keys < 0 or num_keys > 255:
45
 
            raise ValueError('must have 1 => 256 key bits')
46
46
        # We don't need to pass args to tuple.__init__, because that was
47
47
        # already handled in __new__.
48
48
        tuple.__init__(self)