Skip to content

Commit 0ceec53

Browse files
committed
changes
1 parent 22c2d9e commit 0ceec53

File tree

4 files changed

+164
-9
lines changed

4 files changed

+164
-9
lines changed

__pycache__/file2.cpython-37.pyc

209 Bytes
Binary file not shown.

file2.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
import sys
3+
try:
4+
import pandas as pd
5+
global pd
6+
from io import StringIO
7+
global StringIO
8+
import re
9+
import boto3
10+
global re
11+
s3 = boto3.resource('s3')
12+
my_bucket = s3.Bucket('outletipcam-new')
13+
outlets="select code from outlets"
14+
outlets=execute_query("ProdDB",outlets)['rows']
15+
16+
from datetime import date,timedelta
17+
today = date.today() - timedelta(days=1)
18+
today_minus_8=date.today() - timedelta(days=8)
19+
print today_minus_8
20+
21+
last_seven_days=[]
22+
seven_forteen_days=[]
23+
for i in range(1,8):
24+
last_seven_days.append(date.today() - timedelta(days=i))
25+
26+
for i in range(8,15):
27+
seven_forteen_days.append(date.today() - timedelta(days=i))
28+
29+
print last_seven_days
30+
print seven_forteen_days
31+
# outlet/date/camerano/
32+
# df=pd.DataFrame()
33+
datalist=[]
34+
# for i in outlets:
35+
36+
count=0
37+
for object_summary in my_bucket.objects.filter(Prefix="PUN-1040/{}".format(today_minus_8)):
38+
count=count+1
39+
# print object_summary.key
40+
# break
41+
42+
print count
43+
44+
except Exception as e:
45+
print e
46+
print 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno)

file2.py.bak

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
import sys
3+
try:
4+
import pandas as pd
5+
global pd
6+
from io import StringIO
7+
global StringIO
8+
import re
9+
import boto3
10+
global re
11+
s3 = boto3.resource('s3')
12+
my_bucket = s3.Bucket('outletipcam-new')
13+
outlets="select code from outlets"
14+
outlets=execute_query("ProdDB",outlets)['rows']
15+
16+
from datetime import date,timedelta
17+
today = date.today() - timedelta(days=1)
18+
today_minus_8=date.today() - timedelta(days=8)
19+
print today_minus_8
20+
21+
last_seven_days=[]
22+
seven_forteen_days=[]
23+
for i in range(1,8):
24+
last_seven_days.append(date.today() - timedelta(days=i))
25+
26+
for i in range(8,15):
27+
seven_forteen_days.append(date.today() - timedelta(days=i))
28+
29+
print last_seven_days
30+
print seven_forteen_days
31+
# outlet/date/camerano/
32+
# df=pd.DataFrame()
33+
datalist=[]
34+
# for i in outlets:
35+
36+
count=0
37+
for object_summary in my_bucket.objects.filter(Prefix="PUN-1040/{}".format(today_minus_8)):
38+
count=count+1
39+
# print object_summary.key
40+
# break
41+
42+
print count
43+
44+
except Exception as e:
45+
print e
46+
print 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno)

python2.py

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,81 @@
1+
# from file2 import *
2+
import os
13

2-
# myVar="Joe Smart"
3-
# x = open (myVar+".py", "w")
4+
python2='''
5+
import sys
6+
try:
7+
import pandas as pd
8+
global pd
9+
from io import StringIO
10+
global StringIO
11+
import re
12+
import boto3
13+
global re
14+
s3 = boto3.resource('s3')
15+
my_bucket = s3.Bucket('outletipcam-new')
16+
outlets="select code from outlets"
17+
outlets=execute_query("ProdDB",outlets)['rows']
18+
19+
from datetime import date,timedelta
20+
today = date.today() - timedelta(days=1)
21+
today_minus_8=date.today() - timedelta(days=8)
22+
print today_minus_8
23+
24+
last_seven_days=[]
25+
seven_forteen_days=[]
26+
for i in range(1,8):
27+
last_seven_days.append(date.today() - timedelta(days=i))
28+
29+
for i in range(8,15):
30+
seven_forteen_days.append(date.today() - timedelta(days=i))
31+
32+
print last_seven_days
33+
print seven_forteen_days
34+
# outlet/date/camerano/
35+
# df=pd.DataFrame()
36+
datalist=[]
37+
# for i in outlets:
38+
39+
count=0
40+
for object_summary in my_bucket.objects.filter(Prefix="PUN-1040/{}".format(today_minus_8)):
41+
count=count+1
42+
# print object_summary.key
43+
# break
44+
45+
print count
46+
47+
except Exception as e:
48+
print e
49+
print 'Error on line {}'.format(sys.exc_info()[-1].tb_lineno)
50+
'''
451

5-
# x.write("hello")
6-
# x.close()
752

8-
pythonprogram='''
9-
print ("hello how are you doing hello")
53+
myVar="file2"
54+
55+
x = open (myVar+".py", "w")
56+
x.write(python2)
57+
x.close()
58+
59+
60+
# Run 2to3 file2.py
61+
1062

11-
print ("Eod of statemet")
12-
'''
1363

14-
exec(pythonprogram)
64+
# step1=assign a variable with python2 text
65+
# step2=make a file2.py with this text
66+
# step3=convert with the 2to3 module within the code
67+
# step4= extract the text from the converted file
1568

69+
python3=''' '''
70+
a="file2.py"
71+
filetoopen=open(a,'r')
72+
line=filetoopen.readline()
1673

74+
while(line!=""):
75+
# print(line)
76+
python3=python3+line
77+
line=filetoopen.readline()
1778

79+
filetoopen.close()
80+
print (python3)
1881

0 commit comments

Comments
 (0)