def find_locustfile(locustfile):
 names = [locustfile]
 if (not names[0].endswith('.py')):
  names += [(names[0] + '.py')]
 if os.path.dirname(names[0]):
  for name in names:
   expanded = os.path.expanduser(name)
   if os.path.exists(expanded):
    if (name.endswith('.py') or _is_package(expanded)):
     return os.path.abspath(expanded)
 else:
  path = '.'
  while os.path.split(os.path.abspath(path))[1]:
   for name in names:
    joined = os.path.join(path, name)
    if os.path.exists(joined):
     if (name.endswith('.py') or _is_package(joined)):
      return os.path.abspath(joined)
   path = os.path.join('..', path)

def find_locustfile ( locustfile ) : names = [ locustfile ] if ( not names [ 0 ] . endswith ( '.py' ) ) : names += [ ( names [ 0 ] + '.py' ) ] if os . path . dirname ( names [ 0 ] ) : for name in names : expanded = os . path . expanduser ( name ) if os . path . exists ( expanded ) : if ( name . endswith ( '.py' ) or _is_package ( expanded ) ) : return os . path . abspath ( expanded ) else : path = '.' while os . path . split ( os . path . abspath ( path ) ) [ 1 ] : for name in names : joined = os . path . join ( path , name ) if os . path . exists ( joined ) : if ( name . endswith ( '.py' ) or _is_package ( joined ) ) : return os . path . abspath ( joined ) path = os . path . join ( '..' , path )
attempt to locate a locustfile .