Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion comtypes/_npsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def enable(self):
if self.enabled:
return
# first we have to be able to import numpy
import numpy

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in the comment above, we need to import numpy here to cache it in the Python import system.

By adding # noqa: F401 only to this line, you can remove the setting from pyproject.toml while keeping the import.


# if that succeeded we can be enabled
self.enabled = True
Expand Down
2 changes: 1 addition & 1 deletion comtypes/automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ctypes import *
from ctypes import Array as _CArrayType
from ctypes import _Pointer
from ctypes.wintypes import DWORD, LONG, UINT, VARIANT_BOOL, WCHAR, WORD
from ctypes.wintypes import DWORD, LONG, UINT, VARIANT_BOOL, WORD
from typing import TYPE_CHECKING, Any, ClassVar, Optional

import comtypes
Expand Down
1 change: 0 additions & 1 deletion comtypes/client/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
################################################################
import keyword
import sys

import comtypes
import comtypes.automation
Expand Down
1 change: 0 additions & 1 deletion comtypes/test/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
import glob
from distutils.core import setup

import py2exe

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration between this project and py2exe might already be broken, but I'd like to keep it as it is for now.
Please also add # noqa: F401 to this line.


setup(name="test_*", console=glob.glob("test_*.py"))
3 changes: 1 addition & 2 deletions comtypes/test/test_agilent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
# connected, the driver is used in simulation mode.

import unittest
from ctypes import POINTER, c_double
from ctypes import c_double

from comtypes import GUID
from comtypes.client import CreateObject
from comtypes.safearray import _midlSAFEARRAY
from comtypes.test import ResourceDenied

try:
GUID.from_progid("Agilent546XX.Agilent546XX")
Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def GetStackTrace(self, this, *args):

def test_GetStackTrace(self):
p = wrap(self.create())
from ctypes import POINTER, c_int, pointer
from ctypes import c_int, pointer

frames = (c_int * 5)()
res = p.GetStackTrace(42, frames, 5)
Expand Down Expand Up @@ -324,7 +324,7 @@ def OnSomethingElse(self, this, presult):
path = tlb.compile()
from comtypes.connectionpoints import IConnectionPointContainer
from comtypes.gen import TestLib
from comtypes.typeinfo import IProvideClassInfo, IProvideClassInfo2
from comtypes.typeinfo import IProvideClassInfo2

MyServer._com_interfaces_ = [
TestLib.IMyInterface,
Expand Down
1 change: 0 additions & 1 deletion comtypes/test/test_urlhistory.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import unittest
from copy import copy
from ctypes import *

from comtypes.client import CreateObject, GetModule
Expand Down
2 changes: 0 additions & 2 deletions comtypes/test/test_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
VT_UI4,
VT_UI8,
)
from comtypes.test.find_memleak import find_memleak
from comtypes.typeinfo import LoadRegTypeLib


Expand Down Expand Up @@ -316,7 +315,6 @@ def check_perf(rep=20000):
from ctypes import byref, c_int

import comtypes.automation
from comtypes.automation import VARIANT

print(comtypes.automation)
variable = c_int()
Expand Down
1 change: 0 additions & 1 deletion comtypes/tools/typedesc_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Any, Optional, SupportsInt
from typing import Union as _UnionT

import comtypes


class Argument:
Expand Down
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import sys

import sphinx_rtd_theme

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might have been necessary for Sphinx.
Please check if the documentation can still be built even if this is removed.


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
21 changes: 8 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,31 @@ ignore = ["E402"]

[tool.ruff.lint.per-file-ignores]
# production
"comtypes/_npsupport.py" = ["F401"]
"comtypes/_vtbl.py" = ["E722"]
"comtypes/automation.py" = ["F401", "F403", "F405"]
"comtypes/automation.py" = ["F403", "F405"]
"comtypes/viewobject.py" = ["F403", "F405"]
"comtypes/client/_constants.py" = ["F401"]
"comtypes/server/automation.py" = ["F403", "F405"]
"comtypes/server/connectionpoints.py" = ["F401", "F403", "F405"]
"comtypes/server/connectionpoints.py" = ["F403", "F405"]
"comtypes/server/inprocserver.py" = ["E722"]
"comtypes/server/register.py" = ["E713"]
"comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
"comtypes/tools/typedesc.py" = ["F403", "F405"]
"comtypes/tools/typedesc_base.py" = ["F401"]
# gen directory
"comtypes/gen/*" = ["E", "F", "I"]
# stub
"comtypes/hints.pyi" = ["I"]
# tests
"comtypes/test/TestDispServer.py" = ["E401"]
"comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
"comtypes/test/setup.py" = ["F401"]
"comtypes/test/test_agilent.py" = ["F401", "F841"]
"comtypes/test/test_client.py" = ["F401"]
"comtypes/test/find_memleak.py" = ["E401", "F403", "F405"]
"comtypes/test/test_agilent.py" = ["F841"]
"comtypes/test/test_dict.py" = ["F841"]
"comtypes/test/test_eventinterface.py" = ["F841"]
"comtypes/test/test_outparam.py" = ["F841"]
"comtypes/test/test_sapi.py" = ["E401"]
"comtypes/test/test_server.py" = ["F401", "F841"]
"comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
"comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
"comtypes/test/test_variant.py" = ["F401", "F821", "F841"]
"comtypes/test/test_server.py" = ["F841"]
"comtypes/test/test_subinterface.py" = ["E401", "F403", "F405"]
"comtypes/test/test_urlhistory.py" = ["E401", "F403", "F405", "F841"]
"comtypes/test/test_variant.py" = ["F821", "F841"]

[tool.coverage.run]
# Specify the source directory to avoid tracking temporary files created by "test_client_regenerate_modules.py".
Expand Down