Skip to content

Commit

Permalink
Upgrade pydocstyle to 5.0.1 (home-assistant#29830)
Browse files Browse the repository at this point in the history
* Upgrade pydocstyle to 5.0.1

http://www.pydocstyle.org/en/5.0.1/release_notes.html

* Pydocstyle and other docstring fixes
  • Loading branch information
scop authored and balloob committed Dec 10, 2019
1 parent 3ed1738 commit a12cf72
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bmw_connected_drive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bmw_connected_drive/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/dlna_dmr/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/emulated_hue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def is_entity_exposed(self, entity):


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:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/homeworks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/keba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nissan_leaf/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/starline/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/starline/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(
name: str,
device_class: str,
):
"""Constructor."""
"""Initialize sensor."""
super().__init__(account, device, key, name)
self._device_class = device_class

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/starline/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/starline/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(
unit: str,
icon: str,
):
"""Constructor."""
"""Initialize StarLine sensor."""
super().__init__(account, device, key, name)
self._device_class = device_class
self._unit = unit
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tplink/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/upnp/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/upnp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/withings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/withings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
unit_of_measurement: str,
icon: str,
) -> None:
"""Constructor."""
"""Initialize attribute."""
self.measurement = measurement
self.measure_type = measure_type
self.friendly_name = friendly_name
Expand All @@ -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)


Expand Down
14 changes: 7 additions & 7 deletions homeassistant/components/wunderground/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(
device_state_attributes=None,
device_class=None,
):
"""Constructor.
"""Initialize sensor configuration.
:param friendly_name: Friendly name
:param feature: WU feature. See:
Expand Down Expand Up @@ -98,7 +98,7 @@ def __init__(
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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -164,7 +164,7 @@ def __init__(
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -274,7 +274,7 @@ def __init__(
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
Expand All @@ -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
"""
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/components/mqtt/test_light_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/components/upnp/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/components/vera/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a12cf72

Please sign in to comment.