(self, file=None)
| 78 | |
| 79 | class netrc: |
| 80 | def __init__(self, file=None): |
| 81 | default_netrc = file is None |
| 82 | if file is None: |
| 83 | file = os.path.join(os.path.expanduser("~"), ".netrc") |
| 84 | self.hosts = {} |
| 85 | self.macros = {} |
| 86 | try: |
| 87 | with open(file, encoding="utf-8") as fp: |
| 88 | self._parse(file, fp, default_netrc) |
| 89 | except UnicodeDecodeError: |
| 90 | with open(file, encoding="locale") as fp: |
| 91 | self._parse(file, fp, default_netrc) |
| 92 | |
| 93 | def _parse(self, file, fp, default_netrc): |
| 94 | lexer = _netrclex(fp) |
no test coverage detected