generate: container: Fix some issues reported by pylint
This fixes various issues reported by pylint. It now only reports to issues, that can be ignored, since they're only about too many local variables or class attributes. Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
e2f2b3e35f
commit
72062edbf5
1 changed files with 12 additions and 7 deletions
|
@ -17,7 +17,7 @@ class ConfigError(Exception):
|
||||||
def __init__(self, message: str = "") -> None:
|
def __init__(self, message: str = "") -> None:
|
||||||
"""Create Exception object."""
|
"""Create Exception object."""
|
||||||
self.message = message
|
self.message = message
|
||||||
self.super.__init__(message)
|
super().__init__(message)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
"""Convert Exception object to a string."""
|
"""Convert Exception object to a string."""
|
||||||
|
@ -57,7 +57,7 @@ def trim(s: str) -> str:
|
||||||
"""Remove sequential whitespace."""
|
"""Remove sequential whitespace."""
|
||||||
s = s.replace("\t ", "\t")
|
s = s.replace("\t ", "\t")
|
||||||
s = s.replace("\t\\\n", " ")
|
s = s.replace("\t\\\n", " ")
|
||||||
while s.__contains__(" "):
|
while " " in s:
|
||||||
s = s.replace(" ", " ")
|
s = s.replace(" ", " ")
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
@ -236,10 +236,15 @@ class Ports:
|
||||||
def command(self) -> str:
|
def command(self) -> str:
|
||||||
"""Option for podman container create."""
|
"""Option for podman container create."""
|
||||||
ports = ""
|
ports = ""
|
||||||
for port in self.tcp_ports:
|
seperator = " \\\n"
|
||||||
ports += f"\t--port {port}/tcp \\\n"
|
ports += seperator.join(
|
||||||
for port in self.udp_ports:
|
[f"\t--port {port}/tcp" for port in self.tcp_ports]
|
||||||
ports += f"\t--port {port}/udp \\\n"
|
)
|
||||||
|
ports += seperator
|
||||||
|
ports += seperator.join(
|
||||||
|
[f"\t--port {port}/udp" for port in self.udp_ports]
|
||||||
|
)
|
||||||
|
ports += seperator
|
||||||
return ports
|
return ports
|
||||||
|
|
||||||
|
|
||||||
|
@ -447,7 +452,7 @@ class Container:
|
||||||
|
|
||||||
def create_container(self) -> str:
|
def create_container(self) -> str:
|
||||||
"""Generate podman container create command."""
|
"""Generate podman container create command."""
|
||||||
cmd = f"# Create container {self.name}"
|
cmd = f"# Create container {self.name}\n"
|
||||||
cmd += "podman container crate \\\n"
|
cmd += "podman container crate \\\n"
|
||||||
cmd += f"\t--name={self.name} \\\n"
|
cmd += f"\t--name={self.name} \\\n"
|
||||||
if self.privileged:
|
if self.privileged:
|
||||||
|
|
Loading…
Add table
Reference in a new issue