def chdir(self, target_directory):
        """Change current working directory to target directory.

        Args:
            target_directory: The path to new current working directory.

        Raises:
            OSError: if user lacks permission to enter the argument directory
                or if the target is not a directory.
        """
        target_directory = self.filesystem.resolve_path(
            target_directory, allow_fd=True)
        self.filesystem.confirmdir(target_directory)
        directory = self.filesystem.resolve(target_directory)
        # A full implementation would check permissions all the way
        # up the tree.
        if not is_root() and not directory.st_mode | PERM_EXE:
            self.filesystem.raise_os_error(errno.EACCES, directory)
        self.filesystem.cwd = target_directory
def chdir ( self , target_directory ) : target_directory = self . filesystem . resolve_path ( target_directory , allow_fd = True ) self . filesystem . confirmdir ( target_directory ) directory = self . filesystem . resolve ( target_directory ) if not is_root ( ) and not directory . st_mode | PERM_EXE : self . filesystem . raise_os_error ( errno . EACCES , directory ) self . filesystem . cwd = target_directory
Change current working directory to target directory.

        Args:
            target_directory: The path to new current working directory.

        Raises:
            OSError: if user lacks permission to enter the argument directory
                or if the target is not a directory.