schrodinger.application.matsci.typography module

Module to format text

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.typography.TYPO_TYPE(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

unicode = 1
markup = 2
schrodinger.application.matsci.typography.subscript_digits(digits, typo_type=TYPO_TYPE.unicode)

Convert a number to subscripted string

Parameters
  • digits (int) – The number that needs to be subscripted

  • typo_type (TYPO_TYPE) – The typography type

Returns

The integer converted to subscript string using html markup

Return type

str

Raises

ValueError – When the typography type does not have a way for creating subscript style

schrodinger.application.matsci.typography.trim_str(text, max_len, suffix='...')

Trim the string to approximately max_len. Add a suffix if the string is longer than max_len.

Parameters
  • text – String to trim

  • max_len (int) – Max length of the string

  • suffix (str) – Suffix to add if the string is to be trimmed

Return str

Trimmed string

schrodinger.application.matsci.typography.title_case(original, exceptions=('an', 'of', 'the', 'for'), skip_single_letters=True)

Convert the string to title case, optionally ignoring articles and single letters

Examples with default kwargs: “Number of molecules”: “Number of Molecules” “axis b”: “Axis b”

Parameters
  • original (str) – The string to make title case

  • exceptions (tuple) – The words to not capitalize

  • skip_single_letters (bool) – Whether single letters should not be capitalized

Return type

str

Returns

The string in title case

schrodinger.application.matsci.typography.format_info(info)

Format the string text into grey colored italic font.

Parameters

info (string) – String to be formatted

Return type

string

Returns

Formatted string