general: minor cleanup
- get rid of unnecessary globs in get_files (they should be in config if the user wishes) - get rid of some old kython imports - do not convert Path twice in foursquare (so CPath works correctly)
This commit is contained in:
parent
5799c062a5
commit
2025d7ad1a
10 changed files with 20 additions and 58 deletions
|
@ -6,18 +6,14 @@ from typing import NamedTuple
|
|||
import json
|
||||
from typing import Dict, Iterator
|
||||
|
||||
from ..core import get_files, Res, unwrap
|
||||
from ..core import get_files, Res, unwrap, Json
|
||||
from ..core.compat import cached_property
|
||||
from ..core.error import Res, unwrap
|
||||
|
||||
# TODO get rid of fget?
|
||||
from kython import fget
|
||||
from ..core.konsume import zoom, wrap, ignore
|
||||
|
||||
|
||||
# TODO json type??
|
||||
def _get_latest() -> Dict:
|
||||
pp = max(get_files(config.export_path, glob='*.json'))
|
||||
def _get_latest() -> Json:
|
||||
pp = max(get_files(config.export_path))
|
||||
return json.loads(pp.read_text())
|
||||
|
||||
|
||||
|
@ -82,21 +78,5 @@ def iter_data() -> Iterator[Res[Competition]]:
|
|||
|
||||
|
||||
def get_data():
|
||||
return list(sorted(iter_data(), key=fget(Competition.when)))
|
||||
return list(sorted(iter_data(), key=Competition.when.fget))
|
||||
|
||||
|
||||
def test():
|
||||
assert len(get_data()) > 10
|
||||
|
||||
def main():
|
||||
for d in iter_data():
|
||||
try:
|
||||
d = unwrap(d)
|
||||
except Exception as e:
|
||||
print(f'ERROR! {d}')
|
||||
else:
|
||||
print(d.summary)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue