Blackified files

This commit is contained in:
Rhet Turnbull
2022-01-22 09:25:08 -08:00
parent edcc7ea34f
commit 3bafdf7bfd
27 changed files with 327 additions and 300 deletions

View File

@@ -42,7 +42,10 @@ _PHOTOS_5_VERSION = "5000" # I've seen both 5001 and 6000. 6000 is most common
# Ranges for model version by Photos version # Ranges for model version by Photos version
_PHOTOS_5_MODEL_VERSION = [13000, 13999] _PHOTOS_5_MODEL_VERSION = [13000, 13999]
_PHOTOS_6_MODEL_VERSION = [14000, 14999] _PHOTOS_6_MODEL_VERSION = [14000, 14999]
_PHOTOS_7_MODEL_VERSION = [15000, 15999] # Monterey developer preview is 15134, 12.1 is 15331 _PHOTOS_7_MODEL_VERSION = [
15000,
15999,
] # Monterey developer preview is 15134, 12.1 is 15331
# some table names differ between Photos 5 and Photos 6 # some table names differ between Photos 5 and Photos 6
_DB_TABLE_NAMES = { _DB_TABLE_NAMES = {

View File

@@ -24,12 +24,14 @@ from ._constants import (
from .datetime_utils import get_local_tz from .datetime_utils import get_local_tz
from .query_builder import get_query from .query_builder import get_query
__all__ = ["sort_list_by_keys", __all__ = [
"sort_list_by_keys",
"AlbumInfoBaseClass", "AlbumInfoBaseClass",
"AlbumInfo", "AlbumInfo",
"ImportInfo", "ImportInfo",
"ProjectInfo", "ProjectInfo",
"FolderInfo"] "FolderInfo",
]
def sort_list_by_keys(values, sort_keys): def sort_list_by_keys(values, sort_keys):

View File

@@ -71,7 +71,8 @@ from .sqlgrep import sqlgrep
from .uti import get_preferred_uti_extension from .uti import get_preferred_uti_extension
from .utils import expand_and_validate_filepath, load_function, normalize_fs_path from .utils import expand_and_validate_filepath, load_function, normalize_fs_path
__all__ = ["verbose_", __all__ = [
"verbose_",
"get_photos_db", "get_photos_db",
"DateTimeISO8601", "DateTimeISO8601",
"BitMathSize", "BitMathSize",
@@ -113,7 +114,8 @@ __all__ = ["verbose_",
"grep", "grep",
"debug_dump", "debug_dump",
"snap", "snap",
"diff"] "diff",
]
# global variable to control verbose output # global variable to control verbose output
# set via --verbose/-V # set via --verbose/-V

View File

@@ -22,14 +22,16 @@ from .phototemplate import (
get_template_help, get_template_help,
) )
__all__ = ["ExportCommand", __all__ = [
"ExportCommand",
"template_help", "template_help",
"tutorial_help", "tutorial_help",
"rich_text", "rich_text",
"strip_md_header_and_links", "strip_md_header_and_links",
"strip_md_links", "strip_md_links",
"strip_html_comments", "strip_html_comments",
"get_tutorial_text"] "get_tutorial_text",
]
# TODO: The following help text could probably be done as mako template # TODO: The following help text could probably be done as mako template

View File

@@ -1,10 +1,12 @@
""" ConfigOptions class to load/save config settings for osxphotos CLI """ """ ConfigOptions class to load/save config settings for osxphotos CLI """
import toml import toml
__all__ = ["ConfigOptionsException", __all__ = [
"ConfigOptionsException",
"ConfigOptionsInvalidError", "ConfigOptionsInvalidError",
"ConfigOptionsLoadError", "ConfigOptionsLoadError",
"ConfigOptions"] "ConfigOptions",
]
class ConfigOptionsException(Exception): class ConfigOptionsException(Exception):

View File

@@ -2,13 +2,15 @@
import datetime import datetime
__all__ = ["get_local_tz", __all__ = [
"get_local_tz",
"datetime_has_tz", "datetime_has_tz",
"datetime_tz_to_utc", "datetime_tz_to_utc",
"datetime_remove_tz", "datetime_remove_tz",
"datetime_naive_to_utc", "datetime_naive_to_utc",
"datetime_naive_to_local", "datetime_naive_to_local",
"datetime_utc_to_local"] "datetime_utc_to_local",
]
def get_local_tz(dt): def get_local_tz(dt):

View File

@@ -17,12 +17,14 @@ import subprocess
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from functools import lru_cache # pylint: disable=syntax-error from functools import lru_cache # pylint: disable=syntax-error
__all__ = ["escape_str", __all__ = [
"escape_str",
"unescape_str", "unescape_str",
"terminate_exiftool", "terminate_exiftool",
"get_exiftool_path", "get_exiftool_path",
"ExifTool", "ExifTool",
"ExifToolCaching"] "ExifToolCaching",
]
# exiftool -stay_open commands outputs this EOF marker after command is run # exiftool -stay_open commands outputs this EOF marker after command is run
EXIFTOOL_STAYOPEN_EOF = "{ready}" EXIFTOOL_STAYOPEN_EOF = "{ready}"

View File

@@ -1,4 +1,3 @@
__all__ = ["MomentInfo"] __all__ = ["MomentInfo"]
"""MomentInfo class with details about photo moments.""" """MomentInfo class with details about photo moments."""

View File

@@ -4,11 +4,13 @@ import pathvalidate
from ._constants import MAX_DIRNAME_LEN, MAX_FILENAME_LEN from ._constants import MAX_DIRNAME_LEN, MAX_FILENAME_LEN
__all__ = ["sanitize_filepath", __all__ = [
"sanitize_filepath",
"is_valid_filepath", "is_valid_filepath",
"sanitize_filename", "sanitize_filename",
"sanitize_dirname", "sanitize_dirname",
"sanitize_pathpart"] "sanitize_pathpart",
]
def sanitize_filepath(filepath): def sanitize_filepath(filepath):

View File

@@ -48,12 +48,14 @@ from .phototemplate import RenderOptions
from .uti import get_preferred_uti_extension from .uti import get_preferred_uti_extension
from .utils import increment_filename, increment_filename_with_count, lineno from .utils import increment_filename, increment_filename_with_count, lineno
__all__ = ["ExportError", __all__ = [
"ExportError",
"ExportOptions", "ExportOptions",
"ExportResults", "ExportResults",
"PhotoExporter", "PhotoExporter",
"hexdigest", "hexdigest",
"rename_jpeg_files"] "rename_jpeg_files",
]
if TYPE_CHECKING: if TYPE_CHECKING:
from .photoinfo import PhotoInfo from .photoinfo import PhotoInfo

View File

@@ -36,7 +36,8 @@ from .fileutil import FileUtil
from .uti import get_preferred_uti_extension from .uti import get_preferred_uti_extension
from .utils import _get_os_version, increment_filename from .utils import _get_os_version, increment_filename
__all__ = ["NSURL_to_path", __all__ = [
"NSURL_to_path",
"path_to_NSURL", "path_to_NSURL",
"check_photokit_authorization", "check_photokit_authorization",
"request_photokit_authorization", "request_photokit_authorization",
@@ -54,7 +55,8 @@ __all__ = ["NSURL_to_path",
"VideoAsset", "VideoAsset",
"LivePhotoRequest", "LivePhotoRequest",
"LivePhotoAsset", "LivePhotoAsset",
"PhotoLibrary"] "PhotoLibrary",
]
# NOTE: This requires user have granted access to the terminal (e.g. Terminal.app or iTerm) # 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 # to access Photos. This should happen automatically the first time it's called. I've

View File

@@ -7,6 +7,7 @@ from .._constants import _DB_TABLE_NAMES, _PHOTOS_4_VERSION
from ..utils import _db_is_locked, _debug, _open_sql_file from ..utils import _db_is_locked, _debug, _open_sql_file
from .photosdb_utils import get_db_version from .photosdb_utils import get_db_version
def _process_exifinfo(self): def _process_exifinfo(self):
"""load the exif data from the database """load the exif data from the database
this is a PhotosDB method that should be imported in this is a PhotosDB method that should be imported in

View File

@@ -22,8 +22,7 @@ from .photosdb_utils import get_db_version
def _process_faceinfo(self): def _process_faceinfo(self):
""" Process face information """Process face information"""
"""
self._db_faceinfo_pk = {} self._db_faceinfo_pk = {}
self._db_faceinfo_uuid = {} self._db_faceinfo_uuid = {}

View File

@@ -16,11 +16,13 @@ from .._constants import (
) )
from ..utils import _open_sql_file from ..utils import _open_sql_file
__all__ = ["get_db_version", __all__ = [
"get_db_version",
"get_model_version", "get_model_version",
"get_db_model_version", "get_db_model_version",
"UnknownLibraryVersion", "UnknownLibraryVersion",
"get_photos_library_version"] "get_photos_library_version",
]
def get_db_version(db_file): def get_db_version(db_file):

View File

@@ -22,12 +22,14 @@ from .path_utils import sanitize_dirname, sanitize_filename, sanitize_pathpart
from .text_detection import detect_text from .text_detection import detect_text
from .utils import expand_and_validate_filepath, load_function from .utils import expand_and_validate_filepath, load_function
__all__ = ["RenderOptions", __all__ = [
"RenderOptions",
"PhotoTemplateParser", "PhotoTemplateParser",
"PhotoTemplate", "PhotoTemplate",
"parse_default_kv", "parse_default_kv",
"get_template_help", "get_template_help",
"format_str_value"] "format_str_value",
]
# TODO: a lot of values are passed from function to function like path_sep--make these all class properties # TODO: a lot of values are passed from function to function like path_sep--make these all class properties

View File

@@ -14,13 +14,15 @@ from bpylist import archiver
from ._constants import UNICODE_FORMAT from ._constants import UNICODE_FORMAT
from .utils import normalize_unicode from .utils import normalize_unicode
__all__ = ["PLRevGeoLocationInfo", __all__ = [
"PLRevGeoLocationInfo",
"PLRevGeoMapItem", "PLRevGeoMapItem",
"PLRevGeoMapItemAdditionalPlaceInfo", "PLRevGeoMapItemAdditionalPlaceInfo",
"CNPostalAddress", "CNPostalAddress",
"PlaceInfo", "PlaceInfo",
"PlaceInfo4", "PlaceInfo4",
"PlaceInfo5"] "PlaceInfo5",
]
# postal address information, returned by PlaceInfo.address # postal address information, returned by PlaceInfo.address
PostalAddress = namedtuple( PostalAddress = namedtuple(

View File

@@ -1,4 +1,3 @@
__all__ = ["PyReplQuitter", "embed_repl"] __all__ = ["PyReplQuitter", "embed_repl"]
""" Custom Python REPL based on ptpython that allows quitting with custom keywords instead of `quit()` """ """ Custom Python REPL based on ptpython that allows quitting with custom keywords instead of `quit()` """

View File

@@ -38,4 +38,3 @@ class ScoreInfo:
well_chosen_subject: float well_chosen_subject: float
well_framed_subject: float well_framed_subject: float
well_timed_shot: float well_timed_shot: float

View File

@@ -1,4 +1,3 @@
__all__ = ["get_preferred_uti_extension", "get_uti_for_extension"] __all__ = ["get_preferred_uti_extension", "get_uti_for_extension"]
""" get UTI for a given file extension and the preferred extension for a given UTI """ """ get UTI for a given file extension and the preferred extension for a given UTI """

View File

@@ -24,7 +24,8 @@ from Foundation import NSString
from ._constants import UNICODE_FORMAT from ._constants import UNICODE_FORMAT
__all__ = ["noop", __all__ = [
"noop",
"lineno", "lineno",
"dd_to_dms_str", "dd_to_dms_str",
"get_system_library_path", "get_system_library_path",
@@ -36,7 +37,8 @@ __all__ = ["noop",
"increment_filename_with_count", "increment_filename_with_count",
"increment_filename", "increment_filename",
"expand_and_validate_filepath", "expand_and_validate_filepath",
"load_function"] "load_function",
]
_DEBUG = False _DEBUG = False
@@ -379,7 +381,9 @@ def normalize_unicode(value):
return None return None
def increment_filename_with_count(filepath: Union[str,pathlib.Path], count: int = 0) -> str: def increment_filename_with_count(
filepath: Union[str, pathlib.Path], count: int = 0
) -> str:
"""Return filename (1).ext, etc if filename.ext exists """Return filename (1).ext, etc if filename.ext exists
If file exists in filename's parent folder with same stem as filename, If file exists in filename's parent folder with same stem as filename,