roboherd 0.1.6__py3-none-any.whl → 0.1.7__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/__init__.py +25 -0
- roboherd/cow/__init__.py +8 -0
- roboherd/examples/dev_null.py +6 -9
- roboherd/examples/json_echo.py +6 -11
- roboherd/examples/moocow.py +6 -10
- roboherd/examples/number.py +5 -10
- roboherd/examples/rooster.py +5 -11
- roboherd/examples/scarecrow.py +14 -18
- {roboherd-0.1.6.dist-info → roboherd-0.1.7.dist-info}/METADATA +1 -1
- {roboherd-0.1.6.dist-info → roboherd-0.1.7.dist-info}/RECORD +12 -12
- {roboherd-0.1.6.dist-info → roboherd-0.1.7.dist-info}/WHEEL +0 -0
- {roboherd-0.1.6.dist-info → roboherd-0.1.7.dist-info}/entry_points.txt +0 -0
roboherd/__init__.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Main roboherd module. Should contain all necessary elements to build a robocow"""
|
|
2
|
+
|
|
3
|
+
from .cow import RoboCow
|
|
4
|
+
from .annotations import (
|
|
5
|
+
PublishObject,
|
|
6
|
+
PublishActivity,
|
|
7
|
+
RawData,
|
|
8
|
+
ParsedData,
|
|
9
|
+
Activity,
|
|
10
|
+
EmbeddedObject,
|
|
11
|
+
)
|
|
12
|
+
from .annotations.bovine import MarkdownPoster, ObjectFactory, ActivityFactory
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"RoboCow",
|
|
16
|
+
"RawData",
|
|
17
|
+
"ParsedData",
|
|
18
|
+
"Activity",
|
|
19
|
+
"EmbeddedObject",
|
|
20
|
+
"MarkdownPoster",
|
|
21
|
+
"ActivityFactory",
|
|
22
|
+
"ObjectFactory",
|
|
23
|
+
"PublishObject",
|
|
24
|
+
"PublishActivity",
|
|
25
|
+
]
|
roboherd/cow/__init__.py
CHANGED
|
@@ -81,6 +81,14 @@ class RoboCow:
|
|
|
81
81
|
metadata=dict(description="Internal data for the cow"),
|
|
82
82
|
)
|
|
83
83
|
|
|
84
|
+
@staticmethod
|
|
85
|
+
def create(**kwargs):
|
|
86
|
+
"""Creates a new cow. We note that
|
|
87
|
+
`RoboCow.create(name="my name")` is equivalent
|
|
88
|
+
to `RoboCow(information=Information(name="my name"))`.
|
|
89
|
+
"""
|
|
90
|
+
return RoboCow(information=Information(**kwargs))
|
|
91
|
+
|
|
84
92
|
def action(self, action: str = "*", activity_type: str = "*"):
|
|
85
93
|
"""Adds a handler for an event. Use "*" as a wildcard.
|
|
86
94
|
|
roboherd/examples/dev_null.py
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
from roboherd
|
|
2
|
-
from roboherd.cow.types import Information
|
|
1
|
+
from roboherd import RoboCow
|
|
3
2
|
|
|
4
3
|
from .meta import meta_information
|
|
5
4
|
|
|
6
|
-
bot = RoboCow(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
meta_information=meta_information,
|
|
12
|
-
)
|
|
5
|
+
bot = RoboCow.create(
|
|
6
|
+
name="/dev/null",
|
|
7
|
+
description="""I don't do anything.""",
|
|
8
|
+
handle="devnull",
|
|
9
|
+
meta_information=meta_information,
|
|
13
10
|
)
|
roboherd/examples/json_echo.py
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
from roboherd
|
|
4
|
-
from roboherd.annotations import RawData, PublishObject
|
|
5
|
-
from roboherd.annotations.bovine import ObjectFactory
|
|
3
|
+
from roboherd import RoboCow, RawData, PublishObject, ObjectFactory
|
|
6
4
|
|
|
7
|
-
from roboherd.cow.types import Information
|
|
8
5
|
from .meta import meta_information
|
|
9
6
|
|
|
10
|
-
bot = RoboCow(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description="""<p>I'm a silly bot that replies to
|
|
7
|
+
bot = RoboCow.create(
|
|
8
|
+
handle="jsonecho",
|
|
9
|
+
name="JSON Echo {}",
|
|
10
|
+
description="""<p>I'm a silly bot that replies to
|
|
15
11
|
you with the JSON as received through a HTTP
|
|
16
12
|
post request by
|
|
17
13
|
<a href="https://codeberg.org/helge/cattle_grid">cattle_grid</a>.</p>
|
|
18
14
|
|
|
19
15
|
""",
|
|
20
|
-
|
|
21
|
-
)
|
|
16
|
+
meta_information=meta_information,
|
|
22
17
|
)
|
|
23
18
|
|
|
24
19
|
|
roboherd/examples/moocow.py
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
from roboherd
|
|
4
|
-
from roboherd.annotations import EmbeddedObject, PublishObject
|
|
5
|
-
from roboherd.cow.types import Information
|
|
3
|
+
from roboherd import RoboCow, EmbeddedObject, PublishObject
|
|
6
4
|
from .meta import meta_information
|
|
7
5
|
|
|
8
6
|
logger = logging.getLogger(__name__)
|
|
9
7
|
|
|
10
|
-
moocow = RoboCow(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description="""I'm a cow that likes to moo.
|
|
8
|
+
moocow = RoboCow.create(
|
|
9
|
+
handle="moocow",
|
|
10
|
+
name="The mooing cow 🐮",
|
|
11
|
+
description="""I'm a cow that likes to moo.
|
|
15
12
|
|
|
16
13
|
I also serve as an example for the RoboHerd python tool.
|
|
17
14
|
See <a href="https://codeberg.org/helge/roboherd">codeberg.org</a>.""",
|
|
18
|
-
|
|
19
|
-
)
|
|
15
|
+
meta_information=meta_information,
|
|
20
16
|
)
|
|
21
17
|
|
|
22
18
|
|
roboherd/examples/number.py
CHANGED
|
@@ -3,10 +3,7 @@ from urllib.parse import urlparse
|
|
|
3
3
|
|
|
4
4
|
from almabtrieb import Almabtrieb
|
|
5
5
|
|
|
6
|
-
from roboherd
|
|
7
|
-
from roboherd.annotations import PublishObject
|
|
8
|
-
from roboherd.annotations.bovine import ObjectFactory
|
|
9
|
-
from roboherd.cow.types import Information
|
|
6
|
+
from roboherd import RoboCow, PublishObject, ObjectFactory
|
|
10
7
|
from .meta import meta_information
|
|
11
8
|
|
|
12
9
|
|
|
@@ -14,14 +11,12 @@ def hostname(actor_id):
|
|
|
14
11
|
return urlparse(actor_id).netloc
|
|
15
12
|
|
|
16
13
|
|
|
17
|
-
bot = RoboCow(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
description="""<p>I'm a bot by Helge. I post a random number every hour. When posting an even number, I change my Fediverse handle to even. When posting an odd one, I use odd.</p>
|
|
14
|
+
bot = RoboCow.create(
|
|
15
|
+
handle="even",
|
|
16
|
+
description="""<p>I'm a bot by Helge. I post a random number every hour. When posting an even number, I change my Fediverse handle to even. When posting an odd one, I use odd.</p>
|
|
21
17
|
|
|
22
18
|
<p>I also update my name. I'm not sure how you should display my handle with your Fediverse application. Please write a FEP explaining it.</p>""",
|
|
23
|
-
|
|
24
|
-
)
|
|
19
|
+
meta_information=meta_information,
|
|
25
20
|
)
|
|
26
21
|
|
|
27
22
|
|
roboherd/examples/rooster.py
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
from roboherd
|
|
2
|
-
from roboherd.cow.types import Information
|
|
3
|
-
|
|
4
|
-
from roboherd.annotations import PublishObject
|
|
5
|
-
from roboherd.annotations.bovine import ObjectFactory
|
|
1
|
+
from roboherd import RoboCow, PublishObject, ObjectFactory
|
|
6
2
|
|
|
7
3
|
from .meta import meta_information
|
|
8
4
|
|
|
9
|
-
bot = RoboCow(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
meta_information=meta_information,
|
|
14
|
-
)
|
|
5
|
+
bot = RoboCow.create(
|
|
6
|
+
handle="rooster",
|
|
7
|
+
name="The crowing rooster 🐓",
|
|
8
|
+
meta_information=meta_information,
|
|
15
9
|
)
|
|
16
10
|
|
|
17
11
|
|
roboherd/examples/scarecrow.py
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
from roboherd
|
|
2
|
-
from roboherd.cow.types import Information
|
|
1
|
+
from roboherd import RoboCow, MarkdownPoster
|
|
3
2
|
|
|
4
|
-
from roboherd
|
|
5
|
-
from roboherd.annotations.bovine import ObjectFactory
|
|
3
|
+
# from roboherd import PublishObject, ObjectFactory
|
|
6
4
|
|
|
7
5
|
from .meta import meta_information
|
|
8
6
|
|
|
9
|
-
bot = RoboCow(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
meta_information=meta_information,
|
|
15
|
-
)
|
|
7
|
+
bot = RoboCow.create(
|
|
8
|
+
name="The scare crow 👩🌾",
|
|
9
|
+
description="""On startup I scare crows""",
|
|
10
|
+
handle="scarecrow",
|
|
11
|
+
meta_information=meta_information,
|
|
16
12
|
)
|
|
17
13
|
|
|
18
14
|
|
|
19
|
-
@bot.startup
|
|
20
|
-
async def startup(publish_object: PublishObject, object_factory: ObjectFactory):
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
# @bot.startup
|
|
16
|
+
# async def startup(publish_object: PublishObject, object_factory: ObjectFactory):
|
|
17
|
+
# note = object_factory.note(content="Booo! 🐦").as_public().build() # type: ignore
|
|
18
|
+
# await publish_object(note)
|
|
23
19
|
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
@bot.startup
|
|
22
|
+
async def startup(poster: MarkdownPoster):
|
|
23
|
+
await poster("__Booo!__ 🐦")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
roboherd/__init__.py,sha256=
|
|
1
|
+
roboherd/__init__.py,sha256=E89YtYyL77iJDJJkHS4Pn0JdTbmkmQS7Cp_XPqpRgx8,533
|
|
2
2
|
roboherd/__main__.py,sha256=cY4f-39QCDhStJ4gDuuSz46RDFE_AKnu08sTCpQEEV4,2933
|
|
3
3
|
roboherd/register.py,sha256=Gqa5aT2supVJMj7z21btMYRma3_WW0oK5gjZftr048s,976
|
|
4
4
|
roboherd/test_validators.py,sha256=UiFgJkutmXBLjGpdLP2IBYCEf75quwnRHX7Z51G8Xqo,222
|
|
@@ -7,7 +7,7 @@ roboherd/validators.py,sha256=2mc43ZGwFazp4f3B9J4RxZCU4Y_ErSNotib8MnYVtmY,140
|
|
|
7
7
|
roboherd/annotations/__init__.py,sha256=BrP5UWiVnh8FwmHc6wEY3G69BStidGUpF8uP4Ea5-dg,1140
|
|
8
8
|
roboherd/annotations/bovine.py,sha256=cFLUSFzTulikNjZb1lLq5v4tGjL1i7_dR3H6wimegCg,2322
|
|
9
9
|
roboherd/annotations/common.py,sha256=n5rm8WTgsg116RczKdzm_VoPg1mBk_IMf2V7l8UgWKQ,1351
|
|
10
|
-
roboherd/cow/__init__.py,sha256=
|
|
10
|
+
roboherd/cow/__init__.py,sha256=y9NrhXf5ivjfwWBYCqZ0VG1q0gXAYA3_ItfPYWf1qiw,6102
|
|
11
11
|
roboherd/cow/const.py,sha256=fj5nUJUIlcpr1AU2Ur55ToR7iVmYv4UnfdxiQwguv-k,166
|
|
12
12
|
roboherd/cow/handlers.py,sha256=k5Tc1M--wqmZ2EZvzIfID4dp8XE0rN18puMTKkNVjjE,1491
|
|
13
13
|
roboherd/cow/profile.py,sha256=ldeYq50lh97dl50QjOZiGopEbXtCoEsE5QJoXB5XUYU,3330
|
|
@@ -18,13 +18,13 @@ roboherd/cow/test_util.py,sha256=8FLRtVdSMmIo6NSpCpB9mS0PwOCpGgUeDAA1q6Gv0P4,430
|
|
|
18
18
|
roboherd/cow/types.py,sha256=TGXTcPuND7xMly3xFXZyIR7UE3XWyF_MLRuBHWKoFEE,1925
|
|
19
19
|
roboherd/cow/util.py,sha256=ASQn7AnSl5lskECqCyqOKn5BYC8yOces4FK3uNV8010,534
|
|
20
20
|
roboherd/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
roboherd/examples/dev_null.py,sha256=
|
|
22
|
-
roboherd/examples/json_echo.py,sha256=
|
|
21
|
+
roboherd/examples/dev_null.py,sha256=P2_tVh5Y6Cm7A0FQzX7lRaBlXZZqBsia89Jnoa-s5ek,217
|
|
22
|
+
roboherd/examples/json_echo.py,sha256=TB7sdshsTj7KKOxIc1DzkGeacA9JmIOhNOHwGzyRrVY,1208
|
|
23
23
|
roboherd/examples/meta.py,sha256=tFhHe-DJn2J13Mm22f-gFm5I8_3uQwLU4mAkrK2xzEM,170
|
|
24
|
-
roboherd/examples/moocow.py,sha256=
|
|
25
|
-
roboherd/examples/number.py,sha256=
|
|
26
|
-
roboherd/examples/rooster.py,sha256=
|
|
27
|
-
roboherd/examples/scarecrow.py,sha256=
|
|
24
|
+
roboherd/examples/moocow.py,sha256=2bZ8oZOpysuf7l3DP3zM4YiaALQHFbWpbP3h_Xlok6E,974
|
|
25
|
+
roboherd/examples/number.py,sha256=c4zALxrKR5POuAUTmzAF4wHVgXMPfrP736N7dgn4xzo,1845
|
|
26
|
+
roboherd/examples/rooster.py,sha256=E-bqm8AKy_EOzptaH6xrlc5eDE8o9SBhfdNqHpEhUb4,437
|
|
27
|
+
roboherd/examples/scarecrow.py,sha256=jUnBaDJ2w9LQNIJAAfA53oJyRvKPJoKHtvHbeW-Pex0,626
|
|
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.7.dist-info/METADATA,sha256=P95nbFNriZRL6yiODXxuMas9mOQjk8i8PrWYEukG2ug,1007
|
|
42
|
+
roboherd-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
43
|
+
roboherd-0.1.7.dist-info/entry_points.txt,sha256=WebdVUmh8Ot-FupKJY6Du8LuFbmezt9yoy2UICqV3bE,52
|
|
44
|
+
roboherd-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|