gmi_pylib

gmi_pylib is a package of 5 Python modules, or code libraries, to perform standard functions.

Information and software on this web site are provided under the Granite Mountain Informatics LLC End User License Agreement (EULA).

Send questions or comments to GraniteMountainInformaticsLLC@gmail.com.

A full list of the files in the gmi_pylib package are:

The modules are imported into a Python program by specifing the local file path "FILEPATH" and then importing the individual modules in the package:


sys.path.insert(0, FILEPATH))

import gmi_datetime

import gmi_debug

import gmi_file

import gmi_string

import gmi_tdapi

The files in the package are similar in structure.  The files related to the "gmi_datetime.py" module are shown as an example.

gmi_datetime-t.py

Is a Python program to test the functions in the gmi_datetime.py module.


"""


NAME


gmi_datetime-t.py


VERSION


202302150923


SYNOPSIS


python3 gmi_datetime-t.py


DESCRIPTION


Implements tests of the functions in gmi_datetime.py.


REFERENCE


"""


# ######################################################################

# IMPORT CORE MODULES

# ######################################################################


import sys


# ######################################################################

# IMPORT CUSTOM MODULES

# ######################################################################


import gmi_datetime


# ######################################################################

# DECLARE CONSTANTS

# ######################################################################


# ######################################################################

# DECLARE GLOBAL VARIABLES

# ######################################################################


# ######################################################################

# DECLARE FUNCTIONS

# ######################################################################


# ######################################################################

# MAIN

# ######################################################################


print(' '.join(sys.argv))


yyyymmddhhmmss = gmi_datetime.yyyymmddhhmmss()

print(f"yyyymmddhhmmss='{yyyymmddhhmmss}'")

gmi_datetime-t.sh

Is a shell script to call gmi_datetime-t.py to test the functions in the gmi_datetime.py module.


clear

python3 gmi_datetime-t.py

gmi_datetime.py

Is the Python module that contains the standard functions.  The module is self documented using PyPOD simple markup language used for embedding documentation in Python scripts.  This is a very simple module that only contains one function "yyyymmddhhmmss()".


"""

=pod

=head1 NAME

gmi_datetime.py

=head1 VERSION

202302151416

=head1 SYNOPSIS

import gmi_datetime

=head1 DESCRIPTION

This module implements standard date and time functions.

=cut

"""


# ######################################################################

# IMPORT CORE MODULES

# ######################################################################


import datetime


# ######################################################################

# DECLARE GLOBAL VARIABLES

# ######################################################################


# ######################################################################

# DECLARE FUNCTIONS

# ######################################################################


"""

=pod

=head1 FUNCTIONS

=cut

"""


"""

=pod

=head2 yyyymmddhhmmss()

Returns the current date and time as the string yyyymmddhhmmss.

=cut

"""


def yyyymmddhhmmss():

return datetime.datetime.now().strftime("%Y%m%d%H%M%S")


"""

=pod

=head1 REFERENCE

=head1 REQUIRES

=head1 INSTALLATION

=head1 SEE ALSO

=head1 AUTHOR

Granite Mountain Informatics LLC

=head1 COPYRIGHT

Copyright 2023 Granite Mountain Informatics LLC

All Rights Reserved

=head1 PROPRIETARY SOFTWARE LICENSE

=head1 CHANGE HISTORY

=head1 TO DO

=cut

"""

gmi_datetime.py.html

Is the HTML documentation of the gmi_datetime.py module generate using PyPOD.