mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-28 19:58:18 +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 = pgv.AGraph(deps_dict)
|
||||||
G.layout(prog="fdp")
|
G.layout(prog="fdp")
|
||||||
if self.image == "ascii":
|
if self.image == "ascii":
|
||||||
G.write("{0}.dot".format(self.image))
|
G.write(f"{self.image}.dot")
|
||||||
self.graph_easy()
|
self.graph_easy()
|
||||||
G.draw(self.image)
|
G.draw(self.image)
|
||||||
except IOError:
|
except IOError:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
if os.path.isfile(self.image):
|
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()
|
raise SystemExit()
|
||||||
|
|
||||||
def check_file(self):
|
def check_file(self):
|
||||||
"""Check for file format and type
|
"""Check for file format and type
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
image_type = ".{0}".format(self.image.split(".")[1])
|
image_type = f".{self.image.split('.')[1]}"
|
||||||
if image_type not in self.file_format:
|
if image_type not in self.file_format:
|
||||||
print("Format: '{0}' not recognized. Use one of "
|
print(f"Format: '{self.image.split('.')[1]}' not recognized. Use one of "
|
||||||
"them:\n{1}".format(self.image.split(".")[1],
|
f"them:\n{', '.join(self.file_format)}")
|
||||||
", ".join(self.file_format)))
|
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("slpkg: Error: Image file suffix missing")
|
print("slpkg: Error: Image file suffix missing")
|
||||||
|
|
Loading…
Add table
Reference in a new issue