MCPcopy Create free account
hub / github.com/aws/aws-cli / get_text_length

Function get_text_length

awscli/table.py:29–40  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

27
28
29def get_text_length(text):
30 # `len(unichar)` measures the number of characters, so we use
31 # `unicodedata.east_asian_width` to measure the length of characters.
32 # Following responses are considered to be full-width length.
33 # * A(Ambiguous)
34 # * F(Fullwidth)
35 # * W(Wide)
36 text = str(text)
37 return sum(
38 2 if unicodedata.east_asian_width(char) in 'WFA' else 1
39 for char in text
40 )
41
42
43def determine_terminal_width(default_width=80):

Callers 7

center_textFunction · 0.85
align_leftFunction · 0.85
_render_titleMethod · 0.85
_render_column_titlesMethod · 0.85
_render_rowsMethod · 0.85
total_widthMethod · 0.85
_update_max_widthsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected