From 0f0f5269443b91c87ef0ec3635120246f1920b72 Mon Sep 17 00:00:00 2001 From: Milad <63479762+MRyderOC@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:01:18 -0500 Subject: [PATCH 1/4] pylint depracation issue resolved --- .pylintrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index e1ec406e..4a16e611 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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 From f93e5313dc7586926a33742b10d673c6c7912be1 Mon Sep 17 00:00:00 2001 From: Milad <63479762+MRyderOC@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:08:06 -0500 Subject: [PATCH 2/4] more readable code for convert_tr_target_page --- src/dfcx_scrapi/tools/copy_util.py | 34 +++++++++--------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/dfcx_scrapi/tools/copy_util.py b/src/dfcx_scrapi/tools/copy_util.py index 8e97cd14..65498cd8 100644 --- a/src/dfcx_scrapi/tools/copy_util.py +++ b/src/dfcx_scrapi/tools/copy_util.py @@ -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] From 9e090630d0fd18d72b11d0d8fef1a189fa6740fd Mon Sep 17 00:00:00 2001 From: Milad <63479762+MRyderOC@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:17:51 -0500 Subject: [PATCH 3/4] docs fix --- src/dfcx_scrapi/core/agents.py | 4 ++-- src/dfcx_scrapi/core/entity_types.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dfcx_scrapi/core/agents.py b/src/dfcx_scrapi/core/agents.py index 4c8185f0..326e2f17 100644 --- a/src/dfcx_scrapi/core/agents.py +++ b/src/dfcx_scrapi/core/agents.py @@ -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//locations//agents/ - 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:///` Returns: diff --git a/src/dfcx_scrapi/core/entity_types.py b/src/dfcx_scrapi/core/entity_types.py index c805f644..526d840c 100644 --- a/src/dfcx_scrapi/core/entity_types.py +++ b/src/dfcx_scrapi/core/entity_types.py @@ -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 From 89ff59285a8de399a27dcadfb02612fb343d563e Mon Sep 17 00:00:00 2001 From: Milad <63479762+MRyderOC@users.noreply.github.com> Date: Mon, 31 Jul 2023 15:36:00 -0500 Subject: [PATCH 4/4] change df.append to pd.concat due to deprecation warning --- src/dfcx_scrapi/core/changelogs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dfcx_scrapi/core/changelogs.py b/src/dfcx_scrapi/core/changelogs.py index 9e8aedf4..db7ccf55 100644 --- a/src/dfcx_scrapi/core/changelogs.py +++ b/src/dfcx_scrapi/core/changelogs.py @@ -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)