@requires_segment_info
def file_directory(pl, segment_info, remove_scheme=True, shorten_user=True, shorten_cwd=True, shorten_home=False):
 name = buffer_name(segment_info)
 if (not name):
  return None
 match = SCHEME_RE.match(name)
 if match:
  if remove_scheme:
   name = name[(len(match.group(0)) + 1):]
  file_directory = vim_funcs[u'fnamemodify'](name, u':h')
 else:
  file_directory = vim_funcs[u'fnamemodify'](name, (((u':~' if shorten_user else u'') + (u':.' if shorten_cwd else u'')) + u':h'))
  if (not file_directory):
   return None
  if (shorten_home and file_directory.startswith(u'/home/')):
   file_directory = ('~' + file_directory[6:])
 file_directory = file_directory.decode(segment_info[u'encoding'], u'powerline_vim_strtrans_error')
 return (file_directory + os.sep)

@ requires_segment_info def file_directory ( pl , segment_info , remove_scheme = True , shorten_user = True , shorten_cwd = True , shorten_home = False ) : name = buffer_name ( segment_info ) if ( not name ) : return None match = SCHEME_RE . match ( name ) if match : if remove_scheme : name = name [ ( len ( match . group ( 0 ) ) + 1 ) : ] file_directory = vim_funcs [ u'fnamemodify' ] ( name , u':h' ) else : file_directory = vim_funcs [ u'fnamemodify' ] ( name , ( ( ( u':~' if shorten_user else u'' ) + ( u':.' if shorten_cwd else u'' ) ) + u':h' ) ) if ( not file_directory ) : return None if ( shorten_home and file_directory . startswith ( u'/home/' ) ) : file_directory = ( '~' + file_directory [ 6 : ] ) file_directory = file_directory . decode ( segment_info [ u'encoding' ] , u'powerline_vim_strtrans_error' ) return ( file_directory + os . sep )
return file directory .