jglynn / segmund

A crummy app that aggregates segment data from Strava to support enduro style events.
https://segmund.mybluemix.net/
Apache License 2.0
1 stars 0 forks source link

use the segmund access token for non-user calls #16

Closed jglynn closed 4 years ago

jglynn commented 4 years ago

Addresses #15

Also, VSCode is kind of slick -- this is my first taste. Nice to have some linting! 🍻

rocconnick commented 4 years ago

I think the namedtuple is fine, definitely a classic solution. Since the names match, you could have possibly avoided some lines with a dict update on some sort of dict-like structure. If you're curious, check out types.SimpleNamespace, which is dict-like but with dot notation for members. Also, Python 3.7 adds dataclasses.dataclass decorator, which I could see replacing namedtuple for a lot of applications.

And yeah, VSCode is great. It's been my full time editor for the past year when I ditched Sublime. The Python extension support is great, although coverage for JVM stuff might only be so so. I usually run both pylint and flake8 in the editor. The unit testing and remote development plugins are also 💯.

jglynn commented 4 years ago

Yea, since the keys match I was thinking there would be some slick way to do it. I found a reference to the following approach which worked but apparently order matters and this could be inconsistent?

namedtuple('TupleInfo', resp.keys())(**resp)

SimpleNamepace looks neato -- it looks like I could get rid of the TupleInfo declaration entirely and just return SimpleNamespace(**resp) huh? That seems to be working. Not sure if it had flaws.

JG

jglynn commented 4 years ago

IBM Cloud toolchain: Delivery Pipeline deployed segmund to dev, including commit 5cd86ecb3e412b417178beee94586930c3de53fc