Like read() but the argument must be a file-like object. The `f` argument must be iterable, returning one line at a time. Optional second argument is the `source` specifying the name of the file being read. If not given, it is taken from f.name. If `f` has no `name`
(self, f, source=None)
| 760 | return read_ok |
| 761 | |
| 762 | def read_file(self, f, source=None): |
| 763 | """Like read() but the argument must be a file-like object. |
| 764 | |
| 765 | The `f` argument must be iterable, returning one line at a time. |
| 766 | Optional second argument is the `source` specifying the name of the |
| 767 | file being read. If not given, it is taken from f.name. If `f` has no |
| 768 | `name` attribute, `<???>` is used. |
| 769 | """ |
| 770 | if source is None: |
| 771 | try: |
| 772 | source = f.name |
| 773 | except AttributeError: |
| 774 | source = '<???>' |
| 775 | self._read(f, source) |
| 776 | |
| 777 | def read_string(self, string, source='<string>'): |
| 778 | """Read configuration from a given string.""" |