Rename my_configuration to mycfg for brevity
This commit is contained in:
parent
cd804091c3
commit
066641a4ce
31 changed files with 65 additions and 70 deletions
|
@ -1,13 +1,7 @@
|
|||
# TODO just eval setup file to populate paths etc?
|
||||
# TODO note sure if it would
|
||||
|
||||
# TODO maybe just import everything?
|
||||
# TODO how to make it mypy friendly? maybe defensive import? or mypy config? or interface file?
|
||||
|
||||
try:
|
||||
import my_configuration
|
||||
paths = my_configuration.paths # type: ignore
|
||||
import mycfg
|
||||
except ImportError:
|
||||
import warnings
|
||||
warnings.warn("my_configuration package isn't found! That might result in issues")
|
||||
paths = None # type: ignore
|
||||
warnings.warn("mycfg package isn't found! That might result in issues")
|
||||
|
|
|
@ -14,7 +14,7 @@ from kython import dictify
|
|||
# TODO vendorize in my. pkg? It's quite handy...
|
||||
from kython.klogging import LazyLogger
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
logger = LazyLogger('bluemaestro', level=logging.DEBUG)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from kython import listify
|
|||
from kython.org import parse_org_date
|
||||
from kython.kerror import Res, echain
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
import pandas as pd # type: ignore
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from typing import Callable, Union, List
|
||||
|
||||
from my_configuration import paths
|
||||
from my_configuration.repos.kobuddy.src.kobuddy import *
|
||||
from mycfg import paths
|
||||
from mycfg.repos.kobuddy.src.kobuddy import *
|
||||
|
||||
set_databases(paths.kobuddy.export_dir)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import re
|
|||
from typing import Tuple, Iterator, List, Union
|
||||
|
||||
|
||||
from my_configuration.holidays_data import HOLIDAYS_DATA
|
||||
from mycfg.holidays_data import HOLIDAYS_DATA
|
||||
|
||||
|
||||
# pip3 install workalendar
|
||||
|
|
|
@ -8,8 +8,8 @@ import pytz
|
|||
|
||||
from ..common import get_files
|
||||
|
||||
from my_configuration import paths
|
||||
import my_configuration.repos.ghexport.model as ghexport
|
||||
from mycfg import paths
|
||||
import mycfg.repos.ghexport.model as ghexport
|
||||
|
||||
|
||||
def get_logger():
|
||||
|
|
|
@ -3,8 +3,8 @@ from shutil import rmtree
|
|||
from tempfile import TemporaryDirectory
|
||||
from typing import Iterator, Union
|
||||
|
||||
import my_configuration.repos.fbmessengerexport.model as messenger
|
||||
from my_configuration import paths
|
||||
import mycfg.repos.fbmessengerexport.model as messenger
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
def _dump_helper(model: messenger.Model, tdir: Path) -> None:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from . import paths
|
||||
from .common import listify
|
||||
from ._rss import Subscription
|
||||
|
||||
from mycfg import paths
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from . import paths
|
||||
from .common import listify
|
||||
from ._rss import Subscription
|
||||
|
||||
from mycfg import paths
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
|
|
|
@ -22,7 +22,7 @@ def get_logger():
|
|||
|
||||
|
||||
def _get_exports() -> List[Path]:
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
return get_files(paths.foursquare.export_path, '*.json')
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ from .common import group_by_key, the, cproperty, PathIsh, import_file
|
|||
|
||||
|
||||
try:
|
||||
# TODO might be worth having a special mode for type checking with and without my_configuration?
|
||||
# TODO might be worth having a special mode for type checking with and without mycfg?
|
||||
# TODO could somehow use typing.TYPE_CHECKING for that?
|
||||
import my_configuration.repos.hypexport.model as hypexport
|
||||
import mycfg.repos.hypexport.model as hypexport
|
||||
Highlight = hypexport.Highlight
|
||||
Model = hypexport.Model
|
||||
except:
|
||||
|
@ -26,7 +26,7 @@ class Config(NamedTuple):
|
|||
if ep is not None:
|
||||
return Path(ep)
|
||||
else:
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
return Path(paths.hypothesis.export_path)
|
||||
|
||||
@property
|
||||
|
@ -37,7 +37,7 @@ class Config(NamedTuple):
|
|||
else:
|
||||
global Model
|
||||
global Highlight
|
||||
import my_configuration.repos.hypexport.model as hypexport
|
||||
import mycfg.repos.hypexport.model as hypexport
|
||||
# TODO a bit hacky.. not sure how to make it both mypy and runtime safe..
|
||||
Model = hypexport.Model
|
||||
Highlight = hypexport.Highlight
|
||||
|
@ -52,7 +52,7 @@ def configure(*, export_path: Optional[PathIsh]=None, hypexport_path: Optional[P
|
|||
hypexport_path_=hypexport_path,
|
||||
)
|
||||
|
||||
# TODO for the purposes of mypy, try importing my_configuration anyway?
|
||||
# TODO for the purposes of mypy, try importing mycfg anyway?
|
||||
# return type for this method as well
|
||||
# TODO check if it works at runtime..
|
||||
def get_model() -> Model:
|
||||
|
|
|
@ -3,7 +3,7 @@ Uses instapaper API data export JSON file.
|
|||
|
||||
Set via
|
||||
- ~configure~ method
|
||||
- or in ~my_configuration.instpaper.export_path~
|
||||
- or in ~mycfg.instpaper.export_path~
|
||||
|
||||
TODO upload my exporter script to github..
|
||||
"""
|
||||
|
@ -29,8 +29,8 @@ def _get_files():
|
|||
# TODO use helper method from common to get json[s]?
|
||||
export_path = _export_path
|
||||
if export_path is None:
|
||||
# fallback to my_configuration
|
||||
# TODO import my_configuration?
|
||||
# fallback to mycfg
|
||||
# TODO import mycfg?
|
||||
from . import paths
|
||||
export_path = paths.instapaper.export_path
|
||||
return list(sorted(Path(export_path).glob('*.json')))
|
||||
|
|
|
@ -7,7 +7,7 @@ from pathlib import Path
|
|||
import logging
|
||||
import pytz
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
BDIR = paths.jawbone.export_dir
|
||||
|
|
|
@ -87,7 +87,7 @@ def iter_useful(data_file: str):
|
|||
|
||||
# TODO <<< hmm. these files do contain deep and light sleep??
|
||||
# also steps stats??
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
p = paths.jawbone.export_dir / 'old_csv'
|
||||
# TODO with_my?
|
||||
|
|
|
@ -7,7 +7,7 @@ import json
|
|||
|
||||
import pytz
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
# TODO Json type?
|
||||
# TODO memoised properties?
|
||||
|
|
|
@ -6,8 +6,7 @@ from typing import Iterator, List, NamedTuple
|
|||
|
||||
from ..common import get_files
|
||||
|
||||
# TODO eh. rename to my_cfg? easier to type
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
def _get_last():
|
||||
return max(get_files(paths.imdb.export_path, glob='*.csv'))
|
||||
|
|
|
@ -8,7 +8,7 @@ from kython.kompress import open as kopen
|
|||
|
||||
from ..common import get_files
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
def _get_last_takeout():
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
from . import paths
|
||||
from .common import import_file
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# path to pdfannots (https://github.com/0xabu/pdfannots)
|
||||
pdfannots = import_file(paths.pdfs.pdfannots_py)
|
||||
import mycfg.repos.pdfannots.pdfannots as pdfannots
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
|
|
|
@ -41,7 +41,7 @@ class Article(NamedTuple):
|
|||
# TODO add tags?
|
||||
|
||||
|
||||
# TODO integrate with my_configuration
|
||||
# TODO integrate with mycfg
|
||||
def get_articles(json_path: Path) -> Sequence[Article]:
|
||||
import json
|
||||
raw = json.loads(json_path.read_text())['list']
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from pathlib import Path, PosixPath
|
||||
from typing import List, Sequence, Mapping
|
||||
|
||||
from my_configuration import paths
|
||||
import my_configuration.repos.rexport.model as rexport
|
||||
from mycfg import paths
|
||||
import mycfg.repos.rexport.model as rexport
|
||||
|
||||
|
||||
# TODO Move this to kython.kompress?
|
||||
|
|
|
@ -9,7 +9,7 @@ from .common import get_files
|
|||
# TODO get rid of it
|
||||
from kython import group_by_cmp # type: ignore
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
def get_logger():
|
||||
|
@ -17,11 +17,11 @@ def get_logger():
|
|||
|
||||
|
||||
def _get_exports() -> List[Path]:
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
return get_files(paths.rescuetime.export_path, '*.json')
|
||||
|
||||
|
||||
import my_configuration.repos.rescuexport.model as rescuexport
|
||||
import mycfg.repos.rescuexport.model as rescuexport
|
||||
Model = rescuexport.Model
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ See https://help.twitter.com/en/managing-your-account/how-to-download-your-twitt
|
|||
|
||||
Expects path to be set
|
||||
- via ~configure~ (before calling anything else)
|
||||
- or in ~my_configuration.twitter.export_path~
|
||||
- or in ~mycfg.twitter.export_path~
|
||||
"""
|
||||
|
||||
|
||||
|
@ -30,8 +30,8 @@ def configure(*, export_path: Optional[PathIsh]=None) -> None:
|
|||
def _get_export() -> Path:
|
||||
export_path = _export_path
|
||||
if export_path is None:
|
||||
# fallback to my_configuration
|
||||
from . import paths
|
||||
# fallback to mycfg
|
||||
from mycfg import paths
|
||||
export_path = paths.twitter.export_path
|
||||
p = Path(export_path)
|
||||
if p.is_dir():
|
||||
|
|
2
my/vk.py
2
my/vk.py
|
@ -2,7 +2,7 @@ from datetime import datetime
|
|||
import json
|
||||
from typing import NamedTuple, Iterator, Dict, Union, Sequence, Optional
|
||||
|
||||
from my_configuration import paths
|
||||
from mycfg import paths
|
||||
|
||||
|
||||
class Favorite(NamedTuple):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue