Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash when a pylint must display unicode raising a UnicodeEncodeError #9732

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Pierre-Sassoulas
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Work in progress for #8736, this is probably not the right fix, but it's a fix. Hoping for a surrogates/unicode expert to chime in with the right approach πŸ˜„ !

@Pierre-Sassoulas Pierre-Sassoulas added Work in progress Crash πŸ’₯ A bug that makes pylint crash labels Jun 14, 2024
@Pierre-Sassoulas
Copy link
Member Author

We should probably aim to keep the \ud800\udc00 format instead of transforming to actual utf32 characters.

@DanielNoord
Copy link
Collaborator

https://stackoverflow.com/questions/27366479/python-3-os-walk-file-paths-unicodeencodeerror-utf-8-codec-cant-encode-s

encode('utf8','replace') seems to work? Although I really don't like that we need to add special logic for a really uncommon case..

@@ -0,0 +1 @@
comparison-of-constants:3:7:3:37::"Comparison between constants: '𐀀 == ' has a constant value":HIGH
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
comparison-of-constants:3:7:3:37::"Comparison between constants: '𐀀 == ' has a constant value":HIGH
comparison-of-constants:3:7:3:37::"Comparison between constants: '"\U00010000" == "\ud800\udc00"' has a constant value":HIGH

Imo we should aim for this, but I have an intuition that the ast module internal might be involved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I don't think we can. self.out is utf-8 encoded so we always need to encode/escape to utf-8.

Copy link
Contributor

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on astroid:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "parts[0] == ''" can be simplified to "not parts[0]", if it is strictly a string, as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/709f991aed8033beb6ea575188c96a6d75fd9c5a/astroid/modutils.py#L417
  2. use-implicit-booleaness-not-comparison-to-string:
    "parts[starti] == ''" can be simplified to "not parts[starti]", if it is strictly a string, as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/709f991aed8033beb6ea575188c96a6d75fd9c5a/astroid/modutils.py#L424

The following messages are no longer emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "parts[0] == ''" can be simplified to "not parts[0]", if it is striclty a string, as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/709f991aed8033beb6ea575188c96a6d75fd9c5a/astroid/modutils.py#L417
  2. use-implicit-booleaness-not-comparison-to-string:
    "parts[starti] == ''" can be simplified to "not parts[starti]", if it is striclty a string, as an empty string is falsey
    https://github.com/pylint-dev/astroid/blob/709f991aed8033beb6ea575188c96a6d75fd9c5a/astroid/modutils.py#L424

Effect on home-assistant:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "text == ''" can be simplified to "not text", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/util/__init__.py#L43
  2. use-implicit-booleaness-not-comparison-to-string:
    "slug == ''" can be simplified to "not slug", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/util/__init__.py#L46
  3. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/config_validation.py#L264
  4. use-implicit-booleaness-not-comparison-to-string:
    "suggested_area != ''" can be simplified to "suggested_area", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/device_registry.py#L940
  5. use-implicit-booleaness-not-comparison-to-string:
    "self.DOMAIN == ''" can be simplified to "not self.DOMAIN", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/config_entry_oauth2_flow.py#L239
  6. use-implicit-booleaness-not-comparison-to-string:
    "channel_name != ''" can be simplified to "channel_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/roku/helpers.py#L23
  7. use-implicit-booleaness-not-comparison-to-string:
    "host != ''" can be simplified to "host", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/config_flow.py#L59
  8. use-implicit-booleaness-not-comparison-to-string:
    "host != ''" can be simplified to "host", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/__init__.py#L168
  9. use-implicit-booleaness-not-comparison-to-string:
    "exclude != ''" can be simplified to "exclude", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/__init__.py#L170
  10. use-implicit-booleaness-not-comparison-to-string:
    "part.fstype == ''" can be simplified to "not part.fstype", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/systemmonitor/util.py#L25
  11. use-implicit-booleaness-not-comparison-to-string:
    "part.device != ''" can be simplified to "part.device", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/systemmonitor/util.py#L51
  12. use-implicit-booleaness-not-comparison-to-string:
    "profile.name != ''" can be simplified to "profile.name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/homematicip_cloud/climate.py#L285
  13. use-implicit-booleaness-not-comparison-to-string:
    "appliance_name != ''" can be simplified to "appliance_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/smappee/binary_sensor.py#L116
  14. use-implicit-booleaness-not-comparison-to-string:
    "device.ip_address == ''" can be simplified to "not device.ip_address", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/fritz/coordinator.py#L68
  15. use-implicit-booleaness-not-comparison-to-string:
    "location == ''" can be simplified to "not location", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/media_source/local_source.py#L135
  16. unsubscriptable-object:
    Value 'self.hass.data[DOMAIN]' is unsubscriptable
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/media_source/models.py#L89
  17. use-implicit-booleaness-not-comparison-to-string:
    "info.get('vf_internet_key_online_since') != ''" can be simplified to "info.get('vf_internet_key_online_since')", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/button.py#L64
  18. use-implicit-booleaness-not-comparison-to-string:
    "info['phone_num1'] != ''" can be simplified to "info['phone_num1']", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/sensor.py#L110
  19. use-implicit-booleaness-not-comparison-to-string:
    "info['phone_num2'] != ''" can be simplified to "info['phone_num2']", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/sensor.py#L115
  20. use-implicit-booleaness-not-comparison-to-string:
    "self._prefix != ''" can be simplified to "self._prefix", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/elkm1/entity.py#L73
  21. use-implicit-booleaness-not-comparison-to-string:
    "parts.path == ''" can be simplified to "not parts.path", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/auth/indieauth.py#L146
  22. use-implicit-booleaness-not-comparison-to-string:
    "parts.fragment != ''" can be simplified to "parts.fragment", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/auth/indieauth.py#L174
  23. use-implicit-booleaness-not-comparison-to-string:
    "self._components_text != ''" can be simplified to "self._components_text", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/wilight/config_flow.py#L44
  24. use-implicit-booleaness-not-comparison-to-string:
    "state['state'] == ''" can be simplified to "not state['state']", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthing/sensor.py#L237
  25. use-implicit-booleaness-not-comparison-to-string:
    "value_template.render_with_possible_json_value(content) == ''" can be simplified to "not value_template.render_with_possible_json_value(content)", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dweet/sensor.py#L61
  26. use-implicit-booleaness-not-comparison-to-string:
    "chargepoint_name != ''" can be simplified to "chargepoint_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/blue_current/entity.py#L63
  27. use-implicit-booleaness-not-comparison-to-string:
    "identifier == ''" can be simplified to "not identifier", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nest/media_source.py#L291
  28. use-implicit-booleaness-not-comparison-to-string:
    "val == ''" can be simplified to "not val", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/gtfs/sensor.py#L818
  29. use-implicit-booleaness-not-comparison-to-string:
    "tray_state == ''" can be simplified to "not tray_state", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthru/sensor.py#L206
  30. use-implicit-booleaness-not-comparison-to-string:
    "tray_state == ''" can be simplified to "not tray_state", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthru/sensor.py#L234
  31. use-implicit-booleaness-not-comparison-to-string:
    "self.dev.current_temperature != ''" can be simplified to "self.dev.current_temperature", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/iaqualink/climate.py#L111
  32. use-implicit-booleaness-not-comparison-to-string:
    "self.dev.state == ''" can be simplified to "not self.dev.state", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/iaqualink/sensor.py#L53
  33. use-implicit-booleaness-not-comparison-to-string:
    "device_config[CONF_NAME] != ''" can be simplified to "device_config[CONF_NAME]", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/lcn/helpers.py#L393
  34. use-implicit-booleaness-not-comparison-to-string:
    "device_name == ''" can be simplified to "not device_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/lcn/helpers.py#L399
  35. use-implicit-booleaness-not-comparison-to-string:
    "event_type == ''" can be simplified to "not event_type", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/shelly/coordinator.py#L327
  36. use-implicit-booleaness-not-comparison-to-string:
    "action == ''" can be simplified to "not action", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dialogflow/__init__.py#L131
  37. use-implicit-booleaness-not-comparison-to-string:
    "k != ''" can be simplified to "k", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/evohome/water_heater.py#L46
  38. use-implicit-booleaness-not-comparison-to-string:
    "artist_name != ''" can be simplified to "artist_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/media_player.py#L878
  39. use-implicit-booleaness-not-comparison-to-string:
    "artist_name != ''" can be simplified to "artist_name", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/media_player.py#L891
  40. use-implicit-booleaness-not-comparison-to-string:
    "search_id == ''" can be simplified to "not search_id", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/browse_media.py#L63
  41. use-implicit-booleaness-not-comparison-to-string:
    "data[CONF_NAME] == ''" can be simplified to "not data[CONF_NAME]", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/harmony/util.py#L23
  42. unsupported-assignment-operation:
    'self.hass.data[DATA_LAST_WAKE_UP]' does not support item assignment
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/assist_pipeline/pipeline.py#L770
  43. unsupported-assignment-operation:
    'self.run.hass.data[DATA_LAST_WAKE_UP]' does not support item assignment
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/assist_pipeline/pipeline.py#L1377
  44. use-implicit-booleaness-not-comparison-to-string:
    "filter_product == ''" can be simplified to "not filter_product", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/trafikverket_train/config_flow.py#L197
  45. use-implicit-booleaness-not-comparison-to-string:
    "_filter == ''" can be simplified to "not _filter", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/trafikverket_train/config_flow.py#L251
  46. use-implicit-booleaness-not-comparison-to-string:
    "mac == ''" can be simplified to "not mac", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/services.py#L67
  47. use-implicit-booleaness-not-comparison-to-string:
    "client.access_point_mac != ''" can be simplified to "client.access_point_mac", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L133
  48. use-implicit-booleaness-not-comparison-to-string:
    "client.access_point_mac == ''" can be simplified to "not client.access_point_mac", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L136
  49. use-implicit-booleaness-not-comparison-to-string:
    "hub.api.devices[obj_id].system_stats[stat_index] != ''" can be simplified to "hub.api.devices[obj_id].system_stats[stat_index]", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L189
  50. use-implicit-booleaness-not-comparison-to-string:
    "latest_version != ''" can be simplified to "latest_version", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/mqtt/update.py#L202
  51. use-implicit-booleaness-not-comparison-to-string:
    "payload == ''" can be simplified to "not payload", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/mqtt/sensor.py#L264
  52. use-implicit-booleaness-not-comparison-to-string:
    "raw_state == ''" can be simplified to "not raw_state", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/fitbit/sensor.py#L96
  53. use-implicit-booleaness-not-comparison-to-string:
    "label == ''" can be simplified to "not label", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/yamaha_musiccast/media_player.py#L167
  54. use-implicit-booleaness-not-comparison-to-string:
    "media_content_id == ''" can be simplified to "not media_content_id", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/philips_js/media_player.py#L390
  55. use-implicit-booleaness-not-comparison-to-string:
    "media_content.id_or_path == ''" can be simplified to "not media_content.id_or_path", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/forked_daapd/browse_media.py#L171
  56. use-implicit-booleaness-not-comparison-to-string:
    "option == ''" can be simplified to "not option", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/overkiz/select.py#L66
  57. use-implicit-booleaness-not-comparison-to-string:
    "code == ''" can be simplified to "not code", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/elmax/alarm_control_panel.py#L107
  58. use-implicit-booleaness-not-comparison-to-string:
    "getattr(coordinator.data[config_entry.data['garage_name']], info_type) != ''" can be simplified to "getattr(coordinator.data[config_entry.data['garage_name']], info_type)", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/garages_amsterdam/sensor.py#L33
  59. use-implicit-booleaness-not-comparison-to-string:
    "self.thermostat['equipmentStatus'] == ''" can be simplified to "not self.thermostat['equipmentStatus']", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/ecobee/climate.py#L535
  60. use-implicit-booleaness-not-comparison-to-string:
    "name.strip() != ''" can be simplified to "name.strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/ws66i/config_flow.py#L60
  61. unsupported-assignment-operation:
    'self.hass.data[DOMAIN]' does not support item assignment
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/system_health/__init__.py#L228
  62. use-implicit-booleaness-not-comparison-to-string:
    "device_instance.binary_sensor_property[element_uid].sub_type != ''" can be simplified to "device_instance.binary_sensor_property[element_uid].sub_type", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/devolo_home_control/binary_sensor.py#L84
  63. use-implicit-booleaness-not-comparison-to-string:
    "state.state == ''" can be simplified to "not state.state", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/apache_kafka/__init__.py#L122
  64. use-implicit-booleaness-not-comparison-to-string:
    "att == ''" can be simplified to "not att", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/hdmi_cec/__init__.py#L234
  65. use-implicit-booleaness-not-comparison-to-string:
    "volume != ''" can be simplified to "volume", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/volumio/media_player.py#L141
  66. use-implicit-booleaness-not-comparison-to-string:
    "name.strip() != ''" can be simplified to "name.strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/monoprice/config_flow.py#L59
  67. use-implicit-booleaness-not-comparison-to-string:
    "message.payload == ''" can be simplified to "not message.payload", if it is strictly a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dsmr_reader/sensor.py#L49

The following messages are no longer emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "name.strip() != ''" can be simplified to "name.strip()", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/ws66i/config_flow.py#L60
  2. use-implicit-booleaness-not-comparison-to-string:
    "channel_name != ''" can be simplified to "channel_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/roku/helpers.py#L23
  3. use-implicit-booleaness-not-comparison-to-string:
    "info['phone_num1'] != ''" can be simplified to "info['phone_num1']", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/sensor.py#L110
  4. use-implicit-booleaness-not-comparison-to-string:
    "info['phone_num2'] != ''" can be simplified to "info['phone_num2']", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/sensor.py#L115
  5. use-implicit-booleaness-not-comparison-to-string:
    "info.get('vf_internet_key_online_since') != ''" can be simplified to "info.get('vf_internet_key_online_since')", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/vodafone_station/button.py#L64
  6. use-implicit-booleaness-not-comparison-to-string:
    "self.thermostat['equipmentStatus'] == ''" can be simplified to "not self.thermostat['equipmentStatus']", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/ecobee/climate.py#L535
  7. use-implicit-booleaness-not-comparison-to-string:
    "raw_state == ''" can be simplified to "not raw_state", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/fitbit/sensor.py#L96
  8. use-implicit-booleaness-not-comparison-to-string:
    "media_content_id == ''" can be simplified to "not media_content_id", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/philips_js/media_player.py#L390
  9. use-implicit-booleaness-not-comparison-to-string:
    "value_template.render_with_possible_json_value(content) == ''" can be simplified to "not value_template.render_with_possible_json_value(content)", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dweet/sensor.py#L61
  10. use-implicit-booleaness-not-comparison-to-string:
    "location == ''" can be simplified to "not location", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/media_source/local_source.py#L135
  11. use-implicit-booleaness-not-comparison-to-string:
    "appliance_name != ''" can be simplified to "appliance_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/smappee/binary_sensor.py#L116
  12. use-implicit-booleaness-not-comparison-to-string:
    "val == ''" can be simplified to "not val", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/gtfs/sensor.py#L818
  13. use-implicit-booleaness-not-comparison-to-string:
    "device_config[CONF_NAME] != ''" can be simplified to "device_config[CONF_NAME]", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/lcn/helpers.py#L393
  14. use-implicit-booleaness-not-comparison-to-string:
    "device_name == ''" can be simplified to "not device_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/lcn/helpers.py#L399
  15. use-implicit-booleaness-not-comparison-to-string:
    "message.payload == ''" can be simplified to "not message.payload", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dsmr_reader/sensor.py#L49
  16. use-implicit-booleaness-not-comparison-to-string:
    "att == ''" can be simplified to "not att", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/hdmi_cec/__init__.py#L234
  17. use-implicit-booleaness-not-comparison-to-string:
    "device.ip_address == ''" can be simplified to "not device.ip_address", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/fritz/coordinator.py#L68
  18. use-implicit-booleaness-not-comparison-to-string:
    "state.state == ''" can be simplified to "not state.state", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/apache_kafka/__init__.py#L122
  19. use-implicit-booleaness-not-comparison-to-string:
    "self._components_text != ''" can be simplified to "self._components_text", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/wilight/config_flow.py#L44
  20. use-implicit-booleaness-not-comparison-to-string:
    "label == ''" can be simplified to "not label", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/yamaha_musiccast/media_player.py#L167
  21. use-implicit-booleaness-not-comparison-to-string:
    "profile.name != ''" can be simplified to "profile.name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/homematicip_cloud/climate.py#L285
  22. use-implicit-booleaness-not-comparison-to-string:
    "media_content.id_or_path == ''" can be simplified to "not media_content.id_or_path", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/forked_daapd/browse_media.py#L171
  23. use-implicit-booleaness-not-comparison-to-string:
    "event_type == ''" can be simplified to "not event_type", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/shelly/coordinator.py#L327
  24. use-implicit-booleaness-not-comparison-to-string:
    "self._prefix != ''" can be simplified to "self._prefix", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/elkm1/entity.py#L73
  25. use-implicit-booleaness-not-comparison-to-string:
    "getattr(coordinator.data[config_entry.data['garage_name']], info_type) != ''" can be simplified to "getattr(coordinator.data[config_entry.data['garage_name']], info_type)", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/garages_amsterdam/sensor.py#L33
  26. use-implicit-booleaness-not-comparison-to-string:
    "host != ''" can be simplified to "host", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/config_flow.py#L59
  27. use-implicit-booleaness-not-comparison-to-string:
    "host != ''" can be simplified to "host", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/__init__.py#L168
  28. use-implicit-booleaness-not-comparison-to-string:
    "exclude != ''" can be simplified to "exclude", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nmap_tracker/__init__.py#L170
  29. use-implicit-booleaness-not-comparison-to-string:
    "name.strip() != ''" can be simplified to "name.strip()", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/monoprice/config_flow.py#L59
  30. use-implicit-booleaness-not-comparison-to-string:
    "tray_state == ''" can be simplified to "not tray_state", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthru/sensor.py#L206
  31. use-implicit-booleaness-not-comparison-to-string:
    "tray_state == ''" can be simplified to "not tray_state", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthru/sensor.py#L234
  32. use-implicit-booleaness-not-comparison-to-string:
    "chargepoint_name != ''" can be simplified to "chargepoint_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/blue_current/entity.py#L63
  33. use-implicit-booleaness-not-comparison-to-string:
    "client.access_point_mac != ''" can be simplified to "client.access_point_mac", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L133
  34. use-implicit-booleaness-not-comparison-to-string:
    "client.access_point_mac == ''" can be simplified to "not client.access_point_mac", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L136
  35. use-implicit-booleaness-not-comparison-to-string:
    "hub.api.devices[obj_id].system_stats[stat_index] != ''" can be simplified to "hub.api.devices[obj_id].system_stats[stat_index]", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/sensor.py#L189
  36. use-implicit-booleaness-not-comparison-to-string:
    "mac == ''" can be simplified to "not mac", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/unifi/services.py#L67
  37. use-implicit-booleaness-not-comparison-to-string:
    "self.dev.state == ''" can be simplified to "not self.dev.state", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/iaqualink/sensor.py#L53
  38. use-implicit-booleaness-not-comparison-to-string:
    "self.dev.current_temperature != ''" can be simplified to "self.dev.current_temperature", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/iaqualink/climate.py#L111
  39. use-implicit-booleaness-not-comparison-to-string:
    "part.fstype == ''" can be simplified to "not part.fstype", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/systemmonitor/util.py#L25
  40. use-implicit-booleaness-not-comparison-to-string:
    "part.device != ''" can be simplified to "part.device", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/systemmonitor/util.py#L51
  41. use-implicit-booleaness-not-comparison-to-string:
    "payload == ''" can be simplified to "not payload", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/mqtt/sensor.py#L264
  42. use-implicit-booleaness-not-comparison-to-string:
    "latest_version != ''" can be simplified to "latest_version", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/mqtt/update.py#L202
  43. use-implicit-booleaness-not-comparison-to-string:
    "identifier == ''" can be simplified to "not identifier", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/nest/media_source.py#L291
  44. use-implicit-booleaness-not-comparison-to-string:
    "code == ''" can be simplified to "not code", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/elmax/alarm_control_panel.py#L107
  45. use-implicit-booleaness-not-comparison-to-string:
    "option == ''" can be simplified to "not option", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/overkiz/select.py#L66
  46. use-implicit-booleaness-not-comparison-to-string:
    "device_instance.binary_sensor_property[element_uid].sub_type != ''" can be simplified to "device_instance.binary_sensor_property[element_uid].sub_type", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/devolo_home_control/binary_sensor.py#L84
  47. use-implicit-booleaness-not-comparison-to-string:
    "search_id == ''" can be simplified to "not search_id", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/browse_media.py#L63
  48. use-implicit-booleaness-not-comparison-to-string:
    "artist_name != ''" can be simplified to "artist_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/media_player.py#L878
  49. use-implicit-booleaness-not-comparison-to-string:
    "artist_name != ''" can be simplified to "artist_name", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/kodi/media_player.py#L891
  50. use-implicit-booleaness-not-comparison-to-string:
    "filter_product == ''" can be simplified to "not filter_product", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/trafikverket_train/config_flow.py#L197
  51. use-implicit-booleaness-not-comparison-to-string:
    "_filter == ''" can be simplified to "not _filter", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/trafikverket_train/config_flow.py#L251
  52. use-implicit-booleaness-not-comparison-to-string:
    "state['state'] == ''" can be simplified to "not state['state']", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/syncthing/sensor.py#L237
  53. use-implicit-booleaness-not-comparison-to-string:
    "k != ''" can be simplified to "k", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/evohome/water_heater.py#L46
  54. use-implicit-booleaness-not-comparison-to-string:
    "parts.path == ''" can be simplified to "not parts.path", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/auth/indieauth.py#L146
  55. use-implicit-booleaness-not-comparison-to-string:
    "parts.fragment != ''" can be simplified to "parts.fragment", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/auth/indieauth.py#L174
  56. use-implicit-booleaness-not-comparison-to-string:
    "data[CONF_NAME] == ''" can be simplified to "not data[CONF_NAME]", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/harmony/util.py#L23
  57. use-implicit-booleaness-not-comparison-to-string:
    "volume != ''" can be simplified to "volume", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/volumio/media_player.py#L141
  58. use-implicit-booleaness-not-comparison-to-string:
    "action == ''" can be simplified to "not action", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/components/dialogflow/__init__.py#L131
  59. use-implicit-booleaness-not-comparison-to-string:
    "self.DOMAIN == ''" can be simplified to "not self.DOMAIN", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/config_entry_oauth2_flow.py#L239
  60. use-implicit-booleaness-not-comparison-to-string:
    "suggested_area != ''" can be simplified to "suggested_area", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/device_registry.py#L940
  61. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/helpers/config_validation.py#L264
  62. use-implicit-booleaness-not-comparison-to-string:
    "text == ''" can be simplified to "not text", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/util/__init__.py#L43
  63. use-implicit-booleaness-not-comparison-to-string:
    "slug == ''" can be simplified to "not slug", if it is striclty a string, as an empty string is falsey
    https://github.com/home-assistant/core/blob/12dbabb849692577beebdb5024fa0f8f5572e4bb/homeassistant/util/__init__.py#L46

Effect on poetry-core:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "op == ''" can be simplified to "not op", if it is strictly a string, as an empty string is falsey
    https://github.com/python-poetry/poetry-core/blob/a2b6f0015c4a721575488bbe8c0a42c6b16f617e/src/poetry/core/packages/dependency.py#L189

The following messages are no longer emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "op == ''" can be simplified to "not op", if it is striclty a string, as an empty string is falsey
    https://github.com/python-poetry/poetry-core/blob/a2b6f0015c4a721575488bbe8c0a42c6b16f617e/src/poetry/core/packages/dependency.py#L189

Effect on black:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "result[-1] == ''" can be simplified to "not result[-1]", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/output.py#L70
  2. use-implicit-booleaness-not-comparison-to-string:
    "LL[string_idx - 1].value == ''" can be simplified to "not LL[string_idx - 1].value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/trans.py#L1209
  3. use-implicit-booleaness-not-comparison-to-string:
    "N.value == ''" can be simplified to "not N.value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/trans.py#L1241
  4. use-implicit-booleaness-not-comparison-to-string:
    "first.value == ''" can be simplified to "not first.value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L847
  5. use-implicit-booleaness-not-comparison-to-string:
    "last.value == ''" can be simplified to "not last.value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L850
  6. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L859
  7. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L863
  8. use-implicit-booleaness-not-comparison-to-string:
    "prefix != ''" can be simplified to "prefix", if it is strictly a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/blib2to3/pgen2/tokenize.py#L466

