From ee8b403142394938c1295a6b34703f82c6ac38f2 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 15 Dec 2018 11:39:14 -0800 Subject: [PATCH] Remove unnecessary bytes type check in ModuleAnalyzer.for_string() All uses always pass a str, never a bytes. Per the type signature, only str types are allowed. --- sphinx/pycode/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index e3e80772c..4d21e43ea 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -10,7 +10,7 @@ """ import re -from io import BytesIO, StringIO +from io import StringIO from zipfile import ZipFile from sphinx.errors import PycodeError @@ -29,8 +29,6 @@ class ModuleAnalyzer: @classmethod def for_string(cls, string, modname, srcname=''): # type: (str, str, str) -> ModuleAnalyzer - if isinstance(string, bytes): - return cls(BytesIO(string), modname, srcname) return cls(StringIO(string), modname, srcname, decoded=True) @classmethod