Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91656661
__init__.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 13, 03:59
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Nov 15, 03:59 (2 d)
Engine
blob
Format
Raw Data
Handle
22302018
Attached To
R11434 py-licenser
__init__.py
View Options
""" __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
Log In to Comment