This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/addVersions' into develop
- Loading branch information
Showing
16 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_ | ||
""" | ||
__version__ = "0.1" | ||
import datetime | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_ | ||
""" | ||
__version__ = "0.1" | ||
import math | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
""" Debug helpers | ||
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_ | ||
""" | ||
__version__ = "0.1" | ||
import os | ||
import argparse | ||
import sys | ||
|
||
|
||
def get_imported_modules_versions(modules, glob): | ||
"""Return a string containing imported modules versions. | ||
(It isn't intended to be exhautive) | ||
Args: | ||
modules: sys.modules | ||
glob: globals() | ||
Returns: | ||
.string | ||
""" | ||
# Retrieve ColorPipe-tools modules | ||
path = os.path.dirname(os.path.dirname(__file__)) | ||
res = "ColorPipe-tools modules:\n------------------------------" | ||
for name in modules: | ||
if (path in str(modules[name]) | ||
and "debug_helper" not in str(modules[name])): | ||
try: | ||
res = "{0}\n{1} - version {2}".format(res, name, | ||
modules[name].__version__) | ||
except AttributeError: | ||
pass | ||
# Retrieve "interesting" external modules | ||
module_selection = set(modules) & set(glob) | ||
res = "{0}\n\nExternal modules:\n------------------------------".format(res) | ||
for name in module_selection: | ||
if "built-in" not in name and path not in str(modules[name]): | ||
try: | ||
res = "{0}\n{1} - version {2}".format(res, name, | ||
modules[name].__version__) | ||
except AttributeError: | ||
pass | ||
return res | ||
|
||
|
||
def make_full_version_action(version_text): | ||
"""Return a multi-lines version action for argparse | ||
Args: | ||
version_text (str): version text to print | ||
Returns: | ||
.argparse.Action | ||
""" | ||
class FullVersionAction(argparse.Action): | ||
def __init__(self, option_strings, dest=None, nargs=0, default=None, | ||
required=False, type=None, metavar=None, | ||
help=("show version number of the program and its " | ||
"dependencies. And then exit")): | ||
super(FullVersionAction, self).__init__( | ||
option_strings=option_strings, | ||
dest=dest, nargs=nargs, default=default, required=required, | ||
metavar=metavar, type=type, help=help) | ||
|
||
def __call__(self, parser, namespace, values, option_string=None): | ||
print(version_text) | ||
sys.exit() | ||
return FullVersionAction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_ | ||
""" | ||
__version__ = "0.1" | ||
import os | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_ | ||
""" | ||
__version__ = "0.1" | ||
import math | ||
|
||
|
||
|