Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
C0DK committed Jul 4, 2021
1 parent 2fd25b3 commit b8a587b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
7 changes: 7 additions & 0 deletions codoc_views/codoc_base.py
Expand Up @@ -5,6 +5,13 @@
import codoc


@view(
label="Total view",
)
def total_view(graph):
return graph


@view(
label="Module View of the Codoc SDK",
)
Expand Down
7 changes: 7 additions & 0 deletions codoc_views/codoc_domain.py
Expand Up @@ -22,6 +22,13 @@ def domain_model(graph):
return filters.include_only_classes(graph)


@view(
label="Domain Model (total content)",
)
def domain_model_extra(graph):
return filters.get_children_of(codoc.domain.model)(graph)


@view(
label="Domain",
)
Expand Down
16 changes: 10 additions & 6 deletions src/codoc/entrypoints/cli.py
Expand Up @@ -11,6 +11,7 @@
import fire
import sentry_sdk
import logging
import warnings


from codoc.service.finder.config import get_config
Expand Down Expand Up @@ -47,16 +48,19 @@ class CliHandler:
"""

def __init__(
self, path="codoc_views", report_errors=False, silent=False, raise_errors=False
self, path="codoc_views", report_errors=False, verbose=False, raise_errors=False
):
self._path = path

self._raise_errors = raise_errors
if not silent:
logging.basicConfig(
format="%(message)s",
level=logging.INFO,
)
level = logging.DEBUG if verbose else logging.INFO
if not verbose:
warnings.filterwarnings("ignore")

logging.basicConfig(
format="%(message)s",
level=level,
)
self._report_errors = report_errors
if report_errors:
_setup_sentry()
Expand Down
6 changes: 3 additions & 3 deletions src/codoc/service/parsing/dependency.py
Expand Up @@ -185,7 +185,7 @@ def _raise_error(self, error):
if self._strict_mode:
raise error
else:
logger.warning(error)
logger.debug(error)

def get_referenced_identifier_names(self) -> Set[str]:
try:
Expand Down Expand Up @@ -246,15 +246,15 @@ def handle_attribute_error_in_object_inspection(
) -> Optional[ObjectType]:
# Handle special cases - i.e subprocess having OS specific parts
if current_object in [subprocess, os]:
logger.warning(
logger.debug(
f"Could not fetch `{identifier}` in `{current_object}`. Assuming it was OS specific."
)
return current_object
# TODO make faster
if current_object in [
obj for name, obj in inspect.getmembers(builtins)
] or identifier in [name for name, obj in inspect.getmembers(builtins)]:
logger.warning(
logger.debug(
f"Could not fetch `{identifier}` in `{current_object}`. "
"Assuming that you are shadowing a builtin."
)
Expand Down

0 comments on commit b8a587b

Please sign in to comment.