Skip to content
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
286 changes: 241 additions & 45 deletions Cargo.lock

Large diffs are not rendered by default.

146 changes: 126 additions & 20 deletions THIRD-PARTY-LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------
** pydantic; version 2.13.5 -- https://pypi.org/project/pydantic/
** pydantic; version 2.14.1 -- https://pypi.org/project/pydantic/
The MIT License (MIT)

Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors.
Expand All @@ -48,7 +48,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------
** pydantic_core; version 2.46.5 -- https://pypi.org/project/pydantic_core/
** pydantic_core; version 2.50.1 -- https://pypi.org/project/pydantic_core/
The MIT License (MIT)

Copyright (c) 2022 Samuel Colvin
Expand Down Expand Up @@ -607,11 +607,11 @@ PERFORMANCE OF THIS SOFTWARE.
limitations under the License.

------
** derive-where; version 1.6.1 -- https://crates.io/crates/derive-where
** encoding_rs; version 0.8.35 -- https://crates.io/crates/encoding_rs
** nohash-hasher; version 0.2.0 -- https://crates.io/crates/nohash-hasher
** static_assertions; version 1.1.0 -- https://crates.io/crates/static_assertions
** tinyvec; version 1.12.0 -- https://crates.io/crates/tinyvec
** utf8_iter; version 1.0.4 -- https://crates.io/crates/utf8_iter

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -1041,9 +1041,9 @@ Software.


------
** attribute-derive; version 0.10.5 -- https://crates.io/crates/attribute-derive
** attribute-derive; version 0.11.0 -- https://crates.io/crates/attribute-derive
** interpolator; version 0.5.0 -- https://crates.io/crates/interpolator
** manyhow; version 0.11.4 -- https://crates.io/crates/manyhow
** manyhow; version 0.14.1 -- https://crates.io/crates/manyhow
** proc-macro-utils; version 0.10.0 -- https://crates.io/crates/proc-macro-utils
Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -2094,6 +2094,7 @@ limitations under the License.
** bitflags; version 2.13.1 -- https://crates.io/crates/bitflags
** bstr; version 1.13.1 -- https://crates.io/crates/bstr
** cfg-if; version 1.0.4 -- https://crates.io/crates/cfg-if
** displaydoc; version 0.2.7 -- https://crates.io/crates/displaydoc
** drop_bomb; version 0.1.5 -- https://crates.io/crates/drop_bomb
** either; version 1.18.0 -- https://crates.io/crates/either
** encoding_rs_io; version 0.1.8 -- https://crates.io/crates/encoding_rs_io
Expand All @@ -2113,6 +2114,7 @@ limitations under the License.
** regex; version 1.13.1 -- https://crates.io/crates/regex
** signal-hook-registry; version 1.4.8 -- https://crates.io/crates/signal-hook-registry
** smallvec; version 1.15.2 -- https://crates.io/crates/smallvec
** stable_deref_trait; version 1.2.1 -- https://crates.io/crates/stable_deref_trait
** stacker; version 0.1.25 -- https://crates.io/crates/stacker
** unicode-normalization; version 0.1.25 -- https://crates.io/crates/unicode-normalization
** unicode-width; version 0.2.2 -- https://crates.io/crates/unicode-width
Expand Down Expand Up @@ -2735,15 +2737,15 @@ limitations under the License.

------
** arraydeque; version 0.5.1 -- https://crates.io/crates/arraydeque
** get-size-derive2; version 0.10.3 -- https://crates.io/crates/get-size-derive2
** get-size2; version 0.10.3 -- https://crates.io/crates/get-size2
** get-size-derive2; version 0.11.1 -- https://crates.io/crates/get-size-derive2
** get-size2; version 0.11.1 -- https://crates.io/crates/get-size2
** granit-parser; version 1.2.0 -- https://crates.io/crates/granit-parser
** itoa; version 1.0.18 -- https://crates.io/crates/itoa
** libc; version 0.2.189 -- https://crates.io/crates/libc
** manyhow-macros; version 0.11.4 -- https://crates.io/crates/manyhow-macros
** openjd-expr; version 0.10.1 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.11.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.7.3 -- https://crates.io/crates/openjd-sessions
** manyhow-macros; version 0.14.1 -- https://crates.io/crates/manyhow-macros
** openjd-expr; version 0.12.0 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.13.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.8.1 -- https://crates.io/crates/openjd-sessions
** pin-project-lite; version 0.2.17 -- https://crates.io/crates/pin-project-lite
** portable-atomic; version 1.15.0 -- https://crates.io/crates/portable-atomic
** proc-macro2; version 1.0.107 -- https://crates.io/crates/proc-macro2
Expand Down Expand Up @@ -3013,6 +3015,36 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


------
** quote-use-macros; version 0.9.0 -- https://crates.io/crates/quote-use-macros
** quote-use; version 0.9.0 -- https://crates.io/crates/quote-use
Copyright (c) Roland Fredenhagen

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


------
** collection_literals; version 1.0.3 -- https://crates.io/crates/collection_literals
Copyright (c) The collection_literals Contributors
Expand Down Expand Up @@ -3042,6 +3074,17 @@ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.


------
** synstructure; version 0.14.0 -- https://crates.io/crates/synstructure
Copyright 2016 Nika Layzell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


------
** tokio-macros; version 2.7.2 -- https://crates.io/crates/tokio-macros
MIT License
Expand Down Expand Up @@ -3119,7 +3162,7 @@ SOFTWARE.


------
** attribute-derive-macro; version 0.10.5 -- https://crates.io/crates/attribute-derive-macro
** attribute-derive-macro; version 0.11.0 -- https://crates.io/crates/attribute-derive-macro
MIT License

Copyright (c) 2022 Roland Fredenhagen
Expand All @@ -3144,7 +3187,7 @@ SOFTWARE.


------
** char_str; version 0.0.2 -- https://crates.io/crates/char_str
** char_str; version 0.0.4 -- https://crates.io/crates/char_str
MIT License

Copyright (c) 2024 ryota2357
Expand All @@ -3169,13 +3212,11 @@ SOFTWARE.


------
** quote-use-macros; version 0.8.4 -- https://crates.io/crates/quote-use-macros
** quote-use; version 0.8.4 -- https://crates.io/crates/quote-use
** rustpython-ruff_python_ast; version 0.16.5 -- https://crates.io/crates/rustpython-ruff_python_ast
** rustpython-ruff_python_parser; version 0.16.5 -- https://crates.io/crates/rustpython-ruff_python_parser
** rustpython-ruff_python_trivia; version 0.16.5 -- https://crates.io/crates/rustpython-ruff_python_trivia
** rustpython-ruff_source_file; version 0.16.5 -- https://crates.io/crates/rustpython-ruff_source_file
** rustpython-ruff_text_size; version 0.16.5 -- https://crates.io/crates/rustpython-ruff_text_size
** rustpython-ruff_python_ast; version 0.16.10 -- https://crates.io/crates/rustpython-ruff_python_ast
** rustpython-ruff_python_parser; version 0.16.10 -- https://crates.io/crates/rustpython-ruff_python_parser
** rustpython-ruff_python_trivia; version 0.16.10 -- https://crates.io/crates/rustpython-ruff_python_trivia
** rustpython-ruff_source_file; version 0.16.10 -- https://crates.io/crates/rustpython-ruff_source_file
** rustpython-ruff_text_size; version 0.16.10 -- https://crates.io/crates/rustpython-ruff_text_size
MIT License

Copyright (c) <year> <copyright holders>
Expand Down Expand Up @@ -3368,6 +3409,71 @@ dealings in these Data Files or Software without prior written
authorization of the copyright holder.


------
** icu_collections; version 2.3.0 -- https://crates.io/crates/icu_collections
** icu_locale_core; version 2.3.0 -- https://crates.io/crates/icu_locale_core
** icu_properties; version 2.3.0 -- https://crates.io/crates/icu_properties
** icu_properties_data; version 2.3.0 -- https://crates.io/crates/icu_properties_data
** icu_provider; version 2.3.1 -- https://crates.io/crates/icu_provider
** litemap; version 0.8.3 -- https://crates.io/crates/litemap
** potential_utf; version 0.1.6 -- https://crates.io/crates/potential_utf
** tinystr; version 0.8.4 -- https://crates.io/crates/tinystr
** writeable; version 0.6.4 -- https://crates.io/crates/writeable
** yoke-derive; version 0.8.4 -- https://crates.io/crates/yoke-derive
** yoke; version 0.8.3 -- https://crates.io/crates/yoke
** zerofrom-derive; version 0.1.8 -- https://crates.io/crates/zerofrom-derive
** zerofrom; version 0.1.8 -- https://crates.io/crates/zerofrom
** zerotrie; version 0.2.5 -- https://crates.io/crates/zerotrie
** zerovec-derive; version 0.11.6 -- https://crates.io/crates/zerovec-derive
** zerovec; version 0.11.8 -- https://crates.io/crates/zerovec
UNICODE LICENSE V3

COPYRIGHT AND PERMISSION NOTICE

Copyright © 2020-2024 Unicode, Inc.

NOTICE TO USER: Carefully read the following legal agreement. BY
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a
copy of data files and any associated documentation (the "Data Files") or
software and any associated documentation (the "Software") to deal in the
Data Files or Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, and/or sell
copies of the Data Files or Software, and to permit persons to whom the
Data Files or Software are furnished to do so, provided that either (a)
this copyright and permission notice appear with all copies of the Data
Files or Software, or (b) this copyright and permission notice appear in
associated Documentation.

THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
THIRD PARTY RIGHTS.

IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
FILES OR SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in these Data Files or Software without prior written
authorization of the copyright holder.

SPDX-License-Identifier: Unicode-3.0

—

Portions of ICU4X may have been adapted from ICU4C and/or ICU4J.
ICU 1.8.1 to ICU 57.1 © 1995-2016 International Business Machines Corporation and others.


------
** unicode_names2; version 1.3.0 -- https://crates.io/crates/unicode_names2
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
Expand Down
6 changes: 3 additions & 3 deletions rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ name = "_openjd_rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
openjd-expr = "0.10.1"
openjd-model = "0.11.0"
openjd-sessions = "0.7.3"
openjd-expr = "0.12.0"
openjd-model = "0.13.0"
openjd-sessions = "0.8.1"
tokio = { version = "1", features = ["rt-multi-thread"] }
uuid = { version = "1", features = ["v4"] }
serde_json = "1"
Expand Down
4 changes: 2 additions & 2 deletions src/openjd/model/_internal/_variable_reference_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _internal_deepcopy(value: Any) -> Any:


def _validate_model_template_variable_references(
model: Type,
model: Any, # a field annotation: a class, a Union, or a generic alias
value: Any,
current_scope: ResolutionScope,
symbol_prefix: str,
Expand Down Expand Up @@ -831,7 +831,7 @@ def _symbol_expr_type(value: dict, raw: bool) -> Optional[str]:


def _collect_variable_definitions( # noqa: C901 (suppress: too complex)
model: Type,
model: Any, # a field annotation: a class, a Union, or a generic alias
value: Any,
current_scope: ResolutionScope,
symbol_prefix: str,
Expand Down
7 changes: 4 additions & 3 deletions test/openjd/expr/test_error_formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ def test_unclosed_paren(self):
"""Unclosed parenthesis shows caret spanning the expression."""
with pytest.raises(ExpressionError) as exc_info:
evaluate_expression("(1 + 2", values=SymbolTable())
# CPython's wording since ruff 0.16.10 (openjd-rs#429).
expected = [
"Syntax error: unexpected EOF while parsing\n",
"Syntax error: '(' was never closed\n",
" (1 + 2\n",
" ^~~~~~",
]
Expand All @@ -320,7 +321,7 @@ def test_unclosed_bracket(self):
with pytest.raises(ExpressionError) as exc_info:
evaluate_expression("[1, 2, 3", values=SymbolTable())
expected = [
"Syntax error: unexpected EOF while parsing\n",
"Syntax error: '[' was never closed\n",
" [1, 2, 3\n",
" ^~~~~~~~",
]
Expand All @@ -331,7 +332,7 @@ def test_unclosed_string(self):
with pytest.raises(ExpressionError) as exc_info:
evaluate_expression("'unclosed", values=SymbolTable())
expected = [
"Syntax error: missing closing quote in string literal\n",
"Syntax error: unterminated string literal (detected at line 1)\n",
" 'unclosed\n",
" ^~~~~~~~~",
]
Expand Down
37 changes: 36 additions & 1 deletion test/openjd/expr/test_unresolved_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def test_incompatible_types_error(self) -> None:
with pytest.raises(ExpressionError) as exc_info:
evaluate_expression("[X, Y]", values=values)
expected = [
"List literal contains incompatible types: int, string\n",
"List literal contains incompatible types: int and string\n",
" [X, Y]\n",
" ^~~~~~",
]
Expand Down Expand Up @@ -908,3 +908,38 @@ def test_a_value_error_in_a_branch_is_still_absorbed(self, expression: str) -> N
def test_the_expression_fits_within_a_generous_budget(self, expression: str) -> None:
result = evaluate_expression(expression, values=self._values())
assert result.type == ExprType("unresolved[string]")


_UNRESOLVED_INT = ExprValue.unresolved(ExprType("int"))
_UNRESOLVED_BOOL = ExprValue.unresolved(ExprType("bool"))


class TestBoolOpAfterAnUnresolvedOperand:
"""openjd-expr 0.12.0 (openjd-rs#435): once an and/or operand is unresolved, the
result is the union of every operand it could return. Before, the first later
concrete operand decided it, so a value error there rejected a valid expression
and a static value appeared that run time never produces.
"""

@pytest.mark.parametrize(
("expression", "values", "expected"),
[
# 0.11.0: "Division by zero", though X may decide the result at run time.
("10 // (X or Z)", {"X": _UNRESOLVED_INT, "Z": ExprValue(0)}, "unresolved[int]"),
# 0.11.0: ExprValue(3).
("X or N", {"X": _UNRESOLVED_INT, "N": ExprValue(3)}, "unresolved[int]"),
# 0.11.0: typed as bool, so "upper() is not available for bool".
(
"(F and S).upper()",
{"F": _UNRESOLVED_BOOL, "S": ExprValue("abc")},
"unresolved[string]",
),
# 0.11.0: ExprValue(0).
("F and 1 or 0", {"F": _UNRESOLVED_BOOL}, "unresolved[int]"),
],
)
def test_the_result_is_unresolved_of_every_reachable_operand(
self, expression: str, values: dict, expected: str
) -> None:
result = evaluate_expression(expression, values=SymbolTable(values))
assert result.type == ExprType(expected)
25 changes: 25 additions & 0 deletions test/openjd/expr/test_uri_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
output, identical contract.
"""

import pytest

from openjd.expr import ExprValue, PathFormat, SymbolTable, evaluate_expression


Expand Down Expand Up @@ -211,3 +213,26 @@ def test_uri_with_suffix_in_symtab(self) -> None:
"P.with_suffix('.png')", values=symtab, path_format=PathFormat.POSIX
)
assert str(result) == "s3://bucket/scene.png"


class TestSingleLetterSchemeIsAPath:
"""openjd-expr 0.11.0 (openjd-rs#424, openjd-specifications#192): a URI scheme has
at least two characters, so ``C://`` is a Windows drive with a doubled separator,
not a URI with scheme ``c``. Before, it kept its ``//`` like ``s3://``. The path
format is pinned because the default follows the host.
"""

@pytest.mark.parametrize(
("expression", "posix", "windows"),
[
('path("C://scenes/a.ma").parent', "C:/scenes", "C:\\scenes"),
('path(["C://scenes", "a.ma"])', "C:/scenes/a.ma", "C:\\scenes\\a.ma"),
# Control: a two-letter scheme is still a URI under either format.
('path("s3://bucket/a/b").parent', "s3://bucket/a", "s3://bucket/a"),
],
)
def test_a_drive_letter_is_a_path_and_a_scheme_is_a_uri(
self, expression: str, posix: str, windows: str
) -> None:
assert str(evaluate_expression(expression, path_format=PathFormat.POSIX)) == posix
assert str(evaluate_expression(expression, path_format=PathFormat.WINDOWS)) == windows
Loading
Loading