Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gepetto Utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
Gepetto Utils
Commits
7237a9f8
Commit
7237a9f8
authored
9 years ago
by
Guilhem Saurel
Browse files
Options
Downloads
Patches
Plain Diff
check invalid entries
parent
a8e3388e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db.py
+15
-4
15 additions, 4 deletions
db.py
with
15 additions
and
4 deletions
db.py
+
15
−
4
View file @
7237a9f8
#!/usr/bin/env python3
#!/usr/bin/env python3
from
concurrent.futures
import
ThreadPoolExecutor
import
re
import
re
from
pathlib
import
Path
from
pathlib
import
Path
from
bibtexparser
import
load
,
loads
from
bibtexparser
import
load
,
loads
from
bibtexparser.bibdatabase
import
BibDatabase
from
bibtexparser.bibdatabase
import
BibDatabase
from
requests
import
get
from
requests
import
get
from
requests_futures.sessions
import
FuturesSession
HAL_RE
=
[
HAL_RE
=
[
...
@@ -14,9 +16,11 @@ HAL_RE = [
...
@@ -14,9 +16,11 @@ HAL_RE = [
(
re
.
compile
(
r
'
/\d\d/\d\d/\d\d/\d\d/
'
),
(
re
.
compile
(
r
'
/\d\d/\d\d/\d\d/\d\d/
'
),
lambda
g
:
'
hal-%08i
'
%
int
(
g
.
replace
(
'
/
'
,
''
))),
lambda
g
:
'
hal-%08i
'
%
int
(
g
.
replace
(
'
/
'
,
''
))),
]
]
HAL_URL
=
'
https://hal.archives-ouvertes.fr/%s/bibtex
'
HAL_KEYS
=
[
'
url
'
,
'
link
'
,
'
pdf
'
,
'
video
'
]
HAL_KEYS
=
[
'
url
'
,
'
link
'
,
'
pdf
'
,
'
video
'
]
HAL_DICT
=
{}
HAL_DICT
=
{}
USELESS_KEYS
=
{
'
hal_local_reference
'
,
'
hal_version
'
,
'
address
'
,
'
note
'
,
'
month
'
}
USELESS_KEYS
=
{
'
hal_local_reference
'
,
'
hal_version
'
,
'
address
'
,
'
note
'
,
'
month
'
}
GEPETTO_URL
=
'
http://projects.laas.fr/gepetto/index.php/Publications/BibtexEntry?bibtex=%s
'
TEAM_NAMES
=
{
TEAM_NAMES
=
{
'
ad
'
:
[
'
del prete
'
],
'
ad
'
:
[
'
del prete
'
],
...
@@ -54,7 +58,7 @@ def get_hal_entry(hal_id, hal_db):
...
@@ -54,7 +58,7 @@ def get_hal_entry(hal_id, hal_db):
for
key
in
hal_db
.
entries_dict
.
keys
():
for
key
in
hal_db
.
entries_dict
.
keys
():
if
key
.
endswith
(
hal_id
):
if
key
.
endswith
(
hal_id
):
return
hal_db
.
entries_dict
[
key
]
return
hal_db
.
entries_dict
[
key
]
url
=
'
https://hal.archives-ouvertes.fr/%s/bibtex
'
%
hal_id
url
=
HAL_URL
%
hal_id
r
=
get
(
url
)
r
=
get
(
url
)
r
.
raise_for_status
()
r
.
raise_for_status
()
if
'
Aucun document trouvé
'
in
r
.
content
.
decode
():
if
'
Aucun document trouvé
'
in
r
.
content
.
decode
():
...
@@ -107,6 +111,13 @@ if __name__ == '__main__':
...
@@ -107,6 +111,13 @@ if __name__ == '__main__':
for
initials
,
names
in
TEAM_NAMES
.
items
():
for
initials
,
names
in
TEAM_NAMES
.
items
():
if
not_in_dbs
[
initials
]:
if
not_in_dbs
[
initials
]:
header
(
names
[
0
])
header
(
names
[
0
])
with
open
(
'
diffs/%s.txt
'
%
initials
,
'
w
'
)
as
f
:
for
url
,
title
in
not_in_dbs
[
initials
]:
for
url
,
title
in
not_in_dbs
[
initials
]:
print
(
'
IN HAL
'
,
url
,
title
)
print
(
url
,
title
,
file
=
f
)
urls
=
[
GEPETTO_URL
%
entry
[
'
ID
'
]
for
key
in
dbs
.
keys
()
for
entry
in
dbs
[
key
].
entries
]
session
=
FuturesSession
(
executor
=
ThreadPoolExecutor
(
max_workers
=
10
))
futures
=
[
session
.
get
(
u
)
for
u
in
urls
]
toto
=
None
for
future
in
futures
:
response
=
future
.
result
()
if
b
'
Invalid bibtex entry
'
in
response
.
content
:
print
(
'
INVALID
'
,
response
.
url
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment