INNER CODE UNIT · Python
supported_image_ext
yurijmikhalevich/rclip · rclip/main.py:98
supported_image_ext = IMAGE_EXT + (IMAGE_RAW_EXT if enable_raw_support else [])
self._image_regex = re.compile(f"^.+\\.({'|'.join(supported_image_ext)})$", re.I)
excluded_dirs = "|".join(re.escape(dir) for dir in exclude_dirs or self.EXCLUDE_DIRS_DEFAULT)
self._exclude_dir_regex = re.compile(f"^.+\\{os.path.sep}({excluded_dirs})(\\{os.path.sep}.+)?$")
self._image_loading_executor: Optional[ThreadPoolExecutor] = None
self._image_loading_workers = max(1, min(self.MAX_IMAGE_LOADING_WORKERS, os.cpu_count() or 1))
helpers.configure_max_image_pixels(max_image_pixels, self._image_loading_workers)
def _get_image_loading_executor(self) -> ThreadPoolExecutor:
if self._image_loading_executor is None:
self._image_loading_executor = ThreadPoolExecutor(max_workers=self._image_loading_workers)
return self._image_loading_executor
def _is_excluded(self, filepath: str, directory: str) -> bool:
relative_path = os.path.relpath(filepath, directory)
if self._skip_hidden and any(part.startswith(".") for part in relative_path.split(os.path.sep)):