diff --git a/.idea/dictionaries/pavel.xml b/.idea/dictionaries/pavel.xml index 534837e..9d05c57 100644 --- a/.idea/dictionaries/pavel.xml +++ b/.idea/dictionaries/pavel.xml @@ -119,6 +119,7 @@ nullary octothorp onboard + opencyphal overgeneral packbits parseltongue @@ -133,6 +134,7 @@ prog protip pycodestyle + pycyphal pydev pydsdl pygments diff --git a/LICENSE b/LICENSE index 7afc802..9b4039b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 UAVCAN Consortium +Copyright (c) 2018 OpenCyphal 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 diff --git a/README.md b/README.md index b0b2dc0..a6d64ec 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/lurx5gihhcl9wq1w/branch/master?svg=true)](https://ci.appveyor.com/project/Zubax/pydsdl/branch/master) [![Documentation Status](https://readthedocs.org/projects/pydsdl/badge/?version=latest)](https://pydsdl.readthedocs.io/en/latest/?badge=latest) [![PyPI - Downloads](https://img.shields.io/pypi/dm/pydsdl)](https://pypi.org/project/pydsdl/) -[![Forum](https://img.shields.io/discourse/https/forum.uavcan.org/users.svg)](https://forum.uavcan.org) +[![Forum](https://img.shields.io/discourse/https/forum.opencyphal.org/users.svg)](https://forum.opencyphal.org) PyDSDL is a [Cyphal](https://opencyphal.org) DSDL compiler front-end implemented in Python. It accepts a DSDL namespace at the input and produces a well-annotated abstract syntax tree (AST) at the output, diff --git a/appveyor.yml b/appveyor.yml index 0370c91..8a8d451 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -67,7 +67,7 @@ for: # MS Windows test. - cmd: nox --forcecolor --non-interactive --error-on-missing-interpreters --session test lint # Shared test for all platforms. - - git clone https://github.com/UAVCAN/public_regulated_data_types .dsdl-test + - git clone https://github.com/OpenCyphal/public_regulated_data_types .dsdl-test - python -c "import pydsdl; pydsdl.read_namespace('.dsdl-test/uavcan', [])" # DEPLOYMENT PIPELINE @@ -85,7 +85,7 @@ for: # Configure git credentials. - echo "https://${GIT_TOKEN}:x-oauth-basic@github.com" > ~/.git-credentials - git config --global credential.helper store - - git config --global user.email "devnull@uavcan.org" + - git config --global user.email "devnull@opencyphal.org" - git config --global user.name "Release Automation" # Tag and publish this release. Push the tag after the release is out in case it could not be published. - 'git tag $(python3 -c "import pydsdl; print(pydsdl.__version__)")' diff --git a/docs/conf.py b/docs/conf.py index 7a780e1..ba13c78 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,13 +1,13 @@ -# Copyright (c) 2020 UAVCAN Consortium +# Copyright (c) 2020 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import sys import pathlib import datetime -GITHUB_USER_REPO = "UAVCAN", "pydsdl" +GITHUB_USER_REPO = "OpenCyphal", "pydsdl" DESCRIPTION = "A Cyphal DSDL compiler front-end in Python" @@ -23,13 +23,13 @@ EXTERNAL_LINKS = { "OpenCyphal homepage": "https://opencyphal.org/", - "Support forum": "https://forum.uavcan.org/", + "Support forum": "https://forum.opencyphal.org/", } project = "PyDSDL" +author = "OpenCyphal" # noinspection PyShadowingBuiltins -copyright = str(datetime.datetime.now().year) + ", UAVCAN Development Team" -author = "UAVCAN Development Team" +copyright = str(datetime.datetime.now().year) + ", " + author version = ".".join(map(str, pydsdl.__version_info__)) release = pydsdl.__version__ # The full version, including alpha/beta/rc tags diff --git a/docs/index.rst b/docs/index.rst index 2341e89..37cb6f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,7 +6,7 @@ It accepts a DSDL namespace at the input and produces a well-annotated abstract evaluating all constant expressions in the process. All DSDL features defined in the Cyphal Specification are supported. -If you have questions, please bring them to the `support forum `_. +If you have questions, please bring them to the `support forum `_. Contributors, please read the :ref:`dev`! diff --git a/docs/ref_fixer_hack.py b/docs/ref_fixer_hack.py index 082267b..13f7b39 100644 --- a/docs/ref_fixer_hack.py +++ b/docs/ref_fixer_hack.py @@ -3,8 +3,8 @@ I've constructed this Sphinx extension as a quick and dirty "solution" to the problem of broken cross-linking. -The problem is that Autodoc fails to realize that an entity, say, pyuavcan.transport._session.InputSession is -exposed to the user as pyuavcan.transport.InputSession, and that the original name is not a part of the API +The problem is that Autodoc fails to realize that an entity, say, pycyphal.transport._session.InputSession is +exposed to the user as pycyphal.transport.InputSession, and that the original name is not a part of the API and it shouldn't even be mentioned in the documentation at all. I've described this problem in this Sphinx issue at https://github.com/sphinx-doc/sphinx/issues/6574. Since the original name is not exported, Autodoc can't find it in the output and generates no link at all, requiring the user to search manually instead of just clicking on @@ -24,39 +24,41 @@ import docutils.nodes -_ACCEPTANCE_PATTERN = r'.*([a-zA-Z][a-zA-Z0-9_]*\.)+_[a-zA-Z0-9_]*\..+' -_REFTYPES = 'class', 'meth', 'func' +_ACCEPTANCE_PATTERN = r".*([a-zA-Z][a-zA-Z0-9_]*\.)+_[a-zA-Z0-9_]*\..+" +_REFTYPES = "class", "meth", "func" _replacements_made: typing.List[typing.Tuple[str, str]] = [] -def missing_reference(app: sphinx.application.Sphinx, - _env: sphinx.environment.BuildEnvironment, - node: docutils.nodes.Element, - contnode: docutils.nodes.Node) -> typing.Optional[docutils.nodes.Node]: - old_reftarget = node['reftarget'] - if node['reftype'] in _REFTYPES and re.match(_ACCEPTANCE_PATTERN, old_reftarget): - new_reftarget = re.sub(r'\._[a-zA-Z0-9_]*', '', old_reftarget) +def missing_reference( + app: sphinx.application.Sphinx, + _env: sphinx.environment.BuildEnvironment, + node: docutils.nodes.Element, + contnode: docutils.nodes.Node, +) -> typing.Optional[docutils.nodes.Node]: + old_reftarget = node["reftarget"] + if node["reftype"] in _REFTYPES and re.match(_ACCEPTANCE_PATTERN, old_reftarget): + new_reftarget = re.sub(r"\._[a-zA-Z0-9_]*", "", old_reftarget) if new_reftarget != old_reftarget: _replacements_made.append((old_reftarget, new_reftarget)) attrs = contnode.attributes if isinstance(contnode, docutils.nodes.Element) else {} try: - old_refdoc = node['refdoc'] + old_refdoc = node["refdoc"] except KeyError: return None - new_refdoc = old_refdoc.rsplit(os.path.sep, 1)[0] + os.path.sep + new_reftarget.rsplit('.', 1)[0] - return sphinx.util.nodes.make_refnode(app.builder, - old_refdoc, - new_refdoc, - node.get('refid', new_reftarget), - docutils.nodes.literal(new_reftarget, new_reftarget, **attrs), - new_reftarget) + new_refdoc = old_refdoc.rsplit(os.path.sep, 1)[0] + os.path.sep + new_reftarget.rsplit(".", 1)[0] + return sphinx.util.nodes.make_refnode( + app.builder, + old_refdoc, + new_refdoc, + node.get("refid", new_reftarget), + docutils.nodes.literal(new_reftarget, new_reftarget, **attrs), + new_reftarget, + ) return None -def doctree_resolved(_app: sphinx.application.Sphinx, - doctree: docutils.nodes.document, - _docname: str) -> None: +def doctree_resolved(_app: sphinx.application.Sphinx, doctree: docutils.nodes.document, _docname: str) -> None: def predicate(n: docutils.nodes.Node) -> bool: if isinstance(n, docutils.nodes.FixedTextElement): is_text_primitive = len(n.children) == 1 and isinstance(n.children[0], docutils.nodes.Text) @@ -65,22 +67,20 @@ def predicate(n: docutils.nodes.Node) -> bool: return False def substitute_once(text: str) -> str: - out = re.sub(r'\._[a-zA-Z0-9_]*', '', text) + out = re.sub(r"\._[a-zA-Z0-9_]*", "", text) _replacements_made.append((text, out)) return out # The objective here is to replace all references to hidden objects with their exported aliases. - # For example: pyuavcan.presentation._typed_session._publisher.Publisher --> pyuavcan.presentation.Publisher + # For example: pycyphal.presentation._typed_session._publisher.Publisher --> pycyphal.presentation.Publisher for node in doctree.traverse(predicate): assert isinstance(node, docutils.nodes.FixedTextElement) - node.children = [ - docutils.nodes.Text(substitute_once(node.children[0].astext())) - ] + node.children = [docutils.nodes.Text(substitute_once(node.children[0].astext()))] def setup(app: sphinx.application.Sphinx): - app.connect('missing-reference', missing_reference) - app.connect('doctree-resolved', doctree_resolved) + app.connect("missing-reference", missing_reference) + app.connect("doctree-resolved", doctree_resolved) return { - 'parallel_read_safe': True, + "parallel_read_safe": True, } diff --git a/noxfile.py b/noxfile.py index a57e59a..6b67432 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,6 @@ -# Copyright (c) 2021 UAVCAN Consortium +# Copyright (c) 2021 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # type: ignore import os diff --git a/pydsdl/__init__.py b/pydsdl/__init__.py index e1eb116..e34316c 100644 --- a/pydsdl/__init__.py +++ b/pydsdl/__init__.py @@ -1,18 +1,18 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=wrong-import-position import os as _os import sys as _sys -__version__ = "1.15.1" +__version__ = "1.16.0" __version_info__ = tuple(map(int, __version__.split(".")[:3])) __license__ = "MIT" -__author__ = "UAVCAN Consortium" -__copyright__ = "Copyright (c) 2018 UAVCAN Consortium" -__email__ = "consortium@uavcan.org" +__author__ = "OpenCyphal" +__copyright__ = "Copyright (c) 2018 OpenCyphal" +__email__ = "maintainers@opencyphal.org" # Our unorthodox approach to dependency management requires us to apply certain workarounds. # Here, the objective is to allow our library to import stuff from its third-party dependency directory, diff --git a/pydsdl/_bit_length_set/__init__.py b/pydsdl/_bit_length_set/__init__.py index 21bbc4c..4b6cb4e 100644 --- a/pydsdl/_bit_length_set/__init__.py +++ b/pydsdl/_bit_length_set/__init__.py @@ -1,5 +1,5 @@ -# Copyright (c) 2021 UAVCAN Consortium +# Copyright (c) 2021 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from ._bit_length_set import BitLengthSet as BitLengthSet diff --git a/pydsdl/_bit_length_set/_bit_length_set.py b/pydsdl/_bit_length_set/_bit_length_set.py index e1b1676..59cc024 100644 --- a/pydsdl/_bit_length_set/_bit_length_set.py +++ b/pydsdl/_bit_length_set/_bit_length_set.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import typing import warnings @@ -14,7 +14,7 @@ class BitLengthSet: Most of the methods are evaluated analytically in nearly constant time rather than numerically. This is critical for complex layouts where numerical methods break due to combinatorial explosion and/or memory - limits (see this discussed in https://github.com/UAVCAN/pydsdl/issues/23). + limits (see this discussed in https://github.com/OpenCyphal/pydsdl/issues/23). There are several methods that trigger numerical expansion of the solution; due to the aforementioned combinatorial difficulties, they may be effectively incomputable in reasonable time, so production systems should not rely on them. diff --git a/pydsdl/_bit_length_set/_symbolic.py b/pydsdl/_bit_length_set/_symbolic.py index 6bbffee..07c250d 100644 --- a/pydsdl/_bit_length_set/_symbolic.py +++ b/pydsdl/_bit_length_set/_symbolic.py @@ -1,6 +1,6 @@ -# Copyright (c) 2021 UAVCAN Consortium +# Copyright (c) 2021 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import os import abc diff --git a/pydsdl/_bit_length_set/_symbolic_test.py b/pydsdl/_bit_length_set/_symbolic_test.py index 84171d1..db262fa 100644 --- a/pydsdl/_bit_length_set/_symbolic_test.py +++ b/pydsdl/_bit_length_set/_symbolic_test.py @@ -1,6 +1,6 @@ -# Copyright (c) 2021 UAVCAN Consortium +# Copyright (c) 2021 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import typing import random diff --git a/pydsdl/_data_schema_builder.py b/pydsdl/_data_schema_builder.py index e97307c..1ec7896 100644 --- a/pydsdl/_data_schema_builder.py +++ b/pydsdl/_data_schema_builder.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from typing import List, Optional from . import _error diff --git a/pydsdl/_data_type_builder.py b/pydsdl/_data_type_builder.py index f458f45..4572da3 100644 --- a/pydsdl/_data_type_builder.py +++ b/pydsdl/_data_type_builder.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from typing import Optional, Callable, Iterable import logging @@ -198,7 +198,7 @@ def resolve_versioned_data_type(self, name: str, version: _serializable.Version) del name found = list(filter(lambda d: d.full_name == full_name and d.version == version, self._lookup_definitions)) if not found: - # Play Sherlock to help the user with mistakes like https://forum.uavcan.org/t/dsdl-compilation-error/904/2 + # Play Sherlock to help the user with mistakes like https://forum.opencyphal.org/t/904/2 requested_ns = full_name.split(_serializable.CompositeType.NAME_COMPONENT_SEPARATOR)[0] lookup_nss = set(x.root_namespace for x in self._lookup_definitions) subroot_ns = self._definition.name_components[1] if len(self._definition.name_components) > 2 else None diff --git a/pydsdl/_dsdl_definition.py b/pydsdl/_dsdl_definition.py index 1da32e1..93addb1 100644 --- a/pydsdl/_dsdl_definition.py +++ b/pydsdl/_dsdl_definition.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import os import time @@ -54,7 +54,7 @@ def __init__(self, file_path: Path, root_namespace_path: Path): relative_directory, basename = [str(x) for x in os.path.split(relative_path)] # type: str, str - # Parsing the basename, e.g., 434.GetTransportStatistics.0.1.uavcan + # Parsing the basename, e.g., 434.GetTransportStatistics.0.1.dsdl basename_components = basename.split(".")[:-1] str_fixed_port_id: Optional[str] = None if len(basename_components) == 4: @@ -72,7 +72,7 @@ def __init__(self, file_path: Path, root_namespace_path: Path): raise FileNameFormatError( "Not a valid fixed port-ID: %s. " "Namespaces are defined as directories; putting the namespace name in the file name will not work. " - 'For example: "foo/Bar.1.0.uavcan" is OK (where "foo" is a directory); "foo.Bar.1.0.uavcan" is not.' + 'For example: "foo/Bar.1.0.dsdl" is OK (where "foo" is a directory); "foo.Bar.1.0.dsdl" is not.' % str_fixed_port_id, path=self._file_path, ) from None diff --git a/pydsdl/_error.py b/pydsdl/_error.py index d331a2d..d301765 100644 --- a/pydsdl/_error.py +++ b/pydsdl/_error.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=broad-except @@ -57,7 +57,7 @@ def __str__(self) -> str: Nicely formats an error string in the typical error format ``[file:[line:]]description``. Example:: - uavcan/internet/udp/500.HandleIncomingPacket.1.0.uavcan:33: Error such and such + uavcan/internet/udp/500.HandleIncomingPacket.1.0.dsdl:33: Error such and such """ if self.path and self.line: return "%s:%d: %s" % (self.path.as_posix(), self.line, self.text) @@ -85,8 +85,9 @@ def __init__( culprit: typing.Optional[Exception] = None, ): if culprit is not None: - report_text = "PLEASE REPORT AT https://github.com/UAVCAN/pydsdl/issues/new?title=" + urllib.parse.quote( - repr(culprit) + report_text = ( + "PLEASE REPORT AT https://github.com/OpenCyphal/pydsdl/issues/new?title=" + + urllib.parse.quote(repr(culprit)) ) if text: text = text + " " + report_text @@ -115,16 +116,16 @@ def _unittest_error() -> None: assert repr(ex) == "FrontendError: 'Hello world!'" try: - raise FrontendError("Hello world!", path=Path("path/to/file.uavcan"), line=123) + raise FrontendError("Hello world!", path=Path("path/to/file.dsdl"), line=123) except Exception as ex: - assert str(ex) == "path/to/file.uavcan:123: Hello world!" - assert repr(ex) == "FrontendError: 'path/to/file.uavcan:123: Hello world!'" + assert str(ex) == "path/to/file.dsdl:123: Hello world!" + assert repr(ex) == "FrontendError: 'path/to/file.dsdl:123: Hello world!'" try: - raise FrontendError("Hello world!", path=Path("path/to/file.uavcan")) + raise FrontendError("Hello world!", path=Path("path/to/file.dsdl")) except Exception as ex: - assert str(ex) == "path/to/file.uavcan: Hello world!" - assert repr(ex) == "FrontendError: 'path/to/file.uavcan: Hello world!'" + assert str(ex) == "path/to/file.dsdl: Hello world!" + assert repr(ex) == "FrontendError: 'path/to/file.dsdl: Hello world!'" def _unittest_internal_error_github_reporting() -> None: @@ -155,7 +156,7 @@ def _unittest_internal_error_github_reporting() -> None: # Exception('ERROR TEXT') assert str(ex).startswith( "FILE_PATH:42: BASE TEXT " - "PLEASE REPORT AT https://github.com/UAVCAN/pydsdl/issues/new?title=Exception%28%27ERROR%20TEXT%27" + "PLEASE REPORT AT https://github.com/OpenCyphal/pydsdl/issues/new?title=Exception%28%27ERROR%20TEXT%27" ) try: diff --git a/pydsdl/_expression/__init__.py b/pydsdl/_expression/__init__.py index 64ab103..1612671 100644 --- a/pydsdl/_expression/__init__.py +++ b/pydsdl/_expression/__init__.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from ._any import Any as Any from ._any import UndefinedOperatorError as UndefinedOperatorError diff --git a/pydsdl/_expression/_any.py b/pydsdl/_expression/_any.py index 90c802e..ce26355 100644 --- a/pydsdl/_expression/_any.py +++ b/pydsdl/_expression/_any.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import abc from .. import _error diff --git a/pydsdl/_expression/_container.py b/pydsdl/_expression/_container.py index a991f1e..7135705 100644 --- a/pydsdl/_expression/_container.py +++ b/pydsdl/_expression/_container.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=protected-access diff --git a/pydsdl/_expression/_operator.py b/pydsdl/_expression/_operator.py index 522d36b..7f833db 100644 --- a/pydsdl/_expression/_operator.py +++ b/pydsdl/_expression/_operator.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=protected-access diff --git a/pydsdl/_expression/_primitive.py b/pydsdl/_expression/_primitive.py index ba17e6e..6b86485 100644 --- a/pydsdl/_expression/_primitive.py +++ b/pydsdl/_expression/_primitive.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=protected-access diff --git a/pydsdl/_expression/_test.py b/pydsdl/_expression/_test.py index 576d41b..d44dd65 100644 --- a/pydsdl/_expression/_test.py +++ b/pydsdl/_expression/_test.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=consider-using-in,protected-access,too-many-statements diff --git a/pydsdl/_namespace.py b/pydsdl/_namespace.py index f3f2465..b6f19c8 100644 --- a/pydsdl/_namespace.py +++ b/pydsdl/_namespace.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=logging-not-lazy @@ -107,7 +107,7 @@ def read_namespace( :param allow_unregulated_fixed_port_id: Do not reject unregulated fixed port identifiers. As demanded by the specification, the frontend rejects unregulated fixed port ID by default. This is a dangerous feature that must not be used unless you understand the risks. - Please read https://uavcan.org/guide. + Please read https://opencyphal.org/guide. :return: A list of :class:`pydsdl.CompositeType` sorted lexicographically by full data type name, then by major version (newest version first), then by minor version (newest version first). @@ -194,7 +194,7 @@ def read_namespace( _DSDL_FILE_GLOBS = [ - "*.dsdl", # https://forum.uavcan.org/t/uavcan-file-extension/438 + "*.dsdl", # https://forum.opencyphal.org/t/uavcan-file-extension/438 "*.uavcan", # Legacy name, not for new projects. ] _LOG_LIST_ITEM_PREFIX = " " * 4 @@ -617,7 +617,7 @@ def _unittest_nested_roots() -> None: _ensure_no_nested_root_namespaces([Path("a/b"), Path("aa")]) -def _unittest_issue_71() -> None: # https://github.com/UAVCAN/pydsdl/issues/71 +def _unittest_issue_71() -> None: # https://github.com/OpenCyphal/pydsdl/issues/71 import tempfile with tempfile.TemporaryDirectory() as directory: diff --git a/pydsdl/_parser.py b/pydsdl/_parser.py index f3c5893..6c8e508 100644 --- a/pydsdl/_parser.py +++ b/pydsdl/_parser.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import os import typing diff --git a/pydsdl/_port_id_ranges.py b/pydsdl/_port_id_ranges.py index 5344014..b0e4116 100644 --- a/pydsdl/_port_id_ranges.py +++ b/pydsdl/_port_id_ranges.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko MAX_SUBJECT_ID = 8191 MAX_SERVICE_ID = 511 diff --git a/pydsdl/_serializable/__init__.py b/pydsdl/_serializable/__init__.py index f5fc4ab..4589b85 100644 --- a/pydsdl/_serializable/__init__.py +++ b/pydsdl/_serializable/__init__.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from ._serializable import SerializableType as SerializableType diff --git a/pydsdl/_serializable/_array.py b/pydsdl/_serializable/_array.py index 903af23..0223d57 100644 --- a/pydsdl/_serializable/_array.py +++ b/pydsdl/_serializable/_array.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import abc import math @@ -38,7 +38,7 @@ def string_like(self) -> bool: """ True if the array might contain a text string, in which case it is termed to be "string-like". A string-like array is a variable-length array of ``uint8``. - See https://github.com/UAVCAN/specification/issues/51. + See https://github.com/OpenCyphal/specification/issues/51. """ return False diff --git a/pydsdl/_serializable/_attribute.py b/pydsdl/_serializable/_attribute.py index 5bc39b2..c48e0e3 100644 --- a/pydsdl/_serializable/_attribute.py +++ b/pydsdl/_serializable/_attribute.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from .. import _expression from ._serializable import SerializableType, TypeParameterError diff --git a/pydsdl/_serializable/_composite.py b/pydsdl/_serializable/_composite.py index f3c2556..6ed71da 100644 --- a/pydsdl/_serializable/_composite.py +++ b/pydsdl/_serializable/_composite.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import abc import math diff --git a/pydsdl/_serializable/_name.py b/pydsdl/_serializable/_name.py index 5c52c7a..2554d28 100644 --- a/pydsdl/_serializable/_name.py +++ b/pydsdl/_serializable/_name.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import re import string diff --git a/pydsdl/_serializable/_primitive.py b/pydsdl/_serializable/_primitive.py index f2a0e2d..e227e15 100644 --- a/pydsdl/_serializable/_primitive.py +++ b/pydsdl/_serializable/_primitive.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # mypy: warn_unused_ignores=False diff --git a/pydsdl/_serializable/_serializable.py b/pydsdl/_serializable/_serializable.py index 1c6c9b4..6065cf5 100644 --- a/pydsdl/_serializable/_serializable.py +++ b/pydsdl/_serializable/_serializable.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko import abc from .. import _expression diff --git a/pydsdl/_serializable/_void.py b/pydsdl/_serializable/_void.py index 8260aac..576ba2a 100644 --- a/pydsdl/_serializable/_void.py +++ b/pydsdl/_serializable/_void.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko from .._bit_length_set import BitLengthSet from ._serializable import SerializableType diff --git a/pydsdl/_test.py b/pydsdl/_test.py index e54cf55..ddc6f3f 100644 --- a/pydsdl/_test.py +++ b/pydsdl/_test.py @@ -1,6 +1,6 @@ -# Copyright (c) 2018 UAVCAN Consortium +# Copyright (c) 2018 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # pylint: disable=global-statement,protected-access,too-many-statements,consider-using-with @@ -65,21 +65,21 @@ def decorator() -> None: @_in_n_out def _unittest_define() -> None: # I DON'T ALWAYS WRITE UNIT TESTS - d = _define("uavcan/test/5000.Message.1.2.uavcan", "# empty") + d = _define("uavcan/test/5000.Message.1.2.dsdl", "# empty") assert _DIRECTORY is not None assert d.full_name == "uavcan.test.Message" assert d.version == (1, 2) assert d.fixed_port_id == 5000 - assert d.file_path == Path(_DIRECTORY.name, "uavcan", "test", "5000.Message.1.2.uavcan").resolve() + assert d.file_path == Path(_DIRECTORY.name, "uavcan", "test", "5000.Message.1.2.dsdl").resolve() assert d.root_namespace_path == Path(_DIRECTORY.name, "uavcan").resolve() assert open(d.file_path).read() == "# empty" # BUT WHEN I DO, I WRITE UNIT TESTS FOR MY UNIT TESTS - d = _define("uavcan/Service.255.254.uavcan", "# empty 2") + d = _define("uavcan/Service.255.254.dsdl", "# empty 2") assert d.full_name == "uavcan.Service" assert d.version == (255, 254) assert d.fixed_port_id is None - assert d.file_path == Path(_DIRECTORY.name, "uavcan", "Service.255.254.uavcan").resolve() + assert d.file_path == Path(_DIRECTORY.name, "uavcan", "Service.255.254.dsdl").resolve() assert d.root_namespace_path == Path(_DIRECTORY.name, "uavcan").resolve() assert open(d.file_path).read() == "# empty 2" @@ -87,7 +87,7 @@ def _unittest_define() -> None: @_in_n_out def _unittest_simple() -> None: abc = _define( - "vendor/nested/7000.Abc.1.2.uavcan", + "vendor/nested/7000.Abc.1.2.dsdl", dedent( """ @deprecated @@ -107,7 +107,7 @@ def _unittest_simple() -> None: assert isinstance(p, _serializable.DelimitedType) assert isinstance(p.inner_type, _serializable.StructureType) assert p.full_name == "vendor.nested.Abc" - assert str(p.source_file_path).endswith(os.path.join("vendor", "nested", "7000.Abc.1.2.uavcan")) + assert str(p.source_file_path).endswith(os.path.join("vendor", "nested", "7000.Abc.1.2.dsdl")) assert p.source_file_path == abc.file_path assert p.fixed_port_id == 7000 assert p.deprecated @@ -132,12 +132,12 @@ def _unittest_simple() -> None: assert isinstance(t, _serializable.ArrayType) assert str(t.element_type) == "saturated int64" - empty_new = _define("vendor/nested/Empty.255.255.uavcan", """@sealed""") + empty_new = _define("vendor/nested/Empty.255.255.dsdl", """@sealed""") - empty_old = _define("vendor/nested/Empty.255.254.uavcan", """@sealed""") + empty_old = _define("vendor/nested/Empty.255.254.dsdl", """@sealed""") constants = _define( - "another/Constants.5.0.uavcan", + "another/Constants.5.0.dsdl", dedent( """ @sealed @@ -147,7 +147,7 @@ def _unittest_simple() -> None: ) service = _define( - "another/300.Service.0.1.uavcan", + "another/300.Service.0.1.dsdl", dedent( """ @union @@ -258,7 +258,7 @@ def _unittest_simple() -> None: assert hash(p) == hash(p) union = _define( - "another/Union.5.9.uavcan", + "another/Union.5.9.dsdl", dedent( """ @union @@ -300,7 +300,7 @@ def _unittest_simple() -> None: @_in_n_out def _unittest_comments() -> None: abc = _define( - "vendor/nested/7000.Abc.1.2.uavcan", + "vendor/nested/7000.Abc.1.2.dsdl", dedent( """\ # header comment here @@ -330,12 +330,12 @@ def _unittest_comments() -> None: assert p.fields[2].doc == "comment on padding field" assert p.fields[3].doc == "comment on array\nand another" - empty_new = _define("vendor/nested/Empty.255.255.uavcan", """@sealed""") + empty_new = _define("vendor/nested/Empty.255.255.dsdl", """@sealed""") - empty_old = _define("vendor/nested/Empty.255.254.uavcan", """@sealed""") + empty_old = _define("vendor/nested/Empty.255.254.dsdl", """@sealed""") constants = _define( - "another/Constants.5.0.uavcan", + "another/Constants.5.0.dsdl", dedent( """ @sealed @@ -349,7 +349,7 @@ def _unittest_comments() -> None: assert p.constants[0].doc == "no header comment" service = _define( - "another/300.Service.0.1.uavcan", + "another/300.Service.0.1.dsdl", dedent( """\ # first header comment here @@ -385,7 +385,7 @@ def _unittest_comments() -> None: assert res.doc == "second header comment here\nmultiline" # type: ignore union = _define( - "another/Union.5.9.uavcan", + "another/Union.5.9.dsdl", dedent( """ @union @@ -419,120 +419,120 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) return _define(rel_path, definition + "\n").read([], lambda *_: None, allow_unregulated) # pragma: no branch with raises(_error.InvalidDefinitionError, match="(?i).*port ID.*"): - standalone("vendor/1000.InvalidRegulatedSubjectID.1.0.uavcan", "uint2 value\n@sealed") + standalone("vendor/1000.InvalidRegulatedSubjectID.1.0.dsdl", "uint2 value\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*port ID.*"): - standalone("vendor/10.InvalidRegulatedServiceID.1.0.uavcan", "uint2 v1\n@sealed\n---\nint64 v2\n@sealed") + standalone("vendor/10.InvalidRegulatedServiceID.1.0.dsdl", "uint2 v1\n@sealed\n---\nint64 v2\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*subject ID.*"): - standalone("vendor/100000.InvalidRegulatedSubjectID.1.0.uavcan", "uint2 value\n@sealed") + standalone("vendor/100000.InvalidRegulatedSubjectID.1.0.dsdl", "uint2 value\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*service ID.*"): - standalone("vendor/1000.InvalidRegulatedServiceID.1.0.uavcan", "uint2 v1\n@sealed\n---\nint64 v2\n@sealed") + standalone("vendor/1000.InvalidRegulatedServiceID.1.0.dsdl", "uint2 v1\n@sealed\n---\nint64 v2\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*multiple attributes under the same name.*"): - standalone("vendor/AttributeNameCollision.1.0.uavcan", "uint2 value\n@sealed\nint64 value") + standalone("vendor/AttributeNameCollision.1.0.dsdl", "uint2 value\n@sealed\nint64 value") with raises(_error.InvalidDefinitionError, match="(?i).*tagged union cannot contain fewer than.*"): - standalone("vendor/SmallUnion.1.0.uavcan", "@union\nuint2 value\n@sealed") + standalone("vendor/SmallUnion.1.0.dsdl", "@union\nuint2 value\n@sealed") assert ( - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "bool BOOLEAN = false\n@sealed").constants[0].name + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "bool BOOLEAN = false\n@sealed").constants[0].name == "BOOLEAN" ) with raises(_error.InvalidDefinitionError, match=".*Invalid value for boolean constant.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "bool BOOLEAN = 0\n@extent 0") # Should be false + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "bool BOOLEAN = 0\n@extent 0") # Should be false with raises(_error.InvalidDefinitionError, match=".*undefined_identifier.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "bool BOOLEAN = undefined_identifier\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "bool BOOLEAN = undefined_identifier\n@extent 0") with raises(_parser.DSDLSyntaxError): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "bool BOOLEAN = -\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "bool BOOLEAN = -\n@extent 0") with raises(_error.InvalidDefinitionError, match="(?i).*exceeds the range.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "uint10 INTEGRAL = 2000\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "uint10 INTEGRAL = 2000\n@extent 0") with raises(_error.InvalidDefinitionError, match="(?i).*character.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "uint8 CH = '\u0451'\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "uint8 CH = '\u0451'\n@extent 0") with raises(_error.InvalidDefinitionError, match=".*uint8.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "uint9 CH = 'q'\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "uint9 CH = 'q'\n@extent 0") with raises(_error.InvalidDefinitionError, match=".*uint8.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "int8 CH = 'q'\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "int8 CH = 'q'\n@extent 0") with raises(_error.InvalidDefinitionError, match=".*integer constant.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "int8 CH = 1.1\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "int8 CH = 1.1\n@extent 0") with raises(_error.InvalidDefinitionError, match="(?i).*type.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "float32 CH = true\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "float32 CH = true\n@extent 0") with raises(_error.InvalidDefinitionError, match="(?i).*type.*"): - standalone("vendor/invalid_constant_value/A.1.0.uavcan", "float32 CH = 't'\n@extent 0") + standalone("vendor/invalid_constant_value/A.1.0.dsdl", "float32 CH = 't'\n@extent 0") with raises(_parser.DSDLSyntaxError): - standalone("vendor/syntax_error/A.1.0.uavcan", "bool array[10]\n@sealed") + standalone("vendor/syntax_error/A.1.0.dsdl", "bool array[10]\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*array capacity.*"): - standalone("vendor/array_size/A.1.0.uavcan", "bool[0] array\n@sealed") + standalone("vendor/array_size/A.1.0.dsdl", "bool[0] array\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*array capacity.*"): - standalone("vendor/array_size/A.1.0.uavcan", "bool[<1] array\n@sealed") + standalone("vendor/array_size/A.1.0.dsdl", "bool[<1] array\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*array capacity.*"): - standalone("vendor/array_size/A.1.0.uavcan", "bool[true] array\n@sealed") + standalone("vendor/array_size/A.1.0.dsdl", "bool[true] array\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*array capacity.*"): - standalone("vendor/array_size/A.1.0.uavcan", 'bool["text"] array\n@sealed') + standalone("vendor/array_size/A.1.0.dsdl", 'bool["text"] array\n@sealed') with raises(_error.InvalidDefinitionError, match="(?i).*service response marker.*"): standalone( - "vendor/service/A.1.0.uavcan", + "vendor/service/A.1.0.dsdl", "bool request\n@sealed\n---\nbool response\n@sealed\n---\nbool again\n@sealed", ) with raises(_error.InvalidDefinitionError, match="(?i).*unknown directive.*"): - standalone("vendor/directive/A.1.0.uavcan", "@sho_tse_take\n@sealed") + standalone("vendor/directive/A.1.0.dsdl", "@sho_tse_take\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*requires an expression.*"): - standalone("vendor/directive/A.1.0.uavcan", "@assert\n@sealed") + standalone("vendor/directive/A.1.0.dsdl", "@assert\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*does not expect an expression.*"): - standalone("vendor/directive/A.1.0.uavcan", "@union true || false\n@sealed") + standalone("vendor/directive/A.1.0.dsdl", "@union true || false\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*does not expect an expression.*"): - standalone("vendor/directive/A.1.0.uavcan", "@deprecated true || false\n@sealed") + standalone("vendor/directive/A.1.0.dsdl", "@deprecated true || false\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*version number.*"): - standalone("vendor/version/A.0.0.uavcan", "@sealed") + standalone("vendor/version/A.0.0.dsdl", "@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*version number.*"): - standalone("vendor/version/A.0.256.uavcan", "@sealed") + standalone("vendor/version/A.0.256.dsdl", "@sealed") with raises(_dsdl_definition.FileNameFormatError): - standalone("vendor/version/A.0..256.uavcan", "@sealed") + standalone("vendor/version/A.0..256.dsdl", "@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*version number.*"): - standalone("vendor/version/A.256.0.uavcan", "@sealed") + standalone("vendor/version/A.256.0.dsdl", "@sealed") with raises(_parser.DSDLSyntaxError): - standalone("vendor/types/A.1.0.uavcan", "truncated uavcan.node.Heartbeat.1.0 field\n@sealed") + standalone("vendor/types/A.1.0.dsdl", "truncated uavcan.node.Heartbeat.1.0 field\n@sealed") with raises(_serializable._primitive.InvalidCastModeError): - standalone("vendor/types/A.1.0.uavcan", "truncated bool foo\n@sealed") + standalone("vendor/types/A.1.0.dsdl", "truncated bool foo\n@sealed") with raises(_serializable._primitive.InvalidCastModeError): - standalone("vendor/types/A.1.0.uavcan", "truncated int8 foo\n@sealed") + standalone("vendor/types/A.1.0.dsdl", "truncated int8 foo\n@sealed") with raises(_data_type_builder.UndefinedDataTypeError, match=r"(?i).*nonexistent.TypeName.*1\.0.*"): - standalone("vendor/types/A.1.0.uavcan", "nonexistent.TypeName.1.0 field\n@sealed") + standalone("vendor/types/A.1.0.dsdl", "nonexistent.TypeName.1.0 field\n@sealed") with raises(_data_type_builder.UndefinedDataTypeError, match=r"(?i).*vendor[/\\]+types instead of .*vendor.*"): - standalone("vendor/types/A.1.0.uavcan", "types.Nonexistent.1.0 field\n@sealed") + standalone("vendor/types/A.1.0.dsdl", "types.Nonexistent.1.0 field\n@sealed") with raises(_error.InvalidDefinitionError, match=r"(?i).*not defined for.*"): standalone( - "vendor/types/A.1.0.uavcan", + "vendor/types/A.1.0.dsdl", dedent( """ @union @@ -546,7 +546,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match=r"(?i).*field offset is not defined for unions.*"): standalone( - "vendor/types/A.1.0.uavcan", + "vendor/types/A.1.0.dsdl", dedent( """ @union @@ -561,66 +561,64 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_data_type_builder.UndefinedDataTypeError, match=r".*ns.Type_.*1\.0"): _parse_definition( - _define("vendor/types/A.1.0.uavcan", "ns.Type_.1.0 field\n@sealed"), + _define("vendor/types/A.1.0.dsdl", "ns.Type_.1.0 field\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), ], ) with raises(_error.InvalidDefinitionError, match="(?i).*Bit length cannot exceed.*"): _parse_definition( - _define("vendor/types/A.1.0.uavcan", "int128 field\n@sealed"), + _define("vendor/types/A.1.0.dsdl", "int128 field\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), - _define("ns/Type_.1.1.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), + _define("ns/Type_.1.1.dsdl", "@sealed"), ], ) with raises(_error.InvalidDefinitionError, match="(?i).*type.*"): _parse_definition( - _define("vendor/invalid_constant_value/A.1.0.uavcan", "ns.Type_.1.1 VALUE = 123\n@sealed"), + _define("vendor/invalid_constant_value/A.1.0.dsdl", "ns.Type_.1.1 VALUE = 123\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), - _define("ns/Type_.1.1.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), + _define("ns/Type_.1.1.dsdl", "@sealed"), ], ) with raises(_data_type_builder.UndefinedDataTypeError): defs = [ - _define("vendor/circular_dependency/A.1.0.uavcan", "B.1.0 b\n@sealed"), - _define("vendor/circular_dependency/B.1.0.uavcan", "A.1.0 b\n@sealed"), + _define("vendor/circular_dependency/A.1.0.dsdl", "B.1.0 b\n@sealed"), + _define("vendor/circular_dependency/B.1.0.dsdl", "A.1.0 b\n@sealed"), ] _parse_definition(defs[0], defs) with raises(_error.InvalidDefinitionError, match="(?i).*union directive.*"): _parse_definition( - _define("vendor/misplaced_directive/A.1.0.uavcan", "ns.Type_.2.0 field\n@union\n@sealed"), + _define("vendor/misplaced_directive/A.1.0.dsdl", "ns.Type_.2.0 field\n@union\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), ], ) with raises(_error.InvalidDefinitionError, match="(?i).*deprecated directive.*"): _parse_definition( - _define("vendor/misplaced_directive/A.1.0.uavcan", "ns.Type_.2.0 field\n@deprecated\n@sealed"), + _define("vendor/misplaced_directive/A.1.0.dsdl", "ns.Type_.2.0 field\n@deprecated\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), ], ) with raises(_error.InvalidDefinitionError, match="(?i).*deprecated directive.*"): _parse_definition( - _define( - "vendor/misplaced_directive/A.1.0.uavcan", "ns.Type_.2.0 field\n@sealed\n---\n@deprecated\n@sealed" - ), + _define("vendor/misplaced_directive/A.1.0.dsdl", "ns.Type_.2.0 field\n@sealed\n---\n@deprecated\n@sealed"), [ - _define("ns/Type_.2.0.uavcan", "@sealed"), + _define("ns/Type_.2.0.dsdl", "@sealed"), ], ) try: standalone( - "vendor/types/A.1.0.uavcan", + "vendor/types/A.1.0.dsdl", dedent( """ int8 a # Comment @@ -632,22 +630,22 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) ), ) except _error.FrontendError as ex: - assert ex.path and str(ex.path).endswith(os.path.join("vendor", "types", "A.1.0.uavcan")) + assert ex.path and str(ex.path).endswith(os.path.join("vendor", "types", "A.1.0.dsdl")) assert ex.line and ex.line == 4 else: # pragma: no cover assert False - standalone("vendor/types/1.A.1.0.uavcan", "@sealed", allow_unregulated=True) + standalone("vendor/types/1.A.1.0.dsdl", "@sealed", allow_unregulated=True) with raises(_data_type_builder.UnregulatedFixedPortIDError, match=r".*allow_unregulated_fixed_port_id.*"): - standalone("vendor/types/1.A.1.0.uavcan", "@sealed") + standalone("vendor/types/1.A.1.0.dsdl", "@sealed") - standalone("vendor/types/1.A.1.0.uavcan", "@sealed\n---\n@sealed", allow_unregulated=True) + standalone("vendor/types/1.A.1.0.dsdl", "@sealed\n---\n@sealed", allow_unregulated=True) with raises(_data_type_builder.UnregulatedFixedPortIDError, match=r".*allow_unregulated_fixed_port_id.*"): - standalone("vendor/types/1.A.1.0.uavcan", "@sealed\n---\n@sealed") + standalone("vendor/types/1.A.1.0.dsdl", "@sealed\n---\n@sealed") with raises(_error.InvalidDefinitionError, match="(?i).*seal.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int8 a @@ -659,7 +657,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int8 a @@ -671,7 +669,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*sealed.*expression.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int8 a @@ -682,7 +680,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*expression.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int8 a @@ -693,7 +691,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int16 a @@ -704,7 +702,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int16 a @@ -715,7 +713,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*"): standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int16 a @@ -727,7 +725,7 @@ def standalone(rel_path: str, definition: str, allow_unregulated: bool = False) with raises(_error.InvalidDefinitionError, match="(?i).*extent.*"): # Neither extent nor sealed are specified. standalone( - "vendor/sealing/A.1.0.uavcan", + "vendor/sealing/A.1.0.dsdl", dedent( """ int16 a @@ -746,7 +744,7 @@ def print_handler(line_number: int, text: str) -> None: printed_items = line_number, text _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", "# line number 1\n" "# line number 2\n" "@print 2 + 2 == 4 # line number 3\n" "# line number 4\n" "@sealed\n", ).read([], print_handler, False) @@ -754,13 +752,13 @@ def print_handler(line_number: int, text: str) -> None: assert printed_items[0] == 3 assert printed_items[1] == "true" - _define("ns/B.1.0.uavcan", "@print false\n@sealed").read([], print_handler, False) + _define("ns/B.1.0.dsdl", "@print false\n@sealed").read([], print_handler, False) assert printed_items assert printed_items[0] == 1 assert printed_items[1] == "false" _define( - "ns/Offset.1.0.uavcan", "@print _offset_ # Not recorded\n" "uint8 a\n" "@print _offset_\n" "@extent 800\n" + "ns/Offset.1.0.dsdl", "@print _offset_ # Not recorded\n" "uint8 a\n" "@print _offset_\n" "@extent 800\n" ).read([], print_handler, False) assert printed_items assert printed_items[0] == 3 @@ -774,7 +772,7 @@ def _unittest_assert() -> None: _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @assert _offset_ == {0} @@ -806,13 +804,13 @@ def _unittest_assert() -> None: """ ), ), - [_define("ns/Array.1.0.uavcan", "uint8[<=2] foo\n@sealed")], + [_define("ns/Array.1.0.dsdl", "uint8[<=2] foo\n@sealed")], ) with raises(_error.InvalidDefinitionError, match="(?i).*operator is not defined.*"): _parse_definition( _define( - "ns/C.1.0.uavcan", + "ns/C.1.0.dsdl", dedent( """ uint64 big @@ -826,25 +824,25 @@ def _unittest_assert() -> None: with raises(_expression.UndefinedAttributeError): _parse_definition( - _define("ns/C.1.0.uavcan", "@print Service.1.0._bit_length_"), - [_define("ns/Service.1.0.uavcan", "uint8 a\n@sealed\n---\nuint16 b\n@sealed")], + _define("ns/C.1.0.dsdl", "@print Service.1.0._bit_length_"), + [_define("ns/Service.1.0.dsdl", "uint8 a\n@sealed\n---\nuint16 b\n@sealed")], ) with raises(_expression.UndefinedAttributeError): - _parse_definition(_define("ns/C.1.0.uavcan", """uint64 LENGTH = uint64.nonexistent_attribute\n@extent 0"""), []) + _parse_definition(_define("ns/C.1.0.dsdl", """uint64 LENGTH = uint64.nonexistent_attribute\n@extent 0"""), []) with raises(_error.InvalidDefinitionError, match="(?i).*void.*"): - _parse_definition(_define("ns/C.1.0.uavcan", "void2 name\n@sealed"), []) + _parse_definition(_define("ns/C.1.0.dsdl", "void2 name\n@sealed"), []) with raises(_serializable._attribute.InvalidConstantValueError): - _parse_definition(_define("ns/C.1.0.uavcan", "int8 name = true\n@sealed"), []) + _parse_definition(_define("ns/C.1.0.dsdl", "int8 name = true\n@sealed"), []) with raises(_error.InvalidDefinitionError, match=".*value.*"): - _parse_definition(_define("ns/C.1.0.uavcan", "int8 name = {1, 2, 3}\n@sealed"), []) + _parse_definition(_define("ns/C.1.0.dsdl", "int8 name = {1, 2, 3}\n@sealed"), []) _parse_definition( _define( - "ns/D.1.0.uavcan", + "ns/D.1.0.dsdl", dedent( """ @union @@ -860,7 +858,7 @@ def _unittest_assert() -> None: _parse_definition( _define( - "ns/E.1.0.uavcan", + "ns/E.1.0.dsdl", dedent( """ @union @@ -881,7 +879,7 @@ def _unittest_assert() -> None: with raises(_error.InvalidDefinitionError): _parse_definition( _define( - "ns/F.1.0.uavcan", + "ns/F.1.0.dsdl", dedent( """ @union @@ -899,7 +897,7 @@ def _unittest_assert() -> None: with raises(_data_type_builder.AssertionCheckFailureError): _parse_definition( _define( - "ns/G.1.0.uavcan", + "ns/G.1.0.dsdl", dedent( """ float32 a @@ -914,7 +912,7 @@ def _unittest_assert() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*yield a boolean.*"): _parse_definition( _define( - "ns/H.1.0.uavcan", + "ns/H.1.0.dsdl", dedent( """ float32 a @@ -929,7 +927,7 @@ def _unittest_assert() -> None: # Extent verification _parse_definition( _define( - "ns/I.1.0.uavcan", + "ns/I.1.0.dsdl", dedent( """ @assert J.1.0._extent_ == 64 @@ -941,15 +939,15 @@ def _unittest_assert() -> None: ), ), [ - _define("ns/J.1.0.uavcan", "uint8 foo\n@extent 64"), - _define("ns/K.1.0.uavcan", "uint8 foo\n@sealed"), + _define("ns/J.1.0.dsdl", "uint8 foo\n@extent 64"), + _define("ns/K.1.0.dsdl", "uint8 foo\n@sealed"), ], ) # Alignment _parse_definition( _define( - "ns/L.1.0.uavcan", + "ns/L.1.0.dsdl", dedent( """ @assert _offset_ == {0} @@ -971,8 +969,8 @@ def _unittest_assert() -> None: ), ), [ - _define("ns/M.1.0.uavcan", "@extent 16"), - _define("ns/N.1.0.uavcan", "@sealed"), + _define("ns/M.1.0.dsdl", "@extent 16"), + _define("ns/N.1.0.dsdl", "@sealed"), ], ) @@ -999,7 +997,7 @@ def _define(rel_path: str, text: str) -> None: assert [] == _namespace.read_namespace(directory.name) _define( - "zubax/First.1.0.uavcan", + "zubax/First.1.0.dsdl", dedent( """ uint8[<256] a @@ -1011,7 +1009,7 @@ def _define(rel_path: str, text: str) -> None: ) _define( - "zubax/7001.Message.1.0.uavcan", + "zubax/7001.Message.1.0.dsdl", dedent( """ zubax.First.1.0[<=2] a @@ -1023,7 +1021,7 @@ def _define(rel_path: str, text: str) -> None: ) _define( - "zubax/nested/300.Spartans.30.0.uavcan", + "zubax/nested/300.Spartans.30.0.dsdl", dedent( """ @deprecated @@ -1058,7 +1056,7 @@ def _define(rel_path: str, text: str) -> None: assert len(parsed_minimal_args) == 3 _define( - "zubax/colliding/300.Iceberg.30.0.uavcan", + "zubax/colliding/300.Iceberg.30.0.dsdl", dedent( """ @extent 1024 @@ -1084,7 +1082,7 @@ def _define(rel_path: str, text: str) -> None: assert print_output[2] == "{0}" _define( - "zubax/colliding/iceberg/300.Ice.30.0.uavcan", + "zubax/colliding/iceberg/300.Ice.30.0.dsdl", dedent( """ @sealed @@ -1106,9 +1104,9 @@ def _define(rel_path: str, text: str) -> None: _namespace.read_namespace(Path(directory.name, "zubax"), Path(directory.name, "zubax")) try: - os.unlink(Path(directory.name, "zubax/colliding/iceberg/300.Ice.30.0.uavcan")) + os.unlink(Path(directory.name, "zubax/colliding/iceberg/300.Ice.30.0.dsdl")) _define( - "zubax/COLLIDING/300.Iceberg.30.0.uavcan", + "zubax/COLLIDING/300.Iceberg.30.0.dsdl", dedent( """ @extent 1024 @@ -1146,7 +1144,7 @@ def _undefine_glob(rel_path_glob: str) -> None: os.remove(g) _define( - "ns/Spartans.30.0.uavcan", + "ns/Spartans.30.0.dsdl", dedent( """ @deprecated @@ -1162,7 +1160,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ) _define( - "ns/Spartans.30.1.uavcan", + "ns/Spartans.30.1.dsdl", dedent( """ @deprecated @@ -1182,7 +1180,7 @@ def _undefine_glob(rel_path_glob: str) -> None: assert len(parsed) == 2 _define( - "ns/Spartans.30.2.uavcan", + "ns/Spartans.30.2.dsdl", dedent( """ @deprecated @@ -1198,10 +1196,10 @@ def _undefine_glob(rel_path_glob: str) -> None: with raises(_namespace.VersionsOfDifferentKindError): _namespace.read_namespace(Path(directory.name, "ns"), []) - _undefine_glob("ns/Spartans.30.[01].uavcan") + _undefine_glob("ns/Spartans.30.[01].dsdl") _define( - "ns/Spartans.30.0.uavcan", + "ns/Spartans.30.0.dsdl", dedent( """ @deprecated @@ -1219,7 +1217,7 @@ def _undefine_glob(rel_path_glob: str) -> None: assert len(parsed) == 2 _define( - "ns/Spartans.30.1.uavcan", + "ns/Spartans.30.1.dsdl", dedent( """ @deprecated @@ -1233,7 +1231,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ) _define( - "ns/6700.Spartans.30.2.uavcan", + "ns/6700.Spartans.30.2.dsdl", dedent( """ @deprecated @@ -1249,14 +1247,14 @@ def _undefine_glob(rel_path_glob: str) -> None: with raises(_namespace.MultipleDefinitionsUnderSameVersionError): _namespace.read_namespace(Path(directory.name, "ns"), []) - _undefine_glob("ns/Spartans.30.2.uavcan") + _undefine_glob("ns/Spartans.30.2.dsdl") parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) assert len(parsed) == 3 - _undefine_glob("ns/Spartans.30.0.uavcan") + _undefine_glob("ns/Spartans.30.0.dsdl") _define( - "ns/6700.Spartans.30.0.uavcan", + "ns/6700.Spartans.30.0.dsdl", dedent( """ @deprecated @@ -1272,9 +1270,9 @@ def _undefine_glob(rel_path_glob: str) -> None: with raises(_namespace.MinorVersionFixedPortIDError): _namespace.read_namespace(Path(directory.name, "ns"), []) - _undefine_glob("ns/Spartans.30.1.uavcan") + _undefine_glob("ns/Spartans.30.1.dsdl") _define( - "ns/6700.Spartans.30.1.uavcan", + "ns/6700.Spartans.30.1.dsdl", dedent( """ @deprecated @@ -1290,9 +1288,9 @@ def _undefine_glob(rel_path_glob: str) -> None: parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) assert len(parsed) == 3 - _undefine_glob("ns/6700.Spartans.30.1.uavcan") + _undefine_glob("ns/6700.Spartans.30.1.dsdl") _define( - "ns/6701.Spartans.30.1.uavcan", + "ns/6701.Spartans.30.1.dsdl", dedent( """ @deprecated @@ -1309,9 +1307,9 @@ def _undefine_glob(rel_path_glob: str) -> None: _namespace.read_namespace(Path(directory.name, "ns"), []) # Adding new major version under the same FPID - _undefine_glob("ns/6701.Spartans.30.1.uavcan") + _undefine_glob("ns/6701.Spartans.30.1.dsdl") _define( - "ns/6700.Spartans.31.0.uavcan", + "ns/6700.Spartans.31.0.dsdl", dedent( """ @deprecated @@ -1328,9 +1326,9 @@ def _undefine_glob(rel_path_glob: str) -> None: _namespace.read_namespace(Path(directory.name, "ns"), []) # Major version zero allows us to re-use the same FPID under a different (non-zero) major version - _undefine_glob("ns/6700.Spartans.31.0.uavcan") + _undefine_glob("ns/6700.Spartans.31.0.dsdl") _define( - "ns/6700.Spartans.0.1.uavcan", + "ns/6700.Spartans.0.1.dsdl", dedent( """ @deprecated @@ -1344,11 +1342,11 @@ def _undefine_glob(rel_path_glob: str) -> None: ) # These are needed to ensure full branch coverage, see the checking code. - _define("ns/Empty.1.0.uavcan", "@extent 0") - _define("ns/Empty.1.1.uavcan", "@extent 0") - _define("ns/Empty.2.0.uavcan", "@extent 0") - _define("ns/6800.Empty.3.0.uavcan", "@extent 0") - _define("ns/6801.Empty.4.0.uavcan", "@extent 0") + _define("ns/Empty.1.0.dsdl", "@extent 0") + _define("ns/Empty.1.1.dsdl", "@extent 0") + _define("ns/Empty.2.0.dsdl", "@extent 0") + _define("ns/6800.Empty.3.0.dsdl", "@extent 0") + _define("ns/6801.Empty.4.0.dsdl", "@extent 0") parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 8 @@ -1366,11 +1364,11 @@ def _undefine_glob(rel_path_glob: str) -> None: ] # Extent consistency -- non-service type - _define("ns/Consistency.1.0.uavcan", "uint8 a\n@extent 128") - _define("ns/Consistency.1.1.uavcan", "uint8 a\nuint8 b\n@extent 128") + _define("ns/Consistency.1.0.dsdl", "uint8 a\n@extent 128") + _define("ns/Consistency.1.1.dsdl", "uint8 a\nuint8 b\n@extent 128") parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 - _define("ns/Consistency.1.2.uavcan", "uint8 a\nuint8 b\nuint8 c\n@extent 256") + _define("ns/Consistency.1.2.dsdl", "uint8 a\nuint8 b\nuint8 c\n@extent 256") with raises( _namespace.ExtentConsistencyError, match=r"(?i).*extent of ns\.Consistency\.1\.2 is 256 bits.*" ) as ei_extent: @@ -1380,17 +1378,17 @@ def _undefine_glob(rel_path_glob: str) -> None: _undefine_glob("ns/Consistency*") # Extent consistency -- non-service type, zero major version - _define("ns/Consistency.0.1.uavcan", "uint8 a\n@extent 128") - _define("ns/Consistency.0.2.uavcan", "uint8 a\nuint8 b\n@extent 128") + _define("ns/Consistency.0.1.dsdl", "uint8 a\n@extent 128") + _define("ns/Consistency.0.2.dsdl", "uint8 a\nuint8 b\n@extent 128") parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 - _define("ns/Consistency.0.3.uavcan", "uint8 a\nuint8 b\nuint8 c\n@extent 256") # no error + _define("ns/Consistency.0.3.dsdl", "uint8 a\nuint8 b\nuint8 c\n@extent 256") # no error _namespace.read_namespace(Path(directory.name, "ns"), []) _undefine_glob("ns/Consistency*") # Extent consistency -- request _define( - "ns/Consistency.1.0.uavcan", + "ns/Consistency.1.0.dsdl", dedent( """ uint8 a @@ -1402,7 +1400,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ), ) _define( - "ns/Consistency.1.1.uavcan", + "ns/Consistency.1.1.dsdl", dedent( """ uint8 a @@ -1417,7 +1415,7 @@ def _undefine_glob(rel_path_glob: str) -> None: parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 _define( - "ns/Consistency.1.2.uavcan", + "ns/Consistency.1.2.dsdl", dedent( """ uint8 a @@ -1439,7 +1437,7 @@ def _undefine_glob(rel_path_glob: str) -> None: # Extent consistency -- response _define( - "ns/Consistency.1.0.uavcan", + "ns/Consistency.1.0.dsdl", dedent( """ uint8 a @@ -1451,7 +1449,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ), ) _define( - "ns/Consistency.1.1.uavcan", + "ns/Consistency.1.1.dsdl", dedent( """ uint8 a @@ -1466,7 +1464,7 @@ def _undefine_glob(rel_path_glob: str) -> None: parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 _define( - "ns/Consistency.1.2.uavcan", + "ns/Consistency.1.2.dsdl", dedent( """ uint8 a @@ -1486,11 +1484,11 @@ def _undefine_glob(rel_path_glob: str) -> None: _undefine_glob("ns/Consistency*") # Sealing consistency -- non-service type - _define("ns/Consistency.1.0.uavcan", "uint64 a\n@extent 64") - _define("ns/Consistency.1.1.uavcan", "uint64 a\n@extent 64") + _define("ns/Consistency.1.0.dsdl", "uint64 a\n@extent 64") + _define("ns/Consistency.1.1.dsdl", "uint64 a\n@extent 64") parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 - _define("ns/Consistency.1.2.uavcan", "uint64 a\n@sealed") + _define("ns/Consistency.1.2.dsdl", "uint64 a\n@sealed") with raises(_namespace.SealingConsistencyError, match=r"(?i).*ns\.Consistency\.1\.2 is sealed.*") as ei_sealing: _namespace.read_namespace(Path(directory.name, "ns"), []) print(ei_sealing.value) @@ -1499,7 +1497,7 @@ def _undefine_glob(rel_path_glob: str) -> None: # Sealing consistency -- request _define( - "ns/Consistency.1.0.uavcan", + "ns/Consistency.1.0.dsdl", dedent( """ uint64 a @@ -1511,7 +1509,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ), ) _define( - "ns/Consistency.1.1.uavcan", + "ns/Consistency.1.1.dsdl", dedent( """ uint64 a @@ -1525,7 +1523,7 @@ def _undefine_glob(rel_path_glob: str) -> None: parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 _define( - "ns/Consistency.1.2.uavcan", + "ns/Consistency.1.2.dsdl", dedent( """ uint64 a @@ -1544,7 +1542,7 @@ def _undefine_glob(rel_path_glob: str) -> None: # Sealing consistency -- response _define( - "ns/Consistency.1.0.uavcan", + "ns/Consistency.1.0.dsdl", dedent( """ uint64 a @@ -1556,7 +1554,7 @@ def _undefine_glob(rel_path_glob: str) -> None: ), ) _define( - "ns/Consistency.1.1.uavcan", + "ns/Consistency.1.1.dsdl", dedent( """ uint64 a @@ -1570,7 +1568,7 @@ def _undefine_glob(rel_path_glob: str) -> None: parsed = _namespace.read_namespace(Path(directory.name, "ns"), []) # no error assert len(parsed) == 10 _define( - "ns/Consistency.1.2.uavcan", + "ns/Consistency.1.2.dsdl", dedent( """ uint64 a @@ -1615,10 +1613,10 @@ def _unittest_inconsistent_deprecation() -> None: from pytest import raises _parse_definition( - _define("ns/A.1.0.uavcan", "@sealed"), + _define("ns/A.1.0.dsdl", "@sealed"), [ _define( - "ns/B.1.0.uavcan", + "ns/B.1.0.dsdl", dedent( """ @deprecated @@ -1633,7 +1631,7 @@ def _unittest_inconsistent_deprecation() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*depend.*deprecated.*"): _parse_definition( _define( - "ns/C.1.0.uavcan", + "ns/C.1.0.dsdl", dedent( """ X.1.0 b @@ -1641,12 +1639,12 @@ def _unittest_inconsistent_deprecation() -> None: """ ), ), - [_define("ns/X.1.0.uavcan", "@deprecated\n@sealed")], + [_define("ns/X.1.0.dsdl", "@deprecated\n@sealed")], ) _parse_definition( _define( - "ns/D.1.0.uavcan", + "ns/D.1.0.dsdl", dedent( """ @deprecated @@ -1655,7 +1653,7 @@ def _unittest_inconsistent_deprecation() -> None: """ ), ), - [_define("ns/X.1.0.uavcan", "@deprecated\n@sealed")], + [_define("ns/X.1.0.dsdl", "@deprecated\n@sealed")], ) @@ -1665,7 +1663,7 @@ def _unittest_repeated_directives() -> None: _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @union @@ -1682,7 +1680,7 @@ def _unittest_repeated_directives() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*deprecated.*"): _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @deprecated @@ -1697,7 +1695,7 @@ def _unittest_repeated_directives() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*deprecated.*"): _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @deprecated @@ -1713,7 +1711,7 @@ def _unittest_repeated_directives() -> None: _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @union @@ -1734,7 +1732,7 @@ def _unittest_repeated_directives() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*union.*"): _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @union @@ -1751,7 +1749,7 @@ def _unittest_repeated_directives() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*sealed.*"): _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ @sealed @@ -1768,7 +1766,7 @@ def _unittest_repeated_directives() -> None: with raises(_error.InvalidDefinitionError, match="(?i).*extent.*already set.*"): _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( """ int8 a @@ -1790,7 +1788,7 @@ def _unittest_dsdl_parser_basics() -> None: # noinspection SpellCheckingInspection _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( r""" @deprecated @@ -1812,8 +1810,8 @@ def _unittest_dsdl_parser_basics() -> None: ), ), [ - _define("ns/Foo.1.0.uavcan", "int8 THE_CONSTANT = 42\n@extent 1024"), - _define("ns/Bar.1.23.uavcan", "int8 the_field\nint8 A = 0xA\nint8 B = 0xB\n@extent 1024"), + _define("ns/Foo.1.0.dsdl", "int8 THE_CONSTANT = 42\n@extent 1024"), + _define("ns/Bar.1.23.dsdl", "int8 the_field\nint8 A = 0xA\nint8 B = 0xB\n@extent 1024"), ], ) @@ -1824,7 +1822,7 @@ def _unittest_dsdl_parser_expressions() -> None: def throws(definition: str, exc: typing.Type[Exception] = _expression.InvalidOperandError) -> None: with raises(exc): - _parse_definition(_define("ns/Throws.0.1.uavcan", dedent(definition + "\n@sealed")), []) + _parse_definition(_define("ns/Throws.0.1.dsdl", dedent(definition + "\n@sealed")), []) throws("bool R = true && 0") throws("bool R = true || 0") @@ -1861,7 +1859,7 @@ def throws(definition: str, exc: typing.Type[Exception] = _expression.InvalidOpe _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( r""" float64 PI = 3.141592653589793 @@ -1922,7 +1920,7 @@ def _unittest_pickle() -> None: p = _parse_definition( _define( - "ns/A.1.0.uavcan", + "ns/A.1.0.dsdl", dedent( r""" float64 PI = 3.141592653589793 diff --git a/setup.cfg b/setup.cfg index 8033a12..16ea5f5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,14 +1,14 @@ [metadata] name = pydsdl version = attr: pydsdl.__version__ -author = UAVCAN Development Team -author_email = pavel.kirienko@zubax.com -url = https://uavcan.org -description = UAVCAN DSDL processing frontend implemented in Python +author = OpenCyphal +author_email = maintainers@opencyphal.org +url = https://opencyphal.org +description = Cyphal DSDL processing frontend long_description = file: README.md long_description_content_type = text/markdown license = MIT -keywords = uavcan, dsdl, parser, compiler +keywords = cyphal, opencyphal, uavcan, dsdl, parser, compiler classifiers = Intended Audience :: Developers Topic :: Scientific/Engineering diff --git a/setup.py b/setup.py index 4c2619c..b7965c7 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# Copyright (c) 2020 UAVCAN Consortium +# Copyright (c) 2020 OpenCyphal # This software is distributed under the terms of the MIT License. -# Author: Pavel Kirienko +# Author: Pavel Kirienko # type: ignore import sys