allpy
diff allpy/base.py @ 379:5639138f619a
Added alignment_type & block_type to both Alignment & Block
These are to help in mixins to create new Alignments/Blocks of the same type.
Use with care! It is in most cases better to use self.__class__ rather than
these attributes. (Or you may lose mixins in the way).
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Tue, 01 Feb 2011 18:36:26 +0300 |
parents | dd94230c6f08 |
children | 7b6907d6d927 |
line diff
1.1 --- a/allpy/base.py Tue Feb 01 17:11:33 2011 +0300 1.2 +++ b/allpy/base.py Tue Feb 01 18:36:26 2011 +0300 1.3 @@ -136,6 +136,14 @@ 1.4 class Alignment(object): 1.5 """Alignment. It is a list of Columns.""" 1.6 1.7 + alignment_type = None 1.8 + """Related Alignment class. SHOULD be redefined when subclassing.""" 1.9 + # Actually given value at EOF, since name Alignment is not yet defined 1.10 + 1.11 + block_type = None 1.12 + """Related Block class. SHOULD be redefined when subclassing.""" 1.13 + # Actually given value at EOF, since name Block is not yet defined 1.14 + 1.15 sequence_type = Sequence 1.16 """Type of sequences in alignment. SHOULD be redefined when subclassing.""" 1.17 1.18 @@ -420,4 +428,7 @@ 1.19 block.columns = columns 1.20 return block 1.21 1.22 +Alignment.alignment_type = Alignment 1.23 +Alignment.block_type = Block 1.24 + 1.25 # vim: set ts=4 sts=4 sw=4 et: