chriskiehl / Gooey

Turn (almost) any Python command line program into a full GUI application with one line
MIT License
20.68k stars 1.02k forks source link

Change "is not" to "!=" when checking literals #886

Open KianKhadempour opened 1 year ago

KianKhadempour commented 1 year ago

In a most widget files is not is used to check the error against an empty string (''). This doesn't work all the time to my knowledge, so it is best to replace it with "!=", which is an equality check.

Example

Before:

def syncUiState(self, state: FormField):  # type: ignore
        self.widget.setValue(state['value'])  # type: ignore
        self.error.SetLabel(state['error'] or '')
        self.error.Show(state['error'] is not None and state['error'] is not '')

After:

def syncUiState(self, state: FormField):  # type: ignore
        self.widget.setValue(state['value'])  # type: ignore
        self.error.SetLabel(state['error'] or '')
        self.error.Show(state['error'] is not None and state['error'] != '')
#       --------------------------------------------------------------^^----

Checklist:

N/A

N/A