enrobie.utils package#

Subpackages#

Submodules#

enrobie.utils.child module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

exception enrobie.utils.child.InvalidChild(child: str | RobieChild, phase: Literal['initial', 'runtime'], about: str | None = None)[source]#

Bases: Exception

Exception for when the child could not be instantiated.

Note

Similar or identical to classes in other projects.

Parameters:
  • child – Name or child that is determined invalid.

  • phase – From which phase child was found invalid.

  • about – Additional information for the exception.

about: str | None = None#
child: str#
phase: Literal['initial', 'runtime']#

enrobie.utils.importer module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

enrobie.utils.importer.importer(path: str) Any[source]#

Return the function or class using the importable path.

Parameters:

path – Importable Python path for the operation.

Returns:

Function or class using the importable path.

enrobie.utils.param module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

exception enrobie.utils.param.InvalidParam(error: Literal['minimal', 'invalid', 'missing', 'noexist'], about: str | None = None, *, child: RobieChild | None = None, param: str | None = None, value: Any | None = None)[source]#

Bases: Exception

Exception for after invalid parameters are encountered.

Note

Similar or identical to classes in other projects.

Parameters:
  • error – Simple code describing the invalid error.

  • about – Additional information for the exception.

  • child – Child class instance for Chatting Robie.

  • param – Name of the parameter which is not valid.

  • value – Value if any specified for the parameter.

about: str | None = None#
child: RobieChild | None = None#
error: Literal['minimal', 'invalid', 'missing', 'noexist']#
param: str | None = None#
value: Any | None = None#

enrobie.utils.states module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

pydantic model enrobie.utils.states.ClientChannel[source]#

Bases: BaseModel

Cache the information regarding client status on server.

Show JSON schema
{
   "title": "ClientChannel",
   "description": "Cache the information regarding client status on server.",
   "type": "object",
   "properties": {
      "unique": {
         "description": "Unique ID of channel on server",
         "minLength": 1,
         "title": "Unique",
         "type": "string"
      },
      "title": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Friendly human name of channel",
         "title": "Title"
      },
      "topic": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Current topic for the channel",
         "title": "Topic"
      },
      "members": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "minItems": 1,
               "type": "array",
               "uniqueItems": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Current members of the channel",
         "title": "Members"
      }
   },
   "additionalProperties": false,
   "required": [
      "unique"
   ]
}

Config:
  • extra: str = forbid

Fields:
field members: Annotated[set[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current members of the channel', metadata=[MinLen(min_length=1)])] = None#

Current members of the channel

Constraints:
  • min_length = 1

field title: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Friendly human name of channel', metadata=[MinLen(min_length=1)])] = None#

Friendly human name of channel

Constraints:
  • min_length = 1

field topic: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current topic for the channel', metadata=[MinLen(min_length=1)])] = None#

Current topic for the channel

Constraints:
  • min_length = 1

field unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique ID of channel on server', metadata=[MinLen(min_length=1)])] [Required]#

Unique ID of channel on server

Constraints:
  • min_length = 1

class enrobie.utils.states.ClientChannels[source]#

Bases: object

Cache the information regarding client status on server.

Parameters:

client – Client class instance for Chatting Robie.

add_member(unique: str, member: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • member – Remember relevant to the cache operation.

clear_members(unique: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:

unique – Unique identifier for channel on server.

create(unique: str) None[source]#

Create the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

del_member(unique: str, member: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • member – Remember relevant to the cache operation.

delete(unique: str) None[source]#

Delete the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

rename_member(current: str, update: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • current – Current member name to be be searched.

  • update – Value to replace current when is found.

select(unique: str) ClientChannel | None[source]#

Select the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

Returns:

Channel within the internal cache dictionary.

set_title(unique: str, title: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • title – Proper huamn friendly name of the channel.

set_topic(unique: str, topic: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • topic – Topic for discussion within the channel.

class enrobie.utils.states.ClientPublish[source]#

Bases: object

Allow for subscription to client events useful in tests.

publish(mitem: RobieMessage) None[source]#

Submit the message from client to subscriber references.

Parameters:

mitem – Item containing information for operation.

subscribe(callback: Callable[[RobieMessage], None]) None[source]#

Store the callback within internal subscriber reference.

Parameters:

callback – Function that will be called with item.

enrobie.utils.thread module#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

exception enrobie.utils.thread.DupliThread(thread: str | Thread, about: str | None = None)[source]#

Bases: Exception

Exception for when the client thread is already running.

Parameters:
  • thread – Name or thread that would be duplicative.

  • about – Additional information for the exception.

about: str | None = None#
thread: str#

Module contents#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

pydantic model enrobie.utils.ClientChannel[source]#

Bases: BaseModel

Cache the information regarding client status on server.

Show JSON schema
{
   "title": "ClientChannel",
   "description": "Cache the information regarding client status on server.",
   "type": "object",
   "properties": {
      "unique": {
         "description": "Unique ID of channel on server",
         "minLength": 1,
         "title": "Unique",
         "type": "string"
      },
      "title": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Friendly human name of channel",
         "title": "Title"
      },
      "topic": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Current topic for the channel",
         "title": "Topic"
      },
      "members": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "minItems": 1,
               "type": "array",
               "uniqueItems": true
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Current members of the channel",
         "title": "Members"
      }
   },
   "additionalProperties": false,
   "required": [
      "unique"
   ]
}

Config:
  • extra: str = forbid

Fields:
field members: Annotated[set[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current members of the channel', metadata=[MinLen(min_length=1)])] = None#

Current members of the channel

Constraints:
  • min_length = 1

field title: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Friendly human name of channel', metadata=[MinLen(min_length=1)])] = None#

Friendly human name of channel

Constraints:
  • min_length = 1

field topic: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current topic for the channel', metadata=[MinLen(min_length=1)])] = None#

Current topic for the channel

Constraints:
  • min_length = 1

field unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique ID of channel on server', metadata=[MinLen(min_length=1)])] [Required]#

Unique ID of channel on server

Constraints:
  • min_length = 1

class enrobie.utils.ClientChannels[source]#

Bases: object

Cache the information regarding client status on server.

Parameters:

client – Client class instance for Chatting Robie.

add_member(unique: str, member: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • member – Remember relevant to the cache operation.

clear_members(unique: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:

unique – Unique identifier for channel on server.

create(unique: str) None[source]#

Create the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

del_member(unique: str, member: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • member – Remember relevant to the cache operation.

delete(unique: str) None[source]#

Delete the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

rename_member(current: str, update: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • current – Current member name to be be searched.

  • update – Value to replace current when is found.

select(unique: str) ClientChannel | None[source]#

Select the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

Returns:

Channel within the internal cache dictionary.

set_title(unique: str, title: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • title – Proper huamn friendly name of the channel.

set_topic(unique: str, topic: str) None[source]#

Update attribute for channel and create when not exists.

Parameters:
  • unique – Unique identifier for channel on server.

  • topic – Topic for discussion within the channel.

class enrobie.utils.ClientPublish[source]#

Bases: object

Allow for subscription to client events useful in tests.

publish(mitem: RobieMessage) None[source]#

Submit the message from client to subscriber references.

Parameters:

mitem – Item containing information for operation.

subscribe(callback: Callable[[RobieMessage], None]) None[source]#

Store the callback within internal subscriber reference.

Parameters:

callback – Function that will be called with item.

exception enrobie.utils.DupliThread(thread: str | Thread, about: str | None = None)[source]#

Bases: Exception

Exception for when the client thread is already running.

Parameters:
  • thread – Name or thread that would be duplicative.

  • about – Additional information for the exception.

about: str | None = None#
thread: str#
exception enrobie.utils.InvalidChild(child: str | RobieChild, phase: Literal['initial', 'runtime'], about: str | None = None)[source]#

Bases: Exception

Exception for when the child could not be instantiated.

Note

Similar or identical to classes in other projects.

Parameters:
  • child – Name or child that is determined invalid.

  • phase – From which phase child was found invalid.

  • about – Additional information for the exception.

about: str | None = None#
child: str#
phase: Literal['initial', 'runtime']#
exception enrobie.utils.InvalidParam(error: Literal['minimal', 'invalid', 'missing', 'noexist'], about: str | None = None, *, child: RobieChild | None = None, param: str | None = None, value: Any | None = None)[source]#

Bases: Exception

Exception for after invalid parameters are encountered.

Note

Similar or identical to classes in other projects.

Parameters:
  • error – Simple code describing the invalid error.

  • about – Additional information for the exception.

  • child – Child class instance for Chatting Robie.

  • param – Name of the parameter which is not valid.

  • value – Value if any specified for the parameter.

about: str | None = None#
child: RobieChild | None = None#
error: Literal['minimal', 'invalid', 'missing', 'noexist']#
param: str | None = None#
value: Any | None = None#
enrobie.utils.importer(path: str) Any[source]#

Return the function or class using the importable path.

Parameters:

path – Importable Python path for the operation.

Returns:

Function or class using the importable path.