From 71a47fc80c62f58e919059b8c02c0cfdd1fd210e Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sat, 4 Apr 2020 20:10:55 +0200 Subject: [PATCH] Enable pylint global-statement (#33641) --- homeassistant/components/apcupsd/__init__.py | 2 +- .../components/aquostv/media_player.py | 2 +- homeassistant/components/arduino/__init__.py | 2 +- homeassistant/components/bloomsky/__init__.py | 2 +- homeassistant/components/mochad/__init__.py | 2 +- homeassistant/components/scsgate/__init__.py | 2 +- homeassistant/components/sleepiq/__init__.py | 2 +- homeassistant/components/verisure/__init__.py | 2 +- homeassistant/components/zigbee/__init__.py | 18 +++++++++--------- homeassistant/util/dt.py | 2 +- homeassistant/util/yaml/loader.py | 2 +- pylintrc | 1 - 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/apcupsd/__init__.py b/homeassistant/components/apcupsd/__init__.py index 01f74165190..1f99d5410ec 100644 --- a/homeassistant/components/apcupsd/__init__.py +++ b/homeassistant/components/apcupsd/__init__.py @@ -39,7 +39,7 @@ CONFIG_SCHEMA = vol.Schema( def setup(hass, config): """Use config values to set up a function enabling status retrieval.""" - global DATA + global DATA # pylint: disable=global-statement conf = config[DOMAIN] host = conf.get(CONF_HOST) port = conf.get(CONF_PORT) diff --git a/homeassistant/components/aquostv/media_player.py b/homeassistant/components/aquostv/media_player.py index f71f41dc293..5cd13aa3b0e 100644 --- a/homeassistant/components/aquostv/media_player.py +++ b/homeassistant/components/aquostv/media_player.py @@ -126,7 +126,7 @@ class SharpAquosTVDevice(MediaPlayerDevice): def __init__(self, name, remote, power_on_enabled=False): """Initialize the aquos device.""" - global SUPPORT_SHARPTV + global SUPPORT_SHARPTV # pylint: disable=global-statement self._power_on_enabled = power_on_enabled if self._power_on_enabled: SUPPORT_SHARPTV = SUPPORT_SHARPTV | SUPPORT_TURN_ON diff --git a/homeassistant/components/arduino/__init__.py b/homeassistant/components/arduino/__init__.py index 61b03a3160d..76b8c663c94 100644 --- a/homeassistant/components/arduino/__init__.py +++ b/homeassistant/components/arduino/__init__.py @@ -28,7 +28,7 @@ def setup(hass, config): port = config[DOMAIN][CONF_PORT] - global BOARD + global BOARD # pylint: disable=global-statement try: BOARD = ArduinoBoard(port) except (serial.serialutil.SerialException, FileNotFoundError): diff --git a/homeassistant/components/bloomsky/__init__.py b/homeassistant/components/bloomsky/__init__.py index 6373471fe7a..5b21a2a62f0 100644 --- a/homeassistant/components/bloomsky/__init__.py +++ b/homeassistant/components/bloomsky/__init__.py @@ -31,7 +31,7 @@ def setup(hass, config): """Set up the BloomSky component.""" api_key = config[DOMAIN][CONF_API_KEY] - global BLOOMSKY + global BLOOMSKY # pylint: disable=global-statement try: BLOOMSKY = BloomSky(api_key, hass.config.units.is_metric) except RuntimeError: diff --git a/homeassistant/components/mochad/__init__.py b/homeassistant/components/mochad/__init__.py index 683681b50a0..50156b2b4b3 100644 --- a/homeassistant/components/mochad/__init__.py +++ b/homeassistant/components/mochad/__init__.py @@ -42,7 +42,7 @@ def setup(hass, config): host = conf.get(CONF_HOST) port = conf.get(CONF_PORT) - global CONTROLLER + global CONTROLLER # pylint: disable=global-statement try: CONTROLLER = MochadCtrl(host, port) except exceptions.ConfigurationError: diff --git a/homeassistant/components/scsgate/__init__.py b/homeassistant/components/scsgate/__init__.py index 21e3608a51b..b32b91e5625 100644 --- a/homeassistant/components/scsgate/__init__.py +++ b/homeassistant/components/scsgate/__init__.py @@ -34,7 +34,7 @@ SCSGATE_SCHEMA = vol.Schema( def setup(hass, config): """Set up the SCSGate component.""" device = config[DOMAIN][CONF_DEVICE] - global SCSGATE + global SCSGATE # pylint: disable=global-statement try: SCSGATE = SCSGate(device=device, logger=_LOGGER) diff --git a/homeassistant/components/sleepiq/__init__.py b/homeassistant/components/sleepiq/__init__.py index 2b4d9d010a3..3399fcb43c5 100644 --- a/homeassistant/components/sleepiq/__init__.py +++ b/homeassistant/components/sleepiq/__init__.py @@ -46,7 +46,7 @@ def setup(hass, config): Will automatically load sensor components to support devices discovered on the account. """ - global DATA + global DATA # pylint: disable=global-statement username = config[DOMAIN][CONF_USERNAME] password = config[DOMAIN][CONF_PASSWORD] diff --git a/homeassistant/components/verisure/__init__.py b/homeassistant/components/verisure/__init__.py index 32735bf06c1..757e299792a 100644 --- a/homeassistant/components/verisure/__init__.py +++ b/homeassistant/components/verisure/__init__.py @@ -75,7 +75,7 @@ DEVICE_SERIAL_SCHEMA = vol.Schema({vol.Required(ATTR_DEVICE_SERIAL): cv.string}) def setup(hass, config): """Set up the Verisure component.""" - global HUB + global HUB # pylint: disable=global-statement HUB = VerisureHub(config[DOMAIN]) HUB.update_overview = Throttle(config[DOMAIN][CONF_SCAN_INTERVAL])( HUB.update_overview diff --git a/homeassistant/components/zigbee/__init__.py b/homeassistant/components/zigbee/__init__.py index 48c96b7591f..fd9b42398fe 100644 --- a/homeassistant/components/zigbee/__init__.py +++ b/homeassistant/components/zigbee/__init__.py @@ -71,15 +71,15 @@ PLATFORM_SCHEMA = vol.Schema( def setup(hass, config): """Set up the connection to the Zigbee device.""" - global DEVICE - global GPIO_DIGITAL_OUTPUT_LOW - global GPIO_DIGITAL_OUTPUT_HIGH - global ADC_PERCENTAGE - global DIGITAL_PINS - global ANALOG_PINS - global CONVERT_ADC - global ZIGBEE_EXCEPTION - global ZIGBEE_TX_FAILURE + global DEVICE # pylint: disable=global-statement + global GPIO_DIGITAL_OUTPUT_LOW # pylint: disable=global-statement + global GPIO_DIGITAL_OUTPUT_HIGH # pylint: disable=global-statement + global ADC_PERCENTAGE # pylint: disable=global-statement + global DIGITAL_PINS # pylint: disable=global-statement + global ANALOG_PINS # pylint: disable=global-statement + global CONVERT_ADC # pylint: disable=global-statement + global ZIGBEE_EXCEPTION # pylint: disable=global-statement + global ZIGBEE_TX_FAILURE # pylint: disable=global-statement GPIO_DIGITAL_OUTPUT_LOW = xb_const.GPIO_DIGITAL_OUTPUT_LOW GPIO_DIGITAL_OUTPUT_HIGH = xb_const.GPIO_DIGITAL_OUTPUT_HIGH diff --git a/homeassistant/util/dt.py b/homeassistant/util/dt.py index 084888c188c..8efad848e87 100644 --- a/homeassistant/util/dt.py +++ b/homeassistant/util/dt.py @@ -31,7 +31,7 @@ def set_default_time_zone(time_zone: dt.tzinfo) -> None: Async friendly. """ - global DEFAULT_TIME_ZONE + global DEFAULT_TIME_ZONE # pylint: disable=global-statement # NOTE: Remove in the future in favour of typing assert isinstance(time_zone, dt.tzinfo) diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index ba4d1e77576..3727a156b97 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -295,7 +295,7 @@ def secret_yaml(loader: SafeLineLoader, node: yaml.nodes.Node) -> JSON_TYPE: _LOGGER.debug("Secret %s retrieved from keyring", node.value) return pwd - global credstash # pylint: disable=invalid-name + global credstash # pylint: disable=invalid-name, global-statement if credstash: # pylint: disable=no-member diff --git a/pylintrc b/pylintrc index bb51444447a..1b08c40793a 100644 --- a/pylintrc +++ b/pylintrc @@ -34,7 +34,6 @@ disable= abstract-method, cyclic-import, duplicate-code, - global-statement, inconsistent-return-statements, locally-disabled, not-context-manager,