Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable python 3.12, 3.13 #1203

Merged
merged 4 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ workflows:
- test_linux:
matrix:
parameters:
py_version: ["3.8", "3.9", "3.10", "3.11"]
py_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import nox
from nox import Session

DEFAULT_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
DEFAULT_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

PYTHON_VERSIONS = os.environ.get(
"NOX_PYTHON_VERSIONS", ",".join(DEFAULT_PYTHON_VERSIONS)
Expand Down
4 changes: 2 additions & 2 deletions omegaconf/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def get_attr_data(obj: Any, allow_objects: Optional[bool] = None) -> Dict[str, A
value = MISSING
if is_union_annotation(type_) and not is_supported_union_annotation(type_):
e = ConfigValueError(
f"Unions of containers are not supported:\n{name}: {type_str(type_)}"
f"Unions of containers are not supported:\n{name}: {type_str(type_)}" # noqa: E231
)
format_and_raise(node=None, key=None, value=value, cause=e, msg=str(e))

Expand Down Expand Up @@ -409,7 +409,7 @@ def get_dataclass_data(

if is_union_annotation(type_) and not is_supported_union_annotation(type_):
e = ConfigValueError(
f"Unions of containers are not supported:\n{name}: {type_str(type_)}"
f"Unions of containers are not supported:\n{name}: {type_str(type_)}" # noqa: E231
)
format_and_raise(node=None, key=None, value=value, cause=e, msg=str(e))
try:
Expand Down
4 changes: 2 additions & 2 deletions omegaconf/basecontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ def _get_full_key(self, key: Union[DictKeyType, int, slice, None]) -> str:

def _slice_to_str(x: slice) -> str:
if x.step is not None:
return f"{x.start}:{x.stop}:{x.step}"
return f"{x.start}:{x.stop}:{x.step}" # noqa: E231
else:
return f"{x.start}:{x.stop}"
return f"{x.start}:{x.stop}" # noqa: E231

def prepand(
full_key: str,
Expand Down
6 changes: 4 additions & 2 deletions omegaconf/grammar_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
_id = "[a-zA-Z_][\\w\\-]*" # foo, foo_bar, foo-bar, abc123
_resolver_name = f"({_id}(\\.{_id})*)?" # foo, ns.bar3, ns_1.ns_2.b0z
_arg = r"[a-zA-Z_0-9/\-\+.$%*@?|]+" # string representing a resolver argument
_args = f"{_arg}(\\s*,\\s*{_arg})*" # list of resolver arguments
_resolver_inter = f"\\${{\\s*{_resolver_name}\\s*:\\s*{_args}?\\s*}}" # ${foo:bar}
_args = f"{_arg}(\\s*,\\s*{_arg})*" # list of resolver arguments # noqa: E231
_resolver_inter = (
f"\\${{\\s*{_resolver_name}\\s*:\\s*{_args}?\\s*}}" # ${foo:bar} # noqa: E231
)
_inter = f"({_node_inter}|{_resolver_inter})" # any kind of interpolation
_outer = "([^$]|\\$(?!{))+" # any character except $ (unless not followed by {)
SIMPLE_INTERPOLATION_PATTERN = re.compile(
Expand Down
2 changes: 1 addition & 1 deletion omegaconf/grammar_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def empty_str_warning() -> None:
warnings.warn(
f"In the sequence `{txt}` some elements are missing: please replace "
f"them with empty quoted strings. "
f"See https://github.com/omry/omegaconf/issues/572 for details.",
f"See https://github.com/omry/omegaconf/issues/572 for details.", # noqa: E231
category=UserWarning,
)

Expand Down
2 changes: 1 addition & 1 deletion omegaconf/omegaconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def resolver_wrapper(
f"to be an interpolation. Nested interpolations are not supported for "
f"resolvers registered with `[legacy_]register_resolver()`, please use "
f"`register_new_resolver()` instead (see "
f"https://github.com/omry/omegaconf/issues/426 for migration instructions)."
f"https://github.com/omry/omegaconf/issues/426 for migration instructions)." # noqa: E231
)
key = args_str
val = cache[key] if key in cache else resolver(*args_unesc)
Expand Down
4 changes: 2 additions & 2 deletions tests/interpolation/built_in_resolvers/test_oc_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_decode(monkeypatch: Any, value: Optional[str], expected: Any) -> None:
{
# The node of interest is "node" (others are used to test interpolations).
"parent": {
"node": f"${{oc.decode:'{value}'}}",
"node": f"${{oc.decode:'{value}'}}", # noqa: E231
"sibling": 1,
},
"uncle": 2,
Expand Down Expand Up @@ -100,6 +100,6 @@ def test_decode_none() -> None:
],
)
def test_decode_error(monkeypatch: Any, value: Any, exc: Any) -> None:
c = OmegaConf.create({"x": f"${{oc.decode:{value}}}"})
c = OmegaConf.create({"x": f"${{oc.decode:{value}}}"}) # noqa: E231
with exc:
c.x
4 changes: 2 additions & 2 deletions tests/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@
),
(
"dict_unquoted_key",
rf"{{a0-null-1-3.14-NaN- {TAB}-true-False-{UNQUOTED_SPECIAL}\(\)\[\]\{{\}}\:\=\ \{TAB}\,:0}}",
rf"{{a0-null-1-3.14-NaN- {TAB}-true-False-{UNQUOTED_SPECIAL}\(\)\[\]\{{\}}\:\=\ \{TAB}\,:0}}", # noqa: E231
{
rf"a0-null-1-3.14-NaN- {TAB}-true-False-{UNQUOTED_SPECIAL}()[]{{}}:= {TAB},": 0
rf"a0-null-1-3.14-NaN- {TAB}-true-False-{UNQUOTED_SPECIAL}()[]{{}}:= {TAB},": 0 # noqa: E231
},
),
(
Expand Down
Loading