[docs]@dataclasses.dataclassclassAlfredWorkflow:""" Represents a single Alfred Workflow directory. The directory is typically located at:: <Alfred.alfredpreferences>/workflows/user.workflow.<UUID>/ and is expected to contain: - ``info.plist`` — workflow definition (name, version, bundle id, …) - ``icon.png`` — workflow icon - ``main.py`` — Python entry point (for afwf-based workflows) - ``lib/`` — installed Python dependencies All attributes are lazily evaluated and cached on first access. :param dir_workflow: Path to the workflow folder, e.g. ``…/workflows/user.workflow.76458317-…``. """dir_workflow:Pathdef__post_init__(self):self.dir_workflow=Path(self.dir_workflow)# ------------------------------------------------------------------# Directory / file paths# ------------------------------------------------------------------@cached_propertydefworkflow_id(self)->str:"""UUID extracted from the folder name (``user.workflow.<UUID>``)."""returnself.dir_workflow.name.removeprefix("user.workflow.")@cached_propertydefpath_info_plist(self)->Path:"""``info.plist`` workflow definition file."""returnself.dir_workflow/"info.plist"@cached_propertydefpath_icon_png(self)->Path:"""``icon.png`` workflow icon."""returnself.dir_workflow/"icon.png"# ------------------------------------------------------------------# Parsed info.plist fields# ------------------------------------------------------------------@cached_propertydef_plist_data(self)->dict:"""Raw dict parsed from ``info.plist``."""withself.path_info_plist.open("rb")asfh:returnplistlib.load(fh)@cached_propertydefname(self)->str:"""Human-readable workflow name (``name`` key in ``info.plist``)."""returnself._plist_data.get("name","")@cached_propertydefbundle_id(self)->str:""" Reverse-DNS bundle identifier (``bundleid`` key in ``info.plist``), e.g. ``"MacHu-GWU.afwf_fts_anything"``. """returnself._plist_data.get("bundleid","")@cached_propertydefversion(self)->str:"""Workflow version string (``version`` key in ``info.plist``)."""returnself._plist_data.get("version","")@cached_propertydefdescription(self)->str:"""Short description (``description`` key in ``info.plist``)."""returnself._plist_data.get("description","")@cached_propertydefcreated_by(self)->str:"""Author name (``createdby`` key in ``info.plist``)."""returnself._plist_data.get("createdby","")@cached_propertydefweb_address(self)->str:"""Homepage / repo URL (``webaddress`` key in ``info.plist``)."""returnself._plist_data.get("webaddress","")@cached_propertydefreadme(self)->str:"""Full readme text (``readme`` key in ``info.plist``)."""returnself._plist_data.get("readme","")@cached_propertydefdisabled(self)->bool:"""Whether the workflow is currently disabled in Alfred."""returnbool(self._plist_data.get("disabled",False))def__repr__(self)->str:returnf"AlfredWorkflow(name={self.name!r}, bundle_id={self.bundle_id!r}, version={self.version!r})"