Skip to content

Commit

Permalink
repo: add ceph-18.2.2-mgr-ceph-module-stub.patch
Browse files Browse the repository at this point in the history
This mocks out a module for mgr_module.py to 'import' during mypy
type analysis. Previously the ceph_module.pyi was enough for this to
work, but I guess something in the tooling changed.

I cannot figure out why this ever worked before, and why it doesn't
now.

Maybe related to python/mypy#16987 ?
  • Loading branch information
bazaah committed Mar 16, 2024
1 parent c1e9b4c commit e43b5e0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions ceph-18.2.2-mgr-ceph-module-stub.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
diff --git a/src/pybind/mgr/ceph_module.py b/src/pybind/mgr/ceph_module.py
new file mode 100644
index 00000000000..bfa21a853f4
--- /dev/null
+++ b/src/pybind/mgr/ceph_module.py
@@ -0,0 +1,28 @@
+# This is an interface definition of classes that are generated within C++.
+# Used by mypy to do proper type checking of mgr modules.
+# Without this file, all classes have undefined base classes.
+
+from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple, Union
+try:
+ from typing import Protocol # Protocol was added in Python 3.8
+except ImportError:
+ class Protocol: # type: ignore
+ pass
+
+class BasePyOSDMap(object):
+ pass
+
+class BasePyOSDMapIncremental(object):
+ pass
+
+class BasePyCRUSH(object):
+ pass
+
+class BaseMgrStandbyModule(object):
+ pass
+
+class CompletionT(Protocol):
+ pass
+
+class BaseMgrModule(object):
+ pass

0 comments on commit e43b5e0

Please sign in to comment.