Closed kahaaga closed 5 months ago
Attention: 24 lines
in your changes are missing coverage. Please review.
Comparison is base (
c82bc30
) 89.29% compared to head (457cb36
) 88.68%.:exclamation: Current head 457cb36 differs from pull request most recent head 3467647. Consider uploading reports for the commit 3467647 to get more accurate results
Files | Patch % | Lines |
---|---|---|
src/core/pretty_printing.jl | 70.88% | 23 Missing :warning: |
src/encoding_implementations/ordinal_pattern.jl | 0.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Fixes #286.
Introduces:
core/pretty_printing.jl
. Contains generic pretty-printing code for relevant types in our package. Definesour_abstract_types
, which lists the types for which we want to pretty-print.hidefields
can be overridden to not display certain internal fields. Used e.g. forRelativeMeanEncoding
to hide thebinencoder
field.special_typeparameter_info
can be overridden to display certain extra type information. By default, all type annotations are stripped away while pretty-printing. However, forOrdinalPatterns
we want it to be printed asOrdinalPatterns{3}(...)
and notOrdinalPatterns(...)
. Overriding this method takes care of that.Formatting
ComplexityMeasures
types are printed with default typeface, font and color.ComplexityMeasures
type names are printed with custom colors and font weight. Parentheses are color-matched to the names, so it is easier to see which fields belong to what type. Thetype_printcolor
andtype_field_printcolor
functions determine which color is used for printing (default to the color:default
).Approach
To ensure pretty printing is defined for all our types, we loop over
our_abstract_types
, and use@eval
to override twoBase
methods:Base.show(io::IO, ::MIME"text/plain", x)
. The behavior isBase.show(io::IO, x)
. This will always display the one-line version (screenshot example 3)