Upgrade pydocstyle to 5.0.1 (#29830)
* Upgrade pydocstyle to 5.0.1 http://www.pydocstyle.org/en/5.0.1/release_notes.html * Pydocstyle and other docstring fixes
This commit is contained in:
parent
3ed1738f76
commit
a12cf7211d
24 changed files with 33 additions and 33 deletions
|
@ -24,7 +24,7 @@ repos:
|
|||
- id: flake8
|
||||
additional_dependencies:
|
||||
- flake8-docstrings==1.5.0
|
||||
- pydocstyle==4.0.1
|
||||
- pydocstyle==5.0.1
|
||||
files: ^(homeassistant|script|tests)/.+\.py$
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.6.2
|
||||
|
|
|
@ -20,7 +20,7 @@ repos:
|
|||
- id: flake8
|
||||
additional_dependencies:
|
||||
- flake8-docstrings==1.5.0
|
||||
- pydocstyle==4.0.1
|
||||
- pydocstyle==5.0.1
|
||||
files: ^(homeassistant|script|tests)/.+\.py$
|
||||
- repo: https://github.com/PyCQA/bandit
|
||||
rev: 1.6.2
|
||||
|
|
|
@ -119,7 +119,7 @@ class BMWConnectedDriveAccount:
|
|||
def __init__(
|
||||
self, username: str, password: str, region_str: str, name: str, read_only
|
||||
) -> None:
|
||||
"""Constructor."""
|
||||
"""Initialize account."""
|
||||
|
||||
region = get_region_from_name(region_str)
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class BMWConnectedDriveSensor(BinarySensorDevice):
|
|||
def __init__(
|
||||
self, account, vehicle, attribute: str, sensor_name, device_class, icon
|
||||
):
|
||||
"""Constructor."""
|
||||
"""Initialize sensor."""
|
||||
self._account = account
|
||||
self._vehicle = vehicle
|
||||
self._attribute = attribute
|
||||
|
|
|
@ -69,7 +69,7 @@ class BMWConnectedDriveSensor(Entity):
|
|||
"""Representation of a BMW vehicle sensor."""
|
||||
|
||||
def __init__(self, account, vehicle, attribute: str, attribute_info):
|
||||
"""Constructor."""
|
||||
"""Initialize BMW vehicle sensor."""
|
||||
self._vehicle = vehicle
|
||||
self._account = account
|
||||
self._attribute = attribute
|
||||
|
|
|
@ -198,7 +198,7 @@ class DlnaDmrDevice(MediaPlayerDevice):
|
|||
"""Representation of a DLNA DMR device."""
|
||||
|
||||
def __init__(self, dmr_device, name=None):
|
||||
"""Initializer."""
|
||||
"""Initialize DLNA DMR device."""
|
||||
self._device = dmr_device
|
||||
self._name = name
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ class Config:
|
|||
|
||||
|
||||
def _load_json(filename):
|
||||
"""Wrapper, because we actually want to handle invalid json."""
|
||||
"""Load JSON, handling invalid syntax."""
|
||||
try:
|
||||
return load_json(filename)
|
||||
except HomeAssistantError:
|
||||
|
|
|
@ -98,7 +98,7 @@ class HomeworksDevice:
|
|||
"""Base class of a Homeworks device."""
|
||||
|
||||
def __init__(self, controller, addr, name):
|
||||
"""Controller, address, and name of the device."""
|
||||
"""Initialize Homeworks device."""
|
||||
self._addr = addr
|
||||
self._name = name
|
||||
self._controller = controller
|
||||
|
|
|
@ -106,7 +106,7 @@ class KebaHandler(KebaKeContact):
|
|||
"""Representation of a KEBA charging station connection."""
|
||||
|
||||
def __init__(self, hass, host, rfid, refresh_interval):
|
||||
"""Constructor."""
|
||||
"""Initialize charging station connection."""
|
||||
super().__init__(host, self.hass_callback)
|
||||
|
||||
self._update_listeners = []
|
||||
|
|
|
@ -69,7 +69,7 @@ class LeafRangeSensor(LeafEntity):
|
|||
"""Nissan Leaf Range Sensor."""
|
||||
|
||||
def __init__(self, car, ac_on):
|
||||
"""Set-up range sensor. Store if AC on."""
|
||||
"""Set up range sensor. Store if AC on."""
|
||||
self._ac_on = ac_on
|
||||
super().__init__(car)
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class StarlineAccount:
|
|||
"""StarLine Account class."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry):
|
||||
"""Constructor."""
|
||||
"""Initialize StarLine account."""
|
||||
self._hass: HomeAssistant = hass
|
||||
self._config_entry: ConfigEntry = config_entry
|
||||
self._update_interval: int = DEFAULT_SCAN_INTERVAL
|
||||
|
|
|
@ -44,7 +44,7 @@ class StarlineSensor(StarlineEntity, BinarySensorDevice):
|
|||
name: str,
|
||||
device_class: str,
|
||||
):
|
||||
"""Constructor."""
|
||||
"""Initialize sensor."""
|
||||
super().__init__(account, device, key, name)
|
||||
self._device_class = device_class
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class StarlineEntity(Entity):
|
|||
def __init__(
|
||||
self, account: StarlineAccount, device: StarlineDevice, key: str, name: str
|
||||
):
|
||||
"""Constructor."""
|
||||
"""Initialize StarLine entity."""
|
||||
self._account = account
|
||||
self._device = device
|
||||
self._key = key
|
||||
|
|
|
@ -42,7 +42,7 @@ class StarlineSensor(StarlineEntity, Entity):
|
|||
unit: str,
|
||||
icon: str,
|
||||
):
|
||||
"""Constructor."""
|
||||
"""Initialize StarLine sensor."""
|
||||
super().__init__(account, device, key, name)
|
||||
self._device_class = device_class
|
||||
self._unit = unit
|
||||
|
|
|
@ -32,7 +32,7 @@ class SmartDevices:
|
|||
def __init__(
|
||||
self, lights: List[SmartDevice] = None, switches: List[SmartDevice] = None
|
||||
):
|
||||
"""Constructor."""
|
||||
"""Initialize device holder."""
|
||||
self._lights = lights or []
|
||||
self._switches = switches or []
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ class Device:
|
|||
"""Hass representation of an UPnP/IGD."""
|
||||
|
||||
def __init__(self, igd_device):
|
||||
"""Initializer."""
|
||||
"""Initialize UPnP/IGD device."""
|
||||
self._igd_device = igd_device
|
||||
self._mapped_ports = []
|
||||
|
||||
@classmethod
|
||||
async def async_discover(cls, hass: HomeAssistantType):
|
||||
"""Discovery UPNP/IGD devices."""
|
||||
"""Discover UPnP/IGD devices."""
|
||||
_LOGGER.debug("Discovering UPnP/IGD devices")
|
||||
local_ip = None
|
||||
if DOMAIN in hass.data and "config" in hass.data[DOMAIN]:
|
||||
|
|
|
@ -154,7 +154,7 @@ class PerSecondUPnPIGDSensor(UpnpSensor):
|
|||
"""Abstract representation of a X Sent/Received per second sensor."""
|
||||
|
||||
def __init__(self, device, direction):
|
||||
"""Initializer."""
|
||||
"""Initialize sensor."""
|
||||
super().__init__(device)
|
||||
self._direction = direction
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class ThrottleData:
|
|||
"""Throttle data."""
|
||||
|
||||
def __init__(self, interval: int, data: Any):
|
||||
"""Constructor."""
|
||||
"""Initialize throttle data."""
|
||||
self._time = int(time.time())
|
||||
self._interval = interval
|
||||
self._data = data
|
||||
|
@ -126,7 +126,7 @@ class WithingsDataManager:
|
|||
service_available = None
|
||||
|
||||
def __init__(self, hass: HomeAssistant, profile: str, api: ConfigEntryWithingsApi):
|
||||
"""Constructor."""
|
||||
"""Initialize data manager."""
|
||||
self._hass = hass
|
||||
self._api = api
|
||||
self._profile = profile
|
||||
|
|
|
@ -55,7 +55,7 @@ class WithingsAttribute:
|
|||
unit_of_measurement: str,
|
||||
icon: str,
|
||||
) -> None:
|
||||
"""Constructor."""
|
||||
"""Initialize attribute."""
|
||||
self.measurement = measurement
|
||||
self.measure_type = measure_type
|
||||
self.friendly_name = friendly_name
|
||||
|
@ -73,7 +73,7 @@ class WithingsSleepStateAttribute(WithingsAttribute):
|
|||
def __init__(
|
||||
self, measurement: str, friendly_name: str, unit_of_measurement: str, icon: str
|
||||
) -> None:
|
||||
"""Constructor."""
|
||||
"""Initialize sleep state attribute."""
|
||||
super().__init__(measurement, None, friendly_name, unit_of_measurement, icon)
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class WUSensorConfig:
|
|||
device_state_attributes=None,
|
||||
device_class=None,
|
||||
):
|
||||
"""Constructor.
|
||||
"""Initialize sensor configuration.
|
||||
|
||||
:param friendly_name: Friendly name
|
||||
:param feature: WU feature. See:
|
||||
|
@ -98,7 +98,7 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig):
|
|||
unit_of_measurement: Optional[str] = None,
|
||||
device_class=None,
|
||||
):
|
||||
"""Constructor.
|
||||
"""Initialize current conditions sensor configuration.
|
||||
|
||||
:param friendly_name: Friendly name of sensor
|
||||
:field: Field name in the "current_observation" dictionary.
|
||||
|
@ -127,7 +127,7 @@ class WUDailyTextForecastSensorConfig(WUSensorConfig):
|
|||
def __init__(
|
||||
self, period: int, field: str, unit_of_measurement: Optional[str] = None
|
||||
):
|
||||
"""Constructor.
|
||||
"""Initialize daily text forecast sensor configuration.
|
||||
|
||||
:param period: forecast period number
|
||||
:param field: field name to use as value
|
||||
|
@ -164,7 +164,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig):
|
|||
icon=None,
|
||||
device_class=None,
|
||||
):
|
||||
"""Constructor.
|
||||
"""Initialize daily simple forecast sensor configuration.
|
||||
|
||||
:param friendly_name: friendly_name of the sensor
|
||||
:param period: forecast period number
|
||||
|
@ -207,7 +207,7 @@ class WUHourlyForecastSensorConfig(WUSensorConfig):
|
|||
"""Helper for defining sensor configurations for hourly text forecasts."""
|
||||
|
||||
def __init__(self, period: int, field: int):
|
||||
"""Constructor.
|
||||
"""Initialize hourly forecast sensor configuration.
|
||||
|
||||
:param period: forecast period number
|
||||
:param field: field name to use as value
|
||||
|
@ -274,7 +274,7 @@ class WUAlmanacSensorConfig(WUSensorConfig):
|
|||
icon: str,
|
||||
device_class=None,
|
||||
):
|
||||
"""Constructor.
|
||||
"""Initialize almanac sensor configuration.
|
||||
|
||||
:param friendly_name: Friendly name
|
||||
:param field: value name returned in 'almanac' dict as returned by the WU API
|
||||
|
@ -297,7 +297,7 @@ class WUAlertsSensorConfig(WUSensorConfig):
|
|||
"""Helper for defining field configuration for alerts."""
|
||||
|
||||
def __init__(self, friendly_name: Union[str, Callable]):
|
||||
"""Constructor.
|
||||
"""Initialiize alerts sensor configuration.
|
||||
|
||||
:param friendly_name: Friendly name
|
||||
"""
|
||||
|
|
|
@ -4,4 +4,4 @@ bandit==1.6.2
|
|||
black==19.10b0
|
||||
flake8-docstrings==1.5.0
|
||||
flake8==3.7.9
|
||||
pydocstyle==4.0.1
|
||||
pydocstyle==5.0.1
|
||||
|
|
|
@ -117,7 +117,7 @@ class JsonValidator(object):
|
|||
"""Helper to compare JSON."""
|
||||
|
||||
def __init__(self, jsondata):
|
||||
"""Constructor."""
|
||||
"""Initialize JSON validator."""
|
||||
self.jsondata = jsondata
|
||||
|
||||
def __eq__(self, other):
|
||||
|
|
|
@ -15,7 +15,7 @@ class MockDevice(Device):
|
|||
"""Mock device for Device."""
|
||||
|
||||
def __init__(self, udn):
|
||||
"""Initializer."""
|
||||
"""Initialize mock device."""
|
||||
device = MagicMock()
|
||||
device.manufacturer = "mock-manuf"
|
||||
device.name = "mock-name"
|
||||
|
|
|
@ -16,7 +16,7 @@ class ComponentFactory:
|
|||
"""Factory class."""
|
||||
|
||||
def __init__(self, init_controller_mock):
|
||||
"""Constructor."""
|
||||
"""Initialize component factory."""
|
||||
self.init_controller_mock = init_controller_mock
|
||||
|
||||
async def configure_component(
|
||||
|
|
Loading…
Add table
Reference in a new issue