MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/logging/__init__.py:601–626  ·  view source on GitHub ↗

Initialize the formatter with specified format strings. Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an

(self, fmt=None, datefmt=None, style='%', validate=True, *,
                 defaults=None)

Source from the content-addressed store, hash-verified

599 converter = time.localtime
600
601 def __init__(self, fmt=None, datefmt=None, style='%', validate=True, *,
602 defaults=None):
603 """
604 Initialize the formatter with specified format strings.
605
606 Initialize the formatter either with the specified format string, or a
607 default as described above. Allow for specialized date formatting with
608 the optional datefmt argument. If datefmt is omitted, you get an
609 ISO8601-like (or RFC 3339-like) format.
610
611 Use a style parameter of '%', '{' or '$' to specify that you want to
612 use one of %-formatting, :meth:`str.format` (``{}``) formatting or
613 :class:`string.Template` formatting in your format string.
614
615 .. versionchanged:: 3.2
616 Added the ``style`` parameter.
617 """
618 if style not in _STYLES:
619 raise ValueError('Style must be one of: %s' % ','.join(
620 _STYLES.keys()))
621 self._style = _STYLES[style][0](fmt, defaults=defaults)
622 if validate:
623 self._style.validate()
624
625 self._fmt = self._style._fmt
626 self.datefmt = datefmt
627
628 default_time_format = '%Y-%m-%d %H:%M:%S'
629 default_msec_format = '%s,%03d'

Callers

nothing calls this directly

Calls 3

joinMethod · 0.45
keysMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected