Convert svg size to the px version

    :param size: String with the size
323239
def _svg_convert_size(size):
    

    # https://www.w3.org/TR/SVG/coords.html#Units
    conversion_table = {
        "pt": 1.25,
        "pc": 15,
        "mm": 3.543307,
        "cm": 35.43307,
        "in": 90,
        "px": 1
    }
    if len(size) > 3:
        if size[-2:] in conversion_table:
            return round(float(size[:-2]) * conversion_table[size[-2:]])

    return round(float(size))
494910
def format_size(size):
    
    units = ['B', 'KB', 'MB', 'GB']
    unit = ''
    n = size
    old_n = n
    value = size
    for i in units:
        old_n = n
        x, y = divmod(n, 1024)
        if x == 0:
            unit = i
            value = y
            break

        n = x
        unit = i
        value = old_n
    return str(value)+unit
37256
def pixel_x_size(self, zoom):
        
        validate_zoom(zoom)
        return round(
            (self.grid.right - self.grid.left) /
            (self.grid.shape.width * 2**zoom * self.tile_size),
            ROUND
        )
515423
function getSize(requestSizes) {
  const parsed = {};
  const size = utils.parseSizesInput(requestSizes)[0];

  if (typeof size !== 'string') {
    return parsed;
  }

  const parsedSize = size.toUpperCase().split('X');
  const width = parseInt(parsedSize[0], 10);
  if (width) {
    parsed.width = width;
  }

  const height = parseInt(parsedSize[1], 10);
  if (height) {
    parsed.height = height;
  }

  return parsed;
}
336206
def parse_size(image, size):
        
        bits = size.split("x")
        if image.size[0] == 0 or image.size[1] == 0:
            ratio = 1.0
        else:
            ratio = float(image.size[0]) / float(image.size[1])

        if len(bits) == 1 or not bits[1]:
            width = int(bits[0])
            height = int(1 / ratio * width)
        elif not bits[0]:
            height = int(bits[1])
            width = int(height * ratio)
        else:
            width, height = map(int, bits)
        return width, height
989394
def rescale(img, size, mode=None):
    

    assert size[0] or size[1], "Must provide a width or a height"

    size = list(size)
    crop = size[0] and size[1]

    if not size[0]:
        size[0] = int(img.size[0] * size[1] / float(img.size[1]))
    if not size[1]:
        size[1] = int(img.size[1] * size[0] / float(img.size[0]))

    if crop:
        b = img.size[0] > img.size[1]
        crop_size = (img.size[b], int(img.size[b] * size[0] / float(size[1])))

        if mode ==  CROP_TL:
            img = img.crop((0, 0, crop_size[0], crop_size[1]))
        elif mode == CROP_BR:
            img = img.crop((
                img.size[0] - crop_size[0],
                img.size[1] - crop_size[1],
                img.size[0],
                img.size[1]
            ))

    return img.resize(size, Image.ANTIALIAS)
113423
def resize(self, size):
		
		if size is not None:
			self.__value = int(WBinArray(self.__value)[:size])
		self.__size = size
425324
function Canvas (width, height, scale) {
  // Re-purposing an existing canvas element.
  if (!this._canvas) {
    this._canvas = document.createElement('canvas');
  }

  this.width = width;
  this.height = height;
  this.scale = scale || window.devicePixelRatio;

  this._canvas.width = this.width * this.scale;
  this._canvas.height = this.height * this.scale;
  this._canvas.getContext('2d').scale(this.scale, this.scale);
}
642454
function (width, height, canvas) {
            // XXX This should probably be a configurable option
            var match;
            match = this._pxregex.exec(height);
            if (match) {
                this.pixelHeight = match[1];
            } else {
                this.pixelHeight = $(canvas).height();
            }
            match = this._pxregex.exec(width);
            if (match) {
                this.pixelWidth = match[1];
            } else {
                this.pixelWidth = $(canvas).width();
            }
        }
375160
def set_size(self, pt=None, px=None):
        

        assert (pt, px) != (None, None)

        if pt is not None:
            self.__init__(pt, self.font_name)
        else:
            self.__init__(self.px_to_pt(px), self.font_name)
1262546
def _scale(self, image, width, height):
        
        image['options']['scale'] = '%sx%s!' % (width, height)
        image['size'] = (width, height)  # update image size
        return image
1100788
def _translate_size(self, s): #pylint:disable=no-self-use
        
        if isinstance(s, claripy.ast.Base) and not s.singlevalued:
            raise SimFastMemoryError("size not supported")
        if s is None:
            return s
        return self.state.solver.eval(s)
993373
function generateSizeParam(sizes) {
  return sizes.map(size => size.join(DIMENSION_SEPARATOR)).join(SIZE_SEPARATOR);
}
91930
def format_size(size, threshold=1536):
    
    if size < threshold:
        return "%i B" % size
    for unit in ('KiB', 'MiB', 'GiB', 'TiB', 'PiB'):
        size /= 1024.0
        if size < threshold:
            return "%.2f %s" % (size, unit)
    return 'ginormous'
964064
def _presize(self, size:int, val_xtra_size:int=32, scale:Tuple[float]=(0.08, 1.0), ratio:Tuple[float]=(0.75, 4./3.),
             interpolation:int=2):
    ""
    return self.pre_transform(
        tvt.RandomResizedCrop(size, scale=scale, ratio=ratio, interpolation=interpolation), 
        [tvt.Resize(size+val_xtra_size), tvt.CenterCrop(size)])
989904
def setPixmapSize(self, size):
        
        self._pixmapSize = size
        self.setPixmap(self.action().icon().pixmap(size))
        
        max_size = self.parent().maximumPixmapSize()
        
        if self.position() in (XDockToolbar.Position.North,
                               XDockToolbar.Position.South):
            self.setFixedWidth(size.width() + self.padding())
            self.setFixedHeight(max_size.height() + self.padding())
        else:
            self.setFixedWidth(max_size.width() + self.padding())
            self.setFixedHeight(size.height() + self.padding())
691529
def get_size_str(size):
    
    if size == 0:
        magnitude = 0
        level = 0
    else:
        magnitude = math.floor(math.log(size, 10))
        level = int(min(math.floor(magnitude // 3), 4))
    return ('%d' if level == 0 else '%.2f') % (float(size) / 2**(level*10)) + ' ' + SIZE_LEVEL[level]