my.stackexchange: use proper pip package, add stat
+ 'anonymous' mode for stat() function
This commit is contained in:
parent
9d39892e75
commit
ddea816a49
6 changed files with 50 additions and 20 deletions
|
@ -51,12 +51,12 @@ def articles() -> Iterable[Article]:
|
|||
yield from _dal().articles()
|
||||
|
||||
|
||||
def stats():
|
||||
from .core import stat, Stats
|
||||
def stats() -> Stats:
|
||||
from itertools import chain
|
||||
from more_itertools import ilen
|
||||
# todo make stats more defensive?
|
||||
return {
|
||||
'articles' : ilen(articles()),
|
||||
**stat(articles),
|
||||
'highlights': ilen(chain.from_iterable(a.highlights for a in articles())),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue