From 2f47a00c4b91d285de1e501c31fb0c9f8a85e473 Mon Sep 17 00:00:00 2001 From: Matt Zimmerman Date: Sun, 29 Oct 2023 11:55:45 -0700 Subject: [PATCH] document _prop and remove unused parameter --- .pre-commit-config.yaml | 2 +- smarttub/api.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 263935b..f28db74 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: trailing-whitespace - id: check-yaml - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 23.10.1 hooks: - id: black args: diff --git a/smarttub/api.py b/smarttub/api.py index 61b95ae..8be43b8 100644 --- a/smarttub/api.py +++ b/smarttub/api.py @@ -329,8 +329,19 @@ def __init__(self, spa: Spa, **properties): self._prop("watercare") def _prop( - self, json_key, instance_variable_name=None, optional=True, constructor=None + self, + json_key, + instance_variable_name=None, + constructor=None, ): + """Set an instance variable corresponding to the specified JSON property + + Arguments: + json_key -- a key in the self.properties map + instance_variable_name -- the name of the variable to set + constructor -- a callable which accepts the raw value as an argument, and returns an appropriate internal representation (e.g. enum) + """ + if instance_variable_name is None: instance_variable_name = underscore(json_key) if json_key in self.properties: