enrobie.utils package#

Submodules#

enrobie.utils.child module#

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.

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

enrobie.utils.importer module#

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#

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 related to exception.

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

  • value – Value if any specified for the parameter.

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

enrobie.utils.states module#

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

Bases: BaseModel

Cache the information regarding client status on server.

Fields#

Field

Type

Required

Default

Constraints

members

set[str] | None

No

None

min_length=1

title

str | None

No

None

min_length=1

topic

str | None

No

None

min_length=1

unique

str

Yes

min_length=1

unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique ID of channel on server', metadata=[MinLen(min_length=1)])]#
title: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Friendly human name of channel', metadata=[MinLen(min_length=1)])]#
topic: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current topic for the channel', metadata=[MinLen(min_length=1)])]#
members: Annotated[set[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current members of the channel', metadata=[MinLen(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.

create(unique: str) None[source]#

Create the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

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.

delete(unique: str) None[source]#

Delete the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

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.

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.

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.

clear_members(unique: str) None[source]#

Update attribute for channel and create when not exists.

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.

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

Bases: object

Allow for subscription to client events useful in tests.

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

Store the callback within internal subscriber reference.

Parameters:

callback – Function that will be called with item.

publish(mitem: RobieMessage) None[source]#

Submit the message from client to subscriber references.

Parameters:

mitem – Item containing information for operation.

enrobie.utils.thread module#

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.

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

Module contents#

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.

phase: Literal['initial', 'runtime']#
child: str#
about: str | None = None#
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 related to exception.

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

  • value – Value if any specified for the parameter.

error: Literal['minimal', 'invalid', 'missing', 'noexist']#
about: str | None = None#
child: RobieChild | None = None#
param: str | None = None#
value: Any | None = None#
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.

thread: str#
about: str | None = None#
class enrobie.utils.ClientChannel[source]#

Bases: BaseModel

Cache the information regarding client status on server.

Fields#

Field

Type

Required

Default

Constraints

members

set[str] | None

No

None

min_length=1

title

str | None

No

None

min_length=1

topic

str | None

No

None

min_length=1

unique

str

Yes

min_length=1

unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique ID of channel on server', metadata=[MinLen(min_length=1)])]#
title: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Friendly human name of channel', metadata=[MinLen(min_length=1)])]#
topic: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current topic for the channel', metadata=[MinLen(min_length=1)])]#
members: Annotated[set[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Current members of the channel', metadata=[MinLen(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.

create(unique: str) None[source]#

Create the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

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.

delete(unique: str) None[source]#

Delete the channel within the internal cache dictionary.

Parameters:

unique – Unique identifier for channel on server.

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.

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.

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.

clear_members(unique: str) None[source]#

Update attribute for channel and create when not exists.

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.

class enrobie.utils.ClientPublish[source]#

Bases: object

Allow for subscription to client events useful in tests.

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

Store the callback within internal subscriber reference.

Parameters:

callback – Function that will be called with item.

publish(mitem: RobieMessage) None[source]#

Submit the message from client to subscriber references.

Parameters:

mitem – Item containing information for operation.

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.