original_docstring: Given a filename this will try to calculate the python path, add it
      to the search path and return the actual module name that is expected.
      
docstring: Given a filename this will try to calculate the python path, add it
  to the search path and return the actual module name that is expected.
docstring_tokens: Given a filename this will try to calculate the python path add it to the search path and return the actual module name that is expected .
code: def prepare_import(path):
      """Given a filename this will try to calculate the python path, add it
      to the search path and return the actual module name that is expected.
      """
      path = os.path.realpath(path)
  
      fname, ext = os.path.splitext(path)
      if ext == ".py":
          path = fname
  
      if os.path.basename(path) == "__init__":
          path = os.path.dirname(path)
  
      module_name = []
  
      # move up until outside package structure (no __init__.py)
      while True:
          path, name = os.path.split(path)
          module_name.append(name)
  
          if not os.path.exists(os.path.join(path, "__init__.py")):
              break
  
      if sys.path[0] != path:
          sys.path.insert(0, path)
  
      return ".".join(module_name[::-1])
code_tokens: def prepare_import ( path ) : path = os . path . realpath ( path ) fname , ext = os . path . splitext ( path ) if ext == ".py" : path = fname if os . path . basename ( path ) == "__init__" : path = os . path . dirname ( path ) module_name = [ ] while True : path , name = os . path . split ( path ) module_name . append ( name ) if not os . path . exists ( os . path . join ( path , "__init__.py" ) ) : break if sys . path [ 0 ] != path : sys . path . insert ( 0 , path ) return "." . join ( module_name [ : : - 1 ] )
short_docstring: Given a filename this will try to calculate the python path, add it
  to the search path and return the actual module name that is expected.
short_docstring_tokens: Given a filename this will try to calculate the python path add it to the search path and return the actual module name that is expected .
comment: """Given a filename this will try to calculate the python path, add it
      to the search path and return the actual module name that is expected.
      """$SEP$# move up until outside package structure (no __init__.py)