Same file type, different icon. How to reset it

I have a folder with Python source code. All files are being opened with double click with Text Editor, also the "problematic" one. All files have .py extension.

The "problematic" file has a green Qt icon and I didn't find a way to remove it. Reset and set default application (that now is Text Editor) didn't help.

Ubuntu 20.04

enter image description here

$ file -i MyHTMLParser.py 
MyHTMLParser.py: text/x-python; charset=us-ascii

$ file MyHTMLParser.py 
MyHTMLParser.py: Python script, ASCII text executable

$ file -i Scanner.py 
Scanner.py: text/x-python; charset=utf-8

$ file Scanner.py 
Scanner.py: Python script, UTF-8 Unicode text executable, with CRLF line terminators

First line of MyHTMLParser.py:

from html.parser import HTMLParser

First line of Scanner.py:

from PyQt5 import QtCore

text/x-qml MIME type is shown from Properties

enter image description here

That type is not present in

/etc/mime.types

I really can't understand where that information is stored.

UPDATED 'N'

I wrote a script that remove all \r\n line endings and UTF-8 characters. Now Scanner_new.py has the same type of MyHTMLParser.py, but nothing is changed:

$ file -i MyHTMLParser.py 
MyHTMLParser.py: text/x-python; charset=us-ascii

$ file MyHTMLParser.py 
MyHTMLParser.py: Python script, ASCII text executable

$ file -i Scanner_new.py 
Scanner_new.py: text/x-python; charset=us-ascii

$ file Scanner_new.py 
Scanner_new.py: Python script, ASCII text executable

enter image description here


Solution 1:

I found the solution. The problem isn't the line ending or the characters set (UTF-8, ASCII...). If in the file there is the sentence "import QtCore" (never mind if as start line or in the middle of the file) the icon will be the Qt one.

enter image description here

I don't known who is responsible for the parsing, as soon as I click Ctrl+S (with or without "import QtCore") the icon changes