MCPcopy Index your code
hub / github.com/geekcomputers/Python / getUserDir

Method getUserDir

image2pdf/image2pdf.py:13–25  ·  view source on GitHub ↗

Allow user to choose image directory

(self)

Source from the content-addressed store, hash-verified

11 self.isMergePDF = True
12
13 def getUserDir(self):
14 """Allow user to choose image directory"""
15
16 msg = "\n1. Current directory\n2. Custom directory\nEnter a number: "
17 user_option = int(input(msg))
18
19 # Restrict input to either (1 or 2)
20 while user_option <= 0 or user_option >= 3:
21 user_option = int(input(f"\n*Invalid input*\n{msg}"))
22
23 self.directory = (
24 os.getcwd() if user_option == 1 else input("\nEnter custom directory: ")
25 )
26
27 def filter(self, item):
28 return item.endswith(self.validFormats)

Callers 1

image2pdf.pyFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected