 Alright, good afternoon to everyone and let's get a couple of things settled away over here looks like I've got Sound OBS, we should be good. Let's make sure that we started on YouTube Looks like we're going on YouTube. We should be good there Preview anymore. Let me keep this one somewhere where I can see it though. Alright, okay should be good to go Uh, let's see here Yeah All right, so happy Friday to everyone. Good afternoon. Good evening. Whatever time of day it is for you I hope you're having a nice day. My name is Tim. I go by foamy guy on github and discord. This is the deep dive Program, this is a weekly live stream where we are working on things related to circuit python You are brand new and you don't know what circuit python is You can learn more at the main website for the project which is here at circuit python.org To give you a quick idea though, this is basically a version of python that runs on these tiny computers called microcontrollers The downloads page here that I clicked over to has got a bunch of different pictures of these devices So all of these little devices depicted in these photos are microcontrollers. They all support circuit python There are 398 different devices right now that do support circuit python Basically, this means that there is a special program that runs on these devices You plug it into the computer with a thumb. Uh, excuse me a usb drive a usb cable. I should say And the computer will recognize that device as a thumb drive There will be a code file on that thumb drive You open up that code file with whatever text editor you want Edit the code that's in there and save it the microcontroller inside of the main chip here will notice that you made a change And go ahead and reset and run the latest version of your code So that's kind of the really really quick version of what's going on with the project that we're looking at This is an open source project as you'll see today We'll be doing some testing and some reviewing of some prs that were submitted by members of the public So this is an open source project. Anybody is allowed to use it. Anybody's allowed to contribute to it All of that sort of stuff. It is primarily funded the circuit python project by this company adafruit This is their website adafruit.com. They are a hardware and software company based out of new york They design and manufacture some of the electronic devices like the microcontrollers As well as, uh, you know breakouts, uh, little devices that you can connect to your microcontrollers to do various things Whether it's like sensors or rgb lights or buttons, uh buzzers, beepers, gps Just about any kind of little electronic widget you can imagine, uh, they will probably, um Be able to sell you a little breakout board that allows you to connect that widget to your microcontrollers and interact with it from circuit python code If you would like, uh, or you know, arduino or ccode or however you want to do it You don't have to use circuit python in order to be able to use much of the hardware that they sell so Adafruit for paying the folks who work on the project And if you want to help support the project one of the ways you can do that is just by purchasing hardware from them over at adafruit.com So head over there get yourself some fun toys to play with How's it going spavla? Yep. We are live here on, uh, we should be live on youtube and Twitch as well as I think a number of other places, uh, although I will say for the chats if folks are interested in asking questions or Interacting in the chat the two places to do that are going to be discord or youtube I do not have the chat pulled up for any of the other places where we do happen to be live So if you'd like to send the message that I can actually see Your two choices there are going to be discord or youtube The discord is linked down below me on the screen. I believe Yep, adafru.it slash discord. Uh, there are a couple circuit python channels On that discord. There's also the live broadcast chat Which is where we are at during the live broadcasts including this one And that is also the chat that is right below me on the screen there So head over there if you want to, uh Ask questions leave comments just hang out have fun. Uh, that sort of stuff So for folks that don't know, uh, this week was, uh, picon and at picon there were some Open spaces and there were some coding sprints where there was an opportunity for folks who Had not used or contributed to circuit python before We're able to kind of, um, get some guidance on being able to contribute. So As a result of that we have lots and lots of new contributions has go on debo desa over on youtube As a result of that we have lots of new contributions. Uh, and so on this stream What we'll be doing is just going through, uh, prs doing some testing doing some reviewing Trying to get caught up on some of the new prs that have been submitted I don't have a account yet. I'm sure we will have our stats for the weekly meetings, but it will be interesting to see Uh, the exact stats on it, but definitely, uh, I can feel, um, You know the increase in prs over the past week It's been amazing to see all the new folks, uh, first time contributors or less frequent contributors We've had a couple of folks who did contribute a few things last year And in years past who who came back into uh contributed again. We also had lots of folks who Have never contributed before, uh, who made their first contribution. So, uh, tons of great stuff and that's what we're going to be reviewing Um, that's what some of what we're going to be reviewing I'm not limiting myself just to pycon prs We might look into ones that didn't happen to come from pycon But that is in large what we're doing is reviewing prs. I see there's actually two open for this one I wonder if they are, uh Same person or different people just okay. Yeah different people. I think maybe they just opened above Uh, opened accidentally twice or something I think they just opened accidentally twice 11 and 12. So at some point we'll figure out which one is the The quote-unquote good one and and we'll close the other one um But yeah, that's that's what i'm up to today. I'm not going any particular order I'm kind of just going to grab ones that that jump out to me that I think are going to be um You know good to to review so uh loosely based on the time frame, you know the ones that are like zero one two Maybe three four somewhere in that range. Those are going to be the ones most likely to have come from pycon so I will At least take a look through those um to start with but like I said, we're not necessarily Limiting to just that either. So first I'm just going to take a Kind of a skim through and try to get a rough sense for like how many we're looking at Like I'm seeing about Quite a few probably over a dozen maybe a little bit over a dozen Some of these I think are handled um like this one is already merged now So these stats are out of Out of date by I think one or two days depending on I don't know exactly when adabot fetches the new ones and then I don't know If it felt like I don't know how quick uh, how recently it fetches data for But within a day or two these will update with the ones that have been handled At this point though, some of the ones will just end up skipping mini and qtt settings dot toml Updated okay that one's ready for uh, I mean it's not ready yet, but Princess attack him when it's ready Maybe if we take a look at this one. So that's type hints for midi All right, so we've got our try catch with our typing Uh, how's this different from micro python? Uh, good question. There is In the docs a better answer than I could give you for that particular question because as you can imagine We get it a lot circuit python is a fork of micro python Differences from micro python this will tell you kind of the A most succinct list of high level differences um The main one in my mind is the way that circuit python shows up like a usb drive In particular the way you can edit the code and save it and it will automatically run But I believe there are other differences as well in particular things like the api for doing spy and i2c and stuff like that I think is different um as well Yeah, for sure So Yeah, we have our try catch block here for the typing which is good. We do this on the micro controllers Uh, or I should say we do this inside the library so that when this code runs on the micro controller this input Import I should say will fail It will catch the exception that will just pass and go on This is nice because we don't actually want to import anything That is used only for typing when we run this on the micro controller The micro controller is going to ignore the types anyway and it Some of them are quite limited in terms of the amount of ram they have so Being able to not import stuff that we're not using at runtime is quite helpful. And so we use this try catch for that Optional any I suspect we could probably come up with something more specific than any for these right? Let's figure out. What do these take midi in midi out? So I'm not super familiar with midi library, but we'll kind of go and do a bit of Looking around and see what we can't figure out So that was on what now that was just inside of a knit on the midi Class so we need to find let's see what this says about it to an object which implements read length What is that? That's like is that a readable buffer? Maybe feed length That one's right See if we can find something that's using these and figure out what they are Um, let me clone this also. I don't already have it. It's very Of the file system This is nice to have open in here because we can control click through this to find usages That goes usb midi ports It's looks like it's going to always be the ports, huh? So what are those things usb midi? So that's a built-in module What does that module have on it? A module ports is a tuple of port in and port out So port in and port out then is uh should be what we are going to want. I think right is that says We are passing it usb midi ports and then zero as in to say the index within the tuple We have a tuple of ports we grabbed one port from it And passed it into that argument and that port type was this port in here which comes from usb midi port in And I'll link to port in Recently got tripped up on bytes hexes and ints. So I have an irrep for this one Yeah, I in a lot of cases It can be any of the above Uh, and I will definitely freely admit. I definitely don't necessarily have I don't feel that I have the best grasp on when It makes sense to type which ones all the time. So Um, lots of times though, they kind of can be represented in a bunch of different ways like we tend to do hex numbers Uh, which are ints, but then there's also like byte representations sometimes and so it's like It can be tricky for sure and I do not claim to Be a hundred percent perfect by any means. So we've got in channel is going to be an optional union of int Tuple and int. What is in channel? That's on the uh, that's also on init. What is that? Go to it's after the star though, which is a thing. So does that mean it's like a parent thing or no because we don't extend It's kind of weird, huh? Where are these after star? in channel What does this say it is in channel? input channels, this will be used by receive to filter data. This can either be an int uh for the wire protocol channel numbers 0 to 15 Tuple events to listen for multiple channels and it defaults to all channels I wonder what the value is for all channels though, right? Is it just a tuple that contains all of them? I guess that might be what it is How's it going, johnny? Nice to see you this evening um Evening my time, um input channels so Okay, yeah int or tuple events. Yeah, that sounds good and it is optional as well Of course because the default value is none optional essentially means it can either be The things inside of there or it can be none i.e not exist in our case Default is none so definitely can be that Out channel Interestingly that one does show just an int. I guess is that the wire protocol number Used by send if no channel is specified at defaults to zero, which is midi channel one. Okay Yeah, for some reason that one only does one. I don't know why the input it seems like you can take a tuple but Output looks like it's on one. So int there seems good buffer size That's the size of a buffer as the name suggests then it certainly sounds good as well there Julian for debug Okay, in channel. This is basically the same thing as this, right? This is just the property for setting the field that we saw before stuff was gone cough gone Just tired today. So it'll be fine tomorrow. Hopefully fingers crossed for sure Let's see here. So that one does make total sense to be the same as that optional union int or tuple events In channel, this is the setter. So same thing here, right? This is the return of that thing This is the argument for setting the new one All of these types should be the same as whatever it was in the Instructor and they are so we're looking good there returns none because it's a setter Out channel int which matched the int we had before This looks like just a little format change on the quotes there. Maybe black or something probably did that Assert channel. This one's a little interesting Not none out channel Yeah, I guess maybe you're not allowed to do none won't none already Won't none already Won't this already pick up on none? I don't know if we need an extra assert See what that does. Oh, this is uh, does this have ducky? On this this might start typing stuff No, you're not lucky. Oh god. I don't have anything in here. Um, so if it was channel, I don't think the name doesn't matter but Channel channel equals none This mad expected type got none Maybe it's like a might maybe that's what they added the assert for I guess maybe something my pie or something is complaining about that I guess pretty sure this will raise the runtime exception or so. I didn't actually connect so we don't see That type error actually, okay It raises an exception, but it actually raises an exception trying to do the comparison not as a result of the comparison Okay Uh, what does it do? here Although Okay, no defaults to zero. So we'll just say assertion error line three Hmm. I'd be in favor of a more specific error message. I think Because like the whole point I guess of adding the assertion is to make the error message more Make more sense than the one about less than Could we use like is instance? Is it going to be mad at is instance also? Is that work for none? Or like This says expected type int Arguably, honestly, this should say like Something like this as well potentially, right? Anything errors? I don't smell very good So midi message I'm a little curious about the new assert though Are there cases where this is going to raise an error that used to work? I guess the thing is we used to just say self dot underscore midian dot read if midi in was none then it would Not have a dot read anyway. So it would raise an error here Okay, it's probably worth like double checking on the uh On the example code The message is a midi message object optional int Turns none Packet is bytes on this one and num is int Turns none For midi out is not none Yeah, I think it will be worth checking the examples to make sure that like like maybe if you're using only one or the other That it still works for you You wouldn't want to have it to be where like if you have So if that's like a certain none on both like Maybe it makes it so you can't use one or the other I mean, I don't think so because I assume you just wouldn't call send if you're not using out or whatever, right? But We'll want to double check. I think Channel spec is a union of int or a tuple int. Okay channel those I'd have doc strings too much really returns a bool utility function to return True if there's two f's there which could Hypo we could remove on it's not really related to the pr Turn true if the given channel matches the channel spec or type of channel Note is either string or int if note is a string it will be parsed and converted to midi note Yeah Otherwise, it's the number right The midi numbers midi notes are zero to 127 They align with these um string representations of the notes as well Note number 60 is c c uh Octave four c C sharp one That higher 61 if can mean if and only if is that true? Is that a word? I've never heard that before conjunction nice Thank you for that. I did not know that So is that is that true in this case? It might actually be utility function to return True if and only if the given channel matches the channel spec, which yeah, that does sound accurate in this case Because it's not it's checking type as well as the actual equality between them. So it's like Like triple equals in javascript kind of returns an int Any note okay returns the note it played I guess return 60 Oh, well, yeah note parser because this whole purpose in life Wait, okay, but then why would you pass it a number? I guess just because you can midi note Okay, so it used to just say midi note equals note and then it said if note is a string Do all this stuff Then actually sets midi note again, even though we already did it Now the new logic is if it is a string do all of this stuff which includes setting midi note L if it is an int then do this bit Which is nice actually. I think this adds a bit of clarity to the code. They both lead to the same logical operation This one I feel like better conveys right if else if is Literally what the logic is here. That's nice They did a couple of these ones on the variables So this is not like a function argument or a return. It's just a variable like a constant basically How they decided the ones they did it on it's interesting that they did optional int on status, but didn't touch status mask Uh, and then same thing on length but not like any of these ones In my assumption is they ran lipi And it complained about those lines, but I'm curious. I wonder why that's actually the case Raise value error or OOR I know what the OOR is, but that's all right Out of range. There you go. Okay fair enough. Uh, that returns none Last okay, this used to just be a plain list now it is A list and we get to know the types inside of it. It's quite complex, but it's like a tuple of A tuple of optional bytes And optional ints so that's in the first tuple and then Well, that's in the first item within the outer tuple and then the next one is a midi message Annal optional int none optional int int It's another place where there's a new assert into her pool That one feels a little bit odd into her bool, right Buff usually buff is like buffer internal search EOM status This is in what midi message EOM status documents Whatever. Yeah, I mean the code in here seems to think buff is uh Square bracket accessible like sliceable or whatever. So I'm assuming it thinks that it's bytes EOM status Match message status. Did we already do that one bite array? Okay, so byte array that should actually match because that's just getting passed straight through Actually, uh further down it looks like by It's the next one down. Okay EOM status was then status Buffer is this in status which is Int inside there No, not union optional int Or I'm assuming that's index index plus one end index message end index plus one such start index End index those are all numbers returns a of int bool bool This one returns a bigger tuple ease any Right be something better for that like class. I don't actually know cls. Is this the thing you can put there? Actually, sure Better not There's a type inside of here Status might be a number instead of a boolean one message Oh, it's definitely a message also Nation we saw before You do this with true I feel like status would be a number because buffer is a byte array And when you access The thing out of it like this Well, let's see. What do you get a number? That's what we should get there Is the first of what they have marked as bools insertion You know in that's back to our channel in from before tuple event or Union event or tuple event Option all midi message into int bytes returns bytes got another assertion in there From bytes returns a midi message It's going dj. Devon need deep in mqtt error handling seems to be sorted now nice Pt good ol mqtt's init status int Byte spider a exception exception. All right Under the next text takes takes a little while to go through them sometimes depends on how like some of these are You know multiple files lots of different functions like that one Others of them are a bit smaller If there's only one file and if there's not that much code sometimes they go a bit quicker, but Just depends different libraries, you know x Initialized with send and receive but was manipulated using integer keys. I simplified this To improve my pyre reporting about those initial entries Type in same as annotations. They are yes. Yeah, and we're just reviewing the prs from them We might I think we will want to ask about these ones I think tech trick did actually ask about these so we kind of are I would say the changes to get ignore are in a bit of a holding pattern until we get a response And maybe just have a conversation during the meeting about If we want to accept these and if so if we want them to be exactly like this or if there's anything else We want to add at the same time or whatever we can do this as a patch probably um It is probably best for now to Take them out of the changes But what we'll do is we'll go through the rest of the review here And if the only thing we want to change is this Then I'll probably just make a commit that reverts that Uh, but if there is other stuff that we want to change also then We'll leave comments and one of the ones I'll leave is to undo that for now Uh, yeah, yep, lots of new lots of new contributors coming in Through the py cons prints seem like for sure. It's been great to see Okay, so This one this reminds me I was wrong about this one on one of them That's one of the things I forget which one that is we'll need to find that so I can go back and fix it I actually misled somebody about this on one of them. I was thinking this needed to be inside of here, but that's not actually the case I put that as a comment on one of them. They did it, but it actually caused the ci to break so And I have sense learns that we you can have this outside the try catch block and in fact you need to have it outside the try catch block or more specifically You need to have it as Like the first line of code in this file, I think or the first import or something Otherwise something else complains That's one thing to fix on one of these doesn't look like this one though typing So we do have our try catches good there start time float returns float monotonic That'll float. Yeah, I guess so right report bytes byte array tuple any int Me we get any better than any results tuple tuple results Our sensor and report data Why is it that everyone says try catch, but it's actually try accept uh I cannot answer for everyone I can answer for myself and the reason why is because the concepts are the same concepts in java and they're called try catch Uh for me, that's why I use the term catch instead of accept I will say catch feels Easier to say is it less syllables than accept Catch accept. I don't really know if it is or not, but it feels easier to say results tuple That's that append Results is a list The results is a list Gets some things appended to it and then it gets turned into a tuple so results tuple Should always be a tuple instead of Any if i'm understanding right we should get back a tuple that contains another tuple in the zero index and then Accuracy, which i'm assuming is probably an int okay, so we are Definitely gonna have some things to comment. So let's go ahead and leave one here too Yeah throw an error is a good uh Is a good point as well catch is the verb that's used with throw Makes sense. I think I first ran across it with uh minecraft plugin coding Yep, you'll definitely find it in there lots of java going on for that The job of for python same here First make you want to throw things they do they do sometimes they do sometimes I mean, I guess we we even know this one is probably ints It comes from raw data It's multiplied by scalar comes from there I think raw data should come out as an int from here Get multiplied could make it stay an int unless scalar is a float. I guess Built a pin. So this would either be enter floats. I think I'm gonna assume ints Or I guess maybe optional. I mean there is no none in it. So But it could be empty I don't know what if we just left two bull I think we don't know what's in this one Or if anything, I guess the any could be inside of there. I suppose but It's best to not do any's if we can if we can get anything more specific than any. I feel like it's probably best Report bytes byte array returns int unpack. Yep. It's the int out. Okay byte array string this one returns It's like that returns a list of me Oh gosh, where did we go? Oh, okay. I uh wait what? Oh, okay. I see it's a list. We said so it's declaring a list Then it's accessing a certain element index strange beard I don't know how garbage collection works or whatever I feel like it'd be better to keep this as a list, right? Like if we kept this as a list somewhere in a variable Because this is gonna make a new one every time, isn't it? Every time you call this it's gonna create a new Copy of this list just so it can access one thing and return it I guess maybe it gets collected right after that, but Feels like keeping it around would be better in a variable. Maybe Bite array string. It's kind of it's unrelated to the types though. So Turn a string. Yeah, and I guess it would be a string because all these things are strings If this is a number that we're accessing the index of so Bite array tuple any Bite array dictionary string int Classification Dictionary string And activities most likely Like string string to me It'll be classification is a dictionary. We're adding the key Called most likely and we're setting it to the value that we get out of activities with this number Activities is this list with these strings Therefore like most likely would be a number. We'd be accessing one of these strings. Therefore the dictionary Would be having strings for keys and also strings for values if you wanted to use Bite array boolean logical expression there Bite array tuple of ints Port bytes tuple any any Whoa, does that scroll you around so far? I don't even know. Where where where are we now? We're like, there we go. Okay I like that scrolls you really far Port body response values. I don't know exactly what those unpack is I'm not super familiar with unpack format syntax command int buffer byte array Next sequence number int command params optional list events See like I clicked one thing. We're nowhere near We're like way back up here now. We're nowhere near where we just were Now we already passed this. Yeah here. It's highlighted still even Yeah, I clicked this thing and then we scrolled way up there What's up with that github command params If it's none return Checking the length of it so list seems good uh looks like both times Only scrolled you down at the end of the section you are working on Scrolled me up. I feel like but I'm not positive port id int returns int packet list any Yeah, we're definitely up. We're definitely north of where we just were So this was the one I clicked right here came unfolded and became this section List of any so it'd be nice if we could do something better than list of any But I'm guessing this is like an unpacked one Gotta turn in for now. Thanks, Sim. Good night. Oh, yep. Take it easy to have a vessel. We'll see you next time You have a nice night. Uh, let's see here slice packet data next bytes data to any Where's packet type way to like back to separate batch I guess is where where does packet get defined in this file maybe I mean scrolled me down like there's just no It's no seemingly rhyme or reason for where it scrolls you to Uh, I guess packet must be declared inside of this thing somewhere Let's get this one cloned also You know eight whatever do we have this? Okay We're looking at e Is there a report id? There's class packet. Okay, so there it is. Okay separate batch. That's what it was called separate batch It is packet and the class is right below it. So I guess I should have just scrolled a little bit lower instead of going on that journey packet class representing hill crust laboratory sensor hub transport packet I feel like it should have a different name than packet personally, but all right byte array returns none string returns string report id returns a number int channel number header from buffer byte array packet header I have a packet header class as well, which I assume will also be defined On below or perhaps inside of here optional dictionary for reset That seems odd reset usually would be a pin Maybe a digital in out if it's already been It's already been made into that That packet why would packet have reset anyway though? Okay. Wow. That's a lot I have the class packet class class What? packet 377 Spell it wrong doesn't have this Okay There's packet error right now string This is no Longer packet. Okay. Yeah, this is not on packet. That's why this is weird For 95. What is this actually on this is on? B and o 8x reset Like how we have exactly one Exactly one thing the doc strings What is up with that though because this says param i2c bus, but this does not take an i2c bus I'm missing something. Well, I bet you there's a base. I bet you this is the base class I guess there's probably a b and o at 80x I know the number I have this wrong by the way, but yeah, it's whatever b and o whatever I bet you there's a i2c and a spy. This is a base class. I bet you there's one of each and then The i2c one would take an i2c bus the spy one would take a spy bus. We should probably have these documented though Here I think since they exist. I don't know I'm pretty sure reset here though is not I'm pretty sure reset's gonna be a Not a dictionary I think it's going to be either microcontroller pin or Digital in out this the whole rest of the file There yeah, see i2c here it extends this one Which does have this which makes total sense And then spy will do the same thing right there'll be b and o whatever spy this also extends it This also will have its own parameter for spy bus As well as the other pins this calls it reset pin which makes me think uh microcontroller That pin rather than digital in out But we'll find out what we do with reset after we get it. This is a big class Just sets to here. So there's soft reset and hard reset not do anything Reset hardware reset if not Self that reset then return otherwise import digital i0 Set the direction to output set the value to true I think you need this New is it Hard reset 1047 this is way down here No Let me change there is that So this is a side from the current pr. I'm pretty sure this doesn't need to be here though This feels like somebody did thought this would need to be imported because like Oh, okay. I get it. It's this. Okay. Okay. Okay. Okay. I get it. I guess. Yeah Yeah Okay, interesting. I don't I feel like you should have to already have that set on your thing Anyway, I don't even know if it's worth Doing that here. But anyway, that doesn't matter. Um It might be better to do a more specific like from Something like this number and then you could do that there. I don't know. Does that make it so we import less stuff? I'm not actually sure if that equals less Stuff in ram. Anyway, though, this definitely is expecting reset to be a digital in out, right? Because it will not have a direction It may not have a value. I mean, I guess a lot of things have a value, but It's definitely this is expecting digital in out. So reset is here Uh, it just got set from reset, which was passed in so We're expecting reset to be digital in out Not microcontroller.pin Is nothing ever Initializes digital in out. We should be able to verify that in the examples as well Except for that's not using the reset pin. There we go reset pin creates digital in out Let's actually set this to input, which is really weird. Why does it do that? That's weird It's definitely digital in out though debug True false sounds good I don't know if any of the code actually That does. Yeah debug true. So this is more of where it's doing these on variables instead of uh On the arguments this would change to data buffer byte array byte array list any list events dictionary intent I don't know if it matters too much personally I feel like if that's going to say float this should be minus 1.0 if that's going to say float this should be minus 1.0 Or these should be int instead Because because right now it says it's a float but in python this literally is not a float I'm falling correctly So now we're like declaring it as a float but setting the value to an int so we already have a discrepancy But it probably can be a float. So in this case, I think the better fix is probably the 0.0 But I don't know if that's like just my own Is that like an actual best practice or is that just my own like I guess pet peeve or whatever Is that just a thing I care about that doesn't actually matter that part? I'm not sure To ended sequence number Okay, this is the part of the code they were talking about refactoring. I'll have to go back and read their Comment to understand what they did Definitely refactored a bit though because it used to be two ended sequence number It was a dictionary it had keys for rather it had strings for keys Then it had sub dictionaries for values Now it's just dictionary into into has nothing in it yet Beatings dictionary into any That's a little weird. Where do these go? Are these I mean? They must have Come back up somewhere else. I don't know or maybe I maybe that's what they refactored is getting rid of the need for those I don't know Uh Could be random. Oh the scrolling. Yeah. I'm yeah, I'm sure it's like Sure, it's related to something, but it's probably my font size is messing it up is my best guess It's probably trying to like scroll to Keep me looking at the same thing, but it's probably calculating based on font size that's not true I have the font scaled in my browser So sometimes stuff will try to calculate based on font size and I like It's the wrong size this python is non declarative language. I struggle with that too Yeah, the 1.0 thing staying back here with the floats. Yeah, okay I'll leave the comment. I don't know if it matters too much Any initialize return none Magnetic returns an optional tuple of triple float Sounds right for a magnetic reading Quater none Quatern quaternian quaternian All right pronunciation four floats instead of three you a magnetic game Pacific real what that means steps optional int tuple of triple floats linear acceleration Uh acceleration also triple floats gravity triple floats dry row Shake is a boolean optional true. Is it being shook in or not or I guess has it been shaken since the last time you asked? Yeah, this scrolled me way back up Our light I gotta stop clicking those that's Brutal I don't even know where I was at now triple floats linear. Okay. There we go. We passed these ones gravity gyro shake There we go shake is what we were on No stability classification optional string Down would like to look What's the string though optional dictionary? Triple ints raw acceleration a gyro Attic again calibration return none calibration status int Can prams optional list events 757 It took me back up to 200 something. That's so weird sub command params Access some direct really directly it calls into here. It's a command request expect its optional int or int report id optional int Timeout float see that one's got that one declares float and has a literal value of a float even though it's five Even though it's not like You know, there's no fraction of a number of a whole number, but it still is a float packet It might boil down to memory usage 1.0 might take up more space could be yeah, well, yeah, no, I would I would assume it does I would assume it probably does Probably does But in a case like that, I'm assuming something else is gonna set it to a float anyway So I'm assuming that's like memory. We're gonna use regardless Read packet. There's a new packet returns none packet ID ID interval I think we need any on that one probably it will be whatever this is right default report interval is I'm assuming a Love hint probably actually show of its const 2000 microseconds it is Int If that's different, I'm not sure Int There as well specific config int returns the byte array feature id int returns none check id it's boolean Or since your id returns optional int args and quarks I feel like we could maybe even just leave those off I don't know. Maybe there's no harm in including them. I think some libraries we just have left those without Because by their very nature they can be any so adding any I don't know doesn't really tell you much of anything else, but It's none Get data index int format string string Unpack from unpack from I feel like we should be able to get better than any here. Maybe not though back Correct what it returns and it depends on the type and all kinds of stuff. I don't actually know And I think it's different, right? I think I can return different things Especially in this case because format string is dynamic, right? So format string. We're just passing through here So unpack from Prince different types based on the format string This is actually having a variable format string. So in this case, I guess any Is true, I suppose if this is not hard coded then This could be any type at least all the valid types that unpack can make which I assume are at least all of the basic types. Maybe every possible type. I don't actually know It already returned none hard reset returned none soft reset returned none channel int right array for data optional int is I'll pack it Not implemented. So Technically just returns none. I guess but okay, let's try to find the one where I misled them about The future import thing I think this is not it still This one we need to look into some more too, but that's not the one I'm trying to think uh location Product in it It's the le Yeah, I can see I think I said here. Yeah, this import can be inside the tribal lock, which was wrong I was mistaken about this And then they did move it down there and now the and now the actions fail because of it LED so we actually want to change that back Well, that runs. I gotta run to the rest from the fest then origin Want to add the remote for this person Got the pr bridge and set offense the LED So they need to be outside of that Probably this is complaining about the same thing Must be at the beginning of the file. Yeah Turn pre-commit Save it. It's clear. I didn't save it Really complicated. Would you guys be able to take a look at how typing? Probably will we will elect to keep it with any in that kind of case At some point it may be able to be refactored to a state that makes it easier to type If it is currently in a state that's not Really easy you are possible to type very well And I do think it's Going to be better probably to have any then try to have some huge like arcane, you know Option union union option option union It's huge massive thing that just keeps stacking bigger and bigger. You know, it may technically be correct. It's like Hurting more than it's hoping at some point when it's just a wall of text of type because you're like This is That's kind of color this one It's good to me. Of course ring length, of course will be int The item takes an int returning a float in this case Instantly though if that's returning a float and it's just self-red blue green Then wouldn't these be floats? Not actually certain Floats or integers Okay, it's different if red is an instance of this Okay, there's a way where they're in so I guess white optional float full base color union Just v float float float return none Floats full of triple floats return string int for length All the same here optional float for white fill based color union lamp Union in float lower in float upper in float Turns okay, so that one's just like a max min thing. Okay Normalize convert 8 bit 0 to 255 to normalized Those will be floats as they come out. It looks like Lamp norm I guess calls clamp and normal. Yeah Enormalize Back to the 0 to 255 unpack color types crgb Ununion types of those two types And for color two weight float blend between two colors So these ones are the ones where Is the way this function is written It's like works in one of three ways You know it's gonna be you know You're gonna be in for a bit of a challenge on the typing when you read back strings And that's the very first thing this is works in one of three Basically, this is saying like if you pass this kind of thing for this value Then it does one thing if you pass a different kind of thing For that value then it behaves a different way if you pass a different kind of thing for that value Then maybe it behaves a different way. It's like Kind of swiss army knife right it depends on what you pass it To determine how it behaves and like what it returns back and all that stuff so That's a single normalized level zero one and an optional gamma adjusted factor And a brightness Returns a single normalized gamma corrected brightness level That's the first mode The next mode it accepts a single crgb or cshv type An optional single gamma a tuple of those an optional brightness factor Or an rgb brightness tuple that one returns a normalized gamma corrected crgb Third type it can accept the list or tuple of normalized levels But yeah, this one's this one's a bit tough to type I think the enemies are probably fine there like technically you could Build out, you know the big gnarly looking optional union optional union this whole thing like you could build it out To be specific, but it'd be to be overwhelming. You wouldn't really be able to make sense of it Anyway, I don't think so It would probably be nice to refactor the code to have three Maybe like three sub functions or something where it's like one of each type List of those colors other colors list of ints That's palette union position for float palette. Look up. Would that really be a float or a uh int position? Okay, yeah fair enough Okay, expand gradient List of flutes and colors a little tuple of tuples of floats and colors Turns a list of colors of that crgb Um, I think we're I mean, I think we're good on this one I push that back. We need to see if it passes actions because I did Change that back. Okay. That does have all checks passed now I think we're good on this one. I don't think there's anything I mean, I think the enemies are fine on that gamma just right So that when we merged therefore we can make a new release New release is what will cause it to actually show up in the bundle automatically starting tomorrow If we forget to make a release then it won't be in the in the bundle starting tomorrow I mean, it will be there, but it will be the old one We're gonna go 1.4.15. I've been doing minor number for types If nothing else changed at the same time Sometimes in some of the typing functions, they also refactored or did other things in which case maybe it's a different number, but 1 4 15 Definitely higher than 1 4 14 is important because if you put a number that's lower get hope gets all confused and does something weird This did close the linked issue correctly Some of them are not linked to the issue and so you merge the pr and they don't automatically close the issue This was not one of those though. This one actually did automatically close All right passwords by default. I think is taking care of it's rendering Hey Actually, but I think I Yeah, this one's actually only did I look at this one. It's already merged did I release typing in for me? This one will fall off the list tomorrow or whenever it updates Jaira, right? Sheets better wrong numbers in there But oh no, okay. Yeah, say it's in the comments only but no it is but too And now I see him 20x. I don't think I have one of those Probably will want to get that one tested on hardware by penitations And I already are applied to Doc imports only emerging release. Okay, so that's not Basically, we just want to double check if all of these things got changed. I'm assuming they did with the rest of the The rest of the uh commits there You're here. Yeah order here. I don't think matters too much. I mean This one has to be first. I shouldn't say the order doesn't matter too much. This one has to be first The try block versus the rest of the enforce doesn't matter I moved from down here to up in data list list of lists Good bits list names tuple int lists List returns a tuple don't Good bits Oh result that code result Cursive it's recursive ecode bits expulses Returns a tuple Apps the top level function. I don't know what that means result equals decode bits. It's calling. I mean They're not calling itself I don't know maybe not maybe because it doesn't have self that I don't know how that works I guess it looks like it's calling itself to me though, which is weird Why would why would it call itself in there? Must be something different Must be like I don't know I don't know must be something different though because that wouldn't that would just infinite loop, right We'll call itself infinitely because you it would Go inside and inside would call itself that would start the next one which would go inside call itself Go inside call itself go inside call itself And there's no there's no logic before this so there's no like base case to stop the recursion So it has to be a different function. I think Should be calling a different thing. That's weird though because it has the same name. So I don't know self use List int This one I think would be float optional list if the pulses list int pool Assume like floats, right? Better int 1 int 0 int trail int Star see there's one where we have star, but didn't put any which I think it's fine Debug false debug could be typed as bleeding though So data byte array repeat int delay int in bits And if it's going to be a none then it should be optional int. I think Okay, so we had a couple of more And then we'll go mark these ones as Delft, I guess debug was one of the ones we did matrix keypad That's done Oh, it needs a pre-committer or something Maybe we did All right, we saw this earlier I'm in favor of that Honestly, that could be done to a lot of libraries Honestly, there's going to be a lot of libraries that currently use secrets pie Um Or examples honestly, I mean a lot of it's going to be example code more so even than library code but um I see it all changed over to settings toml monster mask. I think I merged this. Yeah pixel spy I play let's read that I penitations my pie optional updated doc string pixel order to provide more details That's good to me All right, so we have uh, these have changed orders a bit. We have our try block It's kind of the way it's showing. It's weird it cut this out of the middle But like it's actually down below here. This is fine bus. I oh spy typing would be the first one. That's all good Those are strings for the variables pixel order Uh, I used to just say set the pixel order pixel color channel order RBW is by default Now it also says can be a string or tuple of integers with values between 0 and 3 Okay, I don't know what the tuple one would be I don't Think I've ever seen that before every time I see a pixel order passed to a thing. It's like one of these It's like a string with rgb Or sometimes w if it has white also But I guess there must be some other notation. There must be a notation. I'm not familiar with I guess spy that one's bus i o dot spy, right? Yep In for int. That's the number of pixels Those these has deleted but they're actually not deleted. They're just here now Uh, bpp. That's like bytes per pixel. That's an int for three brightness is a float. Yep auto write boolean. Yep pixel order Uh optional. So that's what they mentioned up there was either string or the tuples Um, then optional obviously because it's none by default frequency int time Oh, that's an interesting thing. Okay What is that about weird? Didn't change though. So like It's not part of the pr Int for that. It's just represented with binary. Okay, they're passing it by name now It used to not be passed by name, but now it is Okay The unit returns none represent return strings one string not strings n Turns an int the number of neopixels in the chain. Yep. I don't know why that's not length or something in feels Very nondescriptive, but that's all right transmit buffer byte array I wonder if that's supposed to be readable buffer writeable buffer. Honestly, I'm not super good at knowing If those are the right thing to use or not returns none Intransmit Modify wow turn every bit into a special byte pattern Much the same now would be the only bit. I'm unsure about I guess right like as long as that's true then this looks good Um pixel order, where would we see? That maybe if we look neopixel, maybe we could find something it's like neopixel pixel order String here Does it do with it? F dash origin eta fruit All right, what is this gonna be happening with this thing once it gets passed in so this is uh, if not pixel order Then pixel order equals g rb if bpp equals three else g rb w Else if we did get past pixel order, then we say bpp equals the length of pixel order So if that's a string it's going to be the length of the string, but as a tuple that's going to be the length of the tuple If is instance pixel order tuple order to list equals rgb w order for order in pixel order, so Yeah, we're looping over The things that are inside the tuple pixel order For each of those things that are inside of there We are pulling out the index They're pulling out the character at the index of the string rgb w And we are packing that up into a list. So we're gonna end up with a list of numbers zero one and two based on The order of that string As well as the order of the things that came in inside of this And then at the very end it just gets joined together As a list so it Oh, no, no, no, excuse me order order would be numbers then we would be accessing Indexes inside that string. So that was wrong what I said before these would actually end up being individual characters Not numbers Something like this, right because order is a number that came out of this tuple and then we accessed The item at that index of order and because The thing we're accessing it in is a string then that means the thing at that index will be a character Or in python a string only has like the one because I don't think there's a different thing for character So the code. Yeah, the code definitely thinks it can be the tuple of numbers. So, okay I don't know what you would do. I guess for w in that case. Um Oh, well zero through three that would cover. Yeah, no, that would cover w because it's zero based Zero one two three that gives us four total There's four. Yeah. Yeah. Okay Yeah, that seems good. It's correct I never seen that code. I've never seen code that do that before but based on the code that is here That definitely looks right to me That then we can make a release and then I think we're going to be packing it up after that Uh while I do that I will mention if you Enjoy this kind of content or circuit python Content in general you can Catch more of it on saturdays at 10 am central time That is tomorrow morning at 10 am central time I will be back. I will be streaming again. I'll be working on circuit python stuff I will be over on my own channel instead of the ate a fruit channel I will put links in the live broadcast chat before Like right when I'm getting started so you can always head to that same discord that we're in now And link will pop up in there Oh I accidentally press enter and it's submitted. I don't think I should change it obviously Like I meant to put a title and then usually I will put a sentence in here as well And if we edit it we can do that, but I'm pretty sure if I save it It might cause it to do something weird with the actions. I don't want to do it. I think it doesn't I think if you save it again the actions can mess it up So our choices are leave it as is or make another new release Either of which are great, but I think I'm gonna go with leave it that fingered the enter got to be more careful Anyway, what I was going on about While I was busy fat fingering that is tomorrow morning 10 am central time. I'll be back I'll be over on the foamy guy channel. We'll be working on some more circuit python stuff Probably we'll be doing some more pr reviews tomorrow because as you have seen there are lots of prs in We made it through some of them tonight, but there's obviously still pretty good sized list Many of them newer from python sprinters Some of them, however, not like a couple that are in the list that I'm excited about that are ready for Retrying are the ethernet ones If anybody has watched this stream Before one of the things that I've come back to a few times is this Ethernet library pr this one's ready to go again for some more testing. So I'll be back doing some more Network ethernet testing on that. There's also really cool stuff that I'm excited about happening in htp server Which is not in this list because that is even brand newer HTTP server this library here Very excited about this Michael pocusa has been working on this one for a little while now. They have released like basically a big update to htp server with lots of Additional functionality and enhancements and things like this. So this looks really cool. I'm excited to try this one out as well That's kind of a sneak peek of a couple of the things we might look into Tomorrow, but you can rest assured whatever it is. It will definitely be circuit python and it will definitely be Right here on the old youtube and twitch While we are dreaming From today has gone Michael. Thank you for working on this by the way. I didn't realize you were here I'm super excited about this big big big big massive hug reports to you. Thank you so much for working on this If you are interested and you're around in the morning tomorrow at 10 a.m I will take a closer look at this if you're interested in following along Either way, I'll leave comments or whatever if I I find stuff or anything like that I'll leave comments there so you can always just see him that way as well But thank you so much for working on that. This is awesome Thank you to everybody for watching. I will like I said, I'll be back 10 a.m. Central tomorrow I hope you all have a good night. Enjoy the rest of your evening 10 a.m. Central time. Yeah us central time. So I'll give you the I'll give you the from now. So it is about 16 hours from now. So whatever time zone you're in Uh in 16 hours, that's when I'll be back. That'll be 10 a.m. Central us time But it is about 16 hours from now So, uh, thanks again everybody for watching and I will see you all later. Thanks