See :class:`FileLink` for the ``path``, ``url_prefix``, ``result_html_prefix`` and ``result_html_suffix`` parameters. included_suffixes : list Filename suffixes to include when formatting output [default: include all files] notebook_display_form
(self,
path,
url_prefix='',
included_suffixes=None,
result_html_prefix='',
result_html_suffix='<br>',
notebook_display_formatter=None,
terminal_display_formatter=None,
recursive=True)
| 423 | FileLinks("my/data") |
| 424 | """ |
| 425 | def __init__(self, |
| 426 | path, |
| 427 | url_prefix='', |
| 428 | included_suffixes=None, |
| 429 | result_html_prefix='', |
| 430 | result_html_suffix='<br>', |
| 431 | notebook_display_formatter=None, |
| 432 | terminal_display_formatter=None, |
| 433 | recursive=True): |
| 434 | """ |
| 435 | See :class:`FileLink` for the ``path``, ``url_prefix``, |
| 436 | ``result_html_prefix`` and ``result_html_suffix`` parameters. |
| 437 | |
| 438 | included_suffixes : list |
| 439 | Filename suffixes to include when formatting output [default: include |
| 440 | all files] |
| 441 | |
| 442 | notebook_display_formatter : function |
| 443 | Used to format links for display in the notebook. See discussion of |
| 444 | formatter functions below. |
| 445 | |
| 446 | terminal_display_formatter : function |
| 447 | Used to format links for display in the terminal. See discussion of |
| 448 | formatter functions below. |
| 449 | |
| 450 | Formatter functions must be of the form:: |
| 451 | |
| 452 | f(dirname, fnames, included_suffixes) |
| 453 | |
| 454 | dirname : str |
| 455 | The name of a directory |
| 456 | fnames : list |
| 457 | The files in that directory |
| 458 | included_suffixes : list |
| 459 | The file suffixes that should be included in the output (passing None |
| 460 | meansto include all suffixes in the output in the built-in formatters) |
| 461 | recursive : boolean |
| 462 | Whether to recurse into subdirectories. Default is True. |
| 463 | |
| 464 | The function should return a list of lines that will be printed in the |
| 465 | notebook (if passing notebook_display_formatter) or the terminal (if |
| 466 | passing terminal_display_formatter). This function is iterated over for |
| 467 | each directory in self.path. Default formatters are in place, can be |
| 468 | passed here to support alternative formatting. |
| 469 | |
| 470 | """ |
| 471 | if isfile(path): |
| 472 | raise ValueError("Cannot display a file using FileLinks. " |
| 473 | "Use FileLink to display '%s'." % path) |
| 474 | self.included_suffixes = included_suffixes |
| 475 | # remove trailing slashes for more consistent output formatting |
| 476 | path = path.rstrip('/') |
| 477 | |
| 478 | self.path = path |
| 479 | self.url_prefix = url_prefix |
| 480 | self.result_html_prefix = result_html_prefix |
| 481 | self.result_html_suffix = result_html_suffix |
| 482 |
nothing calls this directly
no test coverage detected