.. _f-filetreenode: module ``filehelper.file_tree_node`` ==================================== .. inheritance-diagram:: pyquickhelper.filehelper.file_tree_node Short summary +++++++++++++ module ``pyquickhelper.filehelper.file_tree_node`` a node which contains a file or a folder :githublink:`%|py|6` Classes +++++++ +------------------------------------------------------------------------------+-------------------------------------------------+ | class | truncated documentation | +==============================================================================+=================================================+ | :class:`FileTreeNode ` | Defines a node for a folder or a tree. Example: | +------------------------------------------------------------------------------+-------------------------------------------------+ Properties ++++++++++ +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | property | truncated documentation | +==================================================================================+===========================================================================+ | :meth:`date ` | Returns the modification date. | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :meth:`fullname ` | Returns the full name. | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :meth:`name ` | Returns the file name from the root. | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :meth:`root ` | Returns the root directory, the one used as a root for a synchronization. | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :meth:`size ` | Returns the size. | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :meth:`type ` | Returns the file type (``file`` or ``folder``). | +----------------------------------------------------------------------------------+---------------------------------------------------------------------------+ Static Methods ++++++++++++++ +--------------------------------------------------------------------------------------------------+-------------------------------------------------------------+ | staticmethod | truncated documentation | +==================================================================================================+=============================================================+ | :meth:`build_expression ` | Builds a regular expression validating a list of extension. | +--------------------------------------------------------------------------------------------------+-------------------------------------------------------------+ Methods +++++++ +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | method | truncated documentation | +====================================================================================================+===================================================================================================================+ | :py:meth:`__getitem__ ` | returns the element i | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__init__ ` | Defines a file, relative to a root. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__iter__ ` | iterator on the element | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__len__ ` | Returns the number of elements in this folder and in the subfolders. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`__str__ ` | usual | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`_fill ` | look for subfolders | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :py:meth:`_fillstat ` | private: fill _type, _size | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`copy_to ` | Copies the file to *path*. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`difference ` | Returns the differences with another folder. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`exists ` | say if it does exist or not | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`get ` | return a dictionary with some values which describe the file | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`get_content ` | Returns the content of a text file. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`get_dict ` | Returns a dictionary ``{ self._file : node }``. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`get_fullname ` | | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`hash_md5_readfile ` | Computes a hash of a file. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`isdir ` | is it a folder? | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`isfile ` | is it a file? | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`max_date ` | return the more recent date | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`nb_children ` | return the number of children | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`remove ` | Removes the file. | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`repo_ls ` | call ls of an instance of :class:`SourceRepository` | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ | :meth:`sign ` | Returns ``==``, ``<`` or ``>`` according the dates if the size is not too big, if the sign is ``<`` or ``>``, ... | +----------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: pyquickhelper.filehelper.file_tree_node :members: :special-members: __init__ :show-inheritance: