Skip to content

Commit ecf366f

Browse files
author
Edgar Merger
committed
variantmanager deeper object hinting
1 parent 0cc76ab commit ecf366f

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

xpedition_constraintmanager/constraintmanager_lib_gen/sniff_constraintmanager_ifc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ def add_future_annotations():
180180
file.writelines(lines)
181181
print(f"Added future import line to {filename}.")
182182
else:
183-
print(f"The future import line already exists in {filename}.")
183+
print(f"The future import line already exists in {filename}.")
184+
184185
def run() -> None:
185186
#generate_input() # uncomment this line to generate constraintsauto object
186187
generate_output()

xpedition_variantmanager/variantmanager_ifc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from __future__ import annotations # In order that Python does not evaluate any type hints immediately
12
# -*- coding: mbcs -*-
23
# Created by makepy.py version 0.5.01
3-
# By python version 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
4-
# On Thu Nov 14 09:57:34 2024
4+
# By python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
5+
# On Thu Nov 14 17:54:10 2024
56
'MGCVARIANTMGR Variant Manager Type Library'
67
makepy_version = '0.5.01'
7-
python_version = 0x3090af0
8+
python_version = 0x30b06f0
89

910
import win32com.client.CLSIDToClass, pythoncom, pywintypes
1011
import win32com.client.util

xpedition_variantmanager/variantmanager_lib_gen/sniff_variantmanager_ifc.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,34 @@ def cleanup():
159159
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
160160
print(result)
161161

162+
def add_future_annotations():
163+
# Define the file to be
164+
filename = './variantmanager_ifc.py'
165+
166+
# Define the line to be added
167+
future_import_line = "from __future__ import annotations # In order that Python does not evaluate any type hints immediately\n"
168+
169+
# Read the existing file content
170+
with open(filename, 'r') as file:
171+
lines = file.readlines()
172+
173+
# Check if the line already exists
174+
if future_import_line.strip() not in (line.strip() for line in lines):
175+
# Add the future import line to the top
176+
lines.insert(0, future_import_line)
177+
178+
# Write the modified content back to the file
179+
with open(filename, 'w') as file:
180+
file.writelines(lines)
181+
print(f"Added future import line to {filename}.")
182+
else:
183+
print(f"The future import line already exists in {filename}.")
184+
162185
def run() -> None:
163186
generate_input()
164187
generate_output()
165188
add_type_hints_to_methods()
189+
add_future_annotations()
166190
copy_result()
167191
#cleanup()
168192

xpedition_variantmanager/variantmanager_lib_gen/variantmanager_ifc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from __future__ import annotations # In order that Python does not evaluate any type hints immediately
12
# -*- coding: mbcs -*-
23
# Created by makepy.py version 0.5.01
3-
# By python version 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
4-
# On Thu Nov 14 09:57:34 2024
4+
# By python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
5+
# On Thu Nov 14 17:54:10 2024
56
'MGCVARIANTMGR Variant Manager Type Library'
67
makepy_version = '0.5.01'
7-
python_version = 0x3090af0
8+
python_version = 0x30b06f0
89

910
import win32com.client.CLSIDToClass, pythoncom, pywintypes
1011
import win32com.client.util

xpedition_variantmanager/variantmanager_lib_gen/variantmanager_orig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# -*- coding: mbcs -*-
22
# Created by makepy.py version 0.5.01
3-
# By python version 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
4-
# On Thu Nov 14 09:57:34 2024
3+
# By python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
4+
# On Thu Nov 14 17:54:10 2024
55
'MGCVARIANTMGR Variant Manager Type Library'
66
makepy_version = '0.5.01'
7-
python_version = 0x3090af0
7+
python_version = 0x30b06f0
88

99
import win32com.client.CLSIDToClass, pythoncom, pywintypes
1010
import win32com.client.util

0 commit comments

Comments
 (0)