(self, file=None)
| 65 | |
| 66 | class netrc: |
| 67 | def __init__(self, file=None): |
| 68 | default_netrc = file is None |
| 69 | if file is None: |
| 70 | file = os.path.join(os.path.expanduser("~"), ".netrc") |
| 71 | self.hosts = {} |
| 72 | self.macros = {} |
| 73 | try: |
| 74 | with open(file, encoding="utf-8") as fp: |
| 75 | self._parse(file, fp, default_netrc) |
| 76 | except UnicodeDecodeError: |
| 77 | with open(file, encoding="locale") as fp: |
| 78 | self._parse(file, fp, default_netrc) |
| 79 | |
| 80 | def _parse(self, file, fp, default_netrc): |
| 81 | lexer = _netrclex(fp) |
no test coverage detected