Skip to content

Commit 049e878

Browse files
authored
[pre-commit MyPy] Align the entire repo with MyPy #2 (demisto#29799)
* [pre-commit MyPy] Align the entire repo with MyPy #2 * Add RN * Revert changes in 1.12.26 RN * Update the docker images
1 parent 707e105 commit 049e878

File tree

34 files changed

+231
-196
lines changed

34 files changed

+231
-196
lines changed

.pre-commit-config_template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ repos:
9292
hooks:
9393
- id: mypy
9494
args: [--ignore-missing-imports, --check-untyped-defs, --show-error-codes, --follow-imports=silent, --allow-redefinition]
95-
exclude: "test_data|tests_data|.venv|.*_test.py$|infrastructure_tests"
95+
exclude: "test_data|tests_data|.venv|.*_test.py$|infrastructure_tests|.vulture_whitelist.py"
9696

9797
additional_dependencies:
9898
- astor==0.8.1 ; python_version >= "3.8" and python_version < "3.11"

Packs/AWS_Sagemaker/Integrations/AWSSagemaker/AWSSagemaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def invoke_enpoint(runtime, endpoint_name, payload):
2323

2424
runtime = boto3.Session(aws_access_key_id=aws_access_key_id,
2525
aws_secret_access_key=aws_secret_access_key,
26-
region_name=demisto.params()['AWSRegion']).client('runtime.sagemaker')
26+
region_name=demisto.params()['AWSRegion']).client('runtime.sagemaker') # type: ignore[call-overload]
2727
endpoint_name = demisto.params()['EndpointName']
2828

2929

Packs/AWS_Sagemaker/Integrations/AWSSagemaker/AWSSagemaker.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ commonfields:
44
name: AWS Sagemaker
55
display: AWS Sagemaker
66
category: Data Enrichment & Threat Intelligence
7-
description: AWS Sagemaker - Demisto Phishing Email Classifier
7+
description: AWS Sagemaker - Demisto Phishing Email Classifier.
88
configuration:
99
- display: AWS access key
1010
name: credentials
@@ -45,16 +45,16 @@ script:
4545
- name: predict-phishing
4646
arguments:
4747
- name: inputText
48-
description: The input text (usually email subject + body)
48+
description: The input text (usually email subject + body).
4949
outputs:
5050
- contextPath: DBotPhishingPrediction.Label
51-
description: 'The predicated label: malicious \ other'
51+
description: 'The predicated label: malicious \ other.'
5252
type: string
5353
- contextPath: DBotPhishingPrediction.Probability
54-
description: The predication probability (range 0-1)
54+
description: The predication probability (range 0-1).
5555
type: number
56-
description: Classify input text (usually email content)
57-
dockerimage: demisto/boto3py3:1.0.0.38849
56+
description: Classify input text (usually email content).
57+
dockerimage: demisto/boto3py3:1.0.0.75596
5858
tests:
5959
- Test Sagemaker
6060
fromversion: 5.0.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### AWS Sagemaker
5+
6+
Updated the Docker image to: *demisto/boto3py3:1.0.0.75596*.

Packs/AWS_Sagemaker/pack_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "AWS Sagemaker",
33
"description": "AWS Sagemaker - Demisto Phishing Email Classifier",
44
"support": "xsoar",
5-
"currentVersion": "1.1.3",
5+
"currentVersion": "1.1.4",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Packs/ApiModules/Scripts/AWSApiModule/AWSApiModule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def update_config(self):
7171
command_config['connect_timeout'] = connect_timeout
7272
if retries or timeout:
7373
demisto.debug('Merging client config settings: {}'.format(command_config))
74-
self.config = self.config.merge(Config(**command_config))
74+
self.config = self.config.merge(Config(**command_config)) # type: ignore[arg-type]
7575

7676
def aws_session(self, service, region=None, role_arn=None, role_session_name=None, role_session_duration=None,
7777
role_policy=None):

Packs/ApiModules/Scripts/AWSApiModule/AWSApiModule.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ subtype: python3
88
tags:
99
- infra
1010
- server
11-
comment: AWS Client class, provides generic Infrastructure to all AWS integrations
11+
comment: AWS Client class, provides generic Infrastructure to all AWS integrations.
1212
scripttarget: 0
1313
dependson: {}
1414
timeout: 0s
1515
dockerimage: demisto/boto3py3:1.0.0.52713
1616
fromversion: 5.5.0
17-
17+
tests:
18+
- No tests (auto formatted)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Scripts
3+
4+
##### GetDockerImageLatestTag
5+
6+
Updated the Docker image to: *demisto/python3:3.10.13.74666*.

