gws_core

Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

Folder

RESOURCE
Typing name :  RESOURCE.gws_core.Folder Brick :  gws_core
Parent :
Fs node

Resource that represents a folder in the system.

Technical notes:

/!\ The class that extend folder can only have a path and file_store_id attributes. Other attributes will not be provided when creating the resource.

Views
VIEW FOLDER CONTENTDefault view
View the sub files and folders
VIEW FOLDER CONTENT
View the sub files and folders
Attributes
file_store_id: strflagged: boolis_symbolic_link: boolname: strpath: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDictuid: str
Functions
__init__

Create a new FSNode

path : str - ''
absolute path to the file
add_technical_info

Add technical information on the resource. Technical info are useful to set additional information on the resource.

technical_info : TechnicalInfo
technical information to add (key, value) this is a long description of the technical information
check_resource

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type : Optional
clone

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type : ResourceType
copy_to_directory

Copy the node to the directory and keep the same base name

destination : str
the destination directory
Return type : str
copy_to_path

Copy the file or folder to the destination and rename the base name

destination : str
complete path to the destination
Return type : str
create_dir_if_not_exist

Create a directory inside this folder if it does not exist. Creates intermediate directories if needed.

dir_path : str
Return type : Path
create_empty_file_if_not_exist

Create an empty file inside this folder if it does not exist. Creates intermediate directories if needed.

file_path : str
relative path of the file
Return type : Path
delete_sub_node

Delete the sub node (file or folder) at the given path

sub_node_path : str
relative path of the sub node
ignore_errors : bool - True
if True, errors will be ignored
exists
Return type : bool
get_base_name

Get the name of the file or folder without the path

Return type : str
get_default_name

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type : str
get_default_style

Get the default style of the resource

Return type : TypingStyle
get_model_id

Get the id of the resource model in the database. It is provided by the system for input resources of a task.

Return type : str
get_name_or_default

Get the name of the resource or the default name if the name is None

Return type : str
get_size
Return type : int
get_sub_node

Get the sub node (file or folder) at the given path as a FSNode

sub_node_path : str
relative path of the sub node
Return type : FSNode
get_sub_path

Get the absolute path of the sub node

sub_node_path : str
relative path of the sub node
Return type : str
get_technical_info

Get the technical information of the resource

key : str
key of the technical information
Return type : TechnicalInfo
has_node

Check if the sub node exists

sub_node_path : str
relative path of the sub node
Return type : bool
init

This can be overwritten to perform custom initialization of the resource. This method is called after the init (constructor) of the resource. The values of RFields are set when this method is called.

list_all_file_paths

List the files inside this folder recursively

Return type : List
list_dir

List the files and directories inside this folder (not recursive)

Return type : List
list_dir_path

List the files and directories absolute path inside this folder (not recursive)

Return type : List
rename_sub_node

Rename the sub node (file or folder) at the given path

sub_node_path : str
relative path of the sub node
new_name : str
new name of the sub node
classname @classmethod

Returns the name of the class

slugify : bool - False
True to slugify the class name if True
snakefy : bool - False
True to snakefy the class name if True
replace_uppercase : bool - False
Replace upper cases by "-" if True
Return type : str
copy_style @classmethod

Copy the style of the resource with the possibility to override some properties. Useful when settings the style for a task based on the resource style.

icon_technical_name : str
technical name of the icon if provided, the icon_type must also be provided
icon_type : TypingIconType
type of the icon if provided, the icon_technical_name must also be provided
background_color : str
background color
icon_color : TypingIconColor
icon color
Return type : TypingStyle
full_classname @classmethod

Returns the full name of the class

slugify : bool - False
Slugify the returned class name if True
snakefy : bool - False
Snakefy the returned class name if True
Return type : str
get_human_name @classmethod

Get the human name of the resource

Return type : str
get_short_description @classmethod

Get the short description of the resource

Return type : str
get_style @classmethod

Get the style of the resource

Return type : TypingStyle
get_typing_name @classmethod

Get the typing name of the resource

Return type : str
inheritors @classmethod

Get all the classes that inherit this class

Return type : List