MCPcopy Index your code
hub / github.com/plotly/plotly.py / present

Method present

_plotly_utils/basevalidators.py:2213–2239  ·  view source on GitHub ↗
(self, v)

Source from the content-addressed store, hash-verified

2211 return v
2212
2213 def present(self, v):
2214 if v is None:
2215 return None
2216 else:
2217 if (
2218 self.dimensions == 2
2219 or self.dimensions == "1-2"
2220 and v
2221 and is_array(v[0])
2222 ):
2223 # 2D case
2224 v = copy.deepcopy(v)
2225 for row in v:
2226 for i, (el, validator) in enumerate(zip(row, self.item_validators)):
2227 row[i] = validator.present(el)
2228
2229 return tuple(tuple(row) for row in v)
2230 else:
2231 # 1D case
2232 v = copy.copy(v)
2233 # Call present on each of the item validators
2234 for i, (el, validator) in enumerate(zip(v, self.item_validators)):
2235 # Validate coerce elements
2236 v[i] = validator.present(el)
2237
2238 # Return tuple form of
2239 return tuple(v)
2240
2241
2242class LiteralValidator(BaseValidator):

Callers

nothing calls this directly

Calls 3

is_arrayFunction · 0.85
presentMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected