Skip to content

Commit 683fb5a

Browse files
feat: add support of python3.13 (#929)
Co-authored-by: Darshan Varasani <[email protected]>
1 parent 3d7b910 commit 683fb5a

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

pytest_splunk_addon/addon_parser/props_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _get_extract_fields(self, name: str, value: str):
203203
yield field
204204

205205
# If SOURCE_KEY is used in EXTRACT, generate the test for the same.
206-
regex_for_source_key = r"(?:(?i)in\s+(\w+))\s*$"
206+
regex_for_source_key = r"(?i)(?:in\s+(\w+))\s*$"
207207
extract_source_key = re.search(regex_for_source_key, value, re.MULTILINE)
208208
if extract_source_key:
209209
LOGGER.info(f"Found a source key in {name}")
@@ -260,7 +260,7 @@ def _get_fieldalias_fields(self, name: str, value: str):
260260
"""
261261
regex = (
262262
r"(\"(?:\\\"|[^\"])*\"|\'(?:\\\'|[^\'])*\'|[^\s,]+)"
263-
r"\s+(?i)(?:as(?:new)?)\s+"
263+
r"\s+(?:as(?:new)?)\s+"
264264
r"(\"(?:\\\"|[^\"])*\"|\'(?:\\\'|[^\'])*\'|[^\s,]+)"
265265
)
266266
fields_tuples = re.findall(regex, value, re.IGNORECASE)

pytest_splunk_addon/sample_generation/rule.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def apply(self, events):
188188
.replace(".", "-")
189189
)
190190
host_split = host.split("-")
191-
if re.match("\d+", host_split[-1]):
191+
if re.match(r"\d+", host_split[-1]):
192192
host = "-".join(host_split[:-1])
193193
new_event.metadata["host"] = "{}-{}".format(
194194
host, event_host_count
@@ -327,7 +327,7 @@ def replace(self, sample, token_count):
327327
float_match = re.match(r"[Ff]loat\[(-?[\d\.]+):(-?[\d\.]+)\]", self.replacement)
328328
if float_match:
329329
lower_limit, upper_limit = float_match.groups()
330-
precision = re.search("\[-?\d+\.?(\d*):", self.replacement).group(1)
330+
precision = re.search(r"\[-?\d+\.?(\d*):", self.replacement).group(1)
331331
if not precision:
332332
precision = str(1)
333333
for _ in range(token_count):
@@ -681,7 +681,7 @@ def replace(self, sample, token_count):
681681
yield self.token
682682
for _ in range(token_count):
683683
random_time = datetime.fromtimestamp(
684-
randint(earliest_in_epoch, latest_in_epoch)
684+
randint(int(earliest_in_epoch), int(latest_in_epoch))
685685
)
686686
if timezone_time in ["local", '"local"', "'local'"]:
687687
random_time = random_time.replace(tzinfo=timezone.utc).astimezone(

pytest_splunk_addon/sample_generation/sample_stanza.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
LOGGER = logging.getLogger("pytest-splunk-addon")
2727

28-
TIMEZONE_REX = "((\+1[0-2])|(-1[0-4])|[+|-][0][0-9])([0-5][0-9])"
28+
TIMEZONE_REX = r"((\+1[0-2])|(-1[0-4])|[+|-][0][0-9])([0-5][0-9])"
2929
BULK_EVENT_COUNT = 250
3030

3131
token_value = namedtuple("token_value", ["key", "value"])

pytest_splunk_addon/splunk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def docker_ip():
842842
if not docker_host:
843843
return "127.0.0.1"
844844

845-
match = re.match("^tcp://(.+?):\d+$", docker_host)
845+
match = re.match(r"^tcp://(.+?):\d+$", docker_host)
846846
if not match:
847847
raise ValueError('Invalid value for DOCKER_HOST: "%s".' % (docker_host,))
848848
return match.group(1)

tests/unit/tests_standard_lib/test_event_ingestors/test_ingestor_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_ingestor_can_be_obtained(
103103
ingestor_helper.get_event_ingestor(ingest_method, "ingest_meta_data")
104104
== expected_output
105105
)
106-
assert ingestors_mocks[expected_output].has_calls("ingest_meta_data")
106+
ingestors_mocks[expected_output].assert_called_with("ingest_meta_data")
107107

108108

109109
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)