=== jmcgnh_ is now known as jmcgnh | ||
cjp256 | 23.3.3 made it to -proposed for 20.04 and 22.04, but not 18.04. related to https://github.com/canonical/cloud-init/pull/1742/files i assume? | 17:15 |
---|---|---|
ubottu | Pull 1742 in canonical/cloud-init "Ubuntu/bionic" [Open] | 17:15 |
blackboxsw | cjp256: correct, that httpretty commit is in upstream/main, but we have only pulled bugfixes for 22.3.3 into bionic-proposed | 17:18 |
blackboxsw | so https://github.com/canonical/cloud-init/commit/9aa4ec6982541f5425c860010fa87134e58469e6 is not in the -proposed release yet correct | 17:18 |
ubottu | Commit 9aa4ec6 in canonical/cloud-init "tests: Drop httpretty in favor of responses (#1720)" | 17:18 |
blackboxsw | it will be in 22.4 | 17:19 |
blackboxsw | which is in Nov | 17:19 |
meena | how do I split a line like this to fit into 80 char: | 17:20 |
meena | if toks[0].startswith("options=") or toks[0].startswith("ec_capabilities") or toks[0].startswith("ec_enabled"): | 17:20 |
meena | I guess i could use regex :O | 17:20 |
blackboxsw | that's one nice way. otherwise | 17:21 |
blackboxsw | if any([ | 17:21 |
blackboxsw | test1, | 17:21 |
blackboxsw | test2, | 17:21 |
blackboxsw | test3, | 17:21 |
blackboxsw | ]): | 17:21 |
meena | re.search(r"^(options|ec_capabilities|ec_enabled)=", toks[0]) | 17:22 |
blackboxsw | and was just staring on a regex :) | 17:22 |
blackboxsw | ship it | 17:23 |
cjp256 | use if ( .. ) | 17:23 |
meena | regex is usually my first goto, but then i remember how awful that is to people who haven't done 22 years of Unix nonsense. | 17:23 |
meena | blackboxsw: so this doesn't need an or, that's nice | 17:24 |
* blackboxsw wonders timeit cost of the multi-conditional if vs regex w/ "ORs" due to "|" | 17:24 | |
cjp256 | any([t1, t2, ...]) will evaluate all conditions first to build that array I think, so less effecient | 17:24 |
blackboxsw | yeah +1 cjp256 good pt | 17:24 |
meena | blackboxsw: regex done right can be really fast | 17:25 |
meena | I see so much regex out there that just makes me wanna cry | 17:25 |
meena | blackboxsw: how do you "timeit"? | 17:26 |
blackboxsw | meena: https://docs.python.org/3/library/timeit.html | 17:27 |
blackboxsw | create sample constructs or functions and shove them into it's own function or direct on commandline and see how it behaves vs alternatives across many iterations | 17:27 |
blackboxsw | gives you a quick relative comparison when you are looking at two ways of writing something | 17:28 |
meena | i wish i could feed it random data :D | 17:29 |
meena | basically, like, quickcheck, but timed. | 17:29 |
falcojr | meena: on that note, we're auto-formatting everything with black these days, so write it however you want and let black deal with it | 17:38 |
meena | falcojr: I should just integrate black into my emacs then | 18:02 |
falcojr | yes, I've integrated it into my editor...makes life a lot easier | 18:02 |
meena | i just forgot you had to add () around a long if line to make it make sense | 18:08 |
meena | but i reckon black would've handled that | 18:08 |
cjp256 | blackboxsw: i'm not seeing an updated -proposed deb for 18.04, just the old build from 09/01 | 21:27 |
blackboxsw | cjp256: good pt. I'm not seeing it either. | 21:27 |
blackboxsw | thx cjp256 still stuck in unapproved queue, I think it was an oversight https://launchpad.net/ubuntu/bionic/+queue?queue_state=1&queue_text=cloud-init | 21:28 |
cjp256 | thanks | 21:29 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!