~ubuntu-branches/ubuntu/precise/pydicom/precise

« back to all changes in this revision

Viewing changes to dicom/sequence.py

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2011-11-18 15:16:34 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20111118151634-xiusfypm3ifjai1x
Tags: 0.9.6-1
* New upstream release
* Boosted policy compliance to 3.9.2 -- no changes
* Packaging is no longer done based on a fragile hg2git bridging back to
  the source distribution tarballs:
  - debian/gbp.conf adjusted correspondingly to use 'overlay' approach
  - debian/rules fixed to not cd to sources any longer
* Converted to use dh_python2
* Build-depend on python-all and python-numpy for testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# sequence.py
 
2
"""Hold the Sequence class, which stores a dicom sequence (list of Datasets)"""
 
3
# Copyright (c) 2008 Darcy Mason
 
4
# This file is part of pydicom, released under a modified MIT license.
 
5
#    See the file license.txt included with this distribution, also
 
6
#    available at http://pydicom.googlecode.com
 
7
 
 
8
from dicom.dataelem import DataElement
 
9
 
 
10
class Sequence(list):
 
11
    """Slightly modified python list to print nicely"""
 
12
    def __str__(self):
 
13
        lines = [str(x) for x in self]
 
14
        return "[" + "".join(lines) + "]"
 
15
    
 
16
    def __repr__(self):
 
17
        formatstr = "<%(classname)s, length %(count)d, at %(id)X>"
 
18
        return   formatstr % {'classname':self.__class__.__name__, 'id':id(self), 'count':len(self)}
 
19