Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
b730fa61
Commit
b730fa61
authored
May 13, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' into prod-dev
parents
1f2e364c
409250fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
FileParser.py
parsing/FileParsers/FileParser.py
+5
-2
No files found.
parsing/FileParsers/FileParser.py
View file @
b730fa61
...
@@ -36,13 +36,13 @@ class FileParser:
...
@@ -36,13 +36,13 @@ class FileParser:
# First, check the split dates...
# First, check the split dates...
date_to_parse
=
hyperdata
.
get
(
'publication_date_to_parse'
,
None
)
date_to_parse
=
hyperdata
.
get
(
'publication_date_to_parse'
,
None
)
if
date_to_parse
is
not
None
:
if
date_to_parse
is
not
None
:
date_string
=
re
.
sub
(
'
\
/+'
,
''
,
date_to_parse
)
date_string
=
re
.
sub
(
r'\/
\/+'
,
''
,
date_to_parse
)
hyperdata
[
'publication'
+
"_date"
]
=
dateutil
.
parser
.
parse
(
hyperdata
[
'publication'
+
"_date"
]
=
dateutil
.
parser
.
parse
(
date_string
,
date_string
,
default
=
DEFAULT_DATE
default
=
DEFAULT_DATE
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
el
s
e
:
el
if
hyperdata
.
get
(
'publication_year'
,
None
)
is
not
Non
e
:
prefixes
=
[
key
[:
-
5
]
for
key
in
hyperdata
.
keys
()
if
key
[
-
5
:]
==
"_year"
]
prefixes
=
[
key
[:
-
5
]
for
key
in
hyperdata
.
keys
()
if
key
[
-
5
:]
==
"_year"
]
for
prefix
in
prefixes
:
for
prefix
in
prefixes
:
date_string
=
hyperdata
[
prefix
+
"_year"
]
date_string
=
hyperdata
[
prefix
+
"_year"
]
...
@@ -65,6 +65,8 @@ class FileParser:
...
@@ -65,6 +65,8 @@ class FileParser:
hyperdata
[
prefix
+
"_date"
]
=
dateutil
.
parser
.
parse
(
date_string
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
hyperdata
[
prefix
+
"_date"
]
=
dateutil
.
parser
.
parse
(
date_string
)
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
except
:
except
:
pass
pass
else
:
hyperdata
[
'publication_date'
]
=
datetime
.
datetime
.
now
()
# ...then parse all the "date" fields, to parse it into separate elements
# ...then parse all the "date" fields, to parse it into separate elements
prefixes
=
[
key
[:
-
5
]
for
key
in
hyperdata
.
keys
()
if
key
[
-
5
:]
==
"_date"
]
prefixes
=
[
key
[:
-
5
]
for
key
in
hyperdata
.
keys
()
if
key
[
-
5
:]
==
"_date"
]
...
@@ -81,6 +83,7 @@ class FileParser:
...
@@ -81,6 +83,7 @@ class FileParser:
# finally, return the transformed result!
# finally, return the transformed result!
return
hyperdata
return
hyperdata
print
(
hyperdata
[
'publication_date'
])
def
format_hyperdata_languages
(
self
,
hyperdata
):
def
format_hyperdata_languages
(
self
,
hyperdata
):
"""format the languages found in the hyperdata."""
"""format the languages found in the hyperdata."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment