Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F70909368
copyright_db.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
Mon, Jul 8, 05:24
Size
1 KB
Mime Type
text/x-python
Expires
Wed, Jul 10, 05:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18883154
Attached To
R11434 py-licenser
copyright_db.py
View Options
""" copyright_db.py: Description of the copyrights"""
__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"
from
.
import
export
from
datetime
import
datetime
as
dt
@export
class
CopyrightDB
:
def
__init__
(
self
,
db
):
self
.
__db
=
db
self
.
_copyrights
=
self
.
__db
.
copyrights
def
find_by_id
(
self
,
lid
):
find
=
[
copy
for
copy
in
self
.
_copyrights
if
copy
.
lid
==
lid
]
if
find
:
return
find
[
0
]
else
:
return
None
def
find_by_date
(
self
,
date
):
if
type
(
date
)
==
str
:
date
=
dt
.
strptime
(
date
,
"
%d
-%m-%Y"
)
elif
type
(
date
)
==
float
:
date
=
dt
.
fromtimestamp
(
date
)
find
=
[
copy
for
copy
in
self
.
_copyrights
if
copy
.
start
<
date
<=
copy
.
end
]
if
find
:
return
find
[
0
]
else
:
return
None
Event Timeline
Log In to Comment