1. 2

    We built something very similar last year. It’s a bit simpler though: Raspberry Pi near the door, two wires to the door and a piece of aluminium foil on the door. The Pi runs a webserver that makes the current status available as JSON document and via WebSockets. We just embed that as iframe into our dashboard in the hallway (and in my status bar on my PC) and now have real-time information. It’s been quite useful so far.

    1. 4

      I was expecting Python-AST wizardry and got disappointed. But not as much as by the fact that this is Python-2-style code. Otherwise it’s a thought-inspiring article that boils down to a “use a syntax tree built from nested dicts instead of writing your own DSL parser”.

      Edit: technically correct is the best kind of correct

      1. 2

        What makes you say it’s Python 2?

        1. 3

          Usage of u"" and inheriting from object. Former was just added to Python 3.3+ for backwards compatibility; strs are unicode by default in Python 3 anyway. Making new-style classes doesn’t require inheriting from object in Python 3 (even in 2.7 I think) because old-style classes have been removed altogether.

          Imo, code written today should not aim for Python 2 compatibility unless it’s something that has to work with a Python 2 code base that’s not migrated yet.

          1. 3

            Ok. I don’t think you should write “this is Python 2” when the code is (indeed) compatible with both Python 2 and 3.

            1. 4

              You’re right, technically it’s Python-3-compatible. It’s still Python-2-style code, which I think is bad because it encourages a soon-to-be-EOL’d Python version. Newly written code should just be Python-3-only.

      1. 3

        Nice that this is being pushed forward now. I’ve written a C implementation of (for now) v2.local with bindings to Java and C# (latter by a colleague). I’ve been wanting to publish it, but had my hands full. I hope I manage to get it out on the web in the next two weeks, hopefully including Python bindings!

        1. 2

          That sounds amazing :O

          Can you please link them here when they’re released? https://github.com/paragonie/paseto/issues/45

        1. 4

          I was hoping for something combinding fzf and your shell’s directory history (e.g. ~/.zdirs), so you’d just have to hit a shortcut, enter relevant parts of the path you want and get there; without having to set up any aliases before.

          1. 2

            I’ve stumbled upon Lark recently and started playing with it. I wrote a grammar and a piece of text that should be parsable with it. That piece of text fails to parse though, and I’m left with the position the error occurred and what tokens are expected. If the grammar was complete/correct, that would nicely tell me where my parsed text’s syntax is wrong, however since I’m just writing the grammar and I’m sure the text is correct, I’d like to debug the grammar instead. Unfortunately, Lark doesn’t seem to help me there. I’m a beginner when it comes to parsers, so I don’t really know how to best proceed from there, though a dump of the parser state would probably help, right? Can I get that out of Lark somehow?

            1. 1

              I do want to make debugging grammars easier. But that’s a bit like asking the Python interpreter to guess what lines of code you should write.

              Perhaps you can post or PM me your attempt (code + input), and we’ll take it from there.