/srv/irclogs.ubuntu.com/2022/09/23/#cloud-init.txt

=== jmcgnh_ is now known as jmcgnh
cjp25623.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
ubottuPull 1742 in canonical/cloud-init "Ubuntu/bionic" [Open]17:15
blackboxswcjp256: correct, that httpretty commit is in upstream/main, but we have only pulled bugfixes for 22.3.3 into bionic-proposed17:18
blackboxswso https://github.com/canonical/cloud-init/commit/9aa4ec6982541f5425c860010fa87134e58469e6 is not in the -proposed release yet correct17:18
ubottuCommit 9aa4ec6 in canonical/cloud-init "tests: Drop httpretty in favor of responses (#1720)"17:18
blackboxswit will be in 22.417:19
blackboxswwhich is in Nov 17:19
meenahow 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
meenaI guess i could use regex :O17:20
blackboxswthat's one nice way. otherwise17:21
blackboxswif any([17:21
blackboxsw  test1,17:21
blackboxsw  test2,17:21
blackboxsw  test3,17:21
blackboxsw]):17:21
meenare.search(r"^(options|ec_capabilities|ec_enabled)=", toks[0])17:22
blackboxswand was just staring on a regex :)17:22
blackboxswship it17:23
cjp256use if ( .. )17:23
meenaregex 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
meenablackboxsw: so this doesn't need an or, that's nice17:24
* blackboxsw wonders timeit cost of the multi-conditional if vs regex w/ "ORs" due to "|" 17:24
cjp256any([t1, t2, ...]) will evaluate all conditions first to build that array I think, so less effecient17:24
blackboxswyeah +1 cjp256 good pt17:24
meenablackboxsw: regex done right can be really fast17:25
meenaI see so much regex out there that just makes me wanna cry17:25
meenablackboxsw: how do you "timeit"?17:26
blackboxswmeena: https://docs.python.org/3/library/timeit.html17:27
blackboxswcreate 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 iterations17:27
blackboxswgives you a quick relative comparison when you are looking at two ways of writing something17:28
meenai wish i could feed it random data :D17:29
meenabasically, like, quickcheck, but timed.17:29
falcojrmeena: on that note, we're auto-formatting everything with black these days, so write it however you want and let black deal with it17:38
meenafalcojr: I should just integrate black into my emacs then18:02
falcojryes, I've integrated it into my editor...makes life a lot easier18:02
meenai just forgot you had to add () around a long if line to make it make sense18:08
meenabut i reckon black would've handled that18:08
cjp256blackboxsw: i'm not seeing an updated -proposed deb for 18.04, just the old build from 09/0121:27
blackboxswcjp256: good pt. I'm not seeing it either.21:27
blackboxswthx cjp256 still stuck in unapproved queue, I think it was an oversight https://launchpad.net/ubuntu/bionic/+queue?queue_state=1&queue_text=cloud-init21:28
cjp256thanks21:29

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!