From bc97d63cb777209106b7ef028c690043168cefc8 Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Fri, 10 Nov 2023 20:08:28 +0100 Subject: [PATCH] pyupgrade --- src/collective/__init__.py | 1 - src/collective/elastic/ingest/analysis/analysis.py | 9 ++++----- src/collective/elastic/ingest/logging.py | 4 ---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/collective/__init__.py b/src/collective/__init__.py index 5284146..e69de29 100644 --- a/src/collective/__init__.py +++ b/src/collective/__init__.py @@ -1 +0,0 @@ -__import__("pkg_resources").declare_namespace(__name__) diff --git a/src/collective/elastic/ingest/analysis/analysis.py b/src/collective/elastic/ingest/analysis/analysis.py index d4f058f..e750015 100644 --- a/src/collective/elastic/ingest/analysis/analysis.py +++ b/src/collective/elastic/ingest/analysis/analysis.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from ..elastic import get_ingest_client from ..logging import logger from collective.elastic.ingest import ELASTICSEARCH_7 @@ -9,20 +8,20 @@ import os -_analysis_file = os.environ.get( - "ANALYSIS_FILE", None) -) +_analysis_file = os.environ.get("ANALYSIS_FILE", None) + ANALYSISMAP = None if _analysis_file: try: - with open(_analysis_file, mode="r") as fp: + with open(_analysis_file) as fp: ANALYSISMAP = json.load(fp) except FileNotFoundError: logger.warning(f"Analysis file '{_analysis_file}' not found.") else: logger.info("No analysis file configured.") + def update_analysis(index_name): """Provide elasticsearch with analyzers to be used in mapping. diff --git a/src/collective/elastic/ingest/logging.py b/src/collective/elastic/ingest/logging.py index c0e2e31..4ce52b0 100644 --- a/src/collective/elastic/ingest/logging.py +++ b/src/collective/elastic/ingest/logging.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import - - try: import collective.elastic.plone # noqa: W291 import logging