MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / __next__

Method __next__

web/pgadmin/utils/csv_lib.py:429–464  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

427 return self
428
429 def __next__(self):
430 self.parse_reset()
431
432 while True:
433 try:
434 lineobj = next(self.input_iter)
435 except StopIteration:
436 if len(self.field) != 0 or self.state == IN_QUOTED_FIELD:
437 if self.dialect.strict:
438 raise Error('unexpected end of data')
439 self.parse_save_field()
440 if self.fields:
441 break
442 raise
443
444 if not isinstance(lineobj, str):
445 typ = type(lineobj)
446 typ_name = 'bytes' if typ == bytes else typ.__name__
447 err_str = ('iterator should return strings, not {0}'
448 ' (did you open the file in text mode?)')
449 raise Error(err_str.format(typ_name))
450
451 self.line_num += 1
452 for c in lineobj:
453 if c == '\0':
454 raise Error('line contains NULL byte')
455 self.parse_process_char(c)
456
457 self.parse_process_char('\0')
458
459 if self.state == START_RECORD:
460 break
461
462 fields = self.fields
463 self.fields = None
464 return fields
465
466 next = __next__
467

Callers

nothing calls this directly

Calls 3

parse_resetMethod · 0.95
parse_save_fieldMethod · 0.95
parse_process_charMethod · 0.95

Tested by

no test coverage detected