Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-indexer
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
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
Platform
Development
swh-indexer
Commits
f69131fb
Commit
f69131fb
authored
2 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
cff: Do not change yaml.SafeLoader globally
It may have unexpected side-effects
parent
3adc5a40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!312
cff: Do not change yaml.SafeLoader globally
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/indexer/metadata_dictionary/cff.py
+7
-5
7 additions, 5 deletions
swh/indexer/metadata_dictionary/cff.py
with
7 additions
and
5 deletions
swh/indexer/metadata_dictionary/cff.py
+
7
−
5
View file @
f69131fb
...
...
@@ -6,10 +6,12 @@ from swh.indexer.codemeta import CODEMETA_CONTEXT_URL, CROSSWALK_TABLE, SCHEMA_U
from
.base
import
DictMapping
,
SingleFileMapping
yaml
.
SafeLoader
.
yaml_implicit_resolvers
=
{
k
:
[
r
for
r
in
v
if
r
[
0
]
!=
"
tag:yaml.org,2002:timestamp
"
]
for
k
,
v
in
yaml
.
SafeLoader
.
yaml_implicit_resolvers
.
items
()
}
class
SafeLoader
(
yaml
.
SafeLoader
):
yaml_implicit_resolvers
=
{
k
:
[
r
for
r
in
v
if
r
[
0
]
!=
"
tag:yaml.org,2002:timestamp
"
]
for
k
,
v
in
yaml
.
SafeLoader
.
yaml_implicit_resolvers
.
items
()
}
class
CffMapping
(
DictMapping
,
SingleFileMapping
):
...
...
@@ -22,7 +24,7 @@ class CffMapping(DictMapping, SingleFileMapping):
def
translate
(
self
,
raw_content
:
bytes
)
->
Dict
[
str
,
str
]:
raw_content_string
:
str
=
raw_content
.
decode
()
content_dict
=
yaml
.
load
(
raw_content_string
,
Loader
=
yaml
.
SafeLoader
)
content_dict
=
yaml
.
load
(
raw_content_string
,
Loader
=
SafeLoader
)
metadata
=
self
.
_translate_dict
(
content_dict
)
metadata
[
"
@context
"
]
=
CODEMETA_CONTEXT_URL
...
...
This diff is collapsed.
Click to expand it.
Phabricator Migration user
@phabricator-migration
mentioned in merge request
!313 (closed)
·
2 years ago
mentioned in merge request
!313 (closed)
mentioned in merge request !313
Toggle commit list
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