Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isvaliduri optimization #1779

Merged
merged 3 commits into from Mar 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions rdflib/namespace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,15 @@ def normalizeUri(self, rdfTerm: str) -> str:

def compute_qname(self, uri: str, generate: bool = True) -> Tuple[str, URIRef, str]:

if not _is_valid_uri(uri):
raise ValueError(
'"{}" does not look like a valid URI, cannot serialize this. Did you want to urlencode it?'.format(
uri
if uri not in self.__cache:

if not _is_valid_uri(uri):
raise ValueError(
'"{}" does not look like a valid URI, cannot serialize this. Did you want to urlencode it?'.format(
uri
)
)
)

if uri not in self.__cache:
try:
namespace, name = split_uri(uri)
except ValueError as e:
Expand Down