From 335c121e5554fd9206f4219ea4c51947cf62c243 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Thu, 14 Dec 2017 14:35:20 +0100 Subject: [PATCH] Suppress warning for not using custom encoding. Suppress the warning "NQuadsSerializer/NTSerializer does not use custom encoding." in the case that the `encoding` argument (custom encoding) is set to the same value as the default encoding (`self.encoding`). --- rdflib/plugins/serializers/nquads.py | 2 +- rdflib/plugins/serializers/nt.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rdflib/plugins/serializers/nquads.py b/rdflib/plugins/serializers/nquads.py index f2ed78600..3785452bc 100644 --- a/rdflib/plugins/serializers/nquads.py +++ b/rdflib/plugins/serializers/nquads.py @@ -22,7 +22,7 @@ def __init__(self, store): def serialize(self, stream, base=None, encoding=None, **args): if base is not None: warnings.warn("NQuadsSerializer does not support base.") - if encoding is not None: + if encoding is not None and encoding.lower() != self.encoding.lower(): warnings.warn("NQuadsSerializer does not use custom encoding.") encoding = self.encoding for context in self.store.contexts(): diff --git a/rdflib/plugins/serializers/nt.py b/rdflib/plugins/serializers/nt.py index a85545f3b..77ea5e8c8 100644 --- a/rdflib/plugins/serializers/nt.py +++ b/rdflib/plugins/serializers/nt.py @@ -25,7 +25,7 @@ def __init__(self, store): def serialize(self, stream, base=None, encoding=None, **args): if base is not None: warnings.warn("NTSerializer does not support base.") - if encoding is not None: + if encoding is not None and encoding.lower() != self.encoding.lower(): warnings.warn("NTSerializer does not use custom encoding.") encoding = self.encoding for triple in self.store: