docs: some documentation/thoughts on properly implementing overlay packages

This commit is contained in:
Dima Gerasimov 2023-12-20 02:06:41 +00:00 committed by karlicoss
parent 224ba521e3
commit 84d835962d
12 changed files with 237 additions and 0 deletions

View file

@ -0,0 +1,7 @@
print(f'[main] {__name__} hello')
from .common import merge
def tweets() -> list[str]:
from . import gdpr
return merge(gdpr)

View 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))

View 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