mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-26 19:58:50 +01:00
Updated for f string
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
9b6b5dbfff
commit
e816763ca6
1 changed files with 5 additions and 6 deletions
|
@ -63,24 +63,23 @@ class Graph:
|
|||
G = pgv.AGraph(deps_dict)
|
||||
G.layout(prog="fdp")
|
||||
if self.image == "ascii":
|
||||
G.write("{0}.dot".format(self.image))
|
||||
G.write(f"{self.image}.dot")
|
||||
self.graph_easy()
|
||||
G.draw(self.image)
|
||||
except IOError:
|
||||
raise SystemExit()
|
||||
if os.path.isfile(self.image):
|
||||
print("Graph image file '{0}' created".format(self.image))
|
||||
print(f"Graph image file '{self.image}' created")
|
||||
raise SystemExit()
|
||||
|
||||
def check_file(self):
|
||||
"""Check for file format and type
|
||||
"""
|
||||
try:
|
||||
image_type = ".{0}".format(self.image.split(".")[1])
|
||||
image_type = f".{self.image.split('.')[1]}"
|
||||
if image_type not in self.file_format:
|
||||
print("Format: '{0}' not recognized. Use one of "
|
||||
"them:\n{1}".format(self.image.split(".")[1],
|
||||
", ".join(self.file_format)))
|
||||
print(f"Format: '{self.image.split('.')[1]}' not recognized. Use one of "
|
||||
f"them:\n{', '.join(self.file_format)}")
|
||||
raise SystemExit()
|
||||
except IndexError:
|
||||
print("slpkg: Error: Image file suffix missing")
|
||||
|
|
Loading…
Add table
Reference in a new issue