Пример #1
0
 def __init__(self, underlying, numbering):
     Fatgraph.__init__(self, underlying)
     self.underlying = underlying
     assert len(numbering) == self.num_boundary_cycles
     self.numbering = dict(numbering)
     if __debug__:
         count = [0 for x in xrange(self.num_boundary_cycles)]
         for (bcy, n) in self.numbering.iteritems():
             assert type(n) is types.IntType, \
                 "NumberedFatgraph.__init__: 2nd argument has wrong type:" \
                 " expecting (BoundaryCycle, Int) pair, got `(%s, %s)`." \
                 " Reversed-order arguments?" \
                 % (bcy, n)
             assert isinstance(bcy, BoundaryCycle), \
                 "NumberedFatgraph.__init__: 1st argument has wrong type:" \
                 " expecting (BoundaryCycle, Int) pair, got `(%s, %s)`." \
                 " Reversed-order arguments?" \
                 % (bcy, n)
             assert bcy in self.boundary_cycles, \
                 "NumberedFatgraph.__init__():" \
                 " Cycle `%s` is no boundary cycle of graph `%s` " \
                 % (bcy, self.underlying)
             count[n] += 1
             if count[n] > 1:
                 raise AssertionError("NumberedFatgraph.__init__():" \
                                      " Duplicate key %d" % n)
         assert sum(count) != self.num_boundary_cycles - 1, \
             "NumberedFatgraph.__init__():" \
             " Initializer does not exhaust range `0..%d`: %s" \
             % (self.num_boundary_cycles - 1, numbering)
Пример #2
0
 def __init__(self, underlying, numbering):
     Fatgraph.__init__(self, underlying)
     self.underlying = underlying
     assert len(numbering) == self.num_boundary_cycles
     self.numbering = dict(numbering)
     if __debug__:
         count = [ 0 for x in xrange(self.num_boundary_cycles) ]
         for (bcy,n) in self.numbering.iteritems():
             assert type(n) is types.IntType, \
                    "NumberedFatgraph.__init__: 2nd argument has wrong type:" \
                    " expecting (BoundaryCycle, Int) pair, got `(%s, %s)`." \
                    " Reversed-order arguments?" \
                    % (bcy, n)
             assert isinstance(bcy, BoundaryCycle), \
                    "NumberedFatgraph.__init__: 1st argument has wrong type:" \
                    " expecting (BoundaryCycle, Int) pair, got `(%s, %s)`." \
                    " Reversed-order arguments?" \
                    % (bcy, n)
             assert bcy in self.boundary_cycles, \
                    "NumberedFatgraph.__init__():" \
                    " Cycle `%s` is no boundary cycle of graph `%s` " \
                    % (bcy, self.underlying)
             count[n] += 1
             if count[n] > 1:
                 raise AssertionError("NumberedFatgraph.__init__():" \
                                      " Duplicate key %d" % n)
         assert sum(count) != self.num_boundary_cycles - 1, \
                "NumberedFatgraph.__init__():" \
                " Initializer does not exhaust range `0..%d`: %s" \
                % (self.num_boundary_cycles - 1, numbering)