##// END OF EJS Templates
Make left alignment and full output the default...
walter.doerwald -
r279:88a6697e
parent child
Show More
@@ -398,23 +398,18 def xrepr(item, mode):
398 except (KeyboardInterrupt, SystemExit):
398 except (KeyboardInterrupt, SystemExit):
399 raise
399 raise
400 except Exception:
400 except Exception:
401 yield (-1, True)
402 yield (astyle.style_default, repr(item))
401 yield (astyle.style_default, repr(item))
403 return
402 return
404 if item is None:
403 if item is None:
405 yield (-1, True)
406 yield (astyle.style_type_none, repr(item))
404 yield (astyle.style_type_none, repr(item))
407 elif isinstance(item, bool):
405 elif isinstance(item, bool):
408 yield (-1, True)
409 yield (astyle.style_type_bool, repr(item))
406 yield (astyle.style_type_bool, repr(item))
410 elif isinstance(item, str):
407 elif isinstance(item, str):
411 yield (-1, True)
412 if mode == "cell":
408 if mode == "cell":
413 yield (astyle.style_default, repr(item.expandtabs(tab))[1:-1])
409 yield (astyle.style_default, repr(item.expandtabs(tab))[1:-1])
414 else:
410 else:
415 yield (astyle.style_default, repr(item))
411 yield (astyle.style_default, repr(item))
416 elif isinstance(item, unicode):
412 elif isinstance(item, unicode):
417 yield (-1, True)
418 if mode == "cell":
413 if mode == "cell":
419 yield (astyle.style_default, repr(item.expandtabs(tab))[2:-1])
414 yield (astyle.style_default, repr(item.expandtabs(tab))[2:-1])
420 else:
415 else:
@@ -423,10 +418,8 def xrepr(item, mode):
423 yield (1, True)
418 yield (1, True)
424 yield (astyle.style_type_number, repr(item))
419 yield (astyle.style_type_number, repr(item))
425 elif isinstance(item, complex):
420 elif isinstance(item, complex):
426 yield (-1, True)
427 yield (astyle.style_type_number, repr(item))
421 yield (astyle.style_type_number, repr(item))
428 elif isinstance(item, datetime.datetime):
422 elif isinstance(item, datetime.datetime):
429 yield (-1, True)
430 if mode == "cell":
423 if mode == "cell":
431 # Don't use strftime() here, as this requires year >= 1900
424 # Don't use strftime() here, as this requires year >= 1900
432 yield (astyle.style_type_datetime,
425 yield (astyle.style_type_datetime,
@@ -438,14 +431,12 def xrepr(item, mode):
438 else:
431 else:
439 yield (astyle.style_type_datetime, repr(item))
432 yield (astyle.style_type_datetime, repr(item))
440 elif isinstance(item, datetime.date):
433 elif isinstance(item, datetime.date):
441 yield (-1, True)
442 if mode == "cell":
434 if mode == "cell":
443 yield (astyle.style_type_datetime,
435 yield (astyle.style_type_datetime,
444 "%04d-%02d-%02d" % (item.year, item.month, item.day))
436 "%04d-%02d-%02d" % (item.year, item.month, item.day))
445 else:
437 else:
446 yield (astyle.style_type_datetime, repr(item))
438 yield (astyle.style_type_datetime, repr(item))
447 elif isinstance(item, datetime.time):
439 elif isinstance(item, datetime.time):
448 yield (-1, True)
449 if mode == "cell":
440 if mode == "cell":
450 yield (astyle.style_type_datetime,
441 yield (astyle.style_type_datetime,
451 "%02d:%02d:%02d.%06d" % \
442 "%02d:%02d:%02d.%06d" % \
@@ -453,10 +444,8 def xrepr(item, mode):
453 else:
444 else:
454 yield (astyle.style_type_datetime, repr(item))
445 yield (astyle.style_type_datetime, repr(item))
455 elif isinstance(item, datetime.timedelta):
446 elif isinstance(item, datetime.timedelta):
456 yield (-1, True)
457 yield (astyle.style_type_datetime, repr(item))
447 yield (astyle.style_type_datetime, repr(item))
458 elif isinstance(item, Exception):
448 elif isinstance(item, Exception):
459 yield (-1, True)
460 if item.__class__.__module__ == "exceptions":
449 if item.__class__.__module__ == "exceptions":
461 classname = item.__class__.__name__
450 classname = item.__class__.__name__
462 else:
451 else:
@@ -467,7 +456,6 def xrepr(item, mode):
467 else:
456 else:
468 yield (astyle.style_error, classname)
457 yield (astyle.style_error, classname)
469 elif isinstance(item, (list, tuple)):
458 elif isinstance(item, (list, tuple)):
470 yield (-1, False)
471 if mode == "header" or mode == "footer":
459 if mode == "header" or mode == "footer":
472 if item.__class__.__module__ == "__builtin__":
460 if item.__class__.__module__ == "__builtin__":
473 classname = item.__class__.__name__
461 classname = item.__class__.__name__
@@ -478,6 +466,7 def xrepr(item, mode):
478 "<%s object with %d items at 0x%x>" % \
466 "<%s object with %d items at 0x%x>" % \
479 (classname, len(item), id(item)))
467 (classname, len(item), id(item)))
480 else:
468 else:
469 yield (-1, False)
481 if isinstance(item, list):
470 if isinstance(item, list):
482 yield (astyle.style_default, "[")
471 yield (astyle.style_default, "[")
483 end = "]"
472 end = "]"
@@ -491,7 +480,6 def xrepr(item, mode):
491 yield part
480 yield part
492 yield (astyle.style_default, end)
481 yield (astyle.style_default, end)
493 elif isinstance(item, (dict, types.DictProxyType)):
482 elif isinstance(item, (dict, types.DictProxyType)):
494 yield (-1, False)
495 if mode == "header" or mode == "footer":
483 if mode == "header" or mode == "footer":
496 if item.__class__.__module__ == "__builtin__":
484 if item.__class__.__module__ == "__builtin__":
497 classname = item.__class__.__name__
485 classname = item.__class__.__name__
@@ -502,6 +490,7 def xrepr(item, mode):
502 "<%s object with %d items at 0x%x>" % \
490 "<%s object with %d items at 0x%x>" % \
503 (classname, len(item), id(item)))
491 (classname, len(item), id(item)))
504 else:
492 else:
493 yield (-1, False)
505 if isinstance(item, dict):
494 if isinstance(item, dict):
506 yield (astyle.style_default, "{")
495 yield (astyle.style_default, "{")
507 end = "}"
496 end = "}"
@@ -518,7 +507,6 def xrepr(item, mode):
518 yield part
507 yield part
519 yield (astyle.style_default, end)
508 yield (astyle.style_default, end)
520 else:
509 else:
521 yield (-1, True)
522 yield (astyle.style_default, repr(item))
510 yield (astyle.style_default, repr(item))
523
511
524
512
@@ -584,7 +572,6 class ichain(Pipe):
584 return itertools.chain(*self.iters)
572 return itertools.chain(*self.iters)
585
573
586 def __xrepr__(self, mode):
574 def __xrepr__(self, mode):
587 yield (-1, True)
588 if mode == "header" or mode == "footer":
575 if mode == "header" or mode == "footer":
589 for (i, item) in enumerate(self.iters):
576 for (i, item) in enumerate(self.iters):
590 if i:
577 if i:
@@ -858,7 +845,6 class ifile(path.path):
858 return self.defaultattrs
845 return self.defaultattrs
859
846
860 def __xrepr__(self, mode):
847 def __xrepr__(self, mode):
861 yield (-1, True)
862 try:
848 try:
863 if self.isdir():
849 if self.isdir():
864 name = "idir"
850 name = "idir"
@@ -896,7 +882,6 class ifile(path.path):
896
882
897 class iparentdir(ifile):
883 class iparentdir(ifile):
898 def __xrepr__(self, mode):
884 def __xrepr__(self, mode):
899 yield (-1, True)
900 if mode == "cell":
885 if mode == "cell":
901 yield (astyle.style_dir, os.pardir)
886 yield (astyle.style_dir, os.pardir)
902 else:
887 else:
@@ -945,7 +930,6 class iglob(Table):
945 yield ifile(name)
930 yield ifile(name)
946
931
947 def __xrepr__(self, mode):
932 def __xrepr__(self, mode):
948 yield (-1, True)
949 if mode == "header" or mode == "footer" or mode == "cell":
933 if mode == "header" or mode == "footer" or mode == "cell":
950 yield (astyle.style_default,
934 yield (astyle.style_default,
951 "%s(%r)" % (self.__class__.__name__, self.glob))
935 "%s(%r)" % (self.__class__.__name__, self.glob))
@@ -980,7 +964,6 class iwalk(Table):
980 yield ifile(os.path.join(dirpath, name))
964 yield ifile(os.path.join(dirpath, name))
981
965
982 def __xrepr__(self, mode):
966 def __xrepr__(self, mode):
983 yield (-1, True)
984 if mode == "header" or mode == "footer" or mode == "cell":
967 if mode == "header" or mode == "footer" or mode == "cell":
985 yield (astyle.style_default,
968 yield (astyle.style_default,
986 "%s(%r)" % (self.__class__.__name__, self.base))
969 "%s(%r)" % (self.__class__.__name__, self.base))
@@ -1068,7 +1051,6 class ipwd(Table):
1068 yield ipwdentry(entry.pw_name)
1051 yield ipwdentry(entry.pw_name)
1069
1052
1070 def __xrepr__(self, mode):
1053 def __xrepr__(self, mode):
1071 yield (-1, True)
1072 if mode == "header" or mode == "footer" or mode == "cell":
1054 if mode == "header" or mode == "footer" or mode == "cell":
1073 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1055 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1074 else:
1056 else:
@@ -1117,7 +1099,6 class igrpentry(object):
1117 return ("name", "passwd", "gid", "mem")
1099 return ("name", "passwd", "gid", "mem")
1118
1100
1119 def __xrepr__(self, mode):
1101 def __xrepr__(self, mode):
1120 yield (-1, True)
1121 if mode == "header" or mode == "footer" or mode == "cell":
1102 if mode == "header" or mode == "footer" or mode == "cell":
1122 yield (astyle.style_default, "group ")
1103 yield (astyle.style_default, "group ")
1123 try:
1104 try:
@@ -1148,7 +1129,6 class igrp(Table):
1148 yield igrpentry(entry.gr_name)
1129 yield igrpentry(entry.gr_name)
1149
1130
1150 def __xrepr__(self, mode):
1131 def __xrepr__(self, mode):
1151 yield (-1, False)
1152 if mode == "header" or mode == "footer":
1132 if mode == "header" or mode == "footer":
1153 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1133 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1154 else:
1134 else:
@@ -1254,7 +1234,6 class ienv(Table):
1254 yield Fields(fields, key=key, value=value)
1234 yield Fields(fields, key=key, value=value)
1255
1235
1256 def __xrepr__(self, mode):
1236 def __xrepr__(self, mode):
1257 yield (-1, True)
1258 if mode == "header" or mode == "cell":
1237 if mode == "header" or mode == "cell":
1259 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1238 yield (astyle.style_default, "%s()" % self.__class__.__name__)
1260 else:
1239 else:
@@ -1334,7 +1313,6 class ix(Table):
1334 self._pipe = None
1313 self._pipe = None
1335
1314
1336 def __xrepr__(self, mode):
1315 def __xrepr__(self, mode):
1337 yield (-1, True)
1338 if mode == "header" or mode == "footer":
1316 if mode == "header" or mode == "footer":
1339 yield (astyle.style_default,
1317 yield (astyle.style_default,
1340 "%s(%r)" % (self.__class__.__name__, self.cmd))
1318 "%s(%r)" % (self.__class__.__name__, self.cmd))
@@ -1415,7 +1393,6 class ifilter(Pipe):
1415 raise exc_info[0], exc_info[1], exc_info[2]
1393 raise exc_info[0], exc_info[1], exc_info[2]
1416
1394
1417 def __xrepr__(self, mode):
1395 def __xrepr__(self, mode):
1418 yield (-1, True)
1419 if mode == "header" or mode == "footer":
1396 if mode == "header" or mode == "footer":
1420 input = getattr(self, "input", None)
1397 input = getattr(self, "input", None)
1421 if input is not None:
1398 if input is not None:
@@ -1487,7 +1464,6 class ieval(Pipe):
1487 raise exc_info[0], exc_info[1], exc_info[2]
1464 raise exc_info[0], exc_info[1], exc_info[2]
1488
1465
1489 def __xrepr__(self, mode):
1466 def __xrepr__(self, mode):
1490 yield (-1, True)
1491 if mode == "header" or mode == "footer":
1467 if mode == "header" or mode == "footer":
1492 input = getattr(self, "input", None)
1468 input = getattr(self, "input", None)
1493 if input is not None:
1469 if input is not None:
@@ -1562,7 +1538,6 class isort(Pipe):
1562 yield item
1538 yield item
1563
1539
1564 def __xrepr__(self, mode):
1540 def __xrepr__(self, mode):
1565 yield (-1, True)
1566 if mode == "header" or mode == "footer":
1541 if mode == "header" or mode == "footer":
1567 input = getattr(self, "input", None)
1542 input = getattr(self, "input", None)
1568 if input is not None:
1543 if input is not None:
@@ -1638,7 +1613,7 class iless(Display):
1638
1613
1639 def xformat(value, mode, maxlength):
1614 def xformat(value, mode, maxlength):
1640 align = None
1615 align = None
1641 full = False
1616 full = True
1642 width = 0
1617 width = 0
1643 text = astyle.Text()
1618 text = astyle.Text()
1644 for part in xrepr(value, mode):
1619 for part in xrepr(value, mode):
@@ -1758,7 +1733,6 class XMode(object):
1758 self.mode, id(self))
1733 self.mode, id(self))
1759
1734
1760 def __xrepr__(self, mode):
1735 def __xrepr__(self, mode):
1761 yield (-1, True)
1762 if mode == "header" or mode == "footer":
1736 if mode == "header" or mode == "footer":
1763 yield (astyle.style_default, self.title)
1737 yield (astyle.style_default, self.title)
1764 else:
1738 else:
General Comments 0
You need to be logged in to leave comments. Login now