Skip to content

Commit

Permalink
Add convenient utils command to drop all local data
Browse files Browse the repository at this point in the history
Also add some debug and remove some rich handlers.
  • Loading branch information
Carreau committed Sep 22, 2023
1 parent 05f5461 commit f3f7292
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions papyri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ def render(
trio.run(m2, ascii, html, dry_run, sidebar, graph, minify)


@app.command()
def drop():
_intro()
from . import crosslink as cr

cr.drop()


@app.command()
def ascii(name: str):
_intro()
Expand Down
8 changes: 8 additions & 0 deletions papyri/crosslink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import shutil

import json
import logging
import warnings
Expand Down Expand Up @@ -495,6 +497,12 @@ def relink(self) -> None:
)


def drop():
"""remove all ingested files and db"""
print("removing all files...")
shutil.rmtree(ingest_dir)


def main(path, check, *, dummy_progress):
"""
Parameters
Expand Down
2 changes: 1 addition & 1 deletion papyri/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"""


def example1():
def example1(pos, only, /, var, args, *, kwargs, also=None):
"""
first example.
Expand Down
6 changes: 2 additions & 4 deletions papyri/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,7 @@ def filter(self, record):
self.log = logging.getLogger("papyri")
self.log.setLevel("INFO")
formatter = logging.Formatter(FORMAT, datefmt="[%X]")
rich_handler = RichHandler(rich_tracebacks=True)
rich_handler.setLevel(logging.INFO)
rich_handler = RichHandler(rich_tracebacks=False)
rich_handler.setFormatter(formatter)
self.log.addHandler(rich_handler)

Expand Down Expand Up @@ -1951,8 +1950,7 @@ def collect_api_docs(self, root: str, limit_to: List[str]):
failure_collection: Dict[str, List[str]] = defaultdict(lambda: [])

for qa, target_item in collected.items():
# p2.update(taskp, description=qa)
# p2.advance(taskp)
self.log.debug("treating %r", qa)

with error_collector(qa=qa) as ecollector:
item_docstring, arbitrary, api_object = self.helper_1(
Expand Down

0 comments on commit f3f7292

Please sign in to comment.