Login
Back to bricks list
Introduction Version

Fs node

RESOURCE
Typing name :  RESOURCE.gws_core.FSNode Brick :  gws_core
Parent :
Resource

Node class to manage resources that are stored in the server (as file or folder)

Technical notes:

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

Views

VIEW RESOURCEDefault view
View the complete resource as json

Attributes

file_store_id: stris_symbolic_link: boolname: strpath: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDictuid: str

Functions

__INIT__

Create a new FSNode

Parameters:
NameTypeDefault valueDescription
pathstr '' Absolute path to the file, defaults to "" , optional
ADD_TECHNICAL_INFO

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

Parameters:
NameTypeDefault valueDescription
technical_infoTechnicalInfo Technical information to add (key, value)
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

Parameters:
NameTypeDefault valueDescription
destinationstr The destination directory
Return type:
str
COPY_TO_PATH

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

Parameters:
NameTypeDefault valueDescription
destinationstr Complete path to the destination
Return type:
str
EXISTS
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_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_TECHNICAL_INFO

Get the technical information of the resource

Parameters:
NameTypeDefault valueDescription
keystr Key of the technical information
Return type:
TechnicalInfo
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.

CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
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.

Parameters:
NameTypeDefault valueDescription
icon_technical_namestr Technical name of the icon if provided, the icon_type must also be provided, defaults to none , optional
icon_typeTypingIconType Type of the icon if provided, the icon_technical_name must also be provided, defaults to none , optional
background_colorstr Background color, defaults to none , optional
icon_colorTypingIconColor Icon color, defaults to none , optional
Return type:
TypingStyle
DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
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_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
METHOD_NAMES - @classmethod

Returns the list of the methods

Return type:
List
MODULE_NAME - @classmethod

Returns the module name of the class

Return type:
str
PROPERTY_METHOD_NAMES - @classmethod
PROPERTY_NAMES - @classmethod

Retrieves the property names

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
Return type:
List