Lines Matching refs:args

160 def transform(t, args):  argument
161 if args.transform:
162 rules = json.loads(str(args.transform).replace("'", "\"").replace("\\", "\\\\"))
170 for excl_item in args.exclude:
176 def gendata(f, args): argument
185 if args.run_date:
186 env['run_date'] = args.run_date
187 if args.run_id:
188 env['run_id'] = args.run_id
189 if args.run_attempt:
190 env['run_attempt'] = args.run_attempt
191 if args.run_branch:
192 env['run_branch'] = args.run_branch
193 if args.run_workflow:
194 env['run_workflow'] = args.run_workflow
202 if args.flatten and args.flatten in t and isinstance(t[args.flatten], dict):
203 flat = t.pop(args.flatten)
205 if args.flatten_list_names:
206 … flat_list_dict = json.loads(str(args.flatten_list_names).replace("'", "\"").replace("\\", "\\\\"))
209 … flat = flatten('', flat, args.transpose_separator, flat_list_dict, str(args.escape_separator))
211 flat = unflatten(flat, args.transpose_separator)
213 as_name = args.flatten_dict_name
217 … v[as_name] = k + args.transpose_separator + v[as_name] if as_name in v else k
218 v[as_name + '_depth'] = v[as_name].count(args.transpose_separator)
220 t[args.flatten] = flat_list
222 t[args.flatten] = flat
226 if args.flatten and args.flatten in t and isinstance(t[args.flatten], list):
227 flat = t.pop(args.flatten)
231 … t_clone.update({ args.flatten + args.flatten_separator + k : v for k,v in flat_item.items() })
233 …t_clone.update({ args.flatten + args.flatten_separator + str(idx) : v for idx,v in enumerate(flat_…
235 "_index": args.index,
236 "_source": transform(t_clone, args)
242 "_index": args.index,
243 "_source": transform(t, args)
248 args = parse_args()
258 if args.map_file:
259 with open(args.map_file, "rt") as json_map:
270 if args.dry_run:
272 for f in args.files:
273 xx = gendata(f, args)
284 if args.create_index:
285 es.indices.create(index=args.index, mappings=mappings, settings=settings)
287 if args.run_date:
290 for f in args.files:
293 bulk(es, gendata(f, args), request_timeout=args.bulk_timeout)
365 args = parser.parse_args()
367 return args