Packs/CommonScripts/Scripts/GetDockerImageLatestTag/GetDockerImageLatestTag.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import re
66
from pkg_resources import parse_version
77

8-
requests.packages.urllib3.disable_warnings()
98

109
ACCEPT_HEADER = {
1110
'Accept': "application/json, "

Packs/CommonScripts/Scripts/GetDockerImageLatestTag/GetDockerImageLatestTag.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ comment: Gets docker image latest tag. Script simulates the docker pull flow but
1010
args:
1111
- name: docker_image
1212
required: true
13-
description: 'Docker image full name with version: For example: demisto/python'
13+
description: 'Docker image full name with version: For example: demisto/python.'
1414
- name: use_system_proxy
1515
auto: PREDEFINED
1616
predefined:
1717
- "yes"
1818
- "no"
19-
description: Use system proxy settings
19+
description: Use system proxy settings.
2020
defaultValue: "yes"
2121
- name: trust_any_certificate
2222
auto: PREDEFINED
2323
predefined:
2424
- "yes"
2525
- "no"
26-
description: Trust any certificate (not secure)
26+
description: Trust any certificate (not secure).
2727
defaultValue: "no"
2828
tests:
2929
- No test - no testplaybook, but unit tests exist
3030
fromversion: 5.0.0
31-
dockerimage: demisto/python3:3.10.6.33415
31+
dockerimage: demisto/python3:3.10.13.74666

Packs/CommonScripts/pack_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Common Scripts",
33
"description": "Frequently used scripts pack.",
44
"support": "xsoar",
5-
"currentVersion": "1.12.27",
5+
"currentVersion": "1.12.28",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Packs/Kenna/Integrations/KennaV2/KennaV2_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from KennaV2 import parse_response, search_vulnerabilities, get_connectors, Client, \
44
search_fixes, search_assets, get_asset_vulnerabilities, get_connector_runs
5-
from Tests_Data.ExpectedResult import VULNERABILITIES_SEARCH_EXPECTED, GET_CONNECTORS_EXPECTED, SEARCH_FIXES_EXPECTED, \
5+
from test_data.ExpectedResult import VULNERABILITIES_SEARCH_EXPECTED, GET_CONNECTORS_EXPECTED, SEARCH_FIXES_EXPECTED, \
66
SEARCH_ASSETS_EXPECTED, GET_ASSETS_VULNERABILITIES_EXPECTED, GET_CONNECTOR_RUNS_EXPECTED
7-
from Tests_Data.RawData import VULNERABILITIES_SEARCH_RESPONSE, GET_CONNECTORS_RESPONSE, SEARCH_FIXES_RESPONSE, \
7+
from test_data.RawData import VULNERABILITIES_SEARCH_RESPONSE, GET_CONNECTORS_RESPONSE, SEARCH_FIXES_RESPONSE, \
88
SEARCH_ASSETS_RESPONSE, GET_ASSETS_VULNERABILITIES_RESPONSE, GET_CONNECTOR_RUNS_RESPONSE
99

1010

Packs/PaloAltoNetworksAutomaticSLR_Community/Integrations/PaloAltoNetworksAutomaticSLRCommunity/PaloAltoNetworksAutomaticSLRCommunity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import urllib3
12
import demistomock as demisto # noqa: F401
23
import xmltodict
34
from CommonServerPython import * # noqa: F401
@@ -508,7 +509,7 @@ def main():
508509
try:
509510

510511
if ngfw_tls_verify is False or csp_tls_verify is False:
511-
requests.packages.urllib3.disable_warnings()
512+
urllib3.disable_warnings()
512513

513514
# Establish PANOS XMLAPI Class Connector
514515
xmlapi = PanOSXMLAPI(ngfw_host, ngfw_port, ngfw_api_key, ngfw_tls_verify, ngfw_timeout, system_proxy,

Packs/PaloAltoNetworksAutomaticSLR_Community/Integrations/PaloAltoNetworksAutomaticSLRCommunity/PaloAltoNetworksAutomaticSLRCommunity.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ commonfields:
44
name: Palo Alto Networks Automatic SLR (Community)
55
display: Palo Alto Networks Automatic SLR
66
category: Utilities
7-
description: Allow XSOAR to automatically generate Security Lifecycle Review's (SLR's)
7+
description: Allow XSOAR to automatically generate Security Lifecycle Review's (SLR's).
88
configuration:
99
- display: Firewall Management FQDN or IP Address
1010
name: ngfw_fqdn_ip
@@ -176,129 +176,129 @@ script:
176176
arguments: []
177177
outputs:
178178
- contextPath: AutoSLR.generate.job_id
179-
description: Job ID of stats_dump.tar.gz generation job
179+
description: Job ID of stats_dump.tar.gz generation job.
180180
type: string
181-
description: Initiates the stats_dump.tar.gz generation job on the target firewall
181+
description: Initiates the stats_dump.tar.gz generation job on the target firewall.
182182
- name: autoslr-ngfw-check
183183
arguments:
184184
- name: job_id
185185
required: true
186-
description: Job ID to check
186+
description: Job ID to check.
187187
outputs:
188188
- contextPath: AutoSLR.generate.job_status
189-
description: Returns true when completed, false is an error occured
189+
description: Returns true when completed, false is an error occured.
190190
type: boolean
191-
description: Checks the status of the stats_dump.tar.gz generation job, returns true when completed
191+
description: Checks the status of the stats_dump.tar.gz generation job, returns true when completed.
192192
- name: autoslr-ngfw-download
193193
arguments:
194194
- name: job_id
195195
required: true
196-
description: Job ID of stats_dump.tar.gz generation task
196+
description: Job ID of stats_dump.tar.gz generation task.
197197
outputs:
198198
- contextPath: AutoSLR.generate.file_name
199-
description: Filename of downloaded file
199+
description: Filename of downloaded file.
200200
type: string
201201
- contextPath: InfoFile.EntryID
202-
description: EntryID of Downloaded File
202+
description: EntryID of Downloaded File.
203203
type: string
204-
description: Downloads the stats_dump.tar.gz from the target firewall
204+
description: Downloads the stats_dump.tar.gz from the target firewall.
205205
- name: autoslr-csp-upload
206206
arguments:
207207
- name: input_file
208-
description: EntryID of the file to upload
208+
description: EntryID of the file to upload.
209209
outputs:
210210
- contextPath: AutoSLR.upload.id
211-
description: SLR Reference ID
211+
description: SLR Reference ID.
212212
type: string
213213
- contextPath: AutoSLR.upload.send_to
214-
description: Email address where the report is being sent to
214+
description: Email address where the report is being sent to.
215215
type: string
216-
description: Uploads the stats_dump.tar.gz to Palo Alto Networks
216+
description: Uploads the stats_dump.tar.gz to Palo Alto Networks.
217217
- name: autoslr-ngfw-system-info
218218
arguments: []
219219
outputs:
220220
- contextPath: AutoSLR.ngfw_system_info.hostname
221-
description: Firewall Hostname
221+
description: Firewall Hostname.
222222
type: string
223223
- contextPath: AutoSLR.ngfw_system_info.serial
224-
description: Firewall Serial Number
224+
description: Firewall Serial Number.
225225
type: string
226226
- contextPath: AutoSLR.ngfw_system_info.software
227-
description: Firewall PANOS Version
227+
description: Firewall PANOS Version.
228228
type: string
229-
description: Retrieve information about the target firewall
229+
description: Retrieve information about the target firewall.
230230
- name: autoslr-dump-params
231231
arguments: []
232232
outputs:
233233
- contextPath: AutoSLR.params.csp_host
234-
description: CSP URL
234+
description: CSP URL.
235235
type: string
236236
- contextPath: AutoSLR.params.csp_proxy
237-
description: Use XSOAR Proxy
237+
description: Use XSOAR Proxy.
238238
type: boolean
239239
- contextPath: AutoSLR.params.csp_timeout
240-
description: Timeout for API Operation
240+
description: Timeout for API Operation.
241241
type: number
242242
- contextPath: AutoSLR.params.csp_tls_verify
243-
description: Enable/Disable TLS Certificate Verification
243+
description: Enable/Disable TLS Certificate Verification.
244244
type: boolean
245245
- contextPath: AutoSLR.params.csp_verbose
246-
description: Enable/Disable Verbose Log Output
246+
description: Enable/Disable Verbose Log Output.
247247
type: boolean
248248
- contextPath: AutoSLR.params.ngfw_host
249-
description: Firewall Management FQDN/IP Address
249+
description: Firewall Management FQDN/IP Address.
250250
type: string
251251
- contextPath: AutoSLR.params.ngfw_port
252-
description: Firewall Management TCP Port
252+
description: Firewall Management TCP Port.
253253
type: number
254254
- contextPath: AutoSLR.params.ngfw_proxy
255-
description: Use XSOAR Proxy
255+
description: Use XSOAR Proxy.
256256
type: boolean
257257
- contextPath: AutoSLR.params.ngfw_timeout
258-
description: Timeout for API Operation
258+
description: Timeout for API Operation.
259259
type: number
260260
- contextPath: AutoSLR.params.ngfw_tls_verify
261-
description: Enable/Disable TLS Certificate Verification
261+
description: Enable/Disable TLS Certificate Verification.
262262
type: boolean
263263
- contextPath: AutoSLR.params.ngfw_verbose
264-
description: Enable/Disable Verbose Log Output
264+
description: Enable/Disable Verbose Log Output.
265265
type: boolean
266266
- contextPath: AutoSLR.params.slr_account_name
267-
description: Customer Name
267+
description: Customer Name.
268268
type: string
269269
- contextPath: AutoSLR.params.slr_country
270-
description: Customer Deployment Country
270+
description: Customer Deployment Country.
271271
type: string
272272
- contextPath: AutoSLR.params.slr_deployment_location
273-
description: Customer Deployment Logical Location
273+
description: Customer Deployment Logical Location.
274274
type: string
275275
- contextPath: AutoSLR.params.slr_geographic_region
276-
description: Customer Deployment Geographic Region
276+
description: Customer Deployment Geographic Region.
277277
type: string
278278
- contextPath: AutoSLR.params.slr_industry
279-
description: Customer Industry
279+
description: Customer Industry.
280280
type: string
281281
- contextPath: AutoSLR.params.slr_language
282-
description: 'Customer Langugage '
282+
description: 'Customer Langugage.'
283283
type: string
284284
- contextPath: AutoSLR.params.slr_prepared_by
285-
description: Person who generated the report (name)
285+
description: Person who generated the report (name).
286286
type: string
287287
- contextPath: AutoSLR.params.slr_requested_by
288-
description: Person who generated the report (email)
288+
description: Person who generated the report (email).
289289
type: string
290290
- contextPath: AutoSLR.params.slr_send_to
291-
description: Email address to send the completed report to
291+
description: Email address to send the completed report to.
292292
type: string
293293
- contextPath: AutoSLR.params.system_proxy
294-
description: Use XSOAR Proxy
294+
description: Use XSOAR Proxy.
295295
type: boolean
296296
- contextPath: AutoSLR.params.system_verbose
297-
description: Enable/Disable Verbose Log Output
297+
description: Enable/Disable Verbose Log Output.
298298
type: boolean
299-
description: This command will dump all the non-sensitive parameters to the context, useful for debugging purposes
299+
description: This command will dump all the non-sensitive parameters to the context, useful for debugging purposes.
300300
execution: true
301-
dockerimage: demisto/xml-feed:1.0.0.29458
301+
dockerimage: demisto/xml-feed:1.0.0.75078
302302
subtype: python3
303303
fromversion: 5.0.0
304304
tests:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Palo Alto Networks Automatic SLR
5+
6+
Updated the Docker image to: *demisto/xml-feed:1.0.0.75078*.

Packs/PaloAltoNetworksAutomaticSLR_Community/pack_metadata.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
"name": "Automatic SLR by Palo Alto Networks",
33
"description": "Automate the generation of Palo Alto Networks Security Lifecycle Reviews (SLR's) using XSOAR.",
44
"support": "community",
5-
"currentVersion": "1.0.2",
5+
"currentVersion": "1.0.3",
66
"author": "Matt Smith",
77
"url": "",
88
"email": "",
99
"created": "2020-11-25T15:05:50Z",
10-
"categories": ["Network Security"],
10+
"categories": [
11+
"Network Security"
12+
],
1113
"tags": [],
1214
"useCases": [],
1315
"keywords": [],

Packs/PerimeterX/Integrations/BotDefender/BotDefender.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
44

5-
# Disable insecure warnings
6-
requests.packages.urllib3.disable_warnings()
75

86
# CONSTANTS
97
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'

0 commit comments

Comments
 (0)