Skip to content

Commit 70a75e6

Browse files
committed
PEP8 formation
1 parent ae8bb58 commit 70a75e6

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

new_script.py

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Script Name : new_script.py
22
# Author : Craig Richards
33
# Created : 20th November 2012
4-
# Last Modified :
4+
# Last Modified :
55
# Version : 1.0
66

7-
# Modifications :
7+
# Modifications :
88

99
# Description : This will create a new basic template for a new script
1010

@@ -19,48 +19,48 @@
1919
-sql : SQL Script'''
2020

2121
if len(sys.argv) < 3:
22-
print text
23-
sys.exit()
24-
25-
if '-h' in sys.argv or '--h' in sys.argv or '-help' in sys.argv or '--help' in sys.argv:
26-
print text
27-
sys.exit()
28-
else:
22+
print text
23+
sys.exit()
24+
25+
if '-h' in sys.argv or '--h' in sys.argv or '-help' in sys.argv or '--help' in sys.argv:
26+
print text
27+
sys.exit()
28+
else:
2929
if '-python' in sys.argv[1]:
30-
config_file="python.cfg"
31-
extension=".py"
30+
config_file = "python.cfg"
31+
extension = ".py"
3232
elif '-bash' in sys.argv[1]:
33-
config_file="bash.cfg"
34-
extension=".bash"
33+
config_file = "bash.cfg"
34+
extension = ".bash"
3535
elif '-ksh' in sys.argv[1]:
36-
config_file="ksh.cfg"
37-
extension=".ksh"
36+
config_file = "ksh.cfg"
37+
extension = ".ksh"
3838
elif '-sql' in sys.argv[1]:
39-
config_file="sql.cfg"
40-
extension=".sql"
39+
config_file = "sql.cfg"
40+
extension = ".sql"
4141
else:
42-
print 'Unknown option - ' + text
42+
print 'Unknown option - ' + text
4343
sys.exit()
4444

45-
confdir=os.getenv("my_config")
46-
scripts=os.getenv("scripts")
47-
dev_dir="Development"
48-
newfile=sys.argv[2]
49-
output_file=(newfile+extension)
50-
outputdir=os.path.join(scripts,dev_dir)
51-
script=os.path.join(outputdir, output_file)
52-
input_file=os.path.join(confdir,config_file)
53-
old_text=" Script Name : "
54-
new_text=(" Script Name : "+output_file)
45+
confdir = os.getenv("my_config")
46+
scripts = os.getenv("scripts")
47+
dev_dir = "Development"
48+
newfile = sys.argv[2]
49+
output_file = (newfile + extension)
50+
outputdir = os.path.join(scripts,dev_dir)
51+
script = os.path.join(outputdir, output_file)
52+
input_file = os.path.join(confdir,config_file)
53+
old_text = " Script Name : "
54+
new_text = (" Script Name : " + output_file)
5555
if not(os.path.exists(outputdir)):
5656
os.mkdir(outputdir)
57-
newscript = open(script, 'w')
58-
input=open(input_file,'r')
59-
today=datetime.date.today()
60-
old_date= " Created :"
61-
new_date= (" Created : "+today.strftime("%d %B %Y"))
62-
63-
for line in input:
57+
newscript = open(script, 'w')
58+
input = open(input_file, 'r')
59+
today = datetime.date.today()
60+
old_date = " Created :"
61+
new_date = (" Created : " + today.strftime("%d %B %Y"))
62+
63+
for line in input:
6464
line = line.replace(old_text, new_text)
6565
line = line.replace(old_date, new_date)
66-
newscript.write(line)
66+
newscript.write(line)

0 commit comments

Comments
 (0)