Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9dbc758

Browse files
committed
dding scripts to the branch
1 parent cb448c2 commit 9dbc758

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "/usr/bin/python"
3+
}

scripts/test_scripts/01_class_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# shallow copy
2+
3+
xs = [[1,2.3], [4,5,6], [7,8,9]]
4+
5+
class Point:
6+
""" Points class represents and manipulate x,y coords """
7+
def __init__(self, x = 0, y = 0):
8+
self.x = x
9+
self.y = y
10+
def __repr__(self):
11+
return f'Point({self.x!r}, {self.y!r})'
12+
class Rectangle:
13+
def __init__(self, topleft, bottomright):
14+
self.topleft = topleft
15+
self.bottomright = bottomright
16+
def __repr__(self):
17+
18+
return (Rectangle({self.topleft}, {self.bottomright}))
19+
rect = Rectangle(Point(0,1),Point(5,6))
20+
srect = copy.copy(rect)

scripts/test_scripts/time_utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
import datetime
3+
4+
def add_seconds(time_stamp, secs):
5+
time_stamp = time_stamp + datetime.timedelta(seconds=secs)
6+
return time_stamp
7+
8+
9+
10+
def reduce_seconds(time_stamp, secs):
11+
time_stamp = time_stamp - datetime.timedelta(seconds=secs)
12+
return time_stamp.strftime("%Y-%m-%d %H:%M:%S")
13+
14+
15+
reduce_seconds(1546842021, 2700)

0 commit comments

Comments
 (0)