File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,33 @@ def valid(line):
125125 return line and not line .startswith ('#' )
126126
127127
128- class EntryPoint :
128+ class DeprecatedTuple :
129+ """
130+ Provide subscript item access for backward compatibility.
131+
132+ >>> recwarn = getfixture('recwarn')
133+ >>> ep = EntryPoint(name='name', value='value', group='group')
134+ >>> ep[:]
135+ ('name', 'value', 'group')
136+ >>> ep[0]
137+ 'name'
138+ >>> len(recwarn)
139+ 1
140+ """
141+
142+ _warn = functools .partial (
143+ warnings .warn ,
144+ "EntryPoint tuple interface is deprecated. Access members by name." ,
145+ DeprecationWarning ,
146+ stacklevel = pypy_partial (2 ),
147+ )
148+
149+ def __getitem__ (self , item ):
150+ self ._warn ()
151+ return self ._key ()[item ]
152+
153+
154+ class EntryPoint (DeprecatedTuple ):
129155 """An entry point as defined by Python packaging conventions.
130156
131157 See `the packaging docs on entry points
You can’t perform that action at this time.
0 commit comments