|
3 | 3 | import warnings |
4 | 4 | from pathlib import Path |
5 | 5 | from typing import Any, Optional, Union |
| 6 | +from PIL import Image |
| 7 | +import warnings |
| 8 | +with warnings.catch_warnings(): |
| 9 | + warnings.simplefilter("ignore") |
| 10 | + import pkg_resources |
6 | 11 |
|
7 | 12 | try: |
8 | 13 | from pyspark.sql import DataFrame as sDataFrame |
|
11 | 16 |
|
12 | 17 | sDataFrame = TypeVar("sDataFrame") # type: ignore |
13 | 18 |
|
| 19 | + |
14 | 20 | from dataclasses import asdict, is_dataclass |
15 | 21 |
|
16 | 22 | import numpy as np |
@@ -97,8 +103,11 @@ def __init__( |
97 | 103 | type_schema: optional dict containing pairs of `column name`: `type` |
98 | 104 | **kwargs: other arguments, for valid arguments, check the default configuration file. |
99 | 105 | """ |
100 | | - self.__validate_inputs(df, minimal, tsmode, config_file, lazy) |
| 106 | + |
101 | 107 |
|
| 108 | + self.__validate_inputs(df, minimal, tsmode, config_file, lazy) |
| 109 | + |
| 110 | + |
102 | 111 | if config_file or minimal: |
103 | 112 | if not config_file: |
104 | 113 | config_file = get_config("config_minimal.yaml") |
@@ -340,6 +349,13 @@ def to_file(self, output_file: Union[str, Path], silent: bool = True) -> None: |
340 | 349 | output_file: The name or the path of the file to generate including the extension (.html, .json). |
341 | 350 | silent: if False, opens the file in the default browser or download it in a Google Colab environment |
342 | 351 | """ |
| 352 | + with warnings.catch_warnings(): |
| 353 | + warnings.simplefilter("ignore") |
| 354 | + pillow_version = pkg_resources.get_distribution("Pillow").version |
| 355 | + version_tuple = tuple(map(int, pillow_version.split('.'))) |
| 356 | + if version_tuple < (9, 5, 0): |
| 357 | + warnings.warn("Try running command: 'pip install --upgrade Pillow' to avoid ValueError") |
| 358 | + |
343 | 359 | if not isinstance(output_file, Path): |
344 | 360 | output_file = Path(str(output_file)) |
345 | 361 |
|
|
0 commit comments