From b169903987beced69bdfa0f37f882b1bf1f41d27 Mon Sep 17 00:00:00 2001 From: Arjun Sreedharan Date: Sat, 26 Jul 2014 02:38:19 +0530 Subject: [PATCH 1/2] stick to Python's style guide best practice 'Programs must be written for people to read, and only incidentally for machines to execute.' (Harold Abelson) http://legacy.python.org/dev/peps/pep-0008/#programming-recommendations Signed-off-by: Arjun Sreedharan --- youtube_dl/YoutubeDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index f295174cf..776b03191 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -849,7 +849,7 @@ class YoutubeDL(object): # Keep for backwards compatibility info_dict['stitle'] = info_dict['title'] - if not 'format' in info_dict: + if 'format' not in info_dict: info_dict['format'] = info_dict['ext'] reason = self._match_entry(info_dict) From 60918dd84935d74f478481b4e571f7196e3f8f3e Mon Sep 17 00:00:00 2001 From: Arjun Sreedharan Date: Sat, 26 Jul 2014 02:58:42 +0530 Subject: [PATCH 2/2] use isinstance() instead of type() to assert type Signed-off-by: Arjun Sreedharan --- youtube_dl/YoutubeDL.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 776b03191..a532f4272 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -275,7 +275,7 @@ class YoutubeDL(object): return message assert hasattr(self, '_output_process') - assert type(message) == type('') + assert isinstance(message, str) line_count = message.count('\n') + 1 self._output_process.stdin.write((message + '\n').encode('utf-8')) self._output_process.stdin.flush() @@ -303,7 +303,7 @@ class YoutubeDL(object): def to_stderr(self, message): """Print message to stderr.""" - assert type(message) == type('') + assert isinstance(message, str) if self.params.get('logger'): self.params['logger'].error(message) else: