Commits

Travis Shirk committed 1aba2e9

doc strings, exception consistency

Comments (0)

Files changed (2)

src/eyed3/id3/headers.py

     def rev_version(self):
         return self._version[2]
 
-    ##
-    # \param f File pointer positioned at the start of the ID3 v2 header.
-    # \throws TagException Thrown if the header is invalid
-    # \returns True if a tag header was parsed, False if not.
     def parse(self, f):
+        '''Parse an ID3 v2 header starting at the current position of ``f``.
+        If a header is parsed ``True`` is returned, otherwise ``False``. If
+        a header is found but malformed an ``eyed3.id3.tag.TagException`` is
+        thrown.
+        '''
         from .tag import TagException
 
         self.clear()
 
     # Only call this when you *know* there is an extened header.
     def parse(self, fp, version):
+        '''Parse an ID3 v2 extended header starting at the current position
+        of ``fp`` and per the format defined by ``version``. This method
+        should only be called when the presence of an extended header is known
+        since it moves the file position. If a header is found but malformed
+        an ``eyed3.id3.tag.TagException`` is thrown. The return value is
+        ``None``.
+        '''
         from .tag import TagException
         assert(version[0] == 2)
 
                            frame_header.data_length_indicator))
             if (frame_header.minor_version >= 4 and frame_header.compressed and
                    not frame_header.data_length_indicator):
-                raise FrameException("Invalid frame; compressed with no data "
-                                     "length indicator")
+                core.parseError(FrameException("Invalid frame; compressed with "
+                                               "no data length indicator"))
 
             return frame_header
         elif frame_id == '\x00\x00\x00\x00':

src/eyed3/id3/tag.py

             fileobj = file(filename, "rb")
             close_file = True
         else:
-            raise TagException("Invalid type: %s" % str(type(fileobj)))
+            raise ValueError("Invalid type: %s" % str(type(fileobj)))
 
         self.file_info = FileInfo(filename)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.