From 2c6100ceadcf93b0e9745da9393990c1d0c7d1b8 Mon Sep 17 00:00:00 2001 From: lojack5 <1458329+lojack5@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:28:19 -0600 Subject: [PATCH] Enable return-type annotations With the work from the previous commits, it's as simple as no longer lopping off the args string at the '->' marker. (And one minor fixup to the makePyArgsString code). --- etgtools/extractors.py | 2 +- etgtools/pi_generator.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/etgtools/extractors.py b/etgtools/extractors.py index 35e12c8f..3eb14eb2 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -466,7 +466,7 @@ class FunctionDef(BaseDef, FixWxPrefix): params = list() returns = list() if self.type and self.type != 'void': - returns.append(self.cleanName(self.type)) + returns.append(self.cleanType(self.type)) defValueMap = { 'true': 'True', 'false': 'False', diff --git a/etgtools/pi_generator.py b/etgtools/pi_generator.py index e8a969c0..66e4c7bd 100644 --- a/etgtools/pi_generator.py +++ b/etgtools/pi_generator.py @@ -380,9 +380,6 @@ class PiWrapperGenerator(generators.WrapperGeneratorBase, FixWxPrefix): argsString = function.pyArgsString if not argsString: argsString = '()' - if '->' in argsString: - pos = argsString.find(')') - argsString = argsString[:pos+1] if '(' != argsString[0]: pos = argsString.find('(') argsString = argsString[pos:] @@ -552,9 +549,6 @@ class PiWrapperGenerator(generators.WrapperGeneratorBase, FixWxPrefix): argsString = method.pyArgsString if not argsString: argsString = '()' - if '->' in argsString: - pos = argsString.find(') ->') - argsString = argsString[:pos+1] if '(' != argsString[0]: pos = argsString.find('(') argsString = argsString[pos:]