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 2018/05/25 17:39:58 UTC

[incubator-ponymail] branch master updated: Simplify by using init parameters

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 5d7cb20  Simplify by using init parameters
5d7cb20 is described below

commit 5d7cb20cba832c8694dc94d070f53a7b23a9c7ff
Author: Sebb <se...@apache.org>
AuthorDate: Fri May 25 18:39:57 2018 +0100

    Simplify by using init parameters
---
 tools/import-mbox.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 12d41b7..df85c89 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -107,7 +107,8 @@ rootURL = ""
 
 class BulkThread(Thread):
 
-    def assign(self, id, json, xes, dtype = 'mbox', wc = 'quorum'):
+    def __init__(self, id, json, xes, dtype = 'mbox', wc = 'quorum'):
+        Thread.__init__(self)
         self.id = id
         self.json = json
         self.xes = xes
@@ -121,6 +122,7 @@ class BulkThread(Thread):
         for entry in self.json:
             js = entry
             mid = js['mid']
+            print(mid)
             if self.dtype == 'mbox_source':
                 del js['mid']
             js_arr.append({
@@ -334,13 +336,11 @@ class SlurpThread(Thread):
                                     }
                                 )
                     if len(ja) >= 40:
-                        bulk = BulkThread()
-                        bulk.assign(self.name, ja, es, 'mbox')
+                        bulk = BulkThread(self.name, ja, es, 'mbox')
                         bulk.insert()
                         ja = []
                         
-                        bulks = BulkThread()
-                        bulks.assign(self.name, jas, es, 'mbox_source')
+                        bulks = BulkThread(self.name, jas, es, 'mbox_source')
                         bulks.insert()
                         jas = []
                 else:
@@ -360,14 +360,12 @@ class SlurpThread(Thread):
             y += count
             baddies += bad
             if len(ja) > 0:
-                bulk = BulkThread()
-                bulk.assign(self.name, ja, es, 'mbox')
+                bulk = BulkThread(self.name, ja, es, 'mbox')
                 bulk.insert()
             ja = []
             
             if len(jas) > 0:
-                bulks = BulkThread()
-                bulks.assign(self.name, jas, es, 'mbox_source')
+                bulks = BulkThread(self.name, jas, es, 'mbox_source')
                 bulks.insert()
             jas = []
         self.printid("Done, %u elements left to slurp" % len(lists))

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.