File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change
1
+ Made ``setuptools.package_index.Credential `` a `typing.NamedTuple ` -- by :user: `Avasam `
Original file line number Diff line number Diff line change 18
18
import urllib .request
19
19
from fnmatch import translate
20
20
from functools import wraps
21
+ from typing import NamedTuple
21
22
22
23
from more_itertools import unique_everseen
23
24
@@ -1001,21 +1002,20 @@ def _encode_auth(auth):
1001
1002
return encoded .replace ('\n ' , '' )
1002
1003
1003
1004
1004
- class Credential :
1005
- """
1006
- A username/password pair. Use like a namedtuple.
1005
+ class Credential (NamedTuple ):
1007
1006
"""
1007
+ A username/password pair.
1008
1008
1009
- def __init__ (self , username , password ):
1010
- self .username = username
1011
- self .password = password
1009
+ Displayed separated by `:`.
1010
+ >>> str(Credential('username', 'password'))
1011
+ 'username:password'
1012
+ """
1012
1013
1013
- def __iter__ (self ):
1014
- yield self .username
1015
- yield self .password
1014
+ username : str
1015
+ password : str
1016
1016
1017
- def __str__ (self ):
1018
- return '%( username)s:%( password)s' % vars ( self )
1017
+ def __str__ (self ) -> str :
1018
+ return f' { self . username } : { self . password } '
1019
1019
1020
1020
1021
1021
class PyPIConfig (configparser .RawConfigParser ):
You can’t perform that action at this time.
0 commit comments