# -*- coding: utf-8 -*-
"""
Core
====
Provides a collection of functions that are core to **e13Tools** and are
imported automatically.
"""
# %% IMPORTS
# Built-in imports
from pkg_resources import parse_version
# All declaration
__all__ = ['InputError', 'ShapeError', 'compare_versions']
# %% CLASSES
# Define Error class for wrong inputs
# Define Error class for wrong shapes
[docs]class ShapeError(Exception):
"""
Inappropriate argument shape (of correct type).
"""
pass
# %% FUNCTIONS
# Function that compares two versions with each other
[docs]def compare_versions(a, b):
"""
Compares provided versions `a` and `b` with each other, and returns *True*
if version `a` is later than or equal to version `b`.
"""
if a:
return(parse_version(a) >= parse_version(b))
else:
return(False)