Skip to content

Commit

Permalink
Test branch for PR 221
Browse files Browse the repository at this point in the history
  • Loading branch information
trunk-io[bot] authored Jul 26, 2023
2 parents a3c7075 + 75f7cd2 commit abb9972
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .trunk/configs/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"openmm",
"equi",
"Navid",
"ipykernel"
"ipykernel",
"levelname"
]
}
27 changes: 27 additions & 0 deletions src/cript/api/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import json
import logging
import os
import uuid
import warnings
Expand Down Expand Up @@ -52,8 +53,28 @@ class API:
"""
## Definition
API Client class to communicate with the CRIPT API
Attributes
----------
verbose : bool
A boolean flag that controls whether verbose logging is enabled or not.
When `verbose` is set to `True`, the class will provide additional detailed logging
to the terminal. This can be useful for debugging and understanding the internal
workings of the class.
When `verbose` is set to `False`, the class will only provide essential and concise
logging information, making the terminal output less cluttered and more user-friendly.
```python
# turn off the terminal logs
api.verbose = False
```
"""

# dictates whether the user wants to see terminal log statements or not
verbose: bool = True

_host: str = ""
_api_token: str = ""
_storage_token: str = ""
Expand Down Expand Up @@ -490,6 +511,12 @@ def _is_node_schema_valid(self, node_json: str, is_patch: bool = False) -> bool:
else:
raise CRIPTJsonNodeError(node_list, str(node_list))

if self.verbose:
# logging out info to the terminal for the user feedback
# (improve UX because the program is currently slow)
logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO)
logging.info(f"Validating {node_type} graph...")

# set the schema to test against http POST or PATCH of DB Schema
schema_http_method: str

Expand Down

0 comments on commit abb9972

Please sign in to comment.