class_docstr: Cache for wcwidth sizes.
class_docstr_tok: ["Cache","for","wcwidth","sizes","."]
code: def __missing__(self, string):
      # Note: We use the `max(0, ...` because some non printable control
      #       characters, like e.g. Ctrl-underscore get a -1 wcwidth value.
      #       It can be possible that these characters end up in the input
      #       text.
      if len(string) == 1:
          result = max(0, wcwidth(string))
      else:
          result = sum(max(0, wcwidth(c)) for c in string)
  
      # Cache for short strings.
      # (It's hard to tell what we can consider short...)
      if len(string) < 256:
          self[string] = result
  
      return result
  
imports: from __future__ import unicode_literals
  import inspect
  import os
  import signal
  import sys
  import threading
  import weakref
  from wcwidth import wcwidth
  from six.moves import range
label_desc: Use image node_id 1 for calling the _CharSizesCache obj's underlying member method code with example usage: obj.__missing__(string) and returns: result