diff --git a/examples/allVehicles.py b/examples/allVehicles.py index e4dbea9..5e0c7ab 100644 --- a/examples/allVehicles.py +++ b/examples/allVehicles.py @@ -4,10 +4,10 @@ def main(): - """ Simple example showing how to retrieve all vehciles from the account """ + """ Simple example showing how to retrieve all vehicles from the account """ parser = argparse.ArgumentParser( - prog='allVehciles', - description='Example retrieving all vehciles in the account') + prog='allVehicles', + description='Example retrieving all vehicles in the account') parser.add_argument('-u', '--username', help='Username of Volkswagen id', required=True) parser.add_argument('-p', '--password', help='Password of Volkswagen id', required=True) diff --git a/examples/events.py b/examples/events.py index ffe7005..e4f0f00 100644 --- a/examples/events.py +++ b/examples/events.py @@ -7,8 +7,8 @@ def main(): """ Simple example showing how to work with events """ parser = argparse.ArgumentParser( - prog='allVehciles', - description='Example retrieving all vehciles in the account') + prog='allVehicles', + description='Example retrieving all vehicles in the account') parser.add_argument('-u', '--username', help='Username of Volkswagen id', required=True) parser.add_argument('-p', '--password', help='Password of Volkswagen id', required=True) @@ -32,7 +32,7 @@ def onWeConnectEvent(element, flags): """Simple callback example Args: - element (AddressableObject): Object for which an event occured + element (AddressableObject): Object for which an event occurred flags (AddressableLeaf.ObserverEvent): Information about the type of the event """ if isinstance(element, addressable.AddressableAttribute): diff --git a/examples/savePictures.py b/examples/savePictures.py index 8041e4f..62da221 100644 --- a/examples/savePictures.py +++ b/examples/savePictures.py @@ -8,8 +8,8 @@ def main(): """ Simple example showing how to save pictures """ parser = argparse.ArgumentParser( - prog='allVehciles', - description='Example retrieving all vehciles in the account') + prog='allVehicles', + description='Example retrieving all vehicles in the account') parser.add_argument('-u', '--username', help='Username of Volkswagen id', required=True) parser.add_argument('-p', '--password', help='Password of Volkswagen id', required=True) parser.add_argument('-o', '--outputDir', help='Output directory', required=True) @@ -20,7 +20,7 @@ def saveElement(element, flags): """Simple callback for saving the pictures Args: - element (AddressableObject): Object for which an event occured + element (AddressableObject): Object for which an event occurred flags (AddressableLeaf.ObserverEvent): Information about the type of the event """ del flags diff --git a/tests/test_addressable.py b/tests/test_addressable.py index 25ac9dd..a7fa83b 100644 --- a/tests/test_addressable.py +++ b/tests/test_addressable.py @@ -59,7 +59,7 @@ def observe4(): for observerEntry, observer in zip(observerEntries, observers): assert observerEntry[0] == observer - # Now request only a subset of registred observers + # Now request only a subset of registered observers observerEntries = addressableLeaf.getObserverEntries(flags=addressable.AddressableLeaf.ObserverEvent.VALUE_CHANGED) assert len(observerEntries) == 2 @@ -95,7 +95,7 @@ def test_AddressableLeafParents(): assert addressableLeaf.enabled is True recursiveChildren = parentAddressableLeaf.getRecursiveChildren() - assert len(recursiveChildren) == 2 # This is two as it is the oarent as well as the child + assert len(recursiveChildren) == 2 # This is two as it is the parent as well as the child leafChildren = parentAddressableLeaf.getLeafChildren() assert len(leafChildren) == 1 @@ -111,19 +111,19 @@ def test_AddressableLeafAdresses(): addressableLeaf = addressable.AddressableLeaf(localAddress='child', parent=parentAddressableLeaf) getterAddress = addressableLeaf.localAddress - localAdress = addressableLeaf.getLocalAddress() - globalAdress = addressableLeaf.getGlobalAddress() + localAddress = addressableLeaf.getLocalAddress() + globalAddress = addressableLeaf.getGlobalAddress() - assert getterAddress == localAdress - assert localAdress == 'child' - assert globalAdress == 'parent/child' + assert getterAddress == localAddress + assert localAddress == 'child' + assert globalAddress == 'parent/child' addressableLeaf.localAddress = 'newChild' - localAdress = addressableLeaf.getLocalAddress() - globalAdress = addressableLeaf.getGlobalAddress() - assert localAdress == 'newChild' - assert globalAdress == 'parent/newChild' + localAddress = addressableLeaf.getLocalAddress() + globalAddress = addressableLeaf.getGlobalAddress() + assert localAddress == 'newChild' + assert globalAddress == 'parent/newChild' def test_AddressableLeafParent(): @@ -163,7 +163,7 @@ def test_AddressableByAddressString(): assert root.getByAddressString('/') == root -def test_AdressableAttribute(): +def test_AddressableAttribute(): attribute = addressable.AddressableAttribute(localAddress='test', parent=None, value=None, valueType=str, lastUpdateFromCar=None) assert attribute.value is None @@ -174,7 +174,7 @@ def test_AdressableAttribute(): attribute.value = 'newValue' -def test_AdressableObjectLeafChildren(): +def test_AddressableObjectLeafChildren(): addressableObject = addressable.AddressableObject(localAddress='parent', parent=None) childAddressableLeaf1 = addressable.AddressableAttribute(localAddress='child1', parent=addressableObject, value=None, valueType=str, lastUpdateFromCar=None) childAddressableLeaf2 = addressable.AddressableAttribute(localAddress='child2', parent=addressableObject, value=None, valueType=str, lastUpdateFromCar=None) diff --git a/weconnect/addressable.py b/weconnect/addressable.py index cbca6a8..e6f6921 100644 --- a/weconnect/addressable.py +++ b/weconnect/addressable.py @@ -26,7 +26,7 @@ LOG: logging.Logger = logging.getLogger("weconnect") -class AddressableLeaf(): +class AddressableLeaf: def __init__( self, localAddress: str, @@ -268,7 +268,7 @@ def saveToFile(self, filename: str) -> None: # noqa: C901 htmlfile.write('
')
                     else:
                         htmlfile.write(str(self))
-            elif filename.endswith(('.json')):
+            elif filename.endswith('.json'):
                 with open(filename, mode='w', encoding='utf8') as textfile:
                     if SUPPORT_IMAGES and SUPPORT_ASCII_IMAGES and isinstance(self.value, Image.Image):
                         raise ValueError('Attribute is an image and cannot be converted to json')
@@ -540,7 +540,7 @@ def saveToFile(self, filename: str) -> None:  # noqa: C901
         elif filename.endswith(('.htm', '.HTM', '.html', '.HTML')):
             with open(filename, mode='w', encoding='utf8'):
                 raise ValueError('Object cannot be saved as HTML')
-        elif filename.endswith(('.json')):
+        elif filename.endswith('.json'):
             with open(filename, mode='w', encoding='utf8') as textfile:
                 textfile.write(self.toJSON() + '\n')
         elif filename.endswith(('.png', '.PNG')):
diff --git a/weconnect/auth/my_cupra_session.py b/weconnect/auth/my_cupra_session.py
index c52f7dd..3defcbb 100644
--- a/weconnect/auth/my_cupra_session.py
+++ b/weconnect/auth/my_cupra_session.py
@@ -81,7 +81,7 @@ def doWebAuth(self, authorizationUrl):  # noqa: C901
             elif loginFormResponse.status_code == requests.codes['internal_server_error']:
                 raise RetrievalError('Temporary server error during login')
             else:
-                raise APICompatibilityError('Retrieving credentials page was not successfull,'
+                raise APICompatibilityError('Retrieving credentials page was not successful,'
                                             f' status code: {loginFormResponse.status_code}')
 
         # Find login form on page to obtain inputs
@@ -117,7 +117,7 @@ def doWebAuth(self, authorizationUrl):  # noqa: C901
         if login2Response.status_code != requests.codes['ok']:  # pylint: disable=E1101
             if login2Response.status_code == requests.codes['internal_server_error']:
                 raise RetrievalError('Temporary server error during login')
-            raise APICompatibilityError('Retrieving credentials page was not successfull,'
+            raise APICompatibilityError('Retrieving credentials page was not successful,'
                                         f' status code: {login2Response.status_code}')
 
         credentialsTemplateRegex = r'