Skip to content

Commit 0a6ff69

Browse files
authored
Address coments from CodeQL and SonarCloud (#799)
1 parent 791c065 commit 0a6ff69

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

jsonargparse/_optionals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def omegaconf_load(value):
298298
if isinstance(value_pyyaml, (str, int, float, bool)) or value_pyyaml is None:
299299
return value_pyyaml
300300
value_omegaconf = OmegaConf.to_object(OmegaConf.load(io.StringIO(value)))
301-
str_ref = {k: None for k in [value]}
301+
str_ref = dict.fromkeys([value], None)
302302
return value_pyyaml if value_omegaconf == str_ref else value_omegaconf
303303

304304
return omegaconf_load

jsonargparse/_type_checking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
from ._core import ActionsContainer, ArgumentGroup, ArgumentParser
1616
else:
17-
globals().update({k: None for k in __all__})
17+
globals().update(dict.fromkeys(__all__, None))

jsonargparse/typing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pathlib
77
import re
88
import sys
9-
from re import Pattern
109
from typing import Any, Callable, Optional, Union
1110

1211
if sys.version_info >= (3, 10):
@@ -181,7 +180,7 @@ def validation_fn(cls, v):
181180

182181
def restricted_string_type(
183182
name: str,
184-
regex: Union[str, Pattern],
183+
regex: Union[str, re.Pattern],
185184
docstring: Optional[str] = None,
186185
) -> _TypeAlias:
187186
"""Creates or returns an already registered restricted string type class.

0 commit comments

Comments
 (0)