Page MenuHomec4science

__init__.py
No OneTemporary

File Metadata

Created
Wed, Nov 13, 03:59

__init__.py

""" __init__.py: This modules is designed to rewrite header files. It was
initially written for Akantu and LibMultiscale projects but could be reused
for any other projects."""
__author__ = "Guillaume Anciaux and Nicolas Richart"
__credits__ = [
"Guillaume Anciaux <guillaume.anciaux@epfl.ch>",
"Nicolas Richart <nicolas.richart@epfl.ch>",
]
__copyright__ = "Copyright (©) 2010-2021 EPFL (Ecole Polytechnique Fédérale" \
" de Lausanne) Laboratory (LSMS - Laboratoire de Simulation" \
" en Mécanique des Solides)"
__license__ = "GPLv3"
__version__ = "2.0"
def export(definition):
"""
Decorator to export definitions from sub-modules to the top-level package
:param definition: definition to be exported
:return: definition
"""
# Export the definition to the upper layer
globals()[definition.__name__] = definition
__all__.append(definition.__name__)
return definition
try:
from termcolor import colored as print_colored
except ImportError:
# noinspection PyUnusedLocal
def print_colored(string, *args, **kwargs):
return string
__all__ = ['export']
@export
def licenser_ask_question(question, possible_answer=None, default='y'):
if possible_answer is None:
possible_answer = {'y': True, 'n': False}
answers = '/'.join([k if not k == default else k.upper()
for k in possible_answer.keys()])
answer = None
while answer not in possible_answer.keys():
answer = input('{0} ({1})? '.format(question, answers))
answer = answer.lower()
if answer == '':
return possible_answer[default]
# if answer in possible_answer.keys():
return possible_answer[answer]
from . import licenser_db # NOQA(F401)
from . import version_info # NOQA(F401)
from . import file_info # NOQA(F401)
from . import author_db # NOQA(F401)
from . import copyright_db # NOQA(F401)
from . import file_transformer # NOQA(F401)

Event Timeline