Create __all__ for all python files (#589)
* add __all__ to files "adjustmentsinfo.py" and "albuminfo.py" * add __all__ to file "cli.py" * add __all__ to all files that misses except files with prefix "_"
This commit is contained in:
parent
6261a7b5c9
commit
edcc7ea34f
@ -22,6 +22,15 @@ from .phototemplate import (
|
||||
get_template_help,
|
||||
)
|
||||
|
||||
__all__ = ["ExportCommand",
|
||||
"template_help",
|
||||
"tutorial_help",
|
||||
"rich_text",
|
||||
"strip_md_header_and_links",
|
||||
"strip_md_links",
|
||||
"strip_html_comments",
|
||||
"get_tutorial_text"]
|
||||
|
||||
|
||||
# TODO: The following help text could probably be done as mako template
|
||||
class ExportCommand(click.Command):
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
""" ConfigOptions class to load/save config settings for osxphotos CLI """
|
||||
import toml
|
||||
|
||||
__all__ = ["ConfigOptionsException",
|
||||
"ConfigOptionsInvalidError",
|
||||
"ConfigOptionsLoadError",
|
||||
"ConfigOptions"]
|
||||
|
||||
|
||||
class ConfigOptionsException(Exception):
|
||||
""" Invalid combination of options. """
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
import datetime
|
||||
|
||||
__all__ = ["DateTimeFormatter"]
|
||||
|
||||
|
||||
class DateTimeFormatter:
|
||||
""" provides property access to formatted datetime.datetime strftime values """
|
||||
|
||||
@ -2,6 +2,14 @@
|
||||
|
||||
import datetime
|
||||
|
||||
__all__ = ["get_local_tz",
|
||||
"datetime_has_tz",
|
||||
"datetime_tz_to_utc",
|
||||
"datetime_remove_tz",
|
||||
"datetime_naive_to_utc",
|
||||
"datetime_naive_to_local",
|
||||
"datetime_utc_to_local"]
|
||||
|
||||
|
||||
def get_local_tz(dt):
|
||||
""" Return local timezone as datetime.timezone tzinfo for dt
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
__all__ = ["ExifInfo"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ExifInfo:
|
||||
|
||||
@ -17,6 +17,13 @@ import subprocess
|
||||
from abc import ABC, abstractmethod
|
||||
from functools import lru_cache # pylint: disable=syntax-error
|
||||
|
||||
__all__ = ["escape_str",
|
||||
"unescape_str",
|
||||
"terminate_exiftool",
|
||||
"get_exiftool_path",
|
||||
"ExifTool",
|
||||
"ExifToolCaching"]
|
||||
|
||||
# exiftool -stay_open commands outputs this EOF marker after command is run
|
||||
EXIFTOOL_STAYOPEN_EOF = "{ready}"
|
||||
EXIFTOOL_STAYOPEN_EOF_LEN = len(EXIFTOOL_STAYOPEN_EOF)
|
||||
|
||||
@ -14,6 +14,8 @@ from sqlite3 import Error
|
||||
from ._constants import OSXPHOTOS_EXPORT_DB
|
||||
from ._version import __version__
|
||||
|
||||
__all__ = ["ExportDB_ABC", "ExportDBNoOp", "ExportDB", "ExportDBInMemory"]
|
||||
|
||||
OSXPHOTOS_EXPORTDB_VERSION = "4.0"
|
||||
OSXPHOTOS_ABOUT_STRING = f"Created by osxphotos version {__version__} (https://github.com/RhetTbull/osxphotos) on {datetime.datetime.now()}"
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@ import Foundation
|
||||
|
||||
from .imageconverter import ImageConverter
|
||||
|
||||
__all__ = ["FileUtilABC", "FileUtilMacOS", "FileUtil", "FileUtilNoOp"]
|
||||
|
||||
|
||||
class FileUtilABC(ABC):
|
||||
""" Abstract base class for FileUtil """
|
||||
|
||||
@ -15,6 +15,8 @@ from Foundation import NSDictionary
|
||||
# needed to capture system-level stderr
|
||||
from wurlitzer import pipes
|
||||
|
||||
__all__ = ["ImageConversionError", "ImageConverter"]
|
||||
|
||||
|
||||
class ImageConversionError(Exception):
|
||||
"""Base class for exceptions in this module."""
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
|
||||
__all__ = ["MomentInfo"]
|
||||
"""MomentInfo class with details about photo moments."""
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,12 @@ import pathvalidate
|
||||
|
||||
from ._constants import MAX_DIRNAME_LEN, MAX_FILENAME_LEN
|
||||
|
||||
__all__ = ["sanitize_filepath",
|
||||
"is_valid_filepath",
|
||||
"sanitize_filename",
|
||||
"sanitize_dirname",
|
||||
"sanitize_pathpart"]
|
||||
|
||||
|
||||
def sanitize_filepath(filepath):
|
||||
"""sanitize a filepath"""
|
||||
|
||||
@ -6,6 +6,8 @@ import math
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
__all__ = ["PersonInfo", "FaceInfo", "rotate_image_point"]
|
||||
|
||||
MWG_RS_Area = namedtuple("MWG_RS_Area", ["x", "y", "h", "w"])
|
||||
MPRI_Reg_Rect = namedtuple("MPRI_Reg_Rect", ["x", "y", "h", "w"])
|
||||
|
||||
|
||||
@ -48,6 +48,13 @@ from .phototemplate import RenderOptions
|
||||
from .uti import get_preferred_uti_extension
|
||||
from .utils import increment_filename, increment_filename_with_count, lineno
|
||||
|
||||
__all__ = ["ExportError",
|
||||
"ExportOptions",
|
||||
"ExportResults",
|
||||
"PhotoExporter",
|
||||
"hexdigest",
|
||||
"rename_jpeg_files"]
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .photoinfo import PhotoInfo
|
||||
|
||||
|
||||
@ -53,6 +53,8 @@ from .text_detection import detect_text
|
||||
from .uti import get_preferred_uti_extension, get_uti_for_extension
|
||||
from .utils import _debug, _get_resource_loc, findfiles
|
||||
|
||||
__all__ = ["PhotoInfo", "PhotoInfoNone"]
|
||||
|
||||
|
||||
class PhotoInfo:
|
||||
"""
|
||||
|
||||
@ -36,6 +36,26 @@ from .fileutil import FileUtil
|
||||
from .uti import get_preferred_uti_extension
|
||||
from .utils import _get_os_version, increment_filename
|
||||
|
||||
__all__ = ["NSURL_to_path",
|
||||
"path_to_NSURL",
|
||||
"check_photokit_authorization",
|
||||
"request_photokit_authorization",
|
||||
"PhotoKitError",
|
||||
"PhotoKitFetchFailed",
|
||||
"PhotoKitAuthError",
|
||||
"PhotoKitExportError",
|
||||
"PhotoKitMediaTypeError",
|
||||
"ImageData",
|
||||
"AVAssetData",
|
||||
"PHAssetResourceData",
|
||||
"PhotoKitNotificationDelegate",
|
||||
"PhotoAsset",
|
||||
"SlowMoVideoExporter",
|
||||
"VideoAsset",
|
||||
"LivePhotoRequest",
|
||||
"LivePhotoAsset",
|
||||
"PhotoLibrary"]
|
||||
|
||||
# NOTE: This requires user have granted access to the terminal (e.g. Terminal.app or iTerm)
|
||||
# to access Photos. This should happen automatically the first time it's called. I've
|
||||
# not figured out how to get the call to requestAuthorization_ to actually work in the case
|
||||
|
||||
@ -8,6 +8,8 @@ from more_itertools import chunked
|
||||
from .photoinfo import PhotoInfo
|
||||
from .utils import noop
|
||||
|
||||
__all__ = ["PhotosAlbum"]
|
||||
|
||||
|
||||
class PhotosAlbum:
|
||||
def __init__(self, name: str, verbose: Optional[callable] = None):
|
||||
|
||||
@ -66,6 +66,8 @@ from ..utils import (
|
||||
)
|
||||
from .photosdb_utils import get_db_model_version, get_db_version
|
||||
|
||||
__all__ = ["PhotosDB"]
|
||||
|
||||
# TODO: Add test for imageTimeZoneOffsetSeconds = None
|
||||
# TODO: Add test for __str__
|
||||
# TODO: Add special albums and magic albums
|
||||
|
||||
@ -16,6 +16,12 @@ from .._constants import (
|
||||
)
|
||||
from ..utils import _open_sql_file
|
||||
|
||||
__all__ = ["get_db_version",
|
||||
"get_model_version",
|
||||
"get_db_model_version",
|
||||
"UnknownLibraryVersion",
|
||||
"get_photos_library_version"]
|
||||
|
||||
|
||||
def get_db_version(db_file):
|
||||
"""Gets the Photos DB version from LiGlobals table
|
||||
|
||||
@ -22,6 +22,13 @@ from .path_utils import sanitize_dirname, sanitize_filename, sanitize_pathpart
|
||||
from .text_detection import detect_text
|
||||
from .utils import expand_and_validate_filepath, load_function
|
||||
|
||||
__all__ = ["RenderOptions",
|
||||
"PhotoTemplateParser",
|
||||
"PhotoTemplate",
|
||||
"parse_default_kv",
|
||||
"get_template_help",
|
||||
"format_str_value"]
|
||||
|
||||
# TODO: a lot of values are passed from function to function like path_sep--make these all class properties
|
||||
|
||||
# ensure locale set to user's locale
|
||||
|
||||
@ -14,6 +14,14 @@ from bpylist import archiver
|
||||
from ._constants import UNICODE_FORMAT
|
||||
from .utils import normalize_unicode
|
||||
|
||||
__all__ = ["PLRevGeoLocationInfo",
|
||||
"PLRevGeoMapItem",
|
||||
"PLRevGeoMapItemAdditionalPlaceInfo",
|
||||
"CNPostalAddress",
|
||||
"PlaceInfo",
|
||||
"PlaceInfo4",
|
||||
"PlaceInfo5"]
|
||||
|
||||
# postal address information, returned by PlaceInfo.address
|
||||
PostalAddress = namedtuple(
|
||||
"PostalAddress",
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
|
||||
__all__ = ["PyReplQuitter", "embed_repl"]
|
||||
""" Custom Python REPL based on ptpython that allows quitting with custom keywords instead of `quit()` """
|
||||
|
||||
""" This file is distributed under the same license as the ptpython package:
|
||||
|
||||
@ -8,6 +8,8 @@ from mako.template import Template
|
||||
|
||||
from ._constants import _DB_TABLE_NAMES
|
||||
|
||||
__all__ = ["get_query"]
|
||||
|
||||
QUERY_DIR = os.path.join(os.path.dirname(__file__), "queries")
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@ from typing import Iterable, List, Optional, Tuple
|
||||
|
||||
import bitmath
|
||||
|
||||
__all__ = ["QueryOptions"]
|
||||
|
||||
|
||||
@dataclass
|
||||
class QueryOptions:
|
||||
|
||||
@ -4,6 +4,8 @@ from dataclasses import dataclass
|
||||
|
||||
from ._constants import _PHOTOS_4_VERSION
|
||||
|
||||
__all__ = ["ScoreInfo"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScoreInfo:
|
||||
|
||||
@ -23,6 +23,8 @@ from ._constants import (
|
||||
SEARCH_CATEGORY_YEAR,
|
||||
)
|
||||
|
||||
__all__ = ["SearchInfo"]
|
||||
|
||||
|
||||
class SearchInfo:
|
||||
"""Info about search terms such as machine learning labels that Photos knows about a photo"""
|
||||
|
||||
@ -4,6 +4,8 @@ import re
|
||||
import sqlite3
|
||||
from typing import Generator, List
|
||||
|
||||
__all__ = ["sqlgrep"]
|
||||
|
||||
|
||||
def sqlgrep(
|
||||
filename: str,
|
||||
|
||||
@ -13,6 +13,8 @@ from wurlitzer import pipes
|
||||
|
||||
from .utils import _get_os_version
|
||||
|
||||
__all__ = ["detect_text", "make_request_handler"]
|
||||
|
||||
ver, major, minor = _get_os_version()
|
||||
if ver == "10" and int(major) < 15:
|
||||
vision = False
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
|
||||
__all__ = ["get_preferred_uti_extension", "get_uti_for_extension"]
|
||||
""" get UTI for a given file extension and the preferred extension for a given UTI """
|
||||
|
||||
""" Implementation note: runs only on macOS
|
||||
|
||||
@ -24,6 +24,20 @@ from Foundation import NSString
|
||||
|
||||
from ._constants import UNICODE_FORMAT
|
||||
|
||||
__all__ = ["noop",
|
||||
"lineno",
|
||||
"dd_to_dms_str",
|
||||
"get_system_library_path",
|
||||
"get_last_library_path",
|
||||
"list_photo_libraries",
|
||||
"normalize_fs_path",
|
||||
"findfiles",
|
||||
"normalize_unicode",
|
||||
"increment_filename_with_count",
|
||||
"increment_filename",
|
||||
"expand_and_validate_filepath",
|
||||
"load_function"]
|
||||
|
||||
_DEBUG = False
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user