@flake8ext
def use_jsonutils(logical_line, filename):
 msg = 'N321: jsonutils.%(fun)s must be used instead of json.%(fun)s'
 json_check_skipped_patterns = ['neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/etc/xapi.d/plugins/netwrap']
 for pattern in json_check_skipped_patterns:
  if (pattern in filename):
   return
 if ('json.' in logical_line):
  json_funcs = ['dumps(', 'dump(', 'loads(', 'load(']
  for f in json_funcs:
   pos = logical_line.find(('json.%s' % f))
   if (pos != (-1)):
    (yield (pos, (msg % {'fun': f[:(-1)]})))

@ flake8ext def use_jsonutils ( logical_line , filename ) : msg = 'N321: jsonutils.%(fun)s must be used instead of json.%(fun)s' json_check_skipped_patterns = [ 'neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/etc/xapi.d/plugins/netwrap' ] for pattern in json_check_skipped_patterns : if ( pattern in filename ) : return if ( 'json.' in logical_line ) : json_funcs = [ 'dumps(' , 'dump(' , 'loads(' , 'load(' ] for f in json_funcs : pos = logical_line . find ( ( 'json.%s' % f ) ) if ( pos != ( - 1 ) ) : ( yield ( pos , ( msg % { 'fun' : f [ : ( - 1 ) ] } ) ) )
n321 - use jsonutils instead of json .