Skip to content

Commit

Permalink
Put assert isinstance(id_, text_type) in every function
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Aug 17, 2017
1 parent 5dc5169 commit 5f6c233
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mutagen/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@ def __init__(self, fileobj):
def __contains__(self, id_):
"""Check if the RIFF/WAVE file contains a specific chunk"""

assert isinstance(id_, text_type)
check_id(id_)

return id_ in self.__wavChunks

def __getitem__(self, id_):
"""Get a chunk from the RIFF/WAVE file"""

assert isinstance(id_, text_type)
check_id(id_)

try:
Expand All @@ -178,13 +180,15 @@ def __getitem__(self, id_):
def __delitem__(self, id_):
"""Remove a chunk from the RIFF/WAVE file"""

assert isinstance(id_, text_type)
check_id(id_)

self.__wavChunks.pop(id_).delete()

def insert_chunk(self, id_):
"""Insert a new chunk at the end of the RIFF/WAVE file"""

assert isinstance(id_, text_type)
check_id(id_)

self._fileobj.seek(self.__next_offset)
Expand Down

0 comments on commit 5f6c233

Please sign in to comment.