From e3fa5edfae2d68d4cfa8b117b0c876d30cf03ed1 Mon Sep 17 00:00:00 2001 From: Michael Bordash Date: Wed, 4 Dec 2024 20:11:08 -0500 Subject: [PATCH] updates post linting --- runway/cfngin/exceptions.py | 19 ++++--------------- runway/exceptions.py | 12 +++--------- tests/unit/test_exceptions.py | 7 ++++++- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/runway/cfngin/exceptions.py b/runway/cfngin/exceptions.py index 5f4110228..293d64260 100644 --- a/runway/cfngin/exceptions.py +++ b/runway/cfngin/exceptions.py @@ -71,7 +71,6 @@ def __init__(self, bucket_name: str) -> None: super().__init__() - class CfnginBucketRequired(CfnginError): """CFNgin bucket is required to use a feature but it not provided/disabled.""" @@ -131,11 +130,9 @@ def __init__(self, change_set_id: str) -> None: super().__init__() - class GraphError(CfnginError): """Raised when the graph is invalid (e.g. acyclic dependencies).""" - message: str def __init__( @@ -174,9 +171,7 @@ class ImproperlyConfigured(CfnginError): error: Exception message: str - def __init__( - self, kls: Any, error: Exception, *args: Any, **kwargs: Any - ) -> None: + def __init__(self, kls: Any, error: Exception, *args: Any, **kwargs: Any) -> None: """Instantiate class. Args: @@ -222,7 +217,6 @@ def __reduce__(self) -> tuple[type[Exception], tuple[Any, ...]]: return self.__class__, (self.errors,) - class InvalidDockerizePipConfiguration(CfnginError): """Raised when the provided configuration for dockerized pip is invalid.""" @@ -239,7 +233,6 @@ def __init__(self, msg: str) -> None: super().__init__() - class InvalidUserdataPlaceholder(CfnginError): """Raised when a placeholder name in raw_user_data is not valid. @@ -300,7 +293,6 @@ def __init__(self, key: str, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - class MissingParameterException(CfnginError): """Raised if a required parameter with no default is missing.""" @@ -325,7 +317,6 @@ def __reduce__(self) -> tuple[type[Exception], tuple[Any, ...]]: return self.__class__, (self.parameters,) - class MissingVariable(CfnginError): """Raised when a variable with no default is not provided a value.""" @@ -522,7 +513,6 @@ def __reduce__(self) -> tuple[type[Exception], tuple[Any, ...]]: return self.__class__, (self.failed_steps,) - class StackDidNotChange(CfnginError): """Raised when there are no changes to be made by the provider.""" @@ -560,7 +550,7 @@ class StackUpdateBadStatus(CfnginError): def __init__( self, - stack_name: str , + stack_name: str, stack_status: str, reason: str, *args: Any, @@ -733,8 +723,8 @@ def __init__( self.blueprint_name = blueprint_name self.variable = variable self.message = ( - f'Variable "{variable.name}" in blueprint "{blueprint_name}" hasn\'t been resolved' - ) + f'Variable "{variable.name}" in blueprint "{blueprint_name}" hasn\'t been resolved' + ) super().__init__(*args, **kwargs) def __reduce__(self) -> tuple[type[Exception], tuple[Any, ...]]: @@ -748,7 +738,6 @@ class UnresolvedBlueprintVariables(CfnginError): message: str blueprint_name: str - def __init__(self, blueprint_name: str, *args: Any, **kwargs: Any) -> None: """Instantiate class. diff --git a/runway/exceptions.py b/runway/exceptions.py index 04b17745e..82dfa390b 100644 --- a/runway/exceptions.py +++ b/runway/exceptions.py @@ -299,9 +299,7 @@ class OutputDoesNotExist(RunwayError): stack_name: str """Name of a CloudFormation Stack.""" - def __init__( - self, stack_name: str, output: str, *args: Any, **kwargs: Any - ) -> None: + def __init__(self, stack_name: str, output: str, *args: Any, **kwargs: Any) -> None: """Instantiate class. Args: @@ -360,9 +358,7 @@ class UnknownLookupType(RunwayError): message: str = "Unknown lookup type" - def __init__( - self, lookup: VariableValueLookup, *args: Any, **kwargs: Any - ) -> None: + def __init__(self, lookup: VariableValueLookup, *args: Any, **kwargs: Any) -> None: """Instantiate class. Args: @@ -408,9 +404,7 @@ class UnresolvedVariableValue(RunwayError): lookup: VariableValueLookup message: str = "Unresolved lookup" - def __init__( - self, lookup: VariableValueLookup, *args: Any, **kwargs: Any - ) -> None: + def __init__(self, lookup: VariableValueLookup, *args: Any, **kwargs: Any) -> None: """Instantiate class. Args: diff --git a/tests/unit/test_exceptions.py b/tests/unit/test_exceptions.py index 1846fc8fe..c5f961411 100644 --- a/tests/unit/test_exceptions.py +++ b/tests/unit/test_exceptions.py @@ -108,7 +108,12 @@ class TestFailedVariableLookup: def test_pickle(self) -> None: """Test pickling.""" - exc = FailedVariableLookup(Variable(name="test", value="test"), FailedLookup(VariableValueLookup(VariableValueLiteral("env"), "foo"), Exception("error"))) + exc = FailedVariableLookup( + Variable(name="test", value="test"), + FailedLookup( + VariableValueLookup(VariableValueLiteral("env"), "foo"), Exception("error") + ), + ) assert str(pickle.loads(pickle.dumps(exc))) == str(exc)