Skip to content

Commit 3aa4ddf

Browse files
committed
fix: Return a value of a dict
1 parent f723c76 commit 3aa4ddf

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

ckanext/dcatapchharvest/dcat_helpers.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,24 +247,17 @@ def get_license_ref_uri_by_name(self, vocabulary_name):
247247

248248
def get_license_ref_uri_by_homepage_uri(self, vocabulary_name):
249249
_, _, license_homepage_ref_vocabulary = self._get_license_values()
250-
return next((value for key, value in
251-
license_homepage_ref_vocabulary.items()
252-
if unicode(vocabulary_name) == key),
253-
None)
250+
return license_homepage_ref_vocabulary.get(unicode(vocabulary_name))
254251

255252
def get_license_name_by_ref_uri(self, vocabulary_uri):
256253
_, license_ref_literal_vocabulary, _ = self._get_license_values()
257-
return next((value for key, value in
258-
license_ref_literal_vocabulary.items()
259-
if unicode(vocabulary_uri) == key),
260-
None)
254+
return license_ref_literal_vocabulary.get(
255+
unicode(vocabulary_uri))
261256

262257
def get_license_name_by_homepage_uri(self, vocabulary_uri):
263258
license_homepages_literal_vocabulary, _, _ = self._get_license_values()
264-
return next((value for key, value in
265-
license_homepages_literal_vocabulary.items()
266-
if unicode(vocabulary_uri) == key),
267-
None)
259+
return license_homepages_literal_vocabulary.get(
260+
unicode(vocabulary_uri))
268261

269262
def get_license_homepage_uri_by_name(self, vocabulary_name):
270263
license_homepages_literal_vocabulary, _, _ = self._get_license_values()

0 commit comments

Comments
 (0)