Release v0.60.6 (#1110)

This commit is contained in:
Rhet Turnbull
2023-07-02 10:34:29 -06:00
committed by GitHub
parent 0064304574
commit 7ed8c7e583
8 changed files with 412 additions and 43 deletions

View File

@@ -202,6 +202,9 @@
<span class="sd"> See https://developer.apple.com/documentation/corelocation/clplacemark</span>
<span class="sd"> for additional documentation on reverse geolocation data</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span>
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABC</span><span class="p">,</span> <span class="n">abstractmethod</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">namedtuple</span> <span class="c1"># pylint: disable=syntax-error</span>
@@ -528,35 +531,99 @@
<span class="n">archiver</span><span class="o">.</span><span class="n">update_class_map</span><span class="p">({</span><span class="s2">&quot;PLRevGeoLocationInfo&quot;</span><span class="p">:</span> <span class="n">PLRevGeoLocationInfo</span><span class="p">})</span>
<div class="viewcode-block" id="PlaceInfo"><a class="viewcode-back" href="../../reference.html#osxphotos.PlaceInfo">[docs]</a><span class="k">class</span> <span class="nc">PlaceInfo</span><span class="p">(</span><span class="n">ABC</span><span class="p">):</span>
<span class="c1"># PlaceInfo is really an abstract base class but defining it as such</span>
<span class="c1"># means it doesn&#39;t get picked up by the doc generation tools</span>
<span class="c1"># so we define it as a regular class and then subclass it</span>
<span class="c1"># TODO: right fix is probably have PlaceInfo as the only class that</span>
<span class="c1"># is used and then have PlaceInfo4 and PlaceInfo5 called by PlaceInfo</span>
<span class="c1"># as needed to return the properties (and make them private classes)</span>
<div class="viewcode-block" id="PlaceInfo"><a class="viewcode-back" href="../../reference.html#osxphotos.PlaceInfo">[docs]</a><span class="k">class</span> <span class="nc">PlaceInfo</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Reverse geolocation place info for a photo.&quot;&quot;&quot;</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">address_str</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">address_str</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Returns the full postal address as a string if defined, otherwise `None`.&quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">country_code</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">country_code</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Returns the country_code of place, for example &quot;GB&quot;.</span>
<span class="sd"> Returns `None` if PhotoInfo contains no country code.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">ishome</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">ishome</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Returns `True` if photo place is user&#39;s home address, otherwise `False`.&quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Returns the name of the local place as str.</span>
<span class="sd"> This is what Photos displays in the Info window.</span>
<span class="sd"> **Note** Photos 5 uses a different algorithm to determine the name than earlier versions which means the same Photo may have a different place name in Photos 4 and Photos 5.</span>
<span class="sd"> `PhotoInfo.name` will return the name Photos would have shown depending on the version of the library being processed.</span>
<span class="sd"> Returns `None` if photo does not contain a name.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">names</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">PlaceNames</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;Returns a `PlaceNames` namedtuple with the following fields.</span>
<span class="sd"> Each field is a list with zero or more values, sorted by area in ascending order.</span>
<span class="sd"> E.g. `names.area_of_interest` could be [&#39;Gulf Islands National Seashore&#39;, &#39;Santa Rosa Island&#39;], [&quot;Knott&#39;s Berry Farm&quot;], or [] if `area_of_interest` not defined.</span>
<span class="sd"> The value shown in Photos is the first value in the list. With the exception of `body_of_water` each of these field corresponds to an attribute of</span>
<span class="sd"> a [CLPlacemark](https://developer.apple.com/documentation/corelocation/clplacemark) object.</span>
<span class="sd"> * `country`; the name of the country associated with the placemark.</span>
<span class="sd"> * `state_province`; administrativeArea, The state or province associated with the placemark.</span>
<span class="sd"> * `sub_administrative_area`; additional administrative area information for the placemark.</span>
<span class="sd"> * `city`; locality; the city associated with the placemark.</span>
<span class="sd"> * `additional_city_info`; subLocality, Additional city-level information for the placemark.</span>
<span class="sd"> * `ocean`; the name of the ocean associated with the placemark.</span>
<span class="sd"> * `area_of_interest`; areasOfInterest, The relevant areas of interest associated with the placemark.</span>
<span class="sd"> * `inland_water`; the name of the inland water body associated with the placemark.</span>
<span class="sd"> * `region`; the geographic region associated with the placemark.</span>
<span class="sd"> * `sub_throughfare`; additional street-level information for the placemark.</span>
<span class="sd"> * `postal_code`; the postal code associated with the placemark.</span>
<span class="sd"> * `street_address`; throughfare, The street address associated with the placemark.</span>
<span class="sd"> * `body_of_water`; in Photos 4, any body of water; in Photos 5 contains the union of ocean and inland_water</span>
<span class="sd"> **Note**: In Photos &lt;= 4.0, only the following fields are defined; all others are set to empty list:</span>
<span class="sd"> * `country`</span>
<span class="sd"> * `state_province`</span>
<span class="sd"> * `sub_administrative_area`</span>
<span class="sd"> * `city`</span>
<span class="sd"> * `additional_city_info`</span>
<span class="sd"> * `area_of_interest`</span>
<span class="sd"> * `body_of_water`</span>
<span class="sd"> Note:</span>
<span class="sd"> The `PlaceNames` namedtuple contains reserved fields not listed below (see implementation for details),</span>
<span class="sd"> thus it should be referenced only by name (e.g. `names.city`) and not by index.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="nd">@property</span>
<span class="nd">@abstractmethod</span>
<span class="k">def</span> <span class="nf">address</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Returns a `PostalAddress` namedtuple with details of the postal address containing the following fields:</span>
<span class="sd"> * `city`</span>
<span class="sd"> * `country`</span>
<span class="sd"> * `postal_code`</span>
<span class="sd"> * `state`</span>
<span class="sd"> * `street`</span>
<span class="sd"> * `sub_administrative_area`</span>
<span class="sd"> * `sub_locality`</span>
<span class="sd"> * `iso_country_code`</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span>
<span class="k">def</span> <span class="nf">asdict</span><span class="p">():</span>
<span class="k">pass</span></div>