You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2020/08/17 10:10:32 UTC
[incubator-ponymail] branch master updated: Prefer plain imports
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git
The following commit(s) were added to refs/heads/master by this push:
new a8546b0 Prefer plain imports
a8546b0 is described below
commit a8546b00d6ec17d9a11330bb491d131aebbe7fc6
Author: Sebb <se...@apache.org>
AuthorDate: Mon Aug 17 11:10:13 2020 +0100
Prefer plain imports
---
tools/archiver.py | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/tools/archiver.py b/tools/archiver.py
index d47f3f7..f59389e 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -57,15 +57,14 @@ import uuid
import certifi
import chardet
-from elasticsearch import Elasticsearch
-from elasticsearch import VERSION as ES_VERSION
-from formatflowed import convertToWrapped
+import elasticsearch
+import formatflowed
import netaddr
from ponymailconfig import PonymailConfig
import generators
-ES_MAJOR = ES_VERSION[0]
+ES_MAJOR = elasticsearch.VERSION[0]
# Fetch config
config = PonymailConfig()
@@ -186,7 +185,7 @@ class Archiver(object): # N.B. Also used by import-mbox.py
elif ES_MAJOR in [5,6,7]:
self.wait_for_active_shards = config.get('elasticsearch', 'wait', fallback=1)
else:
- raise Exception("Unexpected elasticsearch version ", ES_VERSION)
+ raise Exception("Unexpected elasticsearch version ", elasticsearch.VERSION)
self.cropout = config.get("debug", "cropout", fallback=None)
uri = config.get("elasticsearch", "uri", fallback="")
dbs = [
@@ -214,14 +213,14 @@ class Archiver(object): # N.B. Also used by import-mbox.py
# If we have a dump dir, we can risk failing the connection.
if dump_dir:
try:
- self.es = Elasticsearch(dbs,
+ self.es = elasticsearch.Elasticsearch(dbs,
max_retries=5,
retry_on_timeout=True
)
except:
print("ES connection failed, but dumponfail specified, dumping to %s" % dump_dir)
else:
- self.es = Elasticsearch(dbs,
+ self.es = elasticsearch.Elasticsearch(dbs,
max_retries=5,
retry_on_timeout=True
)
@@ -329,7 +328,7 @@ class Archiver(object): # N.B. Also used by import-mbox.py
body = self.msgbody(msg, verbose=args.verbose, ignore_body=args.ibody)
try:
if 'content-type' in msg_metadata and msg_metadata['content-type'].find("flowed") != -1:
- body = convertToWrapped(body, character_set="utf-8")
+ body = formatflowed.convertToWrapped(body, character_set="utf-8")
if isinstance(body, str):
body = body.encode('utf-8')
except Exception: