docs: some documentation/thoughts on properly implementing overlay packages
This commit is contained in:
parent
224ba521e3
commit
84d835962d
12 changed files with 237 additions and 0 deletions
0
doc/overlays/main/src/my/py.typed
Normal file
0
doc/overlays/main/src/my/py.typed
Normal file
11
doc/overlays/main/src/my/reddit.py
Normal file
11
doc/overlays/main/src/my/reddit.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
print(f'[main] {__name__} hello')
|
||||
|
||||
|
||||
def upvotes() -> list[str]:
|
||||
return [
|
||||
'reddit upvote1',
|
||||
'reddit upvote2',
|
||||
]
|
||||
|
||||
|
||||
trigger_mypy_error: str = 123
|
7
doc/overlays/main/src/my/twitter/all.py
Normal file
7
doc/overlays/main/src/my/twitter/all.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
print(f'[main] {__name__} hello')
|
||||
|
||||
from .common import merge
|
||||
|
||||
def tweets() -> list[str]:
|
||||
from . import gdpr
|
||||
return merge(gdpr)
|
11
doc/overlays/main/src/my/twitter/common.py
Normal file
11
doc/overlays/main/src/my/twitter/common.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
print(f'[main] {__name__} hello')
|
||||
|
||||
from typing import Protocol
|
||||
|
||||
class Source(Protocol):
|
||||
def tweets(self) -> list[str]:
|
||||
...
|
||||
|
||||
def merge(*sources: Source) -> list[str]:
|
||||
from itertools import chain
|
||||
return list(chain.from_iterable(src.tweets() for src in sources))
|
9
doc/overlays/main/src/my/twitter/gdpr.py
Normal file
9
doc/overlays/main/src/my/twitter/gdpr.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
print(f'[main] {__name__} hello')
|
||||
|
||||
def tweets() -> list[str]:
|
||||
return [
|
||||
'gdpr tweet 1',
|
||||
'gdpr tweet 2',
|
||||
]
|
||||
|
||||
trigger_mypy_error: str = 123
|
Loading…
Add table
Add a link
Reference in a new issue