_pprint

Coloured ASCII art representations of binary sequences.

coinflip.randtests._pprint.determine_rep[source]

Determine single-character representations of each binary value

Parameters:
  • candidate (Any) – One of the two values in a sequence
  • noncandidate (Any) – Value in a sequence which is not candidate
Returns:

  • c_rep (str) – Character representation of the candidate
  • nc_rep (str) – Character representation of the noncandidate

See also

lru_cache
Method used for caching results
coinflip.randtests._pprint.pretty_subseq(series, candidate, noncandidate) → str[source]

Produce a one-line pretty representation of a subsequence

Parameters:
  • series (Series) – Subsequence to represent
  • candidate (Any) – One of the two values in series
  • noncandidate (Any) – Value in a sequence which in series
Returns:

series_rep (str) – Pretty representation of series

See also

determine_rep()
Method used to determine the series character representations
coinflip.randtests._pprint.pretty_seq(series, cols) → str[source]

Produce a multi-line representation of a sequence

Parameters:
  • series (Series) – Sequence to represent
  • cols (int) – Maximum number of characters to use per line
Returns:

series_rep (str) – Pretty represented of a sequence

See also

infer_candidate()
Method used to infer the candidate value of the series
pretty_subseq()
Method wrapped to generate rows
coinflip.randtests._pprint.dim(string) → str[source]

Wrap string in dim character codes

Parameters:string (str) – String to wrap
Returns:str – Wrapped string
coinflip.randtests._pprint.bright(string) → str[source]

Wrap string in bright character codes

Parameters:string (str) – String to wrap
Returns:str – Wrapped string