From 00ef710752ddcf4f5f14a62b747230fa8eb360af Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 20 Nov 2024 14:58:06 +0100 Subject: [PATCH] resolve pylint issues --- geolink_formatter/entity.py | 1 + geolink_formatter/format.py | 1 + geolink_formatter/parser.py | 7 ++++--- geolink_formatter/utils.py | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/geolink_formatter/entity.py b/geolink_formatter/entity.py index 02722b63..c222df0d 100644 --- a/geolink_formatter/entity.py +++ b/geolink_formatter/entity.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +""" Provides the Msg, Document and File classes. """ import datetime diff --git a/geolink_formatter/format.py b/geolink_formatter/format.py index c1eb8d79..c2f1cf82 100644 --- a/geolink_formatter/format.py +++ b/geolink_formatter/format.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +""" Provides class HTML for rendering the xml document from the geolink api as html. """ from datetime import date diff --git a/geolink_formatter/parser.py b/geolink_formatter/parser.py index ee9ed4ea..3af94d59 100644 --- a/geolink_formatter/parser.py +++ b/geolink_formatter/parser.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- +""" Provides classes for parsing the xml document from the geolink api. """ +from importlib import resources as impresources import datetime import requests -import importlib from lxml.etree import DTD, DocumentInvalid, fromstring from xmlschema import XMLSchema11 from geolink_formatter.entity import Document, File @@ -61,7 +62,7 @@ def __init__(self, host_url=None, version='1.2.5', dtd_validation=False, xsd_val self._version = version self._dtd_validation = dtd_validation self._xsd_validation = xsd_validation - xsd = importlib.resources.files('geolink_formatter') / 'schema' / f'v{version}.xsd' + xsd = impresources.files('geolink_formatter') / 'schema' / f'v{version}.xsd' if self._xsd_validation: with xsd.open(mode='r', encoding='utf-8') as xsd_f: self._schema = XMLSchema11(xsd_f.read()) @@ -121,7 +122,7 @@ def _process_single_document(self, document_el, language_link): files = [] for file_el in document_el.iter('file'): href = file_el.attrib.get('href') - if self.host_url and not href.startswith(u'http://') and not href.startswith('https://'): + if self.host_url and not href.startswith('http://') and not href.startswith('https://'): href = f'{self.host_url}{href}' files.append(File( title=file_el.attrib.get('title'), diff --git a/geolink_formatter/utils.py b/geolink_formatter/utils.py index 8f740ca4..1d7bc083 100644 --- a/geolink_formatter/utils.py +++ b/geolink_formatter/utils.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +""" Provides additional methods usable for parsing the xml document from the geolink api. """ + def filter_duplicated_documents(documents): """ @@ -10,7 +12,7 @@ def filter_duplicated_documents(documents): Returns: list[geolink_formatter.entity.Document]: filtered list of documents """ - documents_filtered = list() + documents_filtered = [] for document in documents: if ( [document.id, document.language_link]