~netlandish/email-test-drive

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH 1 of 2 py-scfg] Return None when trying to get missing sub-directive

David Keijser <keijser@gmail.com>
Details
Message ID
<33f5a3354dc7b1fce863.1604249472@splurge.local>
DKIM signature
missing
Download raw message
Patch: +10 -2
# HG changeset patch
# User David Keijser <keijser@gmail.com>
# Date 1604248014 -3600
#      Sun Nov 01 17:26:54 2020 +0100
# Node ID 33f5a3354dc7b1fce8639602d4212da01c7da19a
# Parent  64f694b06df5c2f5140d456de6304804d4d8c8be
Return None when trying to get missing sub-directive

This aligns with the behaviour of get on the top-level directive, previously it
would instead raise an exception.

diff --git a/scfg/__init__.py b/scfg/__init__.py
--- a/scfg/__init__.py
+++ b/scfg/__init__.py
@@ -23,8 +23,7 @@
    def __init__(self, name, params, children=None):
        self.name = name
        self.params = params
        if children is not None:
            self.children = children
        self.children = children or []

    def __str__(self):
        return f"{self.name}: {self.params}"
diff --git a/tests.py b/tests.py
--- a/tests.py
+++ b/tests.py
@@ -26,6 +26,15 @@
            train.get_all("model")[1].get("weight").params[0], "540t"
        )

    def test_access_missing(self):
        train = self.config.get("train")
        self.assertEqual(
            train.get("missing"), None
        )
        self.assertEqual(
            train.get_all("model")[0].get("lines-served").get("missing"), None
        )


if __name__ == "__main__":
    unittest.main()
Details
Message ID
<20201101234401.bok7i4wvl4heda6r@thinkpad>
In-Reply-To
<33f5a3354dc7b1fce863.1604249472@splurge.local> (view parent)
DKIM signature
missing
Download raw message
On 11/01, David Keijser wrote:
># HG changeset patch
># User David Keijser <keijser@gmail.com>
># Date 1604248014 -3600
>#      Sun Nov 01 17:26:54 2020 +0100
># Node ID 33f5a3354dc7b1fce8639602d4212da01c7da19a
># Parent  64f694b06df5c2f5140d456de6304804d4d8c8be
>Return None when trying to get missing sub-directive

Thanks! It's been applied and submitted a new version to pypi.

Just a heads up, the proper mailing list for this repo is:

~petersanchez/public-inbox@lists.code.netlandish.com

No big deal just don't want to accidentally miss your submissions as I
usually ignore this list (it's for testing).
David Keijser <keijser@gmail.com>
Details
Message ID
<20201102102207.ll2jsexcincf6apz@splurge>
In-Reply-To
<20201101234401.bok7i4wvl4heda6r@thinkpad> (view parent)
DKIM signature
missing
Download raw message
On Sun, Nov 01, 2020 at 03:44:01PM -0800, Peter Sanchez wrote:
> On 11/01, David Keijser wrote:
> > # HG changeset patch
> > # User David Keijser <keijser@gmail.com>
> > # Date 1604248014 -3600
> > #      Sun Nov 01 17:26:54 2020 +0100
> > # Node ID 33f5a3354dc7b1fce8639602d4212da01c7da19a
> > # Parent  64f694b06df5c2f5140d456de6304804d4d8c8be
> > Return None when trying to get missing sub-directive
> 
> Thanks! It's been applied and submitted a new version to pypi.

Ok, cool. Did the other patch make it to you too?

Having type annotations would be great when writing code using scfg
because it enables type checking with mypy and nice editor integration
with langserver and the like.

> Just a heads up, the proper mailing list for this repo is:
> 
> ~petersanchez/public-inbox@lists.code.netlandish.com
> 
> No big deal just don't want to accidentally miss your submissions as I
> usually ignore this list (it's for testing).

Oof, that's what I get for pasting the first code block I see into
config files.
Reply to thread Export thread (mbox)