Override for blessings.Terminal._height_and_width
        Adds caching
433349
def _height_and_width(self):
        

        try:
            return self._cache['height_and_width']
        except KeyError:
            handw = self._cache['height_and_width'] = super(Terminal, self)._height_and_width()
            return handw
321973
function replaceSizeTokens(pattern, width, height, next) {
        pattern = pattern
          .replace(/%r/g, '%wx%h')
          .replace(/%w/g, width)
          .replace(/%h/g, height);

        next(null, pattern);
      }
1325182
def _scale_tile(self, value, width, height):
        """"""
        try:
            return self._scale_cache[value, width, height]
        except KeyError:
            tile = pygame.transform.smoothscale(self.tiles[value], (width, height))
            self._scale_cache[value, width, height] = tile
            return tile
1180994
function( width, height ){

            if ( width === undefined && height === undefined ){
                width = this.container.offsetWidth;
                height = this.container.offsetHeight;
            }

            this.width = width || 0;
            this.height = height || 0;
            // should be implemented in renderers
        }
222371
def wrap(self, availWidth, availHeight):
        

        # memorize available space
        self.avWidth = availWidth
        self.avHeight = availHeight

        logger.debug("*** wrap (%f, %f)", availWidth, availHeight)

        if not self.text:
            logger.debug("*** wrap (%f, %f) needed", 0, 0)
            return 0, 0

        # Split lines
        width = availWidth
        self.splitIndex = self.text.splitIntoLines(width, availHeight)

        self.width, self.height = availWidth, self.text.height

        logger.debug("*** wrap (%f, %f) needed, splitIndex %r", self.width, self.height, self.splitIndex)

        return self.width, self.height
716417
function getStatusAndSize(host,path,callback) {

	if(stszCache.get(host,callback)) {
		console.log('getStatusAndSize: Resolved %s%s from stszCache...',host,path);
		return true;
	}

	console.log('getStatusAndSize: Looking up %s%s...',host,path);

	var options = {
		host: host,
		port: 80,
		path: path,
		method: 'GET'
	};

	var req = http.request(options, function(res) {
		var data = '';
		res.setEncoding('utf8');

		res.on('data', function (chunk) {
			data += chunk;
		});
		res.on('end', function () {
			stszCache.set(host,null,res.statusCode,data.length);
		});
		res.on('error', function (e) {
			stszCache.set(host,e);
		});
	});
	req.on('error',function(e) {
		stszCache.set(host,e);
	});
	req.end();
}
596042
def getsize(store, path=None):
    """"""
    path = normalize_storage_path(path)
    if hasattr(store, 'getsize'):
        # pass through
        return store.getsize(path)
    elif isinstance(store, dict):
        # compute from size of values
        if path in store:
            v = store[path]
            size = buffer_size(v)
        else:
            members = listdir(store, path)
            prefix = _path_to_prefix(path)
            size = 0
            for k in members:
                try:
                    v = store[prefix + k]
                except KeyError:
                    pass
                else:
                    try:
                        size += buffer_size(v)
                    except TypeError:
                        return -1
        return size
    else:
        return -1
863356
function fetch (size) {
		size = size || samplesPerFrame;

		let output = data.copy(0, size)
		data.consume(size)

		//if size is too small, fill with silence
		if (!output.length) {
			return silence
		}
		else if (output.length < size) {
			output = util.pad(output, size)
		}

		return output;
	}
755595
def terminal_width():
    """"""
    try:
        if os.name == 'nt':
            _WindowsCSBI.initialize()
            return _WindowsCSBI.get_info(_WindowsCSBI.HANDLE_STDOUT)['terminal_width']
        return struct.unpack('hhhh', fcntl.ioctl(0, termios.TIOCGWINSZ, '\000' * 8))[1]
    except IOError:
        return 80
1122848
def terminal_size():  # decide on *some* terminal size
    """"""
    cr = _ioctl_GWINSZ(0) or _ioctl_GWINSZ(
        1) or _ioctl_GWINSZ(2)  # try open fds
    if not cr:                                                  # ...then ctty
        try:
            fd = os.open(os.ctermid(), os.O_RDONLY)
            cr = _ioctl_GWINSZ(fd)
            os.close(fd)
        except BaseException:
            pass
        if not cr:                            # env vars or finally defaults
            try:
                cr = os.environ['LINES'], os.environ['COLUMNS']
            except BaseException:
                cr = 25, 80
    return int(cr[1]), int(cr[0])
304535
function (width, height) {
            var cfg = this._cfg;
            cfg.width = width;
            cfg.height = height;
        }
1232315
def TerminalSize():
  """"""
  try:
    with open(os.ctermid(), 'r') as tty_instance:
      length_width = struct.unpack(
          'hh', fcntl.ioctl(tty_instance.fileno(), termios.TIOCGWINSZ, '1234'))
  except (IOError, OSError):
    try:
      length_width = (int(os.environ['LINES']),
                      int(os.environ['COLUMNS']))
    except (ValueError, KeyError):
      length_width = (24, 80)
  return length_width
416111
def load(path, cache=None, precache=False):
    
    parser = Stylesheet(cache)
    return parser.load(path, precache=precache)
1350698
def terminal_size():
    
    try:
        (rows, columns) = os.popen('stty size', 'r').read().split()
        rows    = int(rows)
        columns = int(columns)
        return (columns, rows)

    # Currently ignore any errors and return some reasonable default values.
    # Errors may occur, when the library is used in non-terminal application
    # like daemon.
    except:
        pass
    return (80, 24)
894546
function mergeSize(size, result) {
            if (size) {
                if (size.hasOwnProperty("scale")) {
                    result.scale = size.scale;
                }

                if (size.hasOwnProperty("width")) {
                    result.width = size.width;
                }

                if (size.hasOwnProperty("widthUnit")) {
                    result.widthUnit = size.widthUnit;
                }

                if (size.hasOwnProperty("height")) {
                    result.height = size.height;
                }

                if (size.hasOwnProperty("heightUnit")) {
                    result.heightUnit = size.heightUnit;
                }
            }
        }
94388
def onresize(self, emitter, width, height):
        
        super(MyApp, self).onresize(emitter, width, height)
416521
def cached(fn, size=32):
    ''' '''
    assert callable(fn)
    assert isinstance(size, int)
    return overload(fn)(lru_cache(size, typed=True)(fn))