()
| 431 | |
| 432 | def __init__(self, data=None, url=None, filename=None, metadata=None): |
| 433 | def warn(): |
| 434 | if not data: |
| 435 | return False |
| 436 | |
| 437 | # |
| 438 | # Avoid calling lower() on the entire data, because it could be a |
| 439 | # long string and we're only interested in its beginning and end. |
| 440 | # |
| 441 | prefix = data[:10].lower() |
| 442 | suffix = data[-10:].lower() |
| 443 | return prefix.startswith("<iframe ") and suffix.endswith("</iframe>") |
| 444 | |
| 445 | if warn(): |
| 446 | warnings.warn("Consider using IPython.display.IFrame instead") |
no outgoing calls