Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b709866

Browse files
yuji96MrMino
authored andcommitted
replace extra (str) -> extras (iterable)
1 parent 49d02f7 commit b709866

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

IPython/lib/display.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from IPython.core.display import DisplayObject, TextDisplayObject
1010

11-
from typing import Tuple
11+
from typing import Tuple, Iterable
1212

1313
__all__ = ['Audio', 'IFrame', 'YouTubeVideo', 'VimeoVideo', 'ScribdDocument',
1414
'FileLink', 'FileLinks', 'Code']
@@ -263,15 +263,18 @@ class IFrame(object):
263263
src="{src}{params}"
264264
frameborder="0"
265265
allowfullscreen
266-
{extra}
266+
{extras}
267267
></iframe>
268268
"""
269269

270-
def __init__(self, src, width, height, extra="", **kwargs):
270+
def __init__(self, src, width, height, extras: Iterable[str] = None, **kwargs):
271+
if extras is None:
272+
extras = []
273+
271274
self.src = src
272275
self.width = width
273276
self.height = height
274-
self.extra = extra
277+
self.extras = extras
275278
self.params = kwargs
276279

277280
def _repr_html_(self):
@@ -286,7 +289,7 @@ def _repr_html_(self):
286289
width=self.width,
287290
height=self.height,
288291
params=params,
289-
extra=self.extra,
292+
extras=" ".join(self.extras),
290293
)
291294

292295

@@ -320,7 +323,7 @@ def __init__(self, id, width=400, height=300, allow_autoplay=False, **kwargs):
320323
self.id=id
321324
src = "https://www.youtube.com/embed/{0}".format(id)
322325
if allow_autoplay:
323-
kwargs.update(autoplay=1, extra='allow="autoplay"')
326+
kwargs.update(autoplay=1, extras=['allow="autoplay"'])
324327
super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
325328

326329
def _repr_jpeg_(self):

0 commit comments

Comments
 (0)