-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTools.py
More file actions
44 lines (33 loc) · 982 Bytes
/
Tools.py
File metadata and controls
44 lines (33 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
"""
!!! Not certified fit for any purpose, use at your own risk !!!
Copyright (c) Rex Sutton 2016.
Small re-usable functions.
"""
import datetime
def log_string():
""" The prefix for a log-entry.
Returns:
(string): The log-string
"""
return '{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now())
def print_log(message):
"""Print date and time followed by message.
Args:
message (str): The message.
"""
print log_string(), message
def print_matrix_shape(message, matrix):
"""Print message followed by the shape of matrix.
Args:
message (str): The message.
matrix (matrix): The matrix.
"""
print message, len(matrix), len(matrix[0])
def print_vector_shape(message, vector):
"""Print message followed by the length of vector.
Args:
message (str): The first parameter.
vector (vector): The vector.
"""
print message, len(vector)