Skip to content

Commit

Permalink
add types-protobuf, fix AWSWAF type hint (#31792)
Browse files Browse the repository at this point in the history
* add types-protobuf

* fix invalid type

* pre-commit

* rn

* bump, RN
  • Loading branch information
dorschw authored and maimorag committed Dec 28, 2023
1 parent 9aebb9a commit 7c02685
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 30 deletions.
9 changes: 5 additions & 4 deletions Packs/AWS_WAF/Integrations/AWSWAF/AWSWAF.py
Expand Up @@ -2,7 +2,8 @@
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from AWSApiModule import * # noqa: E402
from typing import TYPE_CHECKING, Callable, Tuple, Any, List
from typing import TYPE_CHECKING, Any
from collections.abc import Callable

# The following import are used only for type hints and autocomplete.
# It is not used at runtime, and not exist in the docker image.
Expand All @@ -11,7 +12,7 @@
from mypy_boto3_wafv2.type_defs import (
RegexTypeDef,
UpdateRuleGroupResponseTypeDef,
RuleOutputTypeDef,
RuleTypeDef,
VisibilityConfigTypeDef
)

Expand Down Expand Up @@ -153,7 +154,7 @@ def get_tags_dict_from_args(tag_keys: list, tag_values: list) -> list:
return [{'Key': k, 'Value': v} for k, v in zip(tag_keys, tag_values)]


def build_regex_pattern_object(regex_patterns: list) -> List["RegexTypeDef"]:
def build_regex_pattern_object(regex_patterns: list) -> list["RegexTypeDef"]:
"""
Creates a list of dictionaries which represent a regex set object
Args:
Expand Down Expand Up @@ -431,7 +432,7 @@ def append_new_rule(rules: list, rule: dict) -> list:


def get_required_response_fields_from_rule_group(client: "WAFV2Client", kwargs: dict
) -> Tuple[List["RuleOutputTypeDef"], "VisibilityConfigTypeDef", str]:
) -> tuple[list["RuleTypeDef"], "VisibilityConfigTypeDef", str]:
"""
Gets all the fields from the response that are required for the update request
Args:
Expand Down
2 changes: 1 addition & 1 deletion Packs/AWS_WAF/Integrations/AWSWAF/AWSWAF.yml
Expand Up @@ -1412,7 +1412,7 @@ script:
script: '-'
type: python
subtype: python3
dockerimage: demisto/boto3py3:1.0.0.75596
dockerimage: demisto/boto3py3:1.0.0.83962
fromversion: 6.5.0
tests:
- No tests (auto formatted)
3 changes: 1 addition & 2 deletions Packs/AWS_WAF/Integrations/AWSWAF/AWSWAF_test.py
@@ -1,5 +1,4 @@
import json
import io
from CommonServerPython import *
import pytest
from AWSWAF import OPERATOR_TO_STATEMENT_OPERATOR, REGEX_MATCH_STATEMENT, BYTE_MATCH_STATEMENT
Expand Down Expand Up @@ -56,7 +55,7 @@ def delete_rule_group(self, **kwargs):


def util_load_json(path):
with io.open(f'test_data/{path}.json', mode='r', encoding='utf-8') as f:
with open(f'test_data/{path}.json', encoding='utf-8') as f:
return json.loads(f.read())


Expand Down
6 changes: 6 additions & 0 deletions Packs/AWS_WAF/ReleaseNotes/1_0_4.md
@@ -0,0 +1,6 @@

#### Integrations

##### AWS-WAF
- Documentation and metadata improvements.
- Updated the Docker image to: demisto/boto3py3:1.0.0.83962.
2 changes: 1 addition & 1 deletion Packs/AWS_WAF/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "AWS WAF",
"description": "Amazon Web Services Web Application Firewall (WAF)",
"support": "xsoar",
"currentVersion": "1.0.3",
"currentVersion": "1.0.4",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
44 changes: 22 additions & 22 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -54,6 +54,7 @@ boto3-stubs = { extras = [
"ssm",
"wafv2",
], version = "^1.28.31" }
types-protobuf = "^4.24.0.4"

[tool.poetry.group.native]
# This is the python dependencies from the py3-native docker image.
Expand Down

0 comments on commit 7c02685

Please sign in to comment.