Skip to content

Commit

Permalink
Merge pull request #27 from RhetTbull/bug_ventura_account_26
Browse files Browse the repository at this point in the history
Bug ventura account 26
  • Loading branch information
RhetTbull authored Jun 9, 2023
2 parents cdf8082 + 355cbc1 commit 7b81bb6
Show file tree
Hide file tree
Showing 9 changed files with 1,078 additions and 992 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.5.1
current_version = 0.5.2
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}

Expand Down
2 changes: 1 addition & 1 deletion macnotesapp/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" version info """

__version__ = "0.5.1"
__version__ = "0.5.2"
18 changes: 14 additions & 4 deletions macnotesapp/cli/cli_config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Simple config loader/writer for macnotesapp CLI"""

from __future__ import annotations

import os
import pathlib
from typing import Dict

import toml

Expand All @@ -20,20 +21,29 @@
DEFAULT_EDITOR = "$EDITOR"


def fix_unicode(text: str) -> str:
"""Fix unicode characters in text that on Ventura cause toml.dump to treat str as a list (#26)"""
return text.encode("utf-8").decode()


class ConfigSettings:
config_file = CONFIG_FILE

def __init__(self):
if not self.config_file.is_file():
self._create_config_file()

def read(self) -> Dict:
def read(self) -> dict[str, str]:
"""Read data from config file"""
data = toml.load(self.config_file)
return data.get("defaults", dict())
return data.get("defaults", {})

def write(self, settings: Dict):
def write(self, settings: dict[str, str]):
"""Write settings dict to config file"""
# on Ventura, unicode encoding can cause toml.dump to treat str as a list (#26)
settings = {
k: fix_unicode(v) if isinstance(v, str) else v for k, v in settings.items()
}
data = {"defaults": settings}
if not self.config_file.is_file():
self._create_config_file()
Expand Down
2,023 changes: 1,050 additions & 973 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "macnotesapp"
version = "0.5.1"
version = "0.5.2"
description = "Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code."
authors = ["Rhet Turnbull <[email protected]>"]
license = "MIT License"
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/RhetTbull/macnotesapp"
keywords = ["cli", "mac", "macos"]

[tool.poetry.dependencies]
python = "^3.9"
python = ">=3.9,<3.12" # pyinstaller requires python < 3.12
py-applescript = "^1.0.3"
click = "^8.1.2"
rich = "^12.4.4"
Expand All @@ -21,7 +21,6 @@ wheel = "^0.37.1"
readability-lxml = "^0.8.1"
requests = "^2.28.1"
validators = "^0.20.0"
textual = "^0.8.1"
markdownify = "^0.11.6"
pyobjc-framework-ScriptingBridge = "^9.0.1"

Expand Down
12 changes: 6 additions & 6 deletions site/reference/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3032,8 +3032,8 @@ <h2 id="macnotesapp.notesapp.Account.id" class="doc doc-heading">
<code class="highlight language-python"><span class="nb">id</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>

</h2>
Expand Down Expand Up @@ -3868,8 +3868,8 @@ <h2 id="macnotesapp.notesapp.Folder.id" class="doc doc-heading">
<code class="highlight language-python"><span class="nb">id</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>

</h2>
Expand Down Expand Up @@ -4346,8 +4346,8 @@ <h2 id="macnotesapp.notesapp.Note.body" class="doc doc-heading">
<code class="highlight language-python"><span class="n">body</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>

</h2>
Expand Down Expand Up @@ -4410,8 +4410,8 @@ <h2 id="macnotesapp.notesapp.Note.id" class="doc doc-heading">
<code class="highlight language-python"><span class="nb">id</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>

</h2>
Expand Down Expand Up @@ -4453,8 +4453,8 @@ <h2 id="macnotesapp.notesapp.Note.name" class="doc doc-heading">
<code class="highlight language-python"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-writable"><code>writable</code></small>
</span>

</h2>
Expand Down Expand Up @@ -5421,8 +5421,8 @@ <h2 id="macnotesapp.notesapp.Attachment.id" class="doc doc-heading">
<code class="highlight language-python"><span class="nb">id</span><span class="p">:</span> <span class="nb">str</span></code>

<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
<small class="doc doc-label doc-label-cached"><code>cached</code></small>
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>

</h2>
Expand Down
2 changes: 1 addition & 1 deletion site/search/search_index.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions site/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://rhettbull.github.io/macnotesapp/</loc>
<lastmod>2023-03-14</lastmod>
<lastmod>2023-06-09</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://rhettbull.github.io/macnotesapp/cli/</loc>
<lastmod>2023-03-14</lastmod>
<lastmod>2023-06-09</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://rhettbull.github.io/macnotesapp/reference/</loc>
<lastmod>2023-03-14</lastmod>
<lastmod>2023-06-09</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified site/sitemap.xml.gz
Binary file not shown.

0 comments on commit 7b81bb6

Please sign in to comment.