Skip to content

Commit

Permalink
Merge pull request #334 from C-Accel-CRIPT/develop
Browse files Browse the repository at this point in the history
Hot Fix: MKDocs build documentation workflow Permissions Issue
  • Loading branch information
nh916 authored Sep 12, 2023
2 parents 12dd385 + 5a41a78 commit 8a3aba2
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 82 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build_and_deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# build docs from master branch and push to gh-pages branch to be deployed to repository GitHub pages
# build docs from main branch and push to gh-pages branch to be deployed to repository GitHub pages
name: Build & Deploy Docs
permissions: read-all

# trunk-ignore(checkov/CKV2_GHA_1)
permissions: write-all

on:
push:
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/dependency-review.yml

This file was deleted.

114 changes: 70 additions & 44 deletions src/cript/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,50 +958,50 @@ def search(
Examples
--------
### Search by Node Type
```python
materials_paginator = cript_api.search(
node_type=cript.Material,
search_mode=cript.SearchModes.NODE_TYPE,
value_to_search=None
)
```
### Search by Contains name
```python
contains_name_paginator = cript_api.search(
node_type=cript.Process,
search_mode=cript.SearchModes.CONTAINS_NAME,
value_to_search="poly"
)
```
### Search by Exact Name
```python
exact_name_paginator = cript_api.search(
node_type=cript.Project,
search_mode=cript.SearchModes.EXACT_NAME,
value_to_search="Sodium polystyrene sulfonate"
)
```
### Search by UUID
```python
uuid_paginator = cript_api.search(
node_type=cript.Collection,
search_mode=cript.SearchModes.UUID,
value_to_search="75fd3ee5-48c2-4fc7-8d0b-842f4fc812b7"
)
```
### Search by BigSmiles
```python
paginator = cript_api.search(
node_type=cript.Material,
search_mode=cript.SearchModes.BIGSMILES,
value_to_search="{[][$]CC(C)(C(=O)OCCCC)[$][]}"
)
```
???+ Example "Search by Node Type"
```python
materials_paginator = cript_api.search(
node_type=cript.Material,
search_mode=cript.SearchModes.NODE_TYPE,
value_to_search=None
)
```
??? Example "Search by Contains name"
```python
contains_name_paginator = cript_api.search(
node_type=cript.Process,
search_mode=cript.SearchModes.CONTAINS_NAME,
value_to_search="poly"
)
```
??? Example "Search by Exact Name"
```python
exact_name_paginator = cript_api.search(
node_type=cript.Project,
search_mode=cript.SearchModes.EXACT_NAME,
value_to_search="Sodium polystyrene sulfonate"
)
```
??? Example "Search by UUID"
```python
uuid_paginator = cript_api.search(
node_type=cript.Collection,
search_mode=cript.SearchModes.UUID,
value_to_search="75fd3ee5-48c2-4fc7-8d0b-842f4fc812b7"
)
```
??? Example "Search by BigSmiles"
```python
paginator = cript_api.search(
node_type=cript.Material,
search_mode=cript.SearchModes.BIGSMILES,
value_to_search="{[][$]CC(C)(C(=O)OCCCC)[$][]}"
)
```
Parameters
----------
Expand All @@ -1018,6 +1018,32 @@ def search(
-------
Paginator
paginator object for the user to use to flip through pages of search results
Notes
-----
To learn more about working with pagination, please refer to our
[paginator object documentation](../paginator).
Additionally, you can utilize the utility function [`load_nodes_from_json(node_json)`](../../utility_functions/#cript.nodes.util.load_nodes_from_json)
to convert API JSON responses into Python SDK nodes.
???+ Example "Convert API JSON Response to Python SDK Nodes"
```python
# Get updated project from API
my_paginator = api.search(
node_type=cript.Project,
search_mode=cript.SearchModes.EXACT_NAME,
value_to_search="my project name",
)
# Take specific Project you want from paginator
my_project_from_api_dict: dict = my_paginator.current_page_results[0]
# Deserialize your Project dict into a Project node
my_project_node_from_api = cript.load_nodes_from_json(
nodes_json=json.dumps(my_project_from_api_dict)
)
```
"""

# get node typ from class
Expand Down
3 changes: 3 additions & 0 deletions src/cript/api/valid_search_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class SearchModes(Enum):
value_to_search=None,
)
```
For more details and code examples,
please check the [cript.API.search( ) method](../api/#cript.api.api.API.search)
"""

NODE_TYPE: str = ""
Expand Down
16 changes: 9 additions & 7 deletions src/cript/nodes/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,20 @@ def load_nodes_from_json(nodes_json: str):
Examples
--------
```python
# get project node from API
my_paginator = cript_api.search(
# Get updated project from API
my_paginator = api.search(
node_type=cript.Project,
search_mode=cript.SearchModes.EXACT_NAME,
value_to_search=project_node.name
value_to_search="my project name",
)
# get the project from paginator
my_project_from_api_dict = my_paginator.current_page_results[0]
# Take specific Project you want from paginator
my_project_from_api_dict: dict = my_paginator.current_page_results[0]
# convert API JSON to CRIPT Project node
my_project_from_api = cript.load_nodes_from_json(json.dumps(my_project_from_api_dict))
# Deserialize your Project dict into a Project node
my_project_node_from_api = cript.load_nodes_from_json(
nodes_json=json.dumps(my_project_from_api_dict)
)
```
Raises
Expand Down

0 comments on commit 8a3aba2

Please sign in to comment.