Skip to content

Commit c661c2a

Browse files
committed
Renamed to uet.py for consistency
1 parent c624027 commit c661c2a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

Code/et.py renamed to Code/uet.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python3
22
#
3-
# Casspop Codelette: A short, useful, educational utility. Python and Unix Epoch Time
3+
# uet.py v0.6.1 - Python and Unix Epoch Time
4+
#
5+
# Casspop Codelette: A short, useful, educational utility.
46
#
57
# Copyright (c) 2019,2020 - Gregory Allen Sanders.
68

@@ -23,19 +25,19 @@
2325
parserET = argparse.ArgumentParser()
2426
parserET.add_argument('-d', '--debug', help="Turn on debugging output to et.log file.", action="store_true")
2527
parserET.add_argument('-uet', help="Unix Epoch Time value. Example: ./et.py -uet 1606352895.032772", action="store")
26-
ETHome = os.getcwd()
28+
UETHome = os.getcwd()
2729
logger = logging.getLogger(__name__)
2830
argsET = parserET.parse_args()
2931

3032
if argsET.debug:
31-
logging.basicConfig(filename=ETHome + '/et.log', format='[%(name)s]:%(levelname)s: %(message)s. - %(asctime)s', datefmt='%D %H:%M:%S', level=logging.DEBUG)
33+
logging.basicConfig(filename=UETHome + '/uet.log', format='[%(name)s]:%(levelname)s: %(message)s. - %(asctime)s', datefmt='%D %H:%M:%S', level=logging.DEBUG)
3234
logging.info("Debugging output enabled")
3335
else:
34-
logging.basicConfig(filename=ETHome + '/et.log', format='%(asctime)s - %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level=logging.INFO)
36+
logging.basicConfig(filename=UETHome + '/uet.log', format='%(asctime)s - %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level=logging.INFO)
3537

36-
logger.info(" - - - - et.py DATA LOGGING STARTED - - - - ")
37-
logger.info("'HOME' path is: " + ETHome)
38-
logger.info(" et.py INITIAL CONFIGURATION COMPLETE ")
38+
logger.info(" - - - - uet.py DATA LOGGING STARTED - - - - ")
39+
logger.info("'HOME' path is: " + UETHome)
40+
logger.info(" uet.py INITIAL CONFIGURATION COMPLETE ")
3941

4042
logger.debug('Checked for command line argument: argsET.uet')
4143
if argsET.uet:
@@ -84,14 +86,14 @@ def SignalHandler(signal, frame):
8486
main(argsET.uet) ## If there's a UET as a command line argument, pass it to the main function here.
8587
else:
8688
uet = time.time() ## If there is no -uet argument, make a Unix Epoch Time value to share.
87-
print("\nYou didn't supply a Unix Epoch Time value. Here's one: " + str(uet) + '\n Learn more by typing "./et.py --help".\n')
89+
print("\nYou didn't supply a Unix Epoch Time value. Here's one: " + str(uet) + '\n Learn more by typing "./uet.py --help".\n')
8890
logger.debug('No time value was provided, so we provided this: ' + str(uet))
8991
pass
90-
logger.info(" - - - - et.py COMPLETED ITS MISSION - - - - ")
92+
logger.info(" - - - - uet.py COMPLETED ITS MISSION - - - - ")
9193
except Exception:
9294
logger.info("Exception caught at bottom of try.", exc_info=True)
9395
error = traceback.print_exc()
9496
logger.info(error)
9597
logger.info("That's all folks. Goodbye")
96-
logger.info(" - - - - et.py DATA LOGGING STOPPED BY EXCEPTION - - - - ")
98+
logger.info(" - - - - uet.py DATA LOGGING STOPPED BY EXCEPTION - - - - ")
9799

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Casspop Codelette: A short, useful, educational utility. Python and Unix Epoch
33

44
This is what I'm calling a codelette. It's a little bit of code that does something, but has some value beyond that for learners like me. (I don't know about you, but I'm always learning. Always.)
55

6-
"et.py" stands for EpochTime.py, and is a command line utility that will do one of two things immediately:
6+
"uet.py" stands for UnixEpochTime.py, and is a command line utility that will do one of two things immediately:
77
- it will give you a UET value if you don't provide any command line arguments
88
- it will show you the local and GMT human-readable time for any UET value you provide on the command line
99

1010
There is nothing awe-inspiring about this codelette, but there is a lot that can be learned from it.
1111
For example, in this tiny file, you'll find working examples of:
12-
- logging: sends data to a file called et.log. I like to use the command <code>tail -fn40 et.log</code> in a terminal and watch it happen.
13-
- command line arguments parsing. Type <code>./et.py --help</code> for more info.
12+
- logging: sends data to a file called uet.log. I like to use the command <code>tail -fn40 uet.log</code> in a terminal and watch it happen.
13+
- command line arguments parsing. Type <code>./uet.py --help</code> for more info.
1414
- use of the time module to get the current time
1515
- formatting time strings for human consumption
1616
- setting Python files up so they can be either imported or run as a standalone program
@@ -27,4 +27,4 @@ Maybe you'll find this useful in some way. If so, wonderful. If not, also wond
2727
And as always, "It may not be pretty, but it works!"
2828

2929
Enjoy it like this:<br>
30-
<code>greg@Valiant:~/pyCode$ ./et.py -d -uet 1606352880.8765097</code>
30+
<code>greg@Valiant:~/pyCode$ ./uet.py -d -uet 1606352880.8765097</code>

0 commit comments

Comments
 (0)