Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63049925
__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
Fri, May 17, 10:52
Size
1 KB
Mime Type
text/x-python
Expires
Sun, May 19, 10:52 (2 d)
Engine
blob
Format
Raw Data
Handle
17725828
Attached To
R11434 py-licenser
__init__.py
View Options
"""
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.
"""
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
]
# raise(Exception("\'{0}\' is not a valid answer to the question!".format(answer)))
from
.
import
licenser_db
from
.
import
version_info
from
.
import
file_info
from
.
import
author_db
from
.
import
copyright_db
from
.
import
file_transformer
Event Timeline
Log In to Comment