Inherits from
- HasPrivateTraits: enthought.traits.has_traits.HasPrivateTraits
Attributes
- absolute_path
The absolute path name of this file/folder.
absolute_path = Property(Str)
- children
The folder's children (for files this is always None).
children = Property(List('File'))
- exists
Does the file/folder exist?
exists = Property(Bool)
- ext
The file extension (for folders this is always the empty string).
fixme: Currently the extension includes the '.' (ie. we have '.py' and not 'py'). This is because things like 'os.path.splitext' leave the '.' on, but I'm not sure that this is a good idea!
ext = Property(Str)
- is_file
Is this an existing file?
is_file = Property(Bool)
- is_folder
Is this an existing folder?
is_folder = Property(Bool)
- is_package
Is this a Python package (ie. a folder contaning an '__init__.py' file.
is_package = Property(Bool)
- is_readonly
Is the file/folder readonly?
is_readonly = Property(Bool)
- mime_type
The MIME type of the file (for a folder this will always be 'context/unknown' (is that what it should be?)).
mime_type = Property(Str)
- name
The last component of the path without the extension.
name = Property(Str)
- parent
The parent of this file/folder (None if it has no parent).
parent = Property(Instance('File'))
- path
The path name of this file/folder.
path = Str
- url
A URL reference to the file.
url = Property(Str)
Inherited from base classes
Method summary
- __cmp__(self, other)
- __init__(self, path, **traits)
- __str__(self)
- copy(self, destination)
- create_file(self, contents = '')
- create_folder(self)
- create_folders(self)
- create_package(self)
- delete(self)
- make_writeable(self)
- move(self, destination)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name)
- __reduce_ex__(self, protocol)
- __setstate__(self, state)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get(self, *names, **metadata)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same')
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set(self, trait_change_notify = True, **traits)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- __cmp__(self, other)
Comparison operators.
- __init__(self, path, **traits)
Creates a new representation of the specified path.
- __str__(self)
Returns an 'informal' string representation of the object.
- copy(self, destination)
Copies this file/folder.
- create_file(self, contents = '')
Creates a file at this path.
- create_folder(self)
Creates a folder at this path.
All intermediate folders MUST already exist.
- create_folders(self)
Creates a folder at this path.
This will attempt to create any missing intermediate folders.
- create_package(self)
Creates a package at this path.
All intermediate folders/packages MUST already exist.
- delete(self)
Deletes this file/folder.
Does nothing if the file/folder does not exist.
- make_writeable(self)
Attempt to make the file/folder writeable.
- move(self, destination)
Moves this file/folder.