Skip to content

Commit bef28e0

Browse files
committed
use re in has_conformance
1 parent 7107497 commit bef28e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

openeo/rest/capabilities.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import Dict, List, Optional, Union
2-
from fnmatch import fnmatch
2+
import re
33

44
from openeo.internal.jupyter import render_component
55
from openeo.rest.models import federation_extension
@@ -38,10 +38,11 @@ def api_version_check(self) -> ComparableVersion:
3838
raise ApiVersionException("No API version found")
3939
return ComparableVersion(api_version)
4040

41-
def has_conformance(self, conformance: str) -> bool:
41+
def has_conformance(self, uri: str) -> bool:
4242
"""Check if backend provides a given conformance string"""
43-
for url in self.capabilities.get("conformsTo", []):
44-
if fnmatch(url, conformance):
43+
uri = re.escape(uri).replace('\\*', '[^/]+')
44+
for conformance_uri in self.capabilities.get("conformsTo", []):
45+
if re.match(conformance_uri, uri):
4546
return True
4647
return False
4748

0 commit comments

Comments
 (0)