Show More
@@ -1,38 +1,30 | |||
|
1 | 1 | # util.py - Utilities for declaring interfaces. |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | # zope.interface imposes a run-time cost due to module import overhead and |
|
9 | 9 | # bookkeeping for declaring interfaces. So, we use stubs for various |
|
10 | 10 | # zope.interface primitives unless instructed otherwise. |
|
11 | 11 | |
|
12 | 12 | from __future__ import annotations |
|
13 | 13 | |
|
14 | from .. import encoding | |
|
15 | ||
|
16 | if encoding.environ.get(b'HGREALINTERFACES'): | |
|
17 | from ..thirdparty.zope import interface as zi | |
|
18 | ||
|
19 | Attribute = zi.Attribute | |
|
20 | Interface = zi.Interface | |
|
21 | implementer = zi.implementer | |
|
22 | else: | |
|
14 | if True: | |
|
23 | 15 | |
|
24 | 16 | class Attribute: |
|
25 | 17 | def __init__(self, __name__, __doc__=b''): |
|
26 | 18 | pass |
|
27 | 19 | |
|
28 | 20 | class Interface: |
|
29 | 21 | def __init__( |
|
30 | 22 | self, name, bases=(), attrs=None, __doc__=None, __module__=None |
|
31 | 23 | ): |
|
32 | 24 | pass |
|
33 | 25 | |
|
34 | 26 | def implementer(*ifaces): |
|
35 | 27 | def wrapper(cls): |
|
36 | 28 | return cls |
|
37 | 29 | |
|
38 | 30 | return wrapper |
General Comments 0
You need to be logged in to leave comments.
Login now