mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-22 05:09:12 +00:00
[PR #11119/41923e43 backport][stable-12] fix ruff case SIM103 (#11132)
fix ruff case SIM103 (#11119)
* fix ruff case SIM103
* add changelog frag
(cherry picked from commit 41923e43bd)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
ac6c6df2c7
commit
93d23cfef6
39 changed files with 115 additions and 230 deletions
|
|
@ -255,9 +255,7 @@ class PamdLine:
|
|||
|
||||
@property
|
||||
def is_valid(self):
|
||||
if self.line.strip() == "":
|
||||
return True
|
||||
return False
|
||||
return self.line.strip() == ""
|
||||
|
||||
def validate(self):
|
||||
if not self.is_valid:
|
||||
|
|
@ -282,9 +280,7 @@ class PamdComment(PamdLine):
|
|||
|
||||
@property
|
||||
def is_valid(self):
|
||||
if self.line.startswith("#"):
|
||||
return True
|
||||
return False
|
||||
return self.line.startswith("#")
|
||||
|
||||
|
||||
class PamdInclude(PamdLine):
|
||||
|
|
@ -293,9 +289,7 @@ class PamdInclude(PamdLine):
|
|||
|
||||
@property
|
||||
def is_valid(self):
|
||||
if self.line.startswith("@include"):
|
||||
return True
|
||||
return False
|
||||
return self.line.startswith("@include")
|
||||
|
||||
|
||||
class PamdRule(PamdLine):
|
||||
|
|
@ -399,9 +393,7 @@ class PamdRule(PamdLine):
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
if number >= 0:
|
||||
return True
|
||||
return False
|
||||
return number >= 0
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
|
|
@ -484,9 +476,7 @@ class PamdService:
|
|||
return lines
|
||||
|
||||
def has_rule(self, rule_type, rule_control, rule_path):
|
||||
if self.get(rule_type, rule_control, rule_path):
|
||||
return True
|
||||
return False
|
||||
return bool(self.get(rule_type, rule_control, rule_path))
|
||||
|
||||
def update_rule(
|
||||
self, rule_type, rule_control, rule_path, new_type=None, new_control=None, new_path=None, new_args=None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue