MCPcopy
hub / github.com/django/django / __mul__

Method __mul__

django/contrib/gis/measure.py:329–346  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

327 LALIAS = {k.lower(): v for k, v in ALIAS.items()}
328
329 def __mul__(self, other):
330 if isinstance(other, self.__class__):
331 return Area(
332 default_unit=AREA_PREFIX + self._default_unit,
333 **{AREA_PREFIX + self.STANDARD_UNIT: (self.standard * other.standard)},
334 )
335 elif isinstance(other, NUMERIC_TYPES):
336 return self.__class__(
337 default_unit=self._default_unit,
338 **{self.STANDARD_UNIT: (self.standard * other)},
339 )
340 else:
341 raise TypeError(
342 "%(distance)s must be multiplied with number or %(distance)s"
343 % {
344 "distance": pretty_name(self.__class__),
345 }
346 )
347
348
349class Area(MeasureBase):

Callers

nothing calls this directly

Calls 2

AreaClass · 0.70
pretty_nameFunction · 0.70

Tested by

no test coverage detected