Skip to content

Commit

Permalink
pylint R packs
Browse files Browse the repository at this point in the history
  • Loading branch information
RotemAmit committed Jan 9, 2025
1 parent db8f9db commit d4e5483
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Packs/Reco/Integrations/Reco/Reco.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ def get_link_to_user_overview_page(self, link_type: str, entity_id: str) -> str:
demisto.error(f"Validate API key ReadTimeout error: {str(e)}")
raise e

demisto.info(f"Got link: {link}")
demisto.info(f"Got link: {link}") # pylint: disable=E0606
return link

def add_exclusion_filter(self, key_to_add: str, values_to_add: list[str]):
Expand Down
4 changes: 4 additions & 0 deletions Packs/Reco/ReleaseNotes/1_5_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Integrations

##### Reco
- Code functionality improvements.
2 changes: 1 addition & 1 deletion Packs/Reco/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Reco",
"description": "Reco is an identity-first SaaS security solution that empowers organizations with full visibility into every app, identity, and their actions to seamlessly prioritize and control risks in the SaaS ecosystem",
"support": "partner",
"currentVersion": "1.5.3",
"currentVersion": "1.5.4",
"author": "Reco",
"url": "https://reco.ai",
"email": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@


def format_proxy(addr, username=None, password=None):
protocol = ""
proxy_name = ""
if addr.startswith("http://"):
protocol = addr[:7]
proxy_name = addr[7:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ script:
- contextPath: ReversingLabs.yara_id
description: Identifier of the current set of YARA rules on the TitaniumScale Worker instance.
type: Unknown
dockerimage: demisto/reversinglabs-sdk-py3:2.0.0.98754
dockerimage: demisto/reversinglabs-sdk-py3:2.0.0.1872154
runonce: false
script: '-'
subtype: python3
Expand Down
4 changes: 4 additions & 0 deletions Packs/ReversingLabs_TitaniumScale/ReleaseNotes/1_2_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Integrations
##### ReversingLabs TitaniumScale
- Code functionality improvements.
- Updated the Docker image to *demisto/reversinglabs-sdk-py3:2.0.0.1872154*.
2 changes: 1 addition & 1 deletion Packs/ReversingLabs_TitaniumScale/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ReversingLabs TitaniumScale",
"description": "Extract internal threat indicators with static malware analysis engine. Classify files and determine threat level.",
"support": "partner",
"currentVersion": "1.2.0",
"currentVersion": "1.2.1",
"author": "ReversingLabs",
"url": "https://www.reversinglabs.com/products/malware-threat-hunting-and-investigations",
"email": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from copy import deepcopy

from requests import Response

from CommonServerPython import *
from ReversingLabs.SDK.ticloud import FileReputation, AVScanners, FileAnalysis, RHA1FunctionalSimilarity, \
RHA1Analytics, URIStatistics, URIIndex, AdvancedSearch, ExpressionSearch, FileDownload, FileUpload, \
Expand Down Expand Up @@ -28,6 +31,8 @@


def format_proxy(addr, username=None, password=None):
protocol = ''
proxy_name = ''
if addr.startswith("http://"):
protocol = addr[:7]
proxy_name = addr[7:]
Expand Down Expand Up @@ -1214,6 +1219,8 @@ def certificate_analytics_output(response_json, thumbprint):


def yara_ruleset_command():
response = Response()
output_key = ''
yara = YARAHunting(
host=TICLOUD_URL,
username=USERNAME,
Expand Down Expand Up @@ -1348,6 +1355,8 @@ def yara_matches_feed_output(response_json, time_value):


def yara_retro_actions_command():
response = Response()
output_key = ''
retro = YARARetroHunting(
host=TICLOUD_URL,
username=USERNAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ script:
- contextPath: ReversingLabs.customer_usage_yara
description: Number of active YARA rulesets.
type: Unknown
dockerimage: demisto/reversinglabs-sdk-py3:2.0.0.98754
dockerimage: demisto/reversinglabs-sdk-py3:2.0.0.1872154
runonce: false
script: "-"
subtype: python3
Expand Down
4 changes: 4 additions & 0 deletions Packs/ReversingLabs_Titanium_Cloud/ReleaseNotes/2_6_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Integrations
##### ReversingLabs TitaniumCloud v2
- Code functionality improvements.
- Updated the Docker image to: *demisto/reversinglabs-sdk-py3:2.0.0.1872154*.
2 changes: 1 addition & 1 deletion Packs/ReversingLabs_Titanium_Cloud/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ReversingLabs TitaniumCloud",
"description": "ReversingLabs TitaniumCloud provides file reputation services, threat classification and rich context on over 10 billion files.",
"support": "partner",
"currentVersion": "2.6.0",
"currentVersion": "2.6.1",
"author": "ReversingLabs",
"url": "https://www.reversinglabs.com/products/malware-analysis-platform",
"email": "[email protected]",
Expand Down
54 changes: 28 additions & 26 deletions Packs/Rundeck/Integrations/Rundeck/Rundeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from CommonServerPython import *

import urllib3
from typing import Any, Dict, Optional, Union
from typing import Any
import ntpath
from dateparser import parse

Expand Down Expand Up @@ -34,7 +34,7 @@ def __init__(
params,
verify=True,
proxy=False,
ok_codes=tuple(),
ok_codes=(),
headers=None,
auth=None,
):
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_jobs_list(
:param project_name: A project name to list its jobs
:return: api response.
"""
request_params: Dict[str, Any] = {}
request_params: dict[str, Any] = {}

if id_list:
request_params["idlist"] = ",".join(id_list)
Expand Down Expand Up @@ -130,7 +130,7 @@ def execute_job(
:param run_at_time_raw: select a time to run the job in iso 8061 time as string
:return: api response
"""
request_body: Dict[str, Any] = {}
request_body: dict[str, Any] = {}

if arg_string:
request_body["argString"] = arg_string
Expand Down Expand Up @@ -175,7 +175,7 @@ def retry_job(
:param options: add options for running a job
:return: api response
"""
request_body: Dict[str, Any] = {}
request_body: dict[str, Any] = {}

if arg_string:
request_body["argString"] = arg_string
Expand Down Expand Up @@ -218,8 +218,8 @@ def job_execution_query(
job_exact_filter: str,
exclude_job_exact_filter: str,
execution_type_filter: str,
max_results: Optional[int],
offset: Optional[int],
max_results: int | None,
offset: int | None,
project_name: str,
):
"""
Expand Down Expand Up @@ -253,7 +253,7 @@ def job_execution_query(
:return: api response
"""

request_params: Dict[str, Any] = {}
request_params: dict[str, Any] = {}

if status_filter:
request_params["statusFilter"] = status_filter
Expand Down Expand Up @@ -356,7 +356,7 @@ def adhoc_run(
:param node_filter: node filter to add
:return: api response
"""
request_params: Dict[str, Any] = {}
request_params: dict[str, Any] = {}

if exec_command:
request_params["exec"] = exec_command
Expand Down Expand Up @@ -409,7 +409,7 @@ def adhoc_script_run_from_url(
:param arg_string: arguments to pass to the script when executed.
:return: api response
"""
request_params: Dict[str, Any] = {}
request_params: dict[str, Any] = {}

if node_thread_count:
request_params["nodeThreadcount"] = node_thread_count
Expand Down Expand Up @@ -451,8 +451,9 @@ def webhook_event_send(self, auth_token: str, options: str, free_json: str):
:return: api response
"""

request_params = ""
if options:
request_params: str = options
request_params = options
else:
if free_json:
request_params = free_json
Expand Down Expand Up @@ -492,7 +493,7 @@ def adhoc_script_run(
:return: api response
"""

request_params: Dict[str, str] = {}
request_params: dict[str, str] = {}
if arg_string:
request_params["argString"] = arg_string
if node_thread_count:
Expand Down Expand Up @@ -543,8 +544,8 @@ def adhoc_script_run(


def filter_results(
results: Union[list, dict], fields_to_remove: list, remove_signs: list
) -> Union[list, dict]:
results: list | dict, fields_to_remove: list, remove_signs: list
) -> list | dict:
new_results = []
if isinstance(results, dict):
demisto.info("got results as dictionary")
Expand Down Expand Up @@ -591,7 +592,7 @@ def filter_results(
return new_results


def attribute_pairs_to_dict(attrs_str: Optional[str], delim_char: str = ","):
def attribute_pairs_to_dict(attrs_str: str | None, delim_char: str = ","):
"""
Transforms a string of multiple inputs to a dictionary list
Expand Down Expand Up @@ -623,7 +624,7 @@ def attribute_pairs_to_dict(attrs_str: Optional[str], delim_char: str = ","):
return attrs


def convert_str_to_int(val_to_convert: Optional[str], param_name: str):
def convert_str_to_int(val_to_convert: str | None, param_name: str):
"""
This function get a parameter from Demisto as string and try converting it to integer
:param val_to_convert: the value to convert
Expand All @@ -640,6 +641,7 @@ def convert_str_to_int(val_to_convert: Optional[str], param_name: str):
demisto.error(f"failed to convert {val_to_convert} to integer")
raise
demisto.info(f"finish converting {val_to_convert} to integer")
return None


def calc_run_at_time(selected_time: str) -> str:
Expand Down Expand Up @@ -668,7 +670,7 @@ def collect_headers(entries_list: list) -> list:
"""
headers = [""]
for entry in entries_list:
for key, value in entry.items():
for key, _value in entry.items():
if key == "log":
headers[0] = "log"
headers.append(key.replace("_", " "))
Expand Down Expand Up @@ -811,7 +813,7 @@ def jobs_list_command(client: Client, args: dict):
group_path_exact: str = args.get("group_path_exact", "")
scheduled_filter: str = args.get("scheduled_filter", "")
server_node_uuid_filter: str = args.get("server_node_uuid_filter", "")
max_results: Optional[int] = convert_str_to_int(
max_results: int | None = convert_str_to_int(
args.get("max_results", ""), "max_results"
)
project_name: str = args.get("project_name", "")
Expand Down Expand Up @@ -863,7 +865,7 @@ def webhooks_list_command(client: Client, args: dict):
:return: CommandResults object
"""
project_name: str = args.get("project_name", "")
max_results: Optional[int] = convert_str_to_int(args.get('max_results', ''), 'max_results')
max_results: int | None = convert_str_to_int(args.get('max_results', ''), 'max_results')
demisto.info("sending get webhooks list request")
result = client.get_webhooks_list(project_name)
demisto.info("finish sending get webhooks list request")
Expand Down Expand Up @@ -914,8 +916,8 @@ def job_execution_query_command(client: Client, args: dict):
job_exact_filter: str = args.get("job_exact_filter", "")
exclude_job_exact_filter: str = args.get("exclude_job_exact_filter", "")
execution_type_filter: str = args.get("execution_type_filter", "")
max_results: Optional[int] = convert_str_to_int(args.get("max_results"), "max")
offset: Optional[int] = convert_str_to_int(args.get("offset"), "offset")
max_results: int | None = convert_str_to_int(args.get("max_results"), "max")
offset: int | None = convert_str_to_int(args.get("offset"), "offset")
project_name: str = args.get("project_name", "")
exclude_group_path: str = args.get("exclude_group_path", "")
demisto.info("sending job execution query request")
Expand Down Expand Up @@ -984,11 +986,11 @@ def job_execution_output_command(client: Client, args: dict):
:param args: command's arguments
:return: CommandRusult object
"""
execution_id: Optional[int] = convert_str_to_int(
execution_id: int | None = convert_str_to_int(
args.get("execution_id"), "execution_id"
)
return_full_output: bool = argToBoolean(args.get("return_full_output", False))
max_results: Optional[int] = convert_str_to_int(
max_results: int | None = convert_str_to_int(
args.get("max_results", ""), "max_results"
)
aggregate_log: bool = argToBoolean(args.get("aggregate_log", False))
Expand Down Expand Up @@ -1040,7 +1042,7 @@ def job_execution_abort_command(client: Client, args: dict):
:param args: command's arguments
:return: CommandRusult object
"""
execution_id: Optional[int] = convert_str_to_int(
execution_id: int | None = convert_str_to_int(
args.get("execution_id"), "execution_id"
)

Expand Down Expand Up @@ -1229,7 +1231,7 @@ def webhook_event_send_command(client: Client, args: dict):
)


def test_module(client: Client, project_name: Optional[str]) -> str:
def test_module(client: Client, project_name: str | None) -> str:
try:
projects_list = client.get_project_list()
except DemistoException as e:
Expand Down Expand Up @@ -1271,7 +1273,7 @@ def main() -> None:
# out of the box by it, just pass ``proxy`` to the Client constructor
proxy = demisto.params().get("proxy", False)

args: Dict = demisto.args()
args: dict = demisto.args()
demisto.debug(f"Command being called is {demisto.command()}")
try:
headers = {"Accept": "application/json", "Content-Type": "application/json"}
Expand Down
12 changes: 6 additions & 6 deletions Packs/Rundeck/Integrations/Rundeck/Rundeck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ script:
- description: ID of the job to execute.
name: job_id
required: true
- description: 'Execution arguments for the selected job. For example: -opt1 value1 -opt2 value2'
- description: 'Execution arguments for the selected job. For example: -opt1 value1 -opt2 value2.'
name: arg_string
- auto: PREDEFINED
description: 'The log level. Possible values are: "DEBUG", "VERBOSE", "INFO", "WARN", and "ERROR".'
Expand Down Expand Up @@ -197,7 +197,7 @@ script:
description: The arguments for the job's execution.
type: String
- arguments:
- description: 'Execution arguments for the selected job. For example: -opt1 value1 -opt2 value2'
- description: 'Execution arguments for the selected job. For example: -opt1 value1 -opt2 value2.'
name: arg_string
- description: ID of the execution you want to retry.
name: execution_id
Expand Down Expand Up @@ -256,7 +256,7 @@ script:
description: The ID of the executed job.
type: String
- contextPath: Rundeck.ExecutedJobs.job.averageDuration
description: The average time for the job's executions
description: The average time for the job's executions.
type: Number
- contextPath: Rundeck.ExecutedJobs.job.name
description: The name of the job.
Expand Down Expand Up @@ -360,7 +360,7 @@ script:
name: rundeck-job-executions-query
outputs:
- contextPath: Rundeck.ExecutionsQuery.paging.count
description: The number of results returned
description: The number of results returned.
type: Number
- contextPath: Rundeck.ExecutionsQuery.paging.total
description: The number of total executions.
Expand Down Expand Up @@ -465,7 +465,7 @@ script:
name: rundeck-job-execution-output
outputs:
- contextPath: Rundeck.ExecutionsOutput.id
description: ID of the execution
description: ID of the execution.
type: Number
- contextPath: Rundeck.ExecutionsOutput.offset
description: Byte offset to read from in the file. 0 indicates the beginning.
Expand Down Expand Up @@ -750,7 +750,7 @@ script:
- contextPath: Rundeck.WebhookEvent.executionId
description: The ID of the execution.
type: String
dockerimage: demisto/python3:3.10.13.86272
dockerimage: demisto/python3:3.11.10.116949
runonce: false
script: '-'
subtype: python3
Expand Down
Loading

0 comments on commit d4e5483

Please sign in to comment.