Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc/improvement #137

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,6 @@ valid-metaclass-classmethod-first-arg=mcs

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=StandardError,
Exception,
BaseException
overgeneral-exceptions=builtins.StandardError,
builtins.Exception,
builtins.BaseException
4 changes: 2 additions & 2 deletions src/dfcx_scrapi/core/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ def restore_agent(self, agent_id: str, gcs_bucket_uri: str) -> str:
Args:
agent_id: CX Agent ID string in the following format
projects/<PROJECT ID>/locations/<LOCATION ID>/agents/<AGENT ID>
gcs_bucket_uri: The Google Cloud Storage bucket/filepath to export the
agent to in the following format:
gcs_bucket_uri: The Google Cloud Storage bucket/filepath to restore
the agent from in the following format:
`gs://<bucket-name>/<object-name>`

Returns:
Expand Down
2 changes: 1 addition & 1 deletion src/dfcx_scrapi/core/changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def changelogs_to_dataframe(
],
)

df = df.append(log_data)
df = pd.concat([df, log_data], ignore_index=True)

df = df.reset_index(drop=True)

Expand Down
2 changes: 1 addition & 1 deletion src/dfcx_scrapi/core/entity_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def update_entity_type(

@scrapi_base.api_call_counter_decorator
def delete_entity_type(self, entity_id: str = None, obj=None) -> None:
"""Deletes a single Entity Type resouce object.
"""Deletes a single Entity Type resource object.

Args:
entity_id: the formatted CX Entity ID to delete
Expand Down
34 changes: 10 additions & 24 deletions src/dfcx_scrapi/tools/copy_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,36 +134,22 @@ def _convert_entry_webhooks(page_object, webhooks_map):
def __convert_tr_target_page(
trans_route, pages_map, convert_type=None, flows_map=None, flow=None
):
special_pages = [
"END_FLOW", "END_SESSION",
"CURRENT_PAGE", "PREVIOUS_PAGE", "START_PAGE"
]

if convert_type == "source":
if trans_route.target_page.split("/")[-1] == "END_FLOW":
trans_route.target_page = "END_FLOW"
elif trans_route.target_page.split("/")[-1] == "END_SESSION":
trans_route.target_page = "END_SESSION"
elif trans_route.target_page.split("/")[-1] == "CURRENT_PAGE":
trans_route.target_page = "CURRENT_PAGE"
elif trans_route.target_page.split("/")[-1] == "PREVIOUS_PAGE":
trans_route.target_page = "PREVIOUS_PAGE"
elif trans_route.target_page.split("/")[-1] == "START_PAGE":
trans_route.target_page = "START_PAGE"
last_part = trans_route.target_page.split("/")[-1]
if last_part in special_pages:
trans_route.target_page = last_part
else:
trans_route.target_page = pages_map[trans_route.target_page]

elif convert_type == "destination":
if trans_route.target_page == "END_FLOW":
trans_route.target_page = flows_map[flow] + "/pages/END_FLOW"
elif trans_route.target_page == "END_SESSION":
trans_route.target_page = flows_map[flow] + "/pages/END_SESSION"
elif trans_route.target_page == "CURRENT_PAGE":
trans_route.target_page = (
flows_map[flow] + "/pages/CURRENT_PAGE"
)
elif trans_route.target_page == "PREVIOUS_PAGE":
trans_route.target_page = (
flows_map[flow] + "/pages/PREVIOUS_PAGE"
)
elif trans_route.target_page == "START_PAGE":
trans_route.target_page = flows_map[flow] + "/pages/START_PAGE"
if trans_route.target_page in special_pages:
new_page = f"{flows_map[flow]}/pages/{trans_route.target_page}"
trans_route.target_page = new_page
else:
trans_route.target_page = pages_map[trans_route.target_page]

Expand Down