Skip to content

Commit

Permalink
Python: Fix lint issue (#331)
Browse files Browse the repository at this point in the history
Fix the following lint issue:

```
lib/pulumi_policy/policy.py:1038: error: Argument "enforcementLevel" to "AnalyzeDiagnostic" has incompatible type "int"; expected "ValueType"  [arg-type]
```
  • Loading branch information
justinvp authored Jan 29, 2024
1 parent 90aa706 commit a727381
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sdk/python/lib/pulumi_policy/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ def report_violation(message: str, urn: Optional[str] = None) -> None:
if message:
violation_message += f"\n{message}"

diagnostics.append(proto.AnalyzeDiagnostic( # type: ignore
diagnostics.append(proto.AnalyzeDiagnostic(
policyName=policy_name,
policyPackName=self.__policy_pack_name,
policyPackVersion=self.__policy_pack_version,
Expand All @@ -1039,15 +1039,15 @@ def report_violation(message: str, urn: Optional[str] = None) -> None:
))
return report_violation

def _map_enforcement_level(self, enforcement_level: EnforcementLevel) -> int:
def _map_enforcement_level(self, enforcement_level: EnforcementLevel) -> proto.EnforcementLevel.ValueType:
if enforcement_level == EnforcementLevel.ADVISORY:
return proto.ADVISORY # type: ignore
return proto.ADVISORY
if enforcement_level == EnforcementLevel.MANDATORY:
return proto.MANDATORY # type: ignore
return proto.MANDATORY
if enforcement_level == EnforcementLevel.REMEDIATE:
return proto.REMEDIATE # type: ignore
return proto.REMEDIATE
if enforcement_level == EnforcementLevel.DISABLED:
return proto.DISABLED # type: ignore
return proto.DISABLED
raise AssertionError(
f"unknown enforcement level: {enforcement_level}")

Expand Down

0 comments on commit a727381

Please sign in to comment.