From db52c7b83a42ef3d1f9565f0ac2430b6450846de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= <hugo@lysator.liu.se> Date: Thu, 21 Sep 2023 02:12:39 +0200 Subject: [PATCH] Resolve TODO's in muppet.puppet.ast. --- muppet/puppet/ast.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/muppet/puppet/ast.py b/muppet/puppet/ast.py index de266e8..9624aae 100644 --- a/muppet/puppet/ast.py +++ b/muppet/puppet/ast.py @@ -116,7 +116,7 @@ class PuppetCall(PuppetAST): @dataclass class PuppetCallMethod(PuppetAST): - """A method call? TODO.""" + """A method call.""" func: PuppetAST args: list[PuppetAST] @@ -312,14 +312,14 @@ class PuppetParenthesis(PuppetAST): @dataclass class PuppetQn(PuppetAST): - """Qn TODO.""" + """Qn.""" name: str @dataclass class PuppetQr(PuppetAST): - """Qr TODO.""" + """Qr.""" name: str @@ -839,25 +839,23 @@ from typing import ( TypeVar, Callable, ) +import sys F = TypeVar('F', bound=Callable[..., object]) -# TODO replace this decorator with -# from typing import override -# once the target python version is changed to 3.12 - - -def override(f: F) -> F: - """ - Return function unchanged. - - Placeholder @override annotator if the actual annotation isn't - implemented in the current python version. - """ - return f +if sys.version_info >= (3, 12): + from typing import override +else: + def override(f: F) -> F: + """ + Return function unchanged. + Placeholder @override annotator if the actual annotation isn't + implemented in the current python version. + """ + return f '''.lstrip()) print('''""" -- GitLab