Oh the creative juices are flowing now!!!


class Path:
    def __init__(self, path):
    def __coerce__(self) => File or Dir
    #
    # Properties about the path:
    drive => str
    directory => str
    filename => str
    extension => str
##    uncshare[1]=> ???
    #
    # Mutations.
    def expand_user(self): => ip or Path?
    def expand_vars(self): => ip or Path?
    def to_normpath(self): => ip #normcase/normpath
    def to_abspath(self) => ip #realpath/abspath
    def set_access(self, mode) => None
    def set_owner(self, uid, gid) => None
    def set_root(self, path) => None
    #
    # Introspection.
    def is_accessable(self, mode) => bool #access
    def is_valid(self) => bool # exists
    def is_absolute(self) => bool #isabs
    def is_directory(self) => bool #isdir
    def is_file(self) => bool #isfile
    def is_link(self) => bool #islnk
    def is_mount(self) => bool #ismount
    def is_same(self, path_Dir_or_File) => bool #issamefile
    #
    # Inspection, Extraction
    def get_abspath(self)=> Path
    def get_normpath(self) => Path
##    def get_atime(self) => str #atime
##    def get_mtime(self) => str #mtime
##    def get_ctime(self) => str #ctime
    def get_stat(self) => stat #stat,lstat
##    def get_statvfs(self) => stat #statvfs
##        # do we really need this antiquity?

    ############################################################
    #                         Question                         #
    ############################################################
    # Should all the stat stuff like get_mtime, get_ctime,     #
    # get_atime, etc... be accessed only under get_stat? I     #
    # believe so!                                              #
    ############################################################

    def get_drive(self): => str
    def get_directory(self): => str
    def get_filename(self): => str (empty if is_dir)
    def get_extension(self): => str (empty if is_dir)
    #
    def split(self) => (drive, path, filename, extension)
##    def splitunc(self): ???
##    def splitall(self): ???
##    def relpathto(self, dest): => ???
##    def pathconf(self, name): #pathconfig
    #
    # Modifying operations on links
    def link_new(self, newpath, symbolic=False): ...
    def link_read(self): ...
    def link_readabs(self): ...


class File:
    def new(path)
    (...All existing file methods here...)
    #
    # Mutate, Clone, Destroy.
    def rename(self, newname) => ip or File?
    def delete(self, overwrites=3) => None
    def copy(self, dst) => File
    def unlink(self) => None    #
    #
    # Attribute mutation.
    def update(self) => None #touch
    def copy_mode(src) => None #copymode
    def copy_stat(src) => None #copystat
    def update_mode(dst) => None
    def update_stat(dst) => None
    #
    # Other
    def get_bytes(self): => int => 1292894
    def get_size(self, fmtstr="{0:0.2f}") => str => "1.23 MB"
    def backup(self) => filename.bak{count}


class Dir:
    def new(path)
    def open(path)
    #
    # Mutate, Clone, Destroy.
    def delete(self, onerror=None): => None
    def copy(self, dst, symlinks=True): => Dir
    #
    # Introspection.
    def get_paths(self, pattern=None): [Path, Path, ...]
    def get_dirs(self, pattern=None): => [Dir, Dir, ...]
    def get_files(self, pattern=None): => [File, File, ...]
    def walk_paths(self, pattern=None): itereach->PathObj
    def walk_dirs(self, pattern=None): itereach->DirObj
    def walk_files(self, pattern=None): itereach->FileObj

    ############################################################
    #                         Question                         #
    ############################################################
    # Do we really need "get_*" AND "walk_*"? I believe we     #
    # should choose one set of three                           #
    ############################################################

    def match(self, pattern) => bool
        # Do we need match when re would suffice?
    def glob(self, pattern): => [Path, Path, ...]

    ############################################################
    # Excommunicated Methods.
    ############################################################
    def startfile(self)
        # startfile should part of os anyway.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to