def _fix_dot_imports(not_consumed):
 names = {}
 for (name, stmts) in six.iteritems(not_consumed):
  if any(((isinstance(stmt, astroid.AssName) and isinstance(stmt.ass_type(), astroid.AugAssign)) for stmt in stmts)):
   continue
  for stmt in stmts:
   if (not isinstance(stmt, (astroid.From, astroid.Import))):
    continue
   for imports in stmt.names:
    second_name = None
    if (imports[0] == '*'):
     second_name = name
    elif ((imports[0].find('.') > (-1)) or (name in imports)):
     second_name = imports[0]
    if (second_name and (second_name not in names)):
     names[second_name] = stmt
 return sorted(names.items(), key=(lambda a: a[1].fromlineno))

def _fix_dot_imports ( not_consumed ) : names = { } for ( name , stmts ) in six . iteritems ( not_consumed ) : if any ( ( ( isinstance ( stmt , astroid . AssName ) and isinstance ( stmt . ass_type ( ) , astroid . AugAssign ) ) for stmt in stmts ) ) : continue for stmt in stmts : if ( not isinstance ( stmt , ( astroid . From , astroid . Import ) ) ) : continue for imports in stmt . names : second_name = None if ( imports [ 0 ] == '*' ) : second_name = name elif ( ( imports [ 0 ] . find ( '.' ) > ( - 1 ) ) or ( name in imports ) ) : second_name = imports [ 0 ] if ( second_name and ( second_name not in names ) ) : names [ second_name ] = stmt return sorted ( names . items ( ) , key = ( lambda a : a [ 1 ] . fromlineno ) )
try to fix imports with multiple dots .