Skip to content

Commit

Permalink
variantmanager deeper object hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar Merger committed Nov 14, 2024
1 parent 0cc76ab commit ecf366f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def add_future_annotations():
file.writelines(lines)
print(f"Added future import line to {filename}.")
else:
print(f"The future import line already exists in {filename}.")
print(f"The future import line already exists in {filename}.")

def run() -> None:
#generate_input() # uncomment this line to generate constraintsauto object
generate_output()
Expand Down
7 changes: 4 additions & 3 deletions xpedition_variantmanager/variantmanager_ifc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations # In order that Python does not evaluate any type hints immediately
# -*- coding: mbcs -*-
# Created by makepy.py version 0.5.01
# By python version 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
# On Thu Nov 14 09:57:34 2024
# By python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
# On Thu Nov 14 17:54:10 2024
'MGCVARIANTMGR Variant Manager Type Library'
makepy_version = '0.5.01'
python_version = 0x3090af0
python_version = 0x30b06f0

import win32com.client.CLSIDToClass, pythoncom, pywintypes
import win32com.client.util
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,34 @@ def cleanup():
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print(result)

def add_future_annotations():
# Define the file to be
filename = './variantmanager_ifc.py'

# Define the line to be added
future_import_line = "from __future__ import annotations # In order that Python does not evaluate any type hints immediately\n"

# Read the existing file content
with open(filename, 'r') as file:
lines = file.readlines()

# Check if the line already exists
if future_import_line.strip() not in (line.strip() for line in lines):
# Add the future import line to the top
lines.insert(0, future_import_line)

# Write the modified content back to the file
with open(filename, 'w') as file:
file.writelines(lines)
print(f"Added future import line to {filename}.")
else:
print(f"The future import line already exists in {filename}.")

def run() -> None:
generate_input()
generate_output()
add_type_hints_to_methods()
add_future_annotations()
copy_result()
#cleanup()

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

import win32com.client.CLSIDToClass, pythoncom, pywintypes
import win32com.client.util
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: mbcs -*-
# Created by makepy.py version 0.5.01
# By python version 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
# On Thu Nov 14 09:57:34 2024
# By python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]
# On Thu Nov 14 17:54:10 2024
'MGCVARIANTMGR Variant Manager Type Library'
makepy_version = '0.5.01'
python_version = 0x3090af0
python_version = 0x30b06f0

import win32com.client.CLSIDToClass, pythoncom, pywintypes
import win32com.client.util
Expand Down

0 comments on commit ecf366f

Please sign in to comment.