--- a/eric6/Utilities/MimeTypes.py Thu Apr 08 17:27:12 2021 +0200 +++ b/eric6/Utilities/MimeTypes.py Thu Apr 08 18:27:47 2021 +0200 @@ -16,23 +16,26 @@ """ Function to test, if the given file is a text (i.e. editable) file. - @param filename name of the file to be checked (string) - @return flag indicating an editable file (boolean) + @param filename name of the file to be checked + @type str + @return flag indicating an editable file + @rtype bool """ type_ = mimetypes.guess_type(filename)[0] - if (type_ is None or + return ( + type_ is None or type_.split("/")[0] == "text" or - type_ in Preferences.getUI("TextMimeTypes")): - return True - else: - return False + type_ in Preferences.getUI("TextMimeTypes") + ) def mimeType(filename): """ Function to get the mime type of a file. - @param filename name of the file to be checked (string) - @return mime type of the file (string) + @param filename name of the file to be checked + @type str + @return mime type of the file + @rtype str """ return mimetypes.guess_type(filename)[0]