# -*- coding: utf-8 -*-

# Author: mojiehua
# Email: mojh@ibbd.net
# Created Time: 2017-07-25 09:54:35

class Transform:
    """
    某个字段的值在列表中，则删除该行数据
    field: 字段名
    配置样例：
    transfrom:
      - type: filter
        name: in
        field: fieldname
        values:
          - dropvalue
          - dropvalue2
          - dorpvalue3
    """

    def __init__(self, config):
        self.field = config['field']
        self.values = list(map(str,config['values']))
        self.config = config

    def do(self, rows):
        data = []
        for row in rows:
            if str(row[self.field]) in self.values:
                continue
            else:
                data.append(row)
        return data

@@ -267,32 +267,39 @@
 ues:%0A          -
+ value:
  dropvalue%0A     
@@ -304,16 +304,23 @@
        -
+ value:
  dropval
@@ -334,16 +334,23 @@
        -
+ value:
  dorpval
@@ -457,21 +457,29 @@
 s = 
-list(map(str,
+(i%5B'value'%5D for i in 
 conf
@@ -491,17 +491,16 @@
 alues'%5D)
-)
 %0A       
@@ -608,12 +608,8 @@
  if 
-str(
 row%5B
@@ -619,17 +619,20 @@
 f.field%5D
-)
+ not
  in self
@@ -644,51 +644,8 @@
 es:%0A
-                continue%0A            else:%0A
     
@@ -673,16 +673,17 @@
 nd(row)%0A
+%0A
         

fix eq empty