def shift_path_info(environ):
 path_info = environ.get('PATH_INFO', '')
 if (not path_info):
  return None
 path_parts = path_info.split('/')
 path_parts[1:(-1)] = [p for p in path_parts[1:(-1)] if (p and (p != '.'))]
 name = path_parts[1]
 del path_parts[1]
 script_name = environ.get('SCRIPT_NAME', '')
 script_name = posixpath.normpath(((script_name + '/') + name))
 if script_name.endswith('/'):
  script_name = script_name[:(-1)]
 if ((not name) and (not script_name.endswith('/'))):
  script_name += '/'
 environ['SCRIPT_NAME'] = script_name
 environ['PATH_INFO'] = '/'.join(path_parts)
 if (name == '.'):
  name = None
 return name

def shift_path_info ( environ ) : path_info = environ . get ( 'PATH_INFO' , '' ) if ( not path_info ) : return None path_parts = path_info . split ( '/' ) path_parts [ 1 : ( - 1 ) ] = [ p for p in path_parts [ 1 : ( - 1 ) ] if ( p and ( p != '.' ) ) ] name = path_parts [ 1 ] del path_parts [ 1 ] script_name = environ . get ( 'SCRIPT_NAME' , '' ) script_name = posixpath . normpath ( ( ( script_name + '/' ) + name ) ) if script_name . endswith ( '/' ) : script_name = script_name [ : ( - 1 ) ] if ( ( not name ) and ( not script_name . endswith ( '/' ) ) ) : script_name += '/' environ [ 'SCRIPT_NAME' ] = script_name environ [ 'PATH_INFO' ] = '/' . join ( path_parts ) if ( name == '.' ) : name = None return name
shift a name from path_info to script_name .