general: cleanup -- remove main and executable bit where it's not necessary

This commit is contained in:
Dima Gerasimov 2022-05-31 20:37:16 +01:00 committed by karlicoss
parent 2025d7ad1a
commit 73e57b52d1
13 changed files with 9 additions and 48 deletions

0
my/bluemaestro.py Executable file → Normal file
View file

8
my/body/blood.py Executable file → Normal file
View file

@ -130,11 +130,3 @@ def stats():
def test():
print(dataframe())
assert len(dataframe()) > 10
def main():
print(data())
if __name__ == '__main__':
main()

3
my/emfit/__init__.py Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""
[[https://shop-eu.emfit.com/products/emfit-qs][Emfit QS]] sleep tracker
@ -29,7 +28,7 @@ def dir_hash(path: Path):
# TODO take __file__ into account somehow?
@mcachew(cache_path=cache_dir() / 'emfit.cache', hashf=lambda: dir_hash(config.export_path), logger=dal.log)
@mcachew(cache_path=cache_dir() / 'emfit.cache', hashf=lambda: dir_hash(config.export_path))
def datas() -> Iterable[Res[Emfit]]:
import dataclasses

0
my/emfit/plot.py Executable file → Normal file
View file

0
my/foursquare.py Executable file → Normal file
View file

1
my/jawbone/__init__.py Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/usr/bin/env python3
from typing import Dict, Any, List, Iterable
import json
from functools import lru_cache

0
my/lastfm.py Executable file → Normal file
View file

View file

@ -38,11 +38,3 @@ def get_movies() -> List[Movie]:
def test():
assert len(get_movies()) > 10
def main():
for movie in get_movies():
print(movie)
if __name__ == '__main__':
main()

0
my/pdfs.py Executable file → Normal file
View file

24
my/polar.py Executable file → Normal file
View file

@ -7,6 +7,7 @@ from typing import cast, TYPE_CHECKING
import my.config
# todo use something similar to tz.via_location for config fallback
if not TYPE_CHECKING:
user_config = getattr(my.config, 'polar', None)
else:
@ -40,9 +41,9 @@ from datetime import datetime
from typing import List, Dict, Iterable, NamedTuple, Sequence, Optional
import json
from .core import LazyLogger, Json
from .core import LazyLogger, Json, Res
from .core.common import isoparse
from .error import Res, echain, sort_res_by
from .core.error import echain, sort_res_by
from .core.konsume import wrap, Zoomable, Wdict
@ -108,7 +109,7 @@ class Loader:
# TODO something nicer?
notes = meta['notes'].zoom()
else:
notes = [] # TODO FIXME dict?
notes = []
comments = list(meta['comments'].zoom().values()) if 'comments' in meta else []
meta['questions'].zoom()
meta['flashcards'].zoom()
@ -191,7 +192,7 @@ class Loader:
)
h.consume()
# TODO FIXME when I add defensive error policy, support it
# TODO when I add defensive error policy, support it
# if len(cmap) > 0:
# raise RuntimeError(f'Unconsumed comments: {cmap}')
# TODO sort by date?
@ -209,10 +210,10 @@ class Loader:
# TODO konsume here as well?
di = j['docInfo']
added = di['added']
filename = di['filename'] # TODO here
filename = di['filename']
title = di.get('title', None)
tags_dict = di['tags']
pm = j['pageMetas'] # TODO FIXME handle this too
pm = j['pageMetas'] # todo handle this too?
# todo defensive?
tags = tuple(t['label'] for t in tags_dict.values())
@ -247,14 +248,5 @@ def get_entries() -> List[Result]:
return list(sort_res_by(iter_entries(), key=lambda e: e.created))
def main():
for e in iter_entries():
if isinstance(e, Exception):
logger.exception(e)
else:
logger.info('processed %s', e.uid)
for i in e.items:
logger.info(i)
## deprecated
Error = Exception # for backwards compat with Orger; can remove later

9
my/reddit/rexport.py Executable file → Normal file
View file

@ -238,12 +238,3 @@ def stats() -> Stats:
**stat(upvoted ),
}
def main() -> None:
for e in events(parallel=False):
print(e)
if __name__ == '__main__':
main()

4
my/rtm.py Executable file → Normal file
View file

@ -114,7 +114,3 @@ def active_tasks() -> Iterator[MyTodo]:
if not t.is_completed():
yield t
def print_all_todos():
for t in all_tasks():
print(t)

0
my/youtube/takeout.py Executable file → Normal file
View file