Skip to content

Commit

Permalink
updates post linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mbordash2 committed Dec 5, 2024
1 parent e395f9e commit e3fa5ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
19 changes: 4 additions & 15 deletions runway/cfngin/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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__(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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."""

Expand All @@ -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.
Expand Down Expand Up @@ -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."""

Expand All @@ -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."""

Expand Down Expand Up @@ -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."""

Expand Down Expand Up @@ -560,7 +550,7 @@ class StackUpdateBadStatus(CfnginError):

def __init__(
self,
stack_name: str ,
stack_name: str,
stack_status: str,
reason: str,
*args: Any,
Expand Down Expand Up @@ -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, ...]]:
Expand All @@ -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.
Expand Down
12 changes: 3 additions & 9 deletions runway/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit e3fa5ed

Please sign in to comment.