MCPcopy Index your code
hub / github.com/USArmyResearchLab/Dshell / __init__

Method __init__

dshell/output/output.py:41–70  ·  view source on GitHub ↗
(
            self, file=None, fh=None, mode='w', format=None, timeformat=None, delimiter=None, nobuffer=False,
            noclobber=False, extra=None, cbf=False, **unused_kwargs
    )

Source from the content-addressed store, hash-verified

39 _DESCRIPTION = "Base output class"
40
41 def __init__(
42 self, file=None, fh=None, mode='w', format=None, timeformat=None, delimiter=None, nobuffer=False,
43 noclobber=False, extra=None, cbf=False, **unused_kwargs
44 ):
45 self.format_fields = []
46 self.timeformat = timeformat or self._DEFAULT_TIME_FORMAT
47 self.delimiter = delimiter or self._DEFAULT_DELIM
48 self.nobuffer = nobuffer
49 self.noclobber = noclobber
50 self.extra = extra
51 self.mode = mode
52 self.cbf = cbf
53
54 # Must define attributes even if they are setup in different function.
55 self.format_fields = None
56 self.format = None
57 self.set_format(format or self._DEFAULT_FORMAT)
58
59 # Set the filehandle for any output
60 if fh:
61 self.fh = fh
62 return
63
64 f = file
65 if f:
66 if self.noclobber:
67 f = self._increment_filename(f)
68 self.fh = open(f, self.mode)
69 else:
70 self.fh = sys.stdout
71
72 def reset_fh(self, filename=None, fh=None, mode=None):
73 """

Callers

nothing calls this directly

Calls 2

set_formatMethod · 0.95
_increment_filenameMethod · 0.95

Tested by

no test coverage detected