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

ruff format content files (34) #39241

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions Packs/CaseManagement-Generic/ReleaseNotes/1_4_11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

#### Scripts

##### CaseMgmtResponseProcess

- Metadata and documentation improvements.
##### CaseMgmtAnalystTools

- Metadata and documentation improvements.
##### TimersOnOwnerChange

- Metadata and documentation improvements.
##### CompleteTaskOnTimerBreach

- Metadata and documentation improvements.
##### CaseMgmtDisplayLabels

- Metadata and documentation improvements.
##### CaseMgmtIncidentTypesByRole

- Metadata and documentation improvements.
##### CloseLinkedIncidentsPostProcessing

- Metadata and documentation improvements.
##### CaseMgmtIncidentTypesDisplay

- Metadata and documentation improvements.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401


# requires an XSOAR list that contains a markdown table with links to important Analyst Tools (wikis, google, etc)

# get the Case Management Analyst Tools list
tools = demisto.executeCommand("getList", {"listName": "Case Management Analyst Tools"})[0]['Contents']
tools = demisto.executeCommand("getList", {"listName": "Case Management Analyst Tools"})[0]["Contents"]

# default tools, if the above list does not exist.
default_tools = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

def main():
try:
labels = demisto.incident().get('labels', [])
labels = demisto.incident().get("labels", [])
if labels:
readable = tableToMarkdown("Alert Information", labels)
else:
readable = "No labels found on Incident"

return_results(CommandResults(readable_output=readable, ignore_auto_extract=True))
except Exception as ex:
return_results(f'Failed to execute BaseScript. Error: {str(ex)}')
return_results(f"Failed to execute BaseScript. Error: {ex!s}")


if __name__ in ('__main__', '__builtin__', 'builtins'):
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401


# check if this is a new Incident or not
incident = demisto.incident().get("id")

# if new Incident, the ID will be empty:
if not incident:

# get the XSOAR IncidentTypesRBAC XSOAR List
types_list = demisto.executeCommand("getList", {"listName": "IncidentTypesRBAC"})[0]["Contents"]

Expand All @@ -34,7 +32,7 @@
# remove duplicates
allowedTypes = list(set(allowedTypes))

demisto.results({'hidden': False, 'options': allowedTypes})
demisto.results({"hidden": False, "options": allowedTypes})
except ValueError:
pass
except Exception:
Expand All @@ -43,4 +41,4 @@
# if it's an existing Incident, prevent changing the type from the UI.
# get the current Incident Type, and only return that type.
incident_type = demisto.incident().get("type")
return_results({'hidden': False, 'options': [incident_type]})
return_results({"hidden": False, "options": [incident_type]})
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401


# check if this is a new Incident or not
incident = demisto.incident().get("id")

# if new Incident, the ID will be empty:
if not incident:

# get the XSOAR IncidentTypesFromList XSOAR List, and split on the comma
types_list = demisto.executeCommand("getList", {"listName": "IncidentTypesFromList"})[0]["Contents"]

Expand All @@ -23,10 +21,10 @@
types_list = [x.strip() for x in types_list]

# return the options to display to the user
return_results({'hidden': False, 'options': types_list})
return_results({"hidden": False, "options": types_list})

# if it's an existing Incident, prevent changing the type from the UI.
else:
# get the current Incident Type, and only return that type.
incident_type = demisto.incident().get("type")
return_results({'hidden': False, 'options': [incident_type]})
return_results({"hidden": False, "options": [incident_type]})
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ def main():

# get the list for the IncidentType
# list name must be formatted as follows: IncidentType Response Process
response_process = demisto.executeCommand("getList", {"listName": f"{incident_type}ResponseProcess"})[0]['Contents']
response_process = demisto.executeCommand("getList", {"listName": f"{incident_type}ResponseProcess"})[0]["Contents"]

# check if the list exists and return it's contents, if not get or create the Default list and return it's contents.
if "Item not found" in response_process:
response_process = demisto.executeCommand("getList", {"listName": default_response_process_list})[0]['Contents']
response_process = demisto.executeCommand("getList", {"listName": default_response_process_list})[0]["Contents"]
if "Item not found" in response_process:
result = CommandResults(readable_output=default_contents, ignore_auto_extract=True)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ def main():
linked_incidents = incident.get("linkedIncidents")

if linked_incidents and not str(close_notes).startswith("Closed from parent Incident"):
demisto.executeCommand("executeCommandAt",
{"command": "closeInvestigation",
"arguments": {
"closeReason": close_reason,
"closeNotes": f"Closed from parent Incident {incident_id}\n"
f"\nClose Notes:\n{close_notes}"},
"incidents": ",".join(linked_incidents)})
demisto.executeCommand(
"executeCommandAt",
{
"command": "closeInvestigation",
"arguments": {
"closeReason": close_reason,
"closeNotes": f"Closed from parent Incident {incident_id}\n\nClose Notes:\n{close_notes}",
},
"incidents": ",".join(linked_incidents),
},
)
demisto.results(f"Closing linked Incidents {','.join(linked_incidents)}")


if __name__ in ('__main__', '__builtin__', 'builtins'):
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from CommonServerPython import * # noqa: F401

# get the incident id.
inc = demisto.incident().get('id')
inc = demisto.incident().get("id")

# execute the taskComplete command on all tasks tagged with timerbreach.
demisto.executeCommand("taskComplete", {"id": "timerbreach", "incidentId": inc})
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401


# This script stops the Time to Assignment timer when an Owner is assigned to an Incident, and starts the Remediation
# SLA Timer.

if not demisto.args().get('old') and demisto.args().get('new'): # If owner was no-one and is now someone:
if not demisto.args().get("old") and demisto.args().get("new"): # If owner was no-one and is now someone:
demisto.executeCommand("stopTimer", {"timerField": "timetoassignment"})
demisto.executeCommand("startTimer", {"timerField": "remediationsla"})
demisto.results(
"Assignment of the incident was successful, Time to Assignment has been stopped, and the Remediation timer has"
" been started!")
" been started!"
)
2 changes: 1 addition & 1 deletion Packs/CaseManagement-Generic/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "CaseManagement-Generic",
"description": "Case Management - Generic\n\nBuilt by the Cortex Customer Success Team to provide quick deployment of Case Management with XSOAR",
"support": "community",
"currentVersion": "1.4.10",
"currentVersion": "1.4.11",
"author": "Cortex XSOAR Customer Success",
"url": "",
"email": "",
Expand Down
Loading
Loading