roboherd 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of roboherd might be problematic. Click here for more details.
- roboherd/annotations/__init__.py +2 -27
- roboherd/annotations/bovine.py +28 -2
- roboherd/annotations/common.py +30 -1
- roboherd/examples/scarecrow.py +5 -0
- {roboherd-0.1.5.dist-info → roboherd-0.1.6.dist-info}/METADATA +4 -1
- {roboherd-0.1.5.dist-info → roboherd-0.1.6.dist-info}/RECORD +8 -8
- {roboherd-0.1.5.dist-info → roboherd-0.1.6.dist-info}/WHEEL +0 -0
- {roboherd-0.1.5.dist-info → roboherd-0.1.6.dist-info}/entry_points.txt +0 -0
roboherd/annotations/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from fast_depends import Depends
|
|
2
|
-
from typing import Annotated
|
|
2
|
+
from typing import Annotated
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from .common import PublishObject, PublishActivity # noqa
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def get_raw(data: dict) -> dict:
|
|
@@ -41,28 +41,3 @@ Activity = Annotated[dict, Depends(get_activity)]
|
|
|
41
41
|
|
|
42
42
|
EmbeddedObject = Annotated[dict, Depends(get_embedded_object)]
|
|
43
43
|
"""The embedded object in the activity as parsed by muck_out"""
|
|
44
|
-
|
|
45
|
-
Publisher = Callable[[dict], Awaitable[None]]
|
|
46
|
-
"""Type returned by the publishing functions"""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def construct_publish_object(connection: Almabtrieb, actor_id: str) -> Publisher:
|
|
50
|
-
async def publish(data: dict):
|
|
51
|
-
await connection.trigger("publish_object", {"actor": actor_id, "data": data})
|
|
52
|
-
|
|
53
|
-
return publish
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def construct_publish_activity(connection: Almabtrieb, actor_id: str) -> Publisher:
|
|
57
|
-
async def publish(data: dict):
|
|
58
|
-
await connection.trigger("publish_activity", {"actor": actor_id, "data": data})
|
|
59
|
-
|
|
60
|
-
return publish
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
PublishObject = Annotated[Publisher, Depends(construct_publish_object)]
|
|
64
|
-
"""Allows one to publish an object as the actor. Assumes cattle_grid has the extension `simple_object_storage` or equivalent"""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
PublishActivity = Annotated[Publisher, Depends(construct_publish_activity)]
|
|
68
|
-
"""Allows one to publish an activity as the actor. Assumes cattle_grid has the extension `simple_object_storage` or equivalent"""
|
roboherd/annotations/bovine.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""Test documentation"""
|
|
2
2
|
|
|
3
|
-
from typing import Annotated
|
|
3
|
+
from typing import Annotated, Awaitable, Callable
|
|
4
4
|
from fast_depends import Depends
|
|
5
|
-
from .common import Profile
|
|
5
|
+
from .common import Profile, PublishObject
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
8
|
from bovine.activitystreams import factories_for_actor_object
|
|
@@ -39,3 +39,29 @@ ActivityFactory = Annotated[BovineActivityFactory, Depends(get_activity_factory)
|
|
|
39
39
|
|
|
40
40
|
ObjectFactory = Annotated[BovineObjectFactory, Depends(get_object_factory)] # type: ignore
|
|
41
41
|
"""The object factory of type [bovine.activitystreams.object_factory.ObjectFactory][]"""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
import markdown
|
|
46
|
+
|
|
47
|
+
def get_markdown_poster( # type: ignore
|
|
48
|
+
object_factory: ObjectFactory, publish_object: PublishObject
|
|
49
|
+
):
|
|
50
|
+
async def publish_markdown(message: str):
|
|
51
|
+
content = markdown.markdown(message)
|
|
52
|
+
note = object_factory.note(content=content).as_public().build() # type: ignore
|
|
53
|
+
await publish_object(note)
|
|
54
|
+
|
|
55
|
+
return publish_markdown
|
|
56
|
+
|
|
57
|
+
except ImportError:
|
|
58
|
+
|
|
59
|
+
def get_markdown_poster() -> None:
|
|
60
|
+
raise ImportError("bovine not installed")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
MarkdownPublisher = Callable[[str], Awaitable[None]]
|
|
64
|
+
"""Type of the markdown publisher"""
|
|
65
|
+
|
|
66
|
+
MarkdownPoster = Annotated[MarkdownPublisher, Depends(get_markdown_poster)] # type: ignore
|
|
67
|
+
"""A function that takes a markdown string and posts it as the content of a note"""
|
roboherd/annotations/common.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from fast_depends import Depends
|
|
2
|
-
from typing import Annotated
|
|
2
|
+
from typing import Annotated, Callable, Awaitable
|
|
3
|
+
|
|
4
|
+
from almabtrieb import Almabtrieb
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
from roboherd.cow import RoboCow
|
|
5
8
|
|
|
@@ -12,3 +15,29 @@ def get_profile(cow: RoboCow) -> dict:
|
|
|
12
15
|
|
|
13
16
|
Profile = Annotated[dict, Depends(get_profile)]
|
|
14
17
|
"""The profile of the cow"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Publisher = Callable[[dict], Awaitable[None]]
|
|
21
|
+
"""Type returned by the publishing functions"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def construct_publish_object(connection: Almabtrieb, actor_id: str) -> Publisher:
|
|
25
|
+
async def publish(data: dict):
|
|
26
|
+
await connection.trigger("publish_object", {"actor": actor_id, "data": data})
|
|
27
|
+
|
|
28
|
+
return publish
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def construct_publish_activity(connection: Almabtrieb, actor_id: str) -> Publisher:
|
|
32
|
+
async def publish(data: dict):
|
|
33
|
+
await connection.trigger("publish_activity", {"actor": actor_id, "data": data})
|
|
34
|
+
|
|
35
|
+
return publish
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
PublishObject = Annotated[Publisher, Depends(construct_publish_object)]
|
|
39
|
+
"""Allows one to publish an object as the actor. Assumes cattle_grid has the extension `simple_object_storage` or equivalent"""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
PublishActivity = Annotated[Publisher, Depends(construct_publish_activity)]
|
|
43
|
+
"""Allows one to publish an activity as the actor. Assumes cattle_grid has the extension `simple_object_storage` or equivalent"""
|
roboherd/examples/scarecrow.py
CHANGED
|
@@ -20,3 +20,8 @@ bot = RoboCow(
|
|
|
20
20
|
async def startup(publish_object: PublishObject, object_factory: ObjectFactory):
|
|
21
21
|
note = object_factory.note(content="Booo! 🐦").as_public().build() # type: ignore
|
|
22
22
|
await publish_object(note)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# @bot.startup
|
|
26
|
+
# async def startup(poster: MarkdownPoster):
|
|
27
|
+
# await poster("__Booo!__ 🐦")
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: roboherd
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: A Fediverse bot framework
|
|
5
|
+
Project-URL: Documentation, https://bovine.codeberg.page/roboherd/
|
|
6
|
+
Project-URL: Repository, https://codeberg.org/bovine/roboherd
|
|
5
7
|
Requires-Python: >=3.11
|
|
6
8
|
Requires-Dist: aiohttp>=3.11.12
|
|
7
9
|
Requires-Dist: almabtrieb[mqtt]>=0.1.0a1
|
|
@@ -14,6 +16,7 @@ Requires-Dist: tomli-w>=1.1.0
|
|
|
14
16
|
Requires-Dist: watchfiles>=1.0.4
|
|
15
17
|
Provides-Extra: bovine
|
|
16
18
|
Requires-Dist: bovine>=0.5.15; extra == 'bovine'
|
|
19
|
+
Requires-Dist: markdown>=3.7; extra == 'bovine'
|
|
17
20
|
Description-Content-Type: text/markdown
|
|
18
21
|
|
|
19
22
|
# Roboherd
|
|
@@ -4,9 +4,9 @@ roboherd/register.py,sha256=Gqa5aT2supVJMj7z21btMYRma3_WW0oK5gjZftr048s,976
|
|
|
4
4
|
roboherd/test_validators.py,sha256=UiFgJkutmXBLjGpdLP2IBYCEf75quwnRHX7Z51G8Xqo,222
|
|
5
5
|
roboherd/util.py,sha256=nrFRtyfvMQ8oXoGDYxmCAXcIN14dWBAPGv0cI_B_TP0,1710
|
|
6
6
|
roboherd/validators.py,sha256=2mc43ZGwFazp4f3B9J4RxZCU4Y_ErSNotib8MnYVtmY,140
|
|
7
|
-
roboherd/annotations/__init__.py,sha256=
|
|
8
|
-
roboherd/annotations/bovine.py,sha256=
|
|
9
|
-
roboherd/annotations/common.py,sha256=
|
|
7
|
+
roboherd/annotations/__init__.py,sha256=BrP5UWiVnh8FwmHc6wEY3G69BStidGUpF8uP4Ea5-dg,1140
|
|
8
|
+
roboherd/annotations/bovine.py,sha256=cFLUSFzTulikNjZb1lLq5v4tGjL1i7_dR3H6wimegCg,2322
|
|
9
|
+
roboherd/annotations/common.py,sha256=n5rm8WTgsg116RczKdzm_VoPg1mBk_IMf2V7l8UgWKQ,1351
|
|
10
10
|
roboherd/cow/__init__.py,sha256=MlMvjFbodwZf6vpKlPfIpSn5SHu9IugacSH5ylbySTY,5826
|
|
11
11
|
roboherd/cow/const.py,sha256=fj5nUJUIlcpr1AU2Ur55ToR7iVmYv4UnfdxiQwguv-k,166
|
|
12
12
|
roboherd/cow/handlers.py,sha256=k5Tc1M--wqmZ2EZvzIfID4dp8XE0rN18puMTKkNVjjE,1491
|
|
@@ -24,7 +24,7 @@ roboherd/examples/meta.py,sha256=tFhHe-DJn2J13Mm22f-gFm5I8_3uQwLU4mAkrK2xzEM,170
|
|
|
24
24
|
roboherd/examples/moocow.py,sha256=DMPuR8XBpRRHKXFZM-2_VLYLWx8Iz4OdcE0QTVtYSFs,1097
|
|
25
25
|
roboherd/examples/number.py,sha256=Sj9aYfdtzANUfWVJnoX73zEvDNVcdrr-STZDSwNRHlI,2003
|
|
26
26
|
roboherd/examples/rooster.py,sha256=5_rPGLQTLv1s0cyE6l7WXLum-QLpQZ2p63YBkfrxKFw,596
|
|
27
|
-
roboherd/examples/scarecrow.py,sha256=
|
|
27
|
+
roboherd/examples/scarecrow.py,sha256=CgQuI7smKBJdeMiL8fY5SP1itH5GaFRAoX3I3QGF3rw,748
|
|
28
28
|
roboherd/herd/__init__.py,sha256=6jWgYnuJOpXtYS03mdjEgWd0zXv5kj9w9d7K6UsCPbc,3068
|
|
29
29
|
roboherd/herd/builder.py,sha256=MSVPRF0Jsxure9kdyCoYJHQ7nYilGAD0_uQaGQ-rQyE,619
|
|
30
30
|
roboherd/herd/processor.py,sha256=ncXsYfuTRTT_0-K453COF_oAiGBJN0u5eP8NoeZmWik,1042
|
|
@@ -38,7 +38,7 @@ roboherd/herd/manager/load.py,sha256=BoeBID2UGP--sIKwITABQkQv2lMc9Y8pyp7_nleu2bw
|
|
|
38
38
|
roboherd/herd/manager/test_config.py,sha256=CnoqQ_exrpQdBWVoGxSns3HpccqgmhH9mNJIPTCKKAs,1665
|
|
39
39
|
roboherd/herd/manager/test_load.py,sha256=zyu5LIChMfTnxu_tYK63-bSOHYn1K1zUlbDY5DkE3GY,514
|
|
40
40
|
roboherd/herd/manager/test_manager.py,sha256=9pSMaH7zmN-zagYCIBpQcV3Q0sBT7XZSCvsmLVC0rOI,1047
|
|
41
|
-
roboherd-0.1.
|
|
42
|
-
roboherd-0.1.
|
|
43
|
-
roboherd-0.1.
|
|
44
|
-
roboherd-0.1.
|
|
41
|
+
roboherd-0.1.6.dist-info/METADATA,sha256=DvhOfgjAb92py9-vVqKR0bbsRhx5jau-_DVt_mLB31M,1007
|
|
42
|
+
roboherd-0.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
43
|
+
roboherd-0.1.6.dist-info/entry_points.txt,sha256=WebdVUmh8Ot-FupKJY6Du8LuFbmezt9yoy2UICqV3bE,52
|
|
44
|
+
roboherd-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|