The following messages are no longer emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "result[-1] == ''" can be simplified to "not result[-1]", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/output.py#L70
  2. use-implicit-booleaness-not-comparison-to-string:
    "LL[string_idx - 1].value == ''" can be simplified to "not LL[string_idx - 1].value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/trans.py#L1209
  3. use-implicit-booleaness-not-comparison-to-string:
    "N.value == ''" can be simplified to "not N.value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/trans.py#L1241
  4. use-implicit-booleaness-not-comparison-to-string:
    "first.value == ''" can be simplified to "not first.value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L847
  5. use-implicit-booleaness-not-comparison-to-string:
    "last.value == ''" can be simplified to "not last.value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L850
  6. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L859
  7. use-implicit-booleaness-not-comparison-to-string:
    "leaf.value == ''" can be simplified to "not leaf.value", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/black/nodes.py#L863
  8. use-implicit-booleaness-not-comparison-to-string:
    "prefix != ''" can be simplified to "prefix", if it is striclty a string, as an empty string is falsey
    https://github.com/psf/black/blob/bbfdba3a5e4f0b3105ec9526c51e769866b28f1f/src/blib2to3/pgen2/tokenize.py#L466

Effect on music21:
The following messages are now emitted:

  1. use-implicit-booleaness-not-comparison-to-string:
    "self.stringRep != ''" can be simplified to "self.stringRep", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/tinyNotation.py#L1199
  2. use-implicit-booleaness-not-comparison-to-string:
    "orGroup == ''" can be simplified to "not orGroup", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/sieve.py#L1589
  3. use-implicit-booleaness-not-comparison-to-string:
    "thisRepr != ''" can be simplified to "thisRepr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/tablature.py#L106
  4. use-implicit-booleaness-not-comparison-to-string:
    "num == ''" can be simplified to "not num", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/pitch.py#L902
  5. use-implicit-booleaness-not-comparison-to-string:
    "tupletStr != ''" can be simplified to "tupletStr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/duration.py#L2803
  6. use-implicit-booleaness-not-comparison-to-string:
    "tupletStr != ''" can be simplified to "tupletStr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/duration.py#L2805
  7. use-implicit-booleaness-not-comparison-to-string:
    "self.size == ''" can be simplified to "not self.size", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/expressions.py#L2409
  8. use-implicit-booleaness-not-comparison-to-string:
    "self.chordKind != ''" can be simplified to "self.chordKind", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/harmony.py#L1728
  9. use-implicit-booleaness-not-comparison-to-string:
    "alteration != ''" can be simplified to "alteration", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/harmony.py#L2058
  10. use-implicit-booleaness-not-comparison-to-string:
    "lyr != ''" can be simplified to "lyr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/text.py#L156
  11. use-implicit-booleaness-not-comparison-to-string:
    "excerpt == ''" can be simplified to "not excerpt", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/text.py#L498
  12. use-implicit-booleaness-not-comparison-to-string:
    "prefix != ''" can be simplified to "prefix", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/roman.py#L369
  13. use-implicit-booleaness-not-comparison-to-string:
    "sub == ''" can be simplified to "not sub", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/configure.py#L83
  14. use-implicit-booleaness-not-comparison-to-string:
    "line == ''" can be simplified to "not line", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/configure.py#L95
  15. use-implicit-booleaness-not-comparison-to-string:
    "raw == ''" can be simplified to "not raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/configure.py#L656
  16. use-implicit-booleaness-not-comparison-to-string:
    "raw == ''" can be simplified to "not raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/configure.py#L935
  17. use-implicit-booleaness-not-comparison-to-string:
    "environPath == ''" can be simplified to "not environPath", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/configure.py#L1106
  18. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/spanner.py#L1571
  19. use-implicit-booleaness-not-comparison-to-string:
    "value != ''" can be simplified to "value", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/environment.py#L229
  20. use-implicit-booleaness-not-comparison-to-string:
    "value == ''" can be simplified to "not value", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/environment.py#L254
  21. use-implicit-booleaness-not-comparison-to-string:
    "el.text == ''" can be simplified to "not el.text", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/lily/translate.py#L795
  22. use-implicit-booleaness-not-comparison-to-string:
    "moduleResponse.moduleName == ''" can be simplified to "not moduleResponse.moduleName", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/test/multiprocessTest.py#L257
  23. use-implicit-booleaness-not-comparison-to-string:
    "data == ''" can be simplified to "not data", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L389
  24. use-implicit-booleaness-not-comparison-to-string:
    "data[16:].strip() != ''" can be simplified to "data[16:].strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L660
  25. use-implicit-booleaness-not-comparison-to-string:
    "data[8:].strip() != ''" can be simplified to "data[8:].strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L685
  26. use-implicit-booleaness-not-comparison-to-string:
    "mNumber != ''" can be simplified to "mNumber", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L694
  27. use-implicit-booleaness-not-comparison-to-string:
    "line.strip() == ''" can be simplified to "not line.strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L810
  28. use-implicit-booleaness-not-comparison-to-string:
    "alphas == ''" can be simplified to "not alphas", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L933
  29. use-implicit-booleaness-not-comparison-to-string:
    "entry.strip() != ''" can be simplified to "entry.strip()", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1018
  30. use-implicit-booleaness-not-comparison-to-string:
    "raw == ''" can be simplified to "not raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1178
  31. use-implicit-booleaness-not-comparison-to-string:
    "raw != ''" can be simplified to "raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1207
  32. use-implicit-booleaness-not-comparison-to-string:
    "raw == ''" can be simplified to "not raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1209
  33. use-implicit-booleaness-not-comparison-to-string:
    "raw != ''" can be simplified to "raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1213
  34. use-implicit-booleaness-not-comparison-to-string:
    "raw == ''" can be simplified to "not raw", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1294
  35. use-implicit-booleaness-not-comparison-to-string:
    "numStr == ''" can be simplified to "not numStr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1650
  36. use-implicit-booleaness-not-comparison-to-string:
    "numStr != ''" can be simplified to "numStr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/musedata/__init__.py#L1663
  37. use-implicit-booleaness-not-comparison-to-string:
    "figureString != ''" can be simplified to "figureString", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/figuredBass/harmony.py#L74
  38. use-implicit-booleaness-not-comparison-to-string:
    "line == ''" can be simplified to "not line", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/humdrum/spineParser.py#L396
  39. use-implicit-booleaness-not-comparison-to-string:
    "thisObject.comment == ''" can be simplified to "not thisObject.comment", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/humdrum/spineParser.py#L1328
  40. use-implicit-booleaness-not-comparison-to-string:
    "thisObject.comment == ''" can be simplified to "not thisObject.comment", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/humdrum/spineParser.py#L1460
  41. redefined-variable-type:
    Redefinition of thisObject type from music21.note.Note to music21.note.GeneralNote
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/humdrum/spineParser.py#L2375
  42. use-implicit-booleaness-not-comparison-to-string:
    "stringRemain == ''" can be simplified to "not stringRemain", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L546
  43. use-implicit-booleaness-not-comparison-to-string:
    "splitTuplet[1] != ''" can be simplified to "splitTuplet[1]", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L1083
  44. use-implicit-booleaness-not-comparison-to-string:
    "splitTuplet[2] != ''" can be simplified to "splitTuplet[2]", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L1154
  45. use-implicit-booleaness-not-comparison-to-string:
    "accString != ''" can be simplified to "accString", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L1544
  46. use-implicit-booleaness-not-comparison-to-string:
    "numStr == ''" can be simplified to "not numStr", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L1652
  47. use-implicit-booleaness-not-comparison-to-string:
    "activeChordSymbol != ''" can be simplified to "activeChordSymbol", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L2372
  48. use-implicit-booleaness-not-comparison-to-string:
    "activeChordSymbol != ''" can be simplified to "activeChordSymbol", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/abcFormat/__init__.py#L2476
  49. use-implicit-booleaness-not-comparison-to-string:
    "brailleSig != ''" can be simplified to "brailleSig", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/braille/segment.py#L914
  50. use-implicit-booleaness-not-comparison-to-string:
    "bText != ''" can be simplified to "bText", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/braille/lookup.py#L59
  51. use-implicit-booleaness-not-comparison-to-string:
    "modifier != ''" can be simplified to "modifier", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/graph/utilities.py#L101
  52. use-implicit-booleaness-not-comparison-to-string:
    "numSuffix == ''" can be simplified to "not numSuffix", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/stream/base.py#L9003
  53. use-implicit-booleaness-not-comparison-to-string:
    "text == ''" can be simplified to "not text", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/capella/fromCapellaXML.py#L658
  54. use-implicit-booleaness-not-comparison-to-string:
    "content != ''" can be simplified to "content", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/clercqTemperley.py#L875
  55. use-implicit-booleaness-not-comparison-to-string:
    "sep != ''" can be simplified to "sep", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/clercqTemperley.py#L875
  56. use-implicit-booleaness-not-comparison-to-string:
    "y == ''" can be simplified to "not y", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/clercqTemperley.py#L912
  57. use-implicit-booleaness-not-comparison-to-string:
    "data == ''" can be simplified to "not data", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/translate.py#L656
  58. use-implicit-booleaness-not-comparison-to-string:
    "rl == ''" can be simplified to "not rl", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/translate.py#L1005
  59. use-implicit-booleaness-not-comparison-to-string:
    "line == ''" can be simplified to "not line", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/rtObjects.py#L1133
  60. use-implicit-booleaness-not-comparison-to-string:
    "line == ''" can be simplified to "not line", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/rtObjects.py#L1153
  61. use-implicit-booleaness-not-comparison-to-string:
    "word == ''" can be simplified to "not word", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/romanText/rtObjects.py#L1236
  62. use-implicit-booleaness-not-comparison-to-string:
    "d != ''" can be simplified to "d", if it is strictly a string, as an empty string is falsey
    https://github.com/cuthbertLab/music21/blob/cfabad142f8d42d94fbfeff497285c7bd4be4db1/music21/noteworthy/binaryTranslate.py#L624
  63. use-implicit-booleaness-not-comparison-to-string:
    *"self.alterationStr == ''" can be simplified to "not self.alterationStr", if it is strictly ...

This comment was truncated because GitHub allows only 65536 characters in a comment.

This comment was generated for commit 96592c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash πŸ’₯ A bug that makes pylint crash Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants