Patrik Gustavsson | 8f1f9aa | 2021-06-28 07:41:58 +0200 | [diff] [blame] | 1 | # Copyright (C) 2021 Arm Limited or its affiliates. All rights reserved. |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | # not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # Description: |
| 17 | # Utility functions used in supported operator checking |
| 18 | |
| 19 | |
| 20 | def list_formatter(arg): |
| 21 | # Order and join into a string representation |
| 22 | return ", ".join(sorted(map(str, arg))) |
| 23 | |
| 24 | |
| 25 | # Custom decorator function to allow formatting docstrings containing "{}" |
| 26 | def docstring_format_args(args): |
| 27 | def docstring(func): |
| 28 | func.__doc__ = func.__doc__.format(*args) |
| 29 | return func |
| 30 | |
| 31 | return docstring |