d i f f   - - g i t   a / . g i t h u b / w o r k f l o w s / p y t h o n - a p p . y m l   b / . g i t h u b / w o r k f l o w s / p y t h o n - a p p . y m l 
 
 i n d e x   9 0 4 c b 2 f . . 3 a 8 d 6 4 a   1 0 0 6 4 4 
 
 - - -   a / . g i t h u b / w o r k f l o w s / p y t h o n - a p p . y m l 
 
 + + +   b / . g i t h u b / w o r k f l o w s / p y t h o n - a p p . y m l 
 
 @ @   - 1 , 4 9   + 1 , 3 6   @ @ 
 
 - #   T h i s   w o r k f l o w   w i l l   i n s t a l l   P y t h o n   d e p e n d e n c i e s ,   r u n   t e s t s   a n d   l i n t   w i t h   a   s i n g l e   v e r s i o n   o f   P y t h o n 
 
 - #   F o r   m o r e   i n f o r m a t i o n   s e e :   h t t p s : / / d o c s . g i t h u b . c o m / e n / a c t i o n s / a u t o m a t i n g - b u i l d s - a n d - t e s t s / b u i l d i n g - a n d - t e s t i n g - p y t h o n 
 
 - 
 
   n a m e :   P y t h o n   a p p l i c a t i o n 
 
   
 
   o n : 
 
       p u s h : 
 
 -         b r a n c h e s :   [   " m a s t e r "   ] 
 
 +         b r a n c h e s :   [ " m a s t e r " ] 
 
       p u l l _ r e q u e s t : 
 
 -         b r a n c h e s :   [   " m a s t e r "   ] 
 
 +         b r a n c h e s :   [ " m a s t e r " ] 
 
   
 
   p e r m i s s i o n s : 
 
       c o n t e n t s :   r e a d 
 
   
 
   j o b s : 
 
       b u i l d : 
 
 - 
 
           r u n s - o n :   u b u n t u - l a t e s t 
 
 +         s t r a t e g y : 
 
 +             m a t r i x : 
 
 +                 p y t h o n - v e r s i o n :   [ " 3 . 1 0 " ,   " 3 . 1 1 " ,   " 3 . 1 2 " ] 
 
   
 
           s t e p s : 
 
 -         -   u s e s :   a c t i o n s / c h e c k o u t @ v 3 
 
 -         -   n a m e :   S e t   u p   P y t h o n   3 . 1 0 
 
 -             u s e s :   a c t i o n s / s e t u p - p y t h o n @ v 3 
 
 +         -   u s e s :   a c t i o n s / c h e c k o u t @ v 4 
 
 +         -   n a m e :   S e t   u p   P y t h o n   $ { {   m a t r i x . p y t h o n - v e r s i o n   } } 
 
 +             u s e s :   a c t i o n s / s e t u p - p y t h o n @ v 5 
 
               w i t h : 
 
 -                 p y t h o n - v e r s i o n :   " 3 . 1 0 " 
 
 +                 p y t h o n - v e r s i o n :   $ { {   m a t r i x . p y t h o n - v e r s i o n   } } 
 
           -   n a m e :   I n s t a l l   d e p e n d e n c i e s 
 
               r u n :   | 
 
                   p y t h o n   - m   p i p   i n s t a l l   - - u p g r a d e   p i p 
 
 -                 p i p   i n s t a l l   f l a k e 8   p y t e s t 
 
 -                 i f   [   - f   r e q u i r e m e n t s . t x t   ] ;   t h e n   p i p   i n s t a l l   - r   r e q u i r e m e n t s . t x t ;   f i 
 
 -         -   n a m e :   L i n t   w i t h   f l a k e 8 
 
 -             r u n :   | 
 
 -                 #   s t o p   t h e   b u i l d   i f   t h e r e   a r e   P y t h o n   s y n t a x   e r r o r s   o r   u n d e f i n e d   n a m e s 
 
 -                 f l a k e 8   .   - - c o u n t   - - s e l e c t = E 9 , F 6 3 , F 7 , F 8 2   - - s h o w - s o u r c e   - - s t a t i s t i c s 
 
 -                 #   e x i t - z e r o   t r e a t s   a l l   e r r o r s   a s   w a r n i n g s .   T h e   G i t H u b   e d i t o r   i s   1 2 7   c h a r s   w i d e 
 
 -                 f l a k e 8   .   - - c o u n t   - - e x i t - z e r o   - - m a x - c o m p l e x i t y = 1 0   - - m a x - l i n e - l e n g t h = 1 2 7   - - s t a t i s t i c s 
 
 -         -   n a m e :   I n s t a l l   p y p a / b u i l d 
 
 -             r u n :   > - 
 
 -                 p y t h o n   - m 
 
 -                 p i p   i n s t a l l 
 
 -                 b u i l d 
 
 -                 - - u s e r 
 
 -         -   n a m e :   B u i l d   a   b i n a r y   w h e e l   a n d   a   s o u r c e   t a r b a l l 
 
 +                 p i p   i n s t a l l   - e   " . [ d e v ] " 
 
 +         -   n a m e :   L i n t   w i t h   r u f f 
 
 +             r u n :   r u f f   c h e c k   . 
 
 +         -   n a m e :   T y p e   c h e c k   w i t h   m y p y 
 
 +             r u n :   m y p y   a i o p u l s e 
 
 +         -   n a m e :   T e s t   w i t h   p y t e s t 
 
 +             r u n :   p y t e s t   - - c o v = a i o p u l s e   - - c o v - r e p o r t = x m l 
 
 +         -   n a m e :   B u i l d   p a c k a g e 
 
               r u n :   p y t h o n   - m   b u i l d 
 
 -         -   n a m e :   S t o r e   t h e   d i s t r i b u t i o n   p a c k a g e s 
 
 -             u s e s :   a c t i o n s / u p l o a d - a r t i f a c t @ v 3 
 
 -             w i t h : 
 
 -                 n a m e :   p y t h o n - p a c k a g e - d i s t r i b u t i o n s 
 
 -                 p a t h :   d i s t / 
 
 d i f f   - - g i t   a / . g i t h u b / w o r k f l o w s / p y t h o n - r e l e a s e . y m l   b / . g i t h u b / w o r k f l o w s / p y t h o n - r e l e a s e . y m l 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 1 0 1 5 f c 8 
 
 - - -   / d e v / n u l l 
 
 + + +   b / . g i t h u b / w o r k f l o w s / p y t h o n - r e l e a s e . y m l 
 
 @ @   - 0 , 0   + 1 , 3 8   @ @ 
 
 + n a m e :   R e l e a s e   t o   P y P I 
 
 + 
 
 + o n : 
 
 +     p u s h : 
 
 +         t a g s : 
 
 +             -   " v * " 
 
 + 
 
 + p e r m i s s i o n s : 
 
 +     c o n t e n t s :   w r i t e 
 
 +     i d - t o k e n :   w r i t e 
 
 + 
 
 + j o b s : 
 
 +     r e l e a s e : 
 
 +         r u n s - o n :   u b u n t u - l a t e s t 
 
 +         e n v i r o n m e n t : 
 
 +             n a m e :   p y p i 
 
 +             u r l :   h t t p s : / / p y p i . o r g / p / a i o p u l s e 
 
 + 
 
 +         s t e p s : 
 
 +         -   u s e s :   a c t i o n s / c h e c k o u t @ v 4 
 
 +         -   n a m e :   S e t   u p   P y t h o n   3 . 1 0 
 
 +             u s e s :   a c t i o n s / s e t u p - p y t h o n @ v 5 
 
 +             w i t h : 
 
 +                 p y t h o n - v e r s i o n :   " 3 . 1 0 " 
 
 +         -   n a m e :   I n s t a l l   d e p e n d e n c i e s 
 
 +             r u n :   | 
 
 +                 p y t h o n   - m   p i p   i n s t a l l   - - u p g r a d e   p i p 
 
 +                 p i p   i n s t a l l   - e   " . [ d e v ] " 
 
 +         -   n a m e :   R u n   t e s t s 
 
 +             r u n :   p y t e s t 
 
 +         -   n a m e :   B u i l d   p a c k a g e 
 
 +             r u n :   p y t h o n   - m   b u i l d 
 
 +         -   n a m e :   C r e a t e   G i t H u b   R e l e a s e 
 
 +             u s e s :   s o f t p r o p s / a c t i o n - g h - r e l e a s e @ v 1 
 
 +             w i t h : 
 
 +                 g e n e r a t e _ r e l e a s e _ n o t e s :   t r u e 
 
 +         -   n a m e :   P u b l i s h   t o   P y P I 
 
 +             u s e s :   p y p a / g h - a c t i o n - p y p i - p u b l i s h @ r e l e a s e / v 1 
 
 d i f f   - - g i t   a / . p r e - c o m m i t - c o n f i g . y a m l   b / . p r e - c o m m i t - c o n f i g . y a m l 
 
 i n d e x   4 d f 6 b 6 e . . a f 7 d 0 d 1   1 0 0 6 4 4 
 
 - - -   a / . p r e - c o m m i t - c o n f i g . y a m l 
 
 + + +   b / . p r e - c o m m i t - c o n f i g . y a m l 
 
 @ @   - 1 , 1 4   + 1 , 2 6   @ @ 
 
   r e p o s : 
 
       -   r e p o :   h t t p s : / / g i t h u b . c o m / p s f / b l a c k 
 
 -         r e v :   1 9 . 1 0 b 0 
 
 +         r e v :   2 4 . 4 . 2 
 
           h o o k s : 
 
               -   i d :   b l a c k 
 
                   a r g s : 
 
                       -   - - s a f e 
 
                       -   - - q u i e t 
 
                   f i l e s :   ^ ( ( a i o p u l s e ) / . + ) ? [ ^ / ] + \ . p y $ 
 
 +     -   r e p o :   h t t p s : / / g i t h u b . c o m / a s t r a l - s h / r u f f - p r e - c o m m i t 
 
 +         r e v :   v 0 . 4 . 4 
 
 +         h o o k s : 
 
 +             -   i d :   r u f f 
 
 +                 a r g s : 
 
 +                     -   - - f i x 
 
 +     -   r e p o :   h t t p s : / / g i t h u b . c o m / p r e - c o m m i t / m i r r o r s - m y p y 
 
 +         r e v :   v 1 . 1 0 . 0 
 
 +         h o o k s : 
 
 +             -   i d :   m y p y 
 
 +                 a d d i t i o n a l _ d e p e n d e n c i e s :   [ t y p e s - a l l ] 
 
 +                 f i l e s :   ^ a i o p u l s e / . + \ . p y $ 
 
       -   r e p o :   h t t p s : / / g i t h u b . c o m / c o d e s p e l l - p r o j e c t / c o d e s p e l l 
 
 -         r e v :   v 1 . 1 6 . 0 
 
 +         r e v :   v 2 . 2 . 6 
 
           h o o k s : 
 
               -   i d :   c o d e s p e l l 
 
                   a r g s : 
 
 @ @   - 1 6 , 1 4   + 2 8 , 3   @ @   r e p o s : 
 
                       -   - - s k i p = " . / . * , * . j s o n " 
 
                       -   - - q u i e t - l e v e l = 2 
 
                   e x c l u d e _ t y p e s :   [ j s o n ] 
 
 -     -   r e p o :   h t t p s : / / g i t l a b . c o m / p y c q a / f l a k e 8 
 
 -         r e v :   3 . 7 . 9 
 
 -         h o o k s : 
 
 -             -   i d :   f l a k e 8 
 
 -                 a d d i t i o n a l _ d e p e n d e n c i e s : 
 
 -                     -   f l a k e 8 - d o c s t r i n g s = = 1 . 5 . 0 
 
 -                     -   p y d o c s t y l e = = 5 . 0 . 2 
 
 -                 f i l e s :   ^ ( ( a i o p u l s e ) / . + ) ? [ ^ / ] + \ . p y $ 
 
 -                 a r g s : 
 
 -                     -   - - m a x - l i n e - l e n g t h = 8 8 
 
 -                     -   - - i g n o r e = D 4 0 1 , E 2 0 3 , W 5 0 3 
 
 \   N o   n e w l i n e   a t   e n d   o f   f i l e 
 
 d i f f   - - g i t   a / C H A N G E L O G . m d   b / C H A N G E L O G . m d 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 0 a f e 5 7 d 
 
 - - -   / d e v / n u l l 
 
 + + +   b / C H A N G E L O G . m d 
 
 @ @   - 0 , 0   + 1 , 3 4   @ @ 
 
 + #   C h a n g e l o g 
 
 + 
 
 + A l l   n o t a b l e   c h a n g e s   t o   t h i s   p r o j e c t   w i l l   b e   d o c u m e n t e d   i n   t h i s   f i l e . 
 
 + 
 
 + T h e   f o r m a t   i s   b a s e d   o n   [ K e e p   a   C h a n g e l o g ] ( h t t p s : / / k e e p a c h a n g e l o g . c o m / e n / 1 . 0 . 0 / ) , 
 
 + a n d   t h i s   p r o j e c t   a d h e r e s   t o   [ S e m a n t i c   V e r s i o n i n g ] ( h t t p s : / / s e m v e r . o r g / s p e c / v 2 . 0 . 0 . h t m l ) . 
 
 + 
 
 + # #   [ 0 . 5 . 0 ]   -   2 0 2 6 - 0 8 - 0 1 
 
 + 
 
 + # # #   C h a n g e d 
 
 + -   M i n i m u m   P y t h o n   v e r s i o n   i s   n o w   3 . 1 0 
 
 + -   M o d e r n i z e d   a s y n c i o   p a t t e r n s   ( r e m o v e d   l o o p   p a r a m e t e r   d e p r e c a t i o n ) 
 
 + -   U p d a t e d   t y p e   h i n t s   t o   P y t h o n   3 . 1 0 +   s y n t a x 
 
 + -   I m p r o v e d   e r r o r   h a n d l i n g   w i t h   b o u n d s   c h e c k i n g 
 
 + -   E x t r a c t e d   C a l l b a c k M i x i n   f o r   s h a r e d   c a l l b a c k   l o g i c 
 
 + -   U p d a t e d   C I / C D   w i t h   t e s t i n g   a n d   t y p e   c h e c k i n g 
 
 + -   O r g a n i z e d   p r o t o c o l   c o n s t a n t s   w i t h   e n u m s 
 
 + 
 
 + # # #   D e p r e c a t e d 
 
 + -   ` l o o p `   p a r a m e t e r   i n   H u b . _ _ i n i t _ _ ( )   a n d   H u b . d i s c o v e r ( )   -   w i l l   b e   r e m o v e d   i n   v 0 . 6 . 0 
 
 + 
 
 + # # #   F i x e d 
 
 + -   D u p l i c a t e   I n v a l i d R e s p o n s e E x c e p t i o n   c a t c h   i n   h u b . p y 
 
 + -   U n s a f e   l o c k   m a n a g e m e n t   i n   s e n d _ c o m m a n d ( ) 
 
 + -   M i s s i n g   b o u n d s   c h e c k i n g   i n   r e s p o n s e   p a r s e r s 
 
 + 
 
 + # # #   A d d e d 
 
 + -   C a l l b a c k M i x i n   f o r   s h a r e d   c a l l b a c k   l o g i c 
 
 + -   H u b E n t i t y   b a s e   c l a s s   f o r   h u b   e n t i t i e s 
 
 + -   T y p e   a n n o t a t i o n s   t h r o u g h o u t   c o d e b a s e 
 
 + -   m y p y   t y p e   c h e c k i n g   s u p p o r t 
 
 + -   G i t H u b   A c t i o n s   r e l e a s e   w o r k f l o w 
 
 + 
 
 + # #   [ 0 . 4 . 7 ]   -   P r e v i o u s   r e l e a s e 
 
 d i f f   - - g i t   a / a i o p u l s e / _ _ i n i t _ _ . p y   b / a i o p u l s e / _ _ i n i t _ _ . p y 
 
 i n d e x   8 8 7 6 b 3 b . . 9 c b 5 9 8 2   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / _ _ i n i t _ _ . p y 
 
 + + +   b / a i o p u l s e / _ _ i n i t _ _ . p y 
 
 @ @   - 2 6 , 7   + 2 6 , 7   @ @   _ _ a l l _ _   =   [ 
 
           " I n v a l i d R e s p o n s e E x c e p t i o n " , 
 
           " U p d a t e T y p e " , 
 
   ] 
 
 - _ _ v e r s i o n _ _   =   " 0 . 4 . 6 " 
 
 + _ _ v e r s i o n _ _   =   " 0 . 5 . 0 " 
 
   _ _ a u t h o r _ _   =   " A l a n   M u r r a y " 
 
   
 
   _ L O G G E R   =   l o g g i n g . g e t L o g g e r ( _ _ n a m e _ _ ) 
 
 d i f f   - - g i t   a / a i o p u l s e / c a l l b a c k s . p y   b / a i o p u l s e / c a l l b a c k s . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 7 2 a d 9 4 2 
 
 - - -   / d e v / n u l l 
 
 + + +   b / a i o p u l s e / c a l l b a c k s . p y 
 
 @ @   - 0 , 0   + 1 , 5 7   @ @ 
 
 + " " " C a l l b a c k   m i x i n   f o r   h u b   e n t i t i e s . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
 + 
 
 + i m p o r t   a s y n c i o 
 
 + i m p o r t   f u n c t o o l s 
 
 + i m p o r t   l o g g i n g 
 
 + f r o m   c o l l e c t i o n s . a b c   i m p o r t   C a l l a b l e 
 
 + f r o m   t y p i n g   i m p o r t   A n y 
 
 + 
 
 + _ L O G G E R   =   l o g g i n g . g e t L o g g e r ( _ _ n a m e _ _ ) 
 
 + 
 
 + 
 
 + c l a s s   C a l l b a c k M i x i n : 
 
 +         " " " M i x i n   f o r   e n t i t i e s   t h a t   s u p p o r t   u p d a t e   c a l l b a c k s . " " " 
 
 + 
 
 +         d e f   _ _ i n i t _ _ ( s e l f )   - >   N o n e : 
 
 +                 " " " I n i t i a l i z e   c a l l b a c k   l i s t . " " " 
 
 +                 s e l f . _ u p d a t e _ c a l l b a c k s :   l i s t [ C a l l a b l e [ . . . ,   N o n e ] ]   =   [ ] 
 
 + 
 
 +         d e f   c a l l b a c k _ s u b s c r i b e ( s e l f ,   c a l l b a c k :   C a l l a b l e [ . . . ,   N o n e ] )   - >   N o n e : 
 
 +                 " " " A d d   a   c a l l b a c k   f o r   u p d a t e s . " " " 
 
 +                 s e l f . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 + 
 
 +         d e f   c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   c a l l b a c k :   C a l l a b l e [ . . . ,   N o n e ] )   - >   N o n e : 
 
 +                 " " " R e m o v e   a   c a l l b a c k   f o r   u p d a t e s . " " " 
 
 +                 i f   c a l l b a c k   i n   s e l f . _ u p d a t e _ c a l l b a c k s : 
 
 +                         s e l f . _ u p d a t e _ c a l l b a c k s . r e m o v e ( c a l l b a c k ) 
 
 + 
 
 +         d e f   n o t i f y _ c a l l b a c k ( s e l f ,   * a r g s :   A n y )   - >   N o n e : 
 
 +                 " " " N o t i f y   a l l   c a l l b a c k s   o f   a n   u p d a t e . " " " 
 
 +                 f o r   c a l l b a c k   i n   s e l f . _ u p d a t e _ c a l l b a c k s : 
 
 +                         s e l f . _ s c h e d u l e _ c a l l b a c k ( c a l l b a c k ,   * a r g s ) 
 
 + 
 
 +         d e f   _ s c h e d u l e _ c a l l b a c k ( 
 
 +                 s e l f ,   t a r g e t :   C a l l a b l e [ . . . ,   A n y ] ,   * a r g s :   A n y 
 
 +         )   - >   a s y n c i o . T a s k   |   N o n e : 
 
 +                 " " " S c h e d u l e   a   c a l l b a c k   t o   r u n   a s y n c h r o n o u s l y . 
 
 + 
 
 +                 M u s t   b e   c a l l e d   f r o m   w i t h i n   t h e   e v e n t   l o o p . 
 
 +                 " " " 
 
 +                 t r y : 
 
 +                         l o o p   =   a s y n c i o . g e t _ r u n n i n g _ l o o p ( ) 
 
 +                 e x c e p t   R u n t i m e E r r o r : 
 
 +                         _ L O G G E R . w a r n i n g ( " N o   r u n n i n g   e v e n t   l o o p ,   c a l l b a c k   n o t   s c h e d u l e d " ) 
 
 +                         r e t u r n   N o n e 
 
 + 
 
 +                 #   C h e c k   f o r   p a r t i a l s   t o   p r o p e r l y   d e t e r m i n e   i f   c o r o u t i n e   f u n c t i o n 
 
 +                 c h e c k _ t a r g e t   =   t a r g e t 
 
 +                 w h i l e   i s i n s t a n c e ( c h e c k _ t a r g e t ,   f u n c t o o l s . p a r t i a l ) : 
 
 +                         c h e c k _ t a r g e t   =   c h e c k _ t a r g e t . f u n c 
 
 + 
 
 +                 i f   a s y n c i o . i s c o r o u t i n e ( c h e c k _ t a r g e t ) : 
 
 +                         r e t u r n   l o o p . c r e a t e _ t a s k ( t a r g e t )     #   t y p e :   i g n o r e 
 
 +                 e l i f   a s y n c i o . i s c o r o u t i n e f u n c t i o n ( c h e c k _ t a r g e t ) : 
 
 +                         r e t u r n   l o o p . c r e a t e _ t a s k ( t a r g e t ( * a r g s ) ) 
 
 +                 e l s e : 
 
 +                         r e t u r n   l o o p . r u n _ i n _ e x e c u t o r ( N o n e ,   t a r g e t ,   * a r g s )     #   t y p e :   i g n o r e 
 
 d i f f   - - g i t   a / a i o p u l s e / c o n s t . p y   b / a i o p u l s e / c o n s t . p y 
 
 i n d e x   8 2 a 3 c 2 0 . . 2 a 5 5 f 7 4   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / c o n s t . p y 
 
 + + +   b / a i o p u l s e / c o n s t . p y 
 
 @ @   - 1 , 9   + 1 , 6 6   @ @ 
 
   " " " A c m e d a   P u l s e   H u b   c o n s t a n t s . " " " 
 
 - f r o m   e n u m   i m p o r t   E n u m 
 
 + f r o m   e n u m   i m p o r t   E n u m ,   I n t E n u m 
 
 + 
 
 + 
 
 + c l a s s   U p d a t e T y p e ( E n u m ) : 
 
 +         " " " T y p e s   o f   h u b   u p d a t e s . " " " 
 
 +         i n f o   =   " i n f o " 
 
 +         r o l l e r s   =   " r o l l e r s " 
 
 +         r o o m s   =   " r o o m s " 
 
 +         s c e n e s   =   " s c e n e s " 
 
 +         t i m e r s   =   " t i m e r s " 
 
 + 
 
 + 
 
 + c l a s s   M e s s a g e T y p e ( I n t E n u m ) : 
 
 +         " " " P r o t o c o l   m e s s a g e   t y p e s   f o r   i n c o m i n g   m e s s a g e s . " " " 
 
 +         H U B _ I N F O   =   0 x 1 6 0 0 
 
 +         H U B _ I N F O _ U P D A T E D   =   0 x 0 D 0 0 
 
 +         R O O M _ L I S T   =   0 x 0 1 0 1 
 
 +         S C E N E _ L I S T   =   0 x 3 3 0 1 
 
 +         R O L L E R _ L I S T   =   0 x 2 1 0 1 
 
 +         T I M E R _ L I S T   =   0 x 4 1 0 1 
 
 +         A U T H _ I N F O   =   0 x 0 8 0 0 
 
 +         P O S I T I O N   =   0 x 2 3 0 1 
 
 +         R O L L E R _ U P D A T E D   =   0 x 2 5 0 1 
 
 +         T I M E R _ C R E A T E D   =   0 x 4 3 0 1 
 
 +         T I M E R _ D E V I C E _ U P D A T E D   =   0 x 4 5 0 1 
 
 +         T I M E R _ I N F O _ U P D A T E D   =   0 x 4 9 0 1 
 
 +         T I M E R _ D E L E T E D   =   0 x 4 7 0 1 
 
 +         R O L L E R _ H E A L T H   =   0 x 2 B 0 1 
 
 +         D I S C O V E R _ R E S P O N S E   =   0 x 0 F 0 0 
 
 + 
 
 + 
 
 + c l a s s   C o m m a n d T y p e ( I n t E n u m ) : 
 
 +         " " " C o m m a n d   m e s s a g e   t y p e s . " " " 
 
 +         D I S C O V E R   =   0 x 0 3 0 0 0 0 0 3 
 
 +         C O N N E C T   =   0 x 0 3 0 0 0 0 0 6 
 
 +         L O G I N   =   0 x 0 F 0 0 0 0 0 8 
 
 +         P I N G   =   0 x 0 3 0 0 0 0 1 5 
 
 +         S E T I D   =   0 x 2 8 0 0 0 0 9 0 
 
 +         U N K N O W N 1   =   0 x 2 3 0 0 0 0 9 0 
 
 +         G E T _ H U B _ I N F O   =   0 x 1 E 0 0 0 0 9 0 
 
 +         M O V E _ T O   =   0 x 3 4 0 0 0 0 9 0 
 
 +         M O V E   =   0 x 2 D 0 0 0 0 9 0 
 
 +         G E T _ H E A L T H   =   0 x 3 2 0 0 0 0 9 0 
 
 + 
 
 + 
 
 + c l a s s   R e s p o n s e T y p e ( I n t E n u m ) : 
 
 +         " " " R e s p o n s e   m e s s a g e   t y p e s . " " " 
 
 +         D I S C O V E R   =   0 x 5 7 0 0 0 0 0 4 
 
 +         C O N N E C T   =   0 x 0 F 0 0 0 0 0 7 
 
 +         L O G I N   =   0 x 0 4 0 0 0 0 0 9 
 
 +         P I N G   =   0 x 0 3 0 0 0 0 1 6 
 
 +         S E T I D   =   0 x 0 3 0 0 0 0 9 1 
 
 +         U N K N O W N 1   =   0 x 2 8 0 0 0 0 9 1 
 
 +         G E T _ H U B _ I N F O   =   0 x 4 A 0 0 0 0 9 1 
 
 +         M O V E _ T O   =   0 x 3 4 0 0 0 0 9 1 
 
 +         G E T _ R O O M S   =   0 x 0 1 0 0 0 0 9 1 
 
 +         G E T _ R O L L E R S   =   0 x 0 3 0 0 0 0 9 1 
 
   
 
 - U p d a t e T y p e   =   E n u m ( " U p d a t e T y p e " ,   " i n f o   r o l l e r s   r o o m s   s c e n e s   t i m e r s " ) 
 
   
 
   H E A D E R   =   b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 3 " ) 
 
 + 
 
 + #   K e e p   o l d   c o n s t a n t s   f o r   b a c k w a r d   c o m p a t i b i l i t y 
 
   C O M M A N D _ D I S C O V E R   =   b y t e s . f r o m h e x ( " 0 3 0 0 0 0 0 3 " ) 
 
   R E S P O N S E _ D I S C O V E R   =   b y t e s . f r o m h e x ( " 5 7 0 0 0 0 0 4 " ) 
 
   
 
 d i f f   - - g i t   a / a i o p u l s e / e n t i t i e s . p y   b / a i o p u l s e / e n t i t i e s . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 2 3 b 6 d 6 b 
 
 - - -   / d e v / n u l l 
 
 + + +   b / a i o p u l s e / e n t i t i e s . p y 
 
 @ @   - 0 , 0   + 1 , 2 6   @ @ 
 
 + " " " B a s e   c l a s s   f o r   h u b   e n t i t i e s . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
 + 
 
 + f r o m   t y p i n g   i m p o r t   T Y P E _ C H E C K I N G 
 
 + 
 
 + f r o m   a i o p u l s e . c a l l b a c k s   i m p o r t   C a l l b a c k M i x i n 
 
 + 
 
 + i f   T Y P E _ C H E C K I N G : 
 
 +         f r o m   a i o p u l s e . h u b   i m p o r t   H u b 
 
 + 
 
 + 
 
 + c l a s s   H u b E n t i t y ( C a l l b a c k M i x i n ) : 
 
 +         " " " B a s e   c l a s s   f o r   e n t i t i e s   m a n a g e d   b y   a   h u b . " " " 
 
 + 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   h u b :   H u b ,   e n t i t y _ i d :   b y t e s   |   i n t )   - >   N o n e : 
 
 +                 " " " I n i t i a l i z e   e n t i t y . 
 
 + 
 
 +                 A r g s : 
 
 +                         h u b :   T h e   h u b   i n s t a n c e   t h a t   m a n a g e s   t h i s   e n t i t y . 
 
 +                         e n t i t y _ i d :   T h e   u n i q u e   i d e n t i f i e r   f o r   t h i s   e n t i t y . 
 
 +                 " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( ) 
 
 +                 s e l f . h u b   =   h u b 
 
 +                 s e l f . i d   =   e n t i t y _ i d 
 
 +                 s e l f . n a m e :   s t r   |   N o n e   =   N o n e 
 
 +                 s e l f . i c o n :   i n t   |   N o n e   =   N o n e 
 
 d i f f   - - g i t   a / a i o p u l s e / e r r o r s . p y   b / a i o p u l s e / e r r o r s . p y 
 
 i n d e x   8 d d a a e b . . 9 0 b 6 d 4 d   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / e r r o r s . p y 
 
 + + +   b / a i o p u l s e / e r r o r s . p y 
 
 @ @   - 1 , 1 0   + 1 , 1 6   @ @ 
 
   " " " E r r o r   c l a s s e s   o f   a i o p u l s e   m o d u l e . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
   
 
   c l a s s   H u b B a s e E x c e p t i o n ( E x c e p t i o n ) : 
 
           " " " B a s e   E x c e p t i o n   f o r   p r o t o c o l . " " " 
 
   
 
 -         p a s s 
 
 +         d e f   _ _ i n i t _ _ ( 
 
 +                 s e l f ,   m e s s a g e :   s t r   =   " " ,   r e s p o n s e :   b y t e s   |   N o n e   =   N o n e 
 
 +         )   - >   N o n e : 
 
 +                 " " " I n i t i a l i z e   e x c e p t i o n   w i t h   o p t i o n a l   r e s p o n s e   c o n t e x t . " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( m e s s a g e ) 
 
 +                 s e l f . r e s p o n s e   =   r e s p o n s e 
 
   
 
   
 
   c l a s s   N o t C o n n e c t e d E x c e p t i o n ( H u b B a s e E x c e p t i o n ) : 
 
 d i f f   - - g i t   a / a i o p u l s e / h u b . p y   b / a i o p u l s e / h u b . p y 
 
 i n d e x   8 e 8 f 0 c 0 . . 3 9 f 4 4 6 b   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / h u b . p y 
 
 + + +   b / a i o p u l s e / h u b . p y 
 
 @ @   - 3 , 3 4   + 3 , 3 8   @ @ 
 
   i m p o r t   a s y n c i o 
 
   i m p o r t   b i n a s c i i 
 
   i m p o r t   l o g g i n g 
 
 - f r o m   t y p i n g   i m p o r t   ( 
 
 -         A n y , 
 
 -         L i s t , 
 
 -         C a l l a b l e , 
 
 -         O p t i o n a l , 
 
 - ) 
 
 - i m p o r t   f u n c t o o l s 
 
 + i m p o r t   w a r n i n g s 
 
   
 
   i m p o r t   a s y n c _ t i m e o u t 
 
   
 
 + #   f r o m   a i o p u l s e   i m p o r t   R o l l e r ,   R o o m ,   S c e n e ,   T i m e r 
 
 + i m p o r t   a i o p u l s e 
 
   i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
 - i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
   i m p o r t   a i o p u l s e . e r r o r s   a s   e r r o r s 
 
 - 
 
 - #   f r o m   a i o p u l s e   i m p o r t   R o l l e r ,   R o o m ,   S c e n e ,   T i m e r 
 
   i m p o r t   a i o p u l s e . t r a n s p o r t 
 
 + i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
 + f r o m   a i o p u l s e . c a l l b a c k s   i m p o r t   C a l l b a c k M i x i n 
 
   
 
   _ L O G G E R   =   l o g g i n g . g e t L o g g e r ( _ _ n a m e _ _ ) 
 
   
 
   
 
 - c l a s s   H u b : 
 
 + c l a s s   H u b ( C a l l b a c k M i x i n ) : 
 
           " " " R e p r e s e n t a t i o n   o f   a n   A c m e d a   P u l s e   H u b . " " " 
 
   
 
           d e f   _ _ i n i t _ _ ( 
 
 -                 s e l f ,   h o s t = N o n e ,   l o o p :   O p t i o n a l [ a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p ]   =   N o n e 
 
 +                 s e l f ,   h o s t = N o n e ,   l o o p :   a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p   |   N o n e   =   N o n e 
 
           ) : 
 
                   " " " I n i t   t h e   h u b . " " " 
 
 -                 s e l f . l o o p :   a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p   =   l o o p   o r   a s y n c i o . g e t _ e v e n t _ l o o p ( ) 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( ) 
 
 +                 i f   l o o p   i s   n o t   N o n e : 
 
 +                         w a r n i n g s . w a r n ( 
 
 +                                 " l o o p   p a r a m e t e r   i s   d e p r e c a t e d   a n d   w i l l   b e   r e m o v e d   i n   v 0 . 6 . 0 " , 
 
 +                                 D e p r e c a t i o n W a r n i n g , 
 
 +                                 s t a c k l e v e l = 2 , 
 
 +                         ) 
 
 +                         s e l f . l o o p :   a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p   =   l o o p 
 
 +                 e l s e : 
 
 +                         s e l f . l o o p   =   a s y n c i o . g e t _ r u n n i n g _ l o o p ( ) 
 
                   s e l f . t o p i c   =   s t r . e n c o d e ( " S m a r t _ I d 1 _ y : " ) 
 
                   s e l f . s e q u e n c e   =   4 
 
                   s e l f . h a n d s h a k e   =   a s y n c i o . E v e n t ( ) 
 
 @ @   - 5 4 , 7   + 5 8 , 6   @ @   c l a s s   H u b : 
 
                   s e l f . t i m e r s :   d i c t [ i n t ,   a i o p u l s e . T i m e r ]   =   { } 
 
   
 
                   s e l f . h a n d s h a k e . c l e a r ( ) 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s :   L i s t [ C a l l a b l e ]   =   [ ] 
 
   
 
           d e f   _ _ s t r _ _ ( s e l f ) : 
 
                   " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   t h e   h u b . " " " 
 
 @ @   - 6 6 , 4 9   + 6 9 , 9   @ @   c l a s s   H u b : 
 
                           f " W i F i :   { s e l f . w i f i _ m o d u l e }   " 
 
                   ) 
 
   
 
 -         d e f   c a l l b a c k _ s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " A d d   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 - 
 
 -         d e f   c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " R e m o v e   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 i f   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . u p d a t e _ c a l l b a c k s . r e m o v e ( c a l l b a c k ) 
 
 - 
 
 -         d e f   a s y n c _ a d d _ j o b ( 
 
 -                 s e l f ,   t a r g e t :   C a l l a b l e [ . . . ,   A n y ] ,   * a r g s :   A n y 
 
 -         )   - >   O p t i o n a l [ a s y n c i o . F u t u r e ] : 
 
 -                 " " " A d d   a   j o b   f r o m   w i t h i n   t h e   e v e n t   l o o p . 
 
 - 
 
 -                 T h i s   m e t h o d   m u s t   b e   r u n   i n   t h e   e v e n t   l o o p . 
 
 - 
 
 -                 t a r g e t :   t a r g e t   t o   c a l l . 
 
 -                 a r g s :   p a r a m e t e r s   f o r   m e t h o d   t o   c a l l . 
 
 -                 " " " 
 
 -                 t a s k   =   N o n e 
 
 - 
 
 -                 #   C h e c k   f o r   p a r t i a l s   t o   p r o p e r l y   d e t e r m i n e   i f   c o r o u t i n e   f u n c t i o n 
 
 -                 c h e c k _ t a r g e t   =   t a r g e t 
 
 -                 w h i l e   i s i n s t a n c e ( c h e c k _ t a r g e t ,   f u n c t o o l s . p a r t i a l ) : 
 
 -                         c h e c k _ t a r g e t   =   c h e c k _ t a r g e t . f u n c 
 
 - 
 
 -                 i f   a s y n c i o . i s c o r o u t i n e ( c h e c k _ t a r g e t ) : 
 
 -                         t a s k   =   s e l f . l o o p . c r e a t e _ t a s k ( t a r g e t )     #   t y p e :   i g n o r e 
 
 -                 e l i f   a s y n c i o . i s c o r o u t i n e f u n c t i o n ( c h e c k _ t a r g e t ) : 
 
 -                         t a s k   =   s e l f . l o o p . c r e a t e _ t a s k ( t a r g e t ( * a r g s ) ) 
 
 -                 e l s e : 
 
 -                         t a s k   =   s e l f . l o o p . r u n _ i n _ e x e c u t o r ( N o n e ,   t a r g e t ,   * a r g s )     #   t y p e :   i g n o r e 
 
 - 
 
 -                 r e t u r n   t a s k 
 
 - 
 
 -         d e f   n o t i f y _ c a l l b a c k ( s e l f ,   u p d a t e _ t y p e = N o n e ) : 
 
 -                 " " " T e l l   c a l l b a c k   t h a t   t h e   h u b   h a s   b e e n   u p d a t e d . " " " 
 
 -                 f o r   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . a s y n c _ a d d _ j o b ( c a l l b a c k ,   u p d a t e _ t y p e ) 
 
 - 
 
           @ s t a t i c m e t h o d 
 
           a s y n c   d e f   d i s c o v e r ( 
 
 -                 t i m e o u t = 5 ,   l o o p :   O p t i o n a l [ a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p ]   =   N o n e 
 
 +                 t i m e o u t = 5 ,   l o o p :   a s y n c i o . e v e n t s . A b s t r a c t E v e n t L o o p   |   N o n e   =   N o n e 
 
           ) : 
 
                   " " " U s e   a   b r o a d c a s t   u d p   p a c k e t   t o   f i n d   h u b s   o n   t h e   l a n . " " " 
 
                   d i s c o v e r _ c l i e n t   =   a i o p u l s e . t r a n s p o r t . H u b T r a n s p o r t U d p B r o a d c a s t ( ) 
 
 @ @   - 2 4 4 , 6   + 2 0 7 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ h u b i n f o ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   s t a r t   o f   h u b   i n f o r m a t i o n . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 0 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " H u b   i n f o   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   1 0 
 
                   s e l f . f i r m w a r e _ n a m e ,   p t r   =   u t i l s . u n p a c k _ s t r i n g ( m e s s a g e ,   p t r ) 
 
                   p t r   + =   2 
 
 @ @   - 2 5 8 , 6   + 2 2 6 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ r o l l e r _ u p d a t e d ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   c h a n g e   o f   r o l l e r   i n f o r m a t i o n . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 0 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " R o l l e r   u p d a t e d   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   2     #   s e q u e n c e ? 
 
                   p t r   + =   4 
 
                   p t r   + =   2     #   u n k n o w n   f i e l d 
 
 @ @   - 2 9 5 , 6   + 2 6 8 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ r o o m l i s t ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   r o o m   l i s t . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " R o o m   l i s t   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   1 2 
 
                   r o o m _ c o u n t ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   1 ) 
 
                   f o r   _   i n   r a n g e ( r o o m _ c o u n t ) : 
 
 @ @   - 3 1 2 , 6   + 2 9 0 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ r o l l e r l i s t ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   r o l l e r   b l i n d   l i s t . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " R o l l e r   l i s t   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   2     #   s e q u e n c e ? 
 
                   p t r   + =   1 0 
 
                   r o l l e r _ c o u n t ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   1 ) 
 
 @ @   - 3 5 1 , 6   + 3 3 4 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ s c e n e l i s t ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   s c e n e   l i s t . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " S c e n e   l i s t   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   0 
 
                   _ ,   p t r   =   u t i l s . u n p a c k _ b y t e s ( m e s s a g e ,   p t r ,   1 2 ) 
 
                   s c e n e _ c o u n t ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   1 ) 
 
 @ @   - 3 7 6 , 6   + 3 6 4 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ t i m e r l i s t ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   t i m e r   l i s t . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " T i m e r   l i s t   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   0 
 
                   _ ,   p t r   =   u t i l s . u n p a c k _ b y t e s ( m e s s a g e ,   p t r ,   1 2 ) 
 
                   t i m e r _ c o u n t ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   1 ) 
 
 @ @   - 4 3 1 , 1 1   + 4 2 4 , 2 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ a u t h i n f o ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   a c m e d a   a c c o u n t   i n f o r m a t i o n . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 5 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " A u t h   i n f o   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   1 5 
 
                   _ ,   p t r   =   u t i l s . u n p a c k _ s t r i n g ( m e s s a g e ,   p t r ) 
 
   
 
           d e f   r e s p o n s e _ p o s i t i o n ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   c h a n g e   o f   r o l l e r   p o s i t i o n   i n f o r m a t i o n . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " P o s i t i o n   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   1 2 
 
                   r o l l e r _ i d ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   6 ) 
 
                   r o l l e r _ p e r c e n t ,   p t r   =   u t i l s . u n p a c k _ r o l l e r _ p e r c e n t ( m e s s a g e ,   p t r ) 
 
 @ @   - 4 4 8 , 6   + 4 5 1 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ r o l l e r h e a l t h ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   c h a n g e   o f   r o l l e r   h e a l t h   i n f o r m a t i o n . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 2 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " R o l l e r   h e a l t h   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   1 2 
 
                   r o l l e r _ i d ,   p t r   =   u t i l s . u n p a c k _ i n t ( m e s s a g e ,   p t r ,   6 ) 
 
                   #   l e t t e r   A   a n d   t h e n   4   b y t e s 
 
 @ @   - 4 8 3 , 6   + 4 9 1 , 1 1   @ @   c l a s s   H u b : 
 
   
 
           d e f   r e s p o n s e _ d i s c o v e r ( s e l f ,   m e s s a g e ) : 
 
                   " " " R e c e i v e   a f t e r   d i s c o v e r   b r o a d c a s t   p a c k e t . " " " 
 
 +                 i f   l e n ( m e s s a g e )   <   1 0 : 
 
 +                         r a i s e   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n ( 
 
 +                                 f " D i s c o v e r   m e s s a g e   t o o   s h o r t :   { l e n ( m e s s a g e ) }   b y t e s " , 
 
 +                                 r e s p o n s e = m e s s a g e , 
 
 +                         ) 
 
                   p t r   =   0 
 
                   _ ,   p t r   =   u t i l s . u n p a c k _ b y t e s ( m e s s a g e ,   p t r ,   1 0 ) 
 
                   _ ,   p t r   =   u t i l s . u n p a c k _ b y t e s ( m e s s a g e ,   p t r ) 
 
 @ @   - 6 9 7 , 1 5   + 7 1 0 , 1 3   @ @   c l a s s   H u b : 
 
                                   _ L O G G E R . i n f o ( f " { s e l f . h o s t } :   C o n n e c t i n g " ) 
 
                                   a w a i t   s e l f . c o n n e c t ( ) 
 
                                   #   a w a i t   s e l f . u p d a t e ( ) 
 
 -                                 s e l f . a s y n c _ a d d _ j o b ( s e l f . u p d a t e ) 
 
 +                                 s e l f . _ s c h e d u l e _ c a l l b a c k ( s e l f . u p d a t e ) 
 
                                   a w a i t   s e l f . r e s p o n s e _ p a r s e r ( ) 
 
                           e x c e p t   e r r o r s . C a n n o t C o n n e c t E x c e p t i o n   a s   i n s t : 
 
                                   _ L O G G E R . w a r n i n g ( f " { s e l f . h o s t } :   C o n n e c t   f a i l e d   { i n s t } " ) 
 
                           e x c e p t   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n   a s   i n s t : 
 
                                   _ L O G G E R . w a r n i n g ( f " { s e l f . h o s t } :   H a n d s h a k e   f a i l e d   { i n s t } " ) 
 
                                   a w a i t   s e l f . d i s c o n n e c t ( ) 
 
 -                         e x c e p t   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n   a s   i n s t : 
 
 -                                 _ L O G G E R . w a r n i n g ( f " { s e l f . h o s t } :   P r o t o c o l   e r r o r   { i n s t } " ) 
 
                           e x c e p t   e r r o r s . N o t C o n n e c t e d E x c e p t i o n : 
 
                                   _ L O G G E R . d e b u g ( f " { s e l f . h o s t } :   D i s c o n n e c t e d ,   s t o p p i n g   p a r s e r " ) 
 
                           e x c e p t   O S E r r o r   a s   i n s t : 
 
 d i f f   - - g i t   a / a i o p u l s e / p y . t y p e d   b / a i o p u l s e / p y . t y p e d 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . e 6 9 d e 2 9 
 
 d i f f   - - g i t   a / a i o p u l s e / r o l l e r . p y   b / a i o p u l s e / r o l l e r . p y 
 
 i n d e x   0 1 a 7 8 a 3 . . e 6 0 7 8 e 2   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / r o l l e r . p y 
 
 + + +   b / a i o p u l s e / r o l l e r . p y 
 
 @ @   - 1 , 6 3   + 1 , 7 7   @ @ 
 
 - " " " E l e m e n t s   t h a t   h a n g   o f f   t h e   h u b . " " " 
 
 + " " " R o l l e r   b l i n d   e n t i t y   t h a t   h a n g s   o f f   t h e   h u b . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
 - f r o m   t y p i n g   i m p o r t   L i s t ,   C a l l a b l e 
 
 - 
 
 - i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
 - i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
   i m p o r t   a s y n c i o 
 
   i m p o r t   l o g g i n g 
 
 + f r o m   t y p i n g   i m p o r t   T Y P E _ C H E C K I N G 
 
 + 
 
 + i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
 + i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
 + 
 
 + i f   T Y P E _ C H E C K I N G : 
 
 +         f r o m   a i o p u l s e . h u b   i m p o r t   H u b 
 
   
 
   _ L O G G E R   =   l o g g i n g . g e t L o g g e r ( _ _ n a m e _ _ ) 
 
   
 
   
 
 - c l a s s   R o l l e r : 
 
 + c l a s s   R o l l e r ( H u b E n t i t y ) : 
 
           " " " R e p r e s e n t a t i o n   o f   a   R o l l e r   b l i n d . " " " 
 
   
 
 -         d e f   _ _ i n i t _ _ ( s e l f ,   h u b ,   r o l l e r _ i d ) : 
 
 -                 " " " I n i t   a   n e w   r o l l e r   b l i n d . " " " 
 
 -                 s e l f . h u b   =   h u b 
 
 -                 s e l f . i d   =   r o l l e r _ i d 
 
 -                 s e l f . n a m e   =   N o n e 
 
 -                 s e l f . t y p e   =   N o n e 
 
 -                 s e l f . s e r i a l   =   N o n e 
 
 -                 s e l f . r o o m _ i d   =   N o n e 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   h u b :   H u b ,   r o l l e r _ i d :   i n t )   - >   N o n e : 
 
 +                 " " " I n i t   a   n e w   r o l l e r   b l i n d . 
 
 + 
 
 +                 A r g s : 
 
 +                         h u b :   T h e   h u b   i n s t a n c e . 
 
 +                         r o l l e r _ i d :   T h e   u n i q u e   r o l l e r   i d e n t i f i e r . 
 
 +                 " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( h u b ,   r o l l e r _ i d ) 
 
 +                 s e l f . t y p e :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . s e r i a l :   s t r   |   N o n e   =   N o n e 
 
 +                 s e l f . r o o m _ i d :   b y t e s   |   N o n e   =   N o n e 
 
                   s e l f . r o o m   =   N o n e 
 
 -                 s e l f . b a t t e r y   =   N o n e 
 
 -                 s e l f . c l o s e d _ p e r c e n t   =   N o n e 
 
 -                 s e l f . f l a g s   =   0 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s :   L i s t [ C a l l a b l e ]   =   [ ] 
 
 +                 s e l f . b a t t e r y :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . c l o s e d _ p e r c e n t :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . f l a g s :   i n t   =   0 
 
   
 
                   s e l f . h e a l t h _ l o c k   =   a s y n c i o . L o c k ( ) 
 
 -                 s e l f . h e a l t h _ t a s k   =   h u b . a s y n c _ a d d _ j o b ( s e l f . h e a l t h _ u p d a t e r ) 
 
 +                 s e l f . h e a l t h _ t a s k   =   h u b . _ s c h e d u l e _ c a l l b a c k ( s e l f . h e a l t h _ u p d a t e r ) 
 
   
 
 -         d e f   _ _ d e l _ _ ( s e l f ) : 
 
 -                 s e l f . h e a l t h _ t a s k . c a n c e l ( ) 
 
 +         d e f   _ _ d e l _ _ ( s e l f )   - >   N o n e : 
 
 +                 " " " C a n c e l   h e a l t h   u p d a t e r   t a s k   o n   d e l e t i o n . " " " 
 
 +                 i f   s e l f . h e a l t h _ t a s k : 
 
 +                         s e l f . h e a l t h _ t a s k . c a n c e l ( ) 
 
   
 
 -         d e f   h e a l t h _ u p d a t e d ( s e l f ) : 
 
 +         d e f   h e a l t h _ u p d a t e d ( s e l f )   - >   N o n e : 
 
 +                 " " " S i g n a l   t h a t   h e a l t h   d a t a   h a s   b e e n   r e c e i v e d . " " " 
 
                   t r y : 
 
                           s e l f . h e a l t h _ l o c k . r e l e a s e ( ) 
 
                   e x c e p t   R u n t i m e E r r o r : 
 
                           p a s s 
 
   
 
 -         a s y n c   d e f   h e a l t h _ u p d a t e r ( s e l f ) : 
 
 +         a s y n c   d e f   h e a l t h _ u p d a t e r ( s e l f )   - >   N o n e : 
 
 +                 " " " P e r i o d i c a l l y   u p d a t e   r o l l e r   h e a l t h . " " " 
 
                   a w a i t   s e l f . g e t _ h e a l t h ( ) 
 
                   r u n n i n g   =   T r u e 
 
                   t r y : 
 
                           w h i l e   r u n n i n g : 
 
                                   t r y : 
 
 -                                         a w a i t   a s y n c i o . w a i t _ f o r ( s e l f . h e a l t h _ l o c k . a c q u i r e ( ) ,   t i m e o u t = 3 6 0 0 ) 
 
 +                                         a w a i t   a s y n c i o . w a i t _ f o r ( 
 
 +                                                 s e l f . h e a l t h _ l o c k . a c q u i r e ( ) ,   t i m e o u t = 3 6 0 0 
 
 +                                         ) 
 
                                   e x c e p t   a s y n c i o . T i m e o u t E r r o r : 
 
                                           a w a i t   s e l f . g e t _ h e a l t h ( ) 
 
                                   e x c e p t   a s y n c i o . C a n c e l l e d E r r o r : 
 
                                           r u n n i n g   =   F a l s e 
 
                   e x c e p t   E x c e p t i o n   a s   i n s t : 
 
                           _ L O G G E R . e r r o r ( 
 
 -                                 f " { s e l f . h u b . h o s t } : { s e l f . n a m e } :   h e a l t h   u p d a t e r   u n h a n d l e d   e x c e p t i o n :   { i n s t } " 
 
 +                                 f " { s e l f . h u b . h o s t } : { s e l f . n a m e } :   h e a l t h   u p d a t e r   " 
 
 +                                 f " u n h a n d l e d   e x c e p t i o n :   { i n s t } " 
 
                           ) 
 
                   _ L O G G E R . i n f o ( f " { s e l f . h u b . h o s t } : { s e l f . n a m e } :   h e a l t h   u p d a t e r   s t o p p e d " ) 
 
                   r u n n i n g   =   F a l s e 
 
   
 
 -         d e f   _ _ s t r _ _ ( s e l f ) : 
 
 +         d e f   _ _ s t r _ _ ( s e l f )   - >   s t r : 
 
                   " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   r o l l e r . " " " 
 
                   r e t u r n   ( 
 
                           " N a m e :   { }   I D :   { }   S e r i a l :   { }   R o o m :   { }   T y p e :   { }   C l o s e d   % :   { }   B a t t e r y   % :   { } " 
 
 @ @   - 7 3 , 2 2   + 8 7 , 1 2   @ @   c l a s s   R o l l e r : 
 
                           s e l f . f l a g s , 
 
                   ) 
 
   
 
 -         d e f   c a l l b a c k _ s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " A d d   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 - 
 
 -         d e f   c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " R e m o v e   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 i f   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . u p d a t e _ c a l l b a c k s . r e m o v e ( c a l l b a c k ) 
 
 +         a s y n c   d e f   m o v e _ t o ( s e l f ,   p e r c e n t :   i n t )   - >   N o n e : 
 
 +                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   a   p e r c e n t a g e   c l o s e d . 
 
   
 
 -         d e f   n o t i f y _ c a l l b a c k ( s e l f ) : 
 
 -                 " " " T e l l   c a l l b a c k   t h a t   d e v i c e   h a s   b e e n   u p d a t e d . " " " 
 
 -                 f o r   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . h u b . a s y n c _ a d d _ j o b ( c a l l b a c k ) 
 
 - 
 
 -         a s y n c   d e f   m o v e _ t o ( s e l f ,   p e r c e n t ) : 
 
 -                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   a   p e r c e n t a g e   c l o s e d . " " " 
 
 +                 A r g s : 
 
 +                         p e r c e n t :   T a r g e t   p o s i t i o n   ( 0 - 1 0 0 ) . 
 
 +                 " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 @ @   - 1 0 2 , 7   + 1 0 6 , 7   @ @   c l a s s   R o l l e r : 
 
                           c o n s t . C O M M A N D _ M O V E _ T O ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
                   ) 
 
   
 
 -         a s y n c   d e f   m o v e _ u p ( s e l f ) : 
 
 +         a s y n c   d e f   m o v e _ u p ( s e l f )   - >   N o n e : 
 
                   " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   f u l l y   o p e n . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
 @ @   - 1 1 2 , 9   + 1 1 6 , 1 1   @ @   c l a s s   R o l l e r : 
 
                           +   b y t e s . f r o m h e x ( " 1 0 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
   
 
 -         a s y n c   d e f   m o v e _ s t o p ( s e l f ) : 
 
 +         a s y n c   d e f   m o v e _ s t o p ( s e l f )   - >   N o n e : 
 
                   " " " S e n d   c o m m a n d   t o   s t o p   t h e   r o l l e r . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
 @ @   - 1 2 4 , 9   + 1 3 0 , 1 1   @ @   c l a s s   R o l l e r : 
 
                           +   b y t e s . f r o m h e x ( " 1 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
   
 
 -         a s y n c   d e f   m o v e _ d o w n ( s e l f ) : 
 
 +         a s y n c   d e f   m o v e _ d o w n ( s e l f )   - >   N o n e : 
 
                   " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   f u l l y   c l o s e d . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
 @ @   - 1 3 6 , 1 0   + 1 4 4 , 1 2   @ @   c l a s s   R o l l e r : 
 
                           +   b y t e s . f r o m h e x ( " 1 2 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
   
 
 -         a s y n c   d e f   g e t _ h e a l t h ( s e l f ) : 
 
 -                 " " " . " " " 
 
 +         a s y n c   d e f   g e t _ h e a l t h ( s e l f )   - >   N o n e : 
 
 +                 " " " R e q u e s t   h e a l t h   i n f o r m a t i o n   f r o m   t h e   r o l l e r . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 d i f f   - - g i t   a / a i o p u l s e / r o o m . p y   b / a i o p u l s e / r o o m . p y 
 
 i n d e x   0 8 0 5 f 4 f . . 8 8 a 5 1 c f   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / r o o m . p y 
 
 + + +   b / a i o p u l s e / r o o m . p y 
 
 @ @   - 1 , 4 3   + 1 , 4 0   @ @ 
 
 - " " " E l e m e n t s   t h a t   h a n g   o f f   t h e   h u b . " " " 
 
 + " " " R o o m   e n t i t y   t h a t   h a n g s   o f f   t h e   h u b . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
 - f r o m   t y p i n g   i m p o r t   L i s t ,   C a l l a b l e 
 
 + f r o m   t y p i n g   i m p o r t   T Y P E _ C H E C K I N G 
 
   
 
   i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
   i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
 - i m p o r t   a s y n c i o 
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
   
 
 + i f   T Y P E _ C H E C K I N G : 
 
 +         f r o m   a i o p u l s e . h u b   i m p o r t   H u b 
 
   
 
 - c l a s s   R o o m : 
 
 -         " " " R e p r e s e n t a t i o n   o f   a   R o o m . " " " 
 
   
 
 -         d e f   _ _ i n i t _ _ ( s e l f ,   h u b ,   r o o m _ i d ) : 
 
 -                 " " " I n i t   a   n e w   r o o m . " " " 
 
 -                 s e l f . h u b   =   h u b 
 
 -                 s e l f . i d   =   r o o m _ i d 
 
 -                 s e l f . i c o n   =   N o n e 
 
 -                 s e l f . n a m e   =   N o n e 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s :   L i s t [ C a l l a b l e ]   =   [ ] 
 
 + c l a s s   R o o m ( H u b E n t i t y ) : 
 
 +         " " " R e p r e s e n t a t i o n   o f   a   R o o m . " " " 
 
   
 
 -         d e f   _ _ s t r _ _ ( s e l f ) : 
 
 -                 " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   r o o m . " " " 
 
 -                 r e t u r n   " N a m e :   { }   I D :   { }   I c o n :   { } " . f o r m a t ( s e l f . n a m e ,   s e l f . i d [ 0 : 4 ] ,   s e l f . i c o n ) 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   h u b :   H u b ,   r o o m _ i d :   b y t e s )   - >   N o n e : 
 
 +                 " " " I n i t   a   n e w   r o o m . 
 
   
 
 -         d e f   c a l l b a c k _ s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " A d d   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 s e l f . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 A r g s : 
 
 +                         h u b :   T h e   h u b   i n s t a n c e . 
 
 +                         r o o m _ i d :   T h e   u n i q u e   r o o m   i d e n t i f i e r . 
 
 +                 " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( h u b ,   r o o m _ i d ) 
 
   
 
 -         d e f   c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   c a l l b a c k ) : 
 
 -                 " " " R e m o v e   a   c a l l b a c k   f o r   h u b   u p d a t e s . " " " 
 
 -                 i f   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . u p d a t e _ c a l l b a c k s . r e m o v e ( c a l l b a c k ) 
 
 +         d e f   _ _ s t r _ _ ( s e l f )   - >   s t r : 
 
 +                 " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   r o o m . " " " 
 
 +                 r e t u r n   " N a m e :   { }   I D :   { }   I c o n :   { } " . f o r m a t ( 
 
 +                         s e l f . n a m e ,   s e l f . i d [ 0 : 4 ]   i f   i s i n s t a n c e ( s e l f . i d ,   b y t e s )   e l s e   s e l f . i d ,   s e l f . i c o n 
 
 +                 ) 
 
   
 
 -         d e f   n o t i f y _ c a l l b a c k ( s e l f ) : 
 
 -                 " " " T e l l   c a l l b a c k   t h a t   d e v i c e   h a s   b e e n   u p d a t e d . " " " 
 
 -                 f o r   c a l l b a c k   i n   s e l f . u p d a t e _ c a l l b a c k s : 
 
 -                         s e l f . h u b . a s y n c _ a d d _ j o b ( c a l l b a c k ) 
 
 +         a s y n c   d e f   m o v e _ t o ( s e l f ,   p e r c e n t :   i n t )   - >   N o n e : 
 
 +                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o o m   t o   a   p e r c e n t a g e   c l o s e d . 
 
   
 
 -         a s y n c   d e f   m o v e _ t o ( s e l f ,   p e r c e n t ) : 
 
 -                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   a   p e r c e n t a g e   c l o s e d . " " " 
 
 +                 A r g s : 
 
 +                         p e r c e n t :   T a r g e t   p o s i t i o n   ( 0 - 1 0 0 ) . 
 
 +                 " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 @ @   - 5 1 , 8   + 4 8 , 8   @ @   c l a s s   R o o m : 
 
                           c o n s t . C O M M A N D _ M O V E _ T O ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
                   ) 
 
   
 
 -         a s y n c   d e f   m o v e _ u p ( s e l f ) : 
 
 -                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   f u l l y   o p e n . " " " 
 
 +         a s y n c   d e f   m o v e _ u p ( s e l f )   - >   N o n e : 
 
 +                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o o m   t o   f u l l y   o p e n . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 @ @   - 6 1 , 1 0   + 5 8 , 1 2   @ @   c l a s s   R o o m : 
 
                           +   b y t e s . f r o m h e x ( " 1 0 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
   
 
 -         a s y n c   d e f   m o v e _ s t o p ( s e l f ) : 
 
 -                 " " " S e n d   c o m m a n d   t o   s t o p   t h e   r o l l e r . " " " 
 
 +         a s y n c   d e f   m o v e _ s t o p ( s e l f )   - >   N o n e : 
 
 +                 " " " S e n d   c o m m a n d   t o   s t o p   t h e   r o o m . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 @ @   - 7 3 , 1 0   + 7 2 , 1 2   @ @   c l a s s   R o o m : 
 
                           +   b y t e s . f r o m h e x ( " 1 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
   
 
 -         a s y n c   d e f   m o v e _ d o w n ( s e l f ) : 
 
 -                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o l l e r   t o   f u l l y   c l o s e d . " " " 
 
 +         a s y n c   d e f   m o v e _ d o w n ( s e l f )   - >   N o n e : 
 
 +                 " " " S e n d   c o m m a n d   t o   m o v e   t h e   r o o m   t o   f u l l y   c l o s e d . " " " 
 
                   m e s s a g e   =   ( 
 
                           b y t e s . f r o m h e x ( " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 " ) 
 
                           +   b y t e s . f r o m h e x ( " 0 6 0 0 " ) 
 
 @ @   - 8 5 , 4   + 8 6 , 6   @ @   c l a s s   R o o m : 
 
                           +   b y t e s . f r o m h e x ( " 1 2 " ) 
 
                           +   b y t e s . f r o m h e x ( " f f " ) 
 
                   ) 
 
 -                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e ) 
 
 +                 a w a i t   s e l f . h u b . s e n d _ c o m m a n d ( 
 
 +                         c o n s t . C O M M A N D _ M O V E ,   b y t e s . f r o m h e x ( " 2 2 0 1 " ) ,   m e s s a g e 
 
 +                 ) 
 
 d i f f   - - g i t   a / a i o p u l s e / s c e n e . p y   b / a i o p u l s e / s c e n e . p y 
 
 i n d e x   c 8 8 9 0 b 9 . . a 8 2 3 8 4 1   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / s c e n e . p y 
 
 + + +   b / a i o p u l s e / s c e n e . p y 
 
 @ @   - 1 , 2 1   + 1 , 2 8   @ @ 
 
 - " " " E l e m e n t s   t h a t   h a n g   o f f   t h e   h u b . " " " 
 
 - f r o m   t y p i n g   i m p o r t   L i s t ,   C a l l a b l e 
 
 + " " " S c e n e   e n t i t y   t h a t   h a n g s   o f f   t h e   h u b . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
 - i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
 - i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
 - i m p o r t   a s y n c i o 
 
 + f r o m   t y p i n g   i m p o r t   T Y P E _ C H E C K I N G 
 
   
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
   
 
 - c l a s s   S c e n e : 
 
 + i f   T Y P E _ C H E C K I N G : 
 
 +         f r o m   a i o p u l s e . h u b   i m p o r t   H u b 
 
 + 
 
 + 
 
 + c l a s s   S c e n e ( H u b E n t i t y ) : 
 
           " " " R e p r e s e n t a t i o n   o f   a   S c e n e . " " " 
 
   
 
 -         d e f   _ _ i n i t _ _ ( s e l f ,   h u b ,   s c e n e _ i d ) : 
 
 -                 " " " I n i t   a   n e w   s c e n e . " " " 
 
 -                 s e l f . h u b   =   h u b 
 
 -                 s e l f . i d   =   s c e n e _ i d 
 
 -                 s e l f . i c o n   =   N o n e 
 
 -                 s e l f . n a m e   =   N o n e 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   h u b :   H u b ,   s c e n e _ i d :   b y t e s )   - >   N o n e : 
 
 +                 " " " I n i t   a   n e w   s c e n e . 
 
 + 
 
 +                 A r g s : 
 
 +                         h u b :   T h e   h u b   i n s t a n c e . 
 
 +                         s c e n e _ i d :   T h e   u n i q u e   s c e n e   i d e n t i f i e r . 
 
 +                 " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( h u b ,   s c e n e _ i d ) 
 
   
 
 -         d e f   _ _ s t r _ _ ( s e l f ) : 
 
 +         d e f   _ _ s t r _ _ ( s e l f )   - >   s t r : 
 
                   " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   s c e n e . " " " 
 
 -                 r e t u r n   " N a m e :   { }   I D :   { }   I c o n :   { } " . f o r m a t ( s e l f . n a m e ,   s e l f . i d [ 0 : 4 ] ,   s e l f . i c o n ) 
 
 +                 r e t u r n   " N a m e :   { }   I D :   { }   I c o n :   { } " . f o r m a t ( 
 
 +                         s e l f . n a m e ,   s e l f . i d [ 0 : 4 ]   i f   i s i n s t a n c e ( s e l f . i d ,   b y t e s )   e l s e   s e l f . i d ,   s e l f . i c o n 
 
 +                 ) 
 
 d i f f   - - g i t   a / a i o p u l s e / t i m e r . p y   b / a i o p u l s e / t i m e r . p y 
 
 i n d e x   e 9 b a b 1 6 . . e c 9 7 c 4 7   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / t i m e r . p y 
 
 + + +   b / a i o p u l s e / t i m e r . p y 
 
 @ @   - 1 , 3 4   + 1 , 3 9   @ @ 
 
 - " " " E l e m e n t s   t h a t   h a n g   o f f   t h e   h u b . " " " 
 
 - f r o m   t y p i n g   i m p o r t   L i s t ,   C a l l a b l e 
 
 + " " " T i m e r   e n t i t y   t h a t   h a n g s   o f f   t h e   h u b . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
 - i m p o r t   a i o p u l s e . u t i l s   a s   u t i l s 
 
 - i m p o r t   a i o p u l s e . c o n s t   a s   c o n s t 
 
 - i m p o r t   a s y n c i o 
 
 + f r o m   t y p i n g   i m p o r t   T Y P E _ C H E C K I N G 
 
   
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
   
 
 - c l a s s   T i m e r : 
 
 + i f   T Y P E _ C H E C K I N G : 
 
 +         f r o m   a i o p u l s e . h u b   i m p o r t   H u b 
 
 + 
 
 + 
 
 + c l a s s   T i m e r ( H u b E n t i t y ) : 
 
           " " " R e p r e s e n t a t i o n   o f   a   T i m e r . " " " 
 
   
 
 -         d e f   _ _ i n i t _ _ ( s e l f ,   h u b ,   t i m e r _ i d ) : 
 
 -                 " " " I n i t   a   n e w   t i m e r . " " " 
 
 -                 s e l f . h u b   =   h u b 
 
 -                 s e l f . i d   =   t i m e r _ i d 
 
 -                 s e l f . i c o n   =   N o n e 
 
 -                 s e l f . n a m e   =   N o n e 
 
 -                 s e l f . s t a t e   =   N o n e 
 
 -                 s e l f . h o u r   =   N o n e 
 
 -                 s e l f . m i n u t e   =   N o n e 
 
 -                 s e l f . d a y s   =   N o n e 
 
 -                 s e l f . e n t i t y   =   N o n e 
 
 - 
 
 -         d e f   _ _ s t r _ _ ( s e l f ) : 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   h u b :   H u b ,   t i m e r _ i d :   b y t e s )   - >   N o n e : 
 
 +                 " " " I n i t   a   n e w   t i m e r . 
 
 + 
 
 +                 A r g s : 
 
 +                         h u b :   T h e   h u b   i n s t a n c e . 
 
 +                         t i m e r _ i d :   T h e   u n i q u e   t i m e r   i d e n t i f i e r . 
 
 +                 " " " 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( h u b ,   t i m e r _ i d ) 
 
 +                 s e l f . s t a t e :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . h o u r :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . m i n u t e :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . d a y s :   i n t   |   N o n e   =   N o n e 
 
 +                 s e l f . e n t i t y :   H u b E n t i t y   |   N o n e   =   N o n e 
 
 + 
 
 +         d e f   _ _ s t r _ _ ( s e l f )   - >   s t r : 
 
                   " " " R e t u r n s   s t r i n g   r e p r e s e n t a t i o n   o f   t i m e r . " " " 
 
                   r e t u r n   ( 
 
                           f " N a m e :   { s e l f . n a m e }   " 
 
 -                         f " I D :   { s e l f . i d [ 0 : 4 ] }   " 
 
 +                         f " I D :   { s e l f . i d [ 0 : 4 ]   i f   i s i n s t a n c e ( s e l f . i d ,   b y t e s )   e l s e   s e l f . i d }   " 
 
                           f " I c o n :   { s e l f . i c o n }   " 
 
                           f " S t a t e :   { s e l f . s t a t e }   " 
 
                           f " T i m e :   { s e l f . h o u r } : { s e l f . m i n u t e }   " 
 
 -                         f " D a y s :   { s e l f . d a y s : > 0 7 b }   " 
 
 +                         f " D a y s :   { s e l f . d a y s : > 0 7 b }   "   i f   s e l f . d a y s   i s   n o t   N o n e   e l s e   " D a y s :   N o n e   " 
 
                           f ' E n t i t y :   { s e l f . e n t i t y . n a m e   i f   s e l f . e n t i t y   e l s e   " N o n e " } ' 
 
                   ) 
 
 d i f f   - - g i t   a / a i o p u l s e / t r a n s p o r t . p y   b / a i o p u l s e / t r a n s p o r t . p y 
 
 i n d e x   1 5 3 c b 8 3 . . c 6 3 d e 1 c   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / t r a n s p o r t . p y 
 
 + + +   b / a i o p u l s e / t r a n s p o r t . p y 
 
 @ @   - 4 8 , 7   + 4 8 , 7   @ @   c l a s s   H u b T r a n s p o r t U d p ( H u b T r a n s p o r t B a s e ) : 
 
                   i f   h o s t : 
 
                           s e l f . h o s t   =   h o s t 
 
   
 
 -                 l o o p   =   a s y n c i o . g e t _ e v e n t _ l o o p ( ) 
 
 +                 l o o p   =   a s y n c i o . g e t _ r u n n i n g _ l o o p ( ) 
 
                   s e l f . t r a n s p o r t ,   s e l f . p r o t o c o l   =   a w a i t   l o o p . c r e a t e _ d a t a g r a m _ e n d p o i n t ( 
 
                           l a m b d a :   s e l f , 
 
                           r e m o t e _ a d d r = ( s e l f . h o s t ,   s e l f . p o r t ) , 
 
 @ @   - 6 1 , 1 0   + 6 1 , 1 4   @ @   c l a s s   H u b T r a n s p o r t U d p ( H u b T r a n s p o r t B a s e ) : 
 
   
 
           d e f   s e n d ( s e l f ,   b u f f e r ) : 
 
                   " " " A b s t r a c t i o n   o f   t h e   u n d e r l y i n g   t r a n s p o r t   t o   s e n d   a   b u f f e r . " " " 
 
 +                 i f   n o t   s e l f . t r a n s p o r t : 
 
 +                         r a i s e   N o t C o n n e c t e d E x c e p t i o n ( " U D P   t r a n s p o r t   n o t   c o n n e c t e d " ) 
 
                   s e l f . t r a n s p o r t . s e n d t o ( b u f f e r ,   ( s e l f . h o s t ,   s e l f . p o r t ) ) 
 
   
 
           a s y n c   d e f   r e c e i v e ( s e l f ) : 
 
                   " " " A b s t r a c t i o n   o f   t h e   u n d e r l y i n g   t r a n s p o r t   t o   r e c e i v e . " " " 
 
 +                 i f   n o t   s e l f . t r a n s p o r t : 
 
 +                         r a i s e   N o t C o n n e c t e d E x c e p t i o n ( " U D P   t r a n s p o r t   n o t   c o n n e c t e d " ) 
 
                   r e t u r n   a w a i t   s e l f . r e c e i v e _ q u e u e . g e t ( ) 
 
   
 
           d e f   d a t a g r a m _ r e c e i v e d ( s e l f ,   d a t a ,   a d d r ) : 
 
 @ @   - 8 7 , 7   + 9 1 , 7   @ @   c l a s s   H u b T r a n s p o r t U d p B r o a d c a s t ( H u b T r a n s p o r t U d p ) : 
 
   
 
                   s o c k . s e n d t o ( b " 0 " ,   ( " < b r o a d c a s t > " ,   1 5 0 0 ) ) 
 
   
 
 -                 l o o p   =   a s y n c i o . g e t _ e v e n t _ l o o p ( ) 
 
 +                 l o o p   =   a s y n c i o . g e t _ r u n n i n g _ l o o p ( ) 
 
                   s e l f . t r a n s p o r t ,   s e l f . p r o t o c o l   =   a w a i t   l o o p . c r e a t e _ d a t a g r a m _ e n d p o i n t ( 
 
                           l a m b d a :   s e l f , 
 
                           s o c k = s o c k , 
 
 @ @   - 1 1 2 , 9   + 1 1 6 , 9   @ @   c l a s s   H u b T r a n s p o r t T c p ( H u b T r a n s p o r t B a s e ) : 
 
   
 
           a s y n c   d e f   d o _ c o n n e c t i o n ( s e l f ) : 
 
                   " " " T r y   a n d   e s t a b l i s h   a   T C P   c o n n e c t i o n . " " " 
 
 -                 l o o p   =   a s y n c i o . g e t _ e v e n t _ l o o p ( ) 
 
 -                 s e l f . r e a d e r   =   a s y n c i o . S t r e a m R e a d e r ( l o o p = l o o p ) 
 
 -                 s e l f . p r o t o c o l   =   a s y n c i o . S t r e a m R e a d e r P r o t o c o l ( s e l f . r e a d e r ,   l o o p = l o o p ) 
 
 +                 l o o p   =   a s y n c i o . g e t _ r u n n i n g _ l o o p ( ) 
 
 +                 s e l f . r e a d e r   =   a s y n c i o . S t r e a m R e a d e r ( ) 
 
 +                 s e l f . p r o t o c o l   =   a s y n c i o . S t r e a m R e a d e r P r o t o c o l ( s e l f . r e a d e r ) 
 
   
 
                   #   T h e   f o l l o w i n g   b l o c k s   u n t i l   a   c o n n e c t i o n   i s   m a d e 
 
                   s e l f . t r a n s p o r t ,   _   =   a w a i t   l o o p . c r e a t e _ c o n n e c t i o n ( 
 
 @ @   - 1 6 6 , 1 3   + 1 7 0 , 1 3   @ @   c l a s s   H u b T r a n s p o r t T c p ( H u b T r a n s p o r t B a s e ) : 
 
           d e f   s e n d ( s e l f ,   b u f f e r ) : 
 
                   " " " A b s t r a c t i o n   o f   t h e   u n d e r l y i n g   t r a n s p o r t   t o   s e n d   a   b u f f e r . " " " 
 
                   i f   n o t   s e l f . w r i t e r   o r   s e l f . w r i t e r . i s _ c l o s i n g ( ) : 
 
 -                         r a i s e   N o t C o n n e c t e d E x c e p t i o n 
 
 +                         r a i s e   N o t C o n n e c t e d E x c e p t i o n ( " T C P   t r a n s p o r t   n o t   c o n n e c t e d " ) 
 
                   s e l f . w r i t e r . w r i t e ( b u f f e r ) 
 
   
 
           a s y n c   d e f   r e c e i v e ( s e l f ) : 
 
                   " " " R e c e i v e   f r o m   s t r e a m . " " " 
 
 -                 i f   s e l f . w r i t e r . i s _ c l o s i n g ( ) : 
 
 -                         r a i s e   N o t C o n n e c t e d E x c e p t i o n 
 
 +                 i f   n o t   s e l f . r e a d e r   o r   n o t   s e l f . w r i t e r   o r   s e l f . w r i t e r . i s _ c l o s i n g ( ) : 
 
 +                         r a i s e   N o t C o n n e c t e d E x c e p t i o n ( " T C P   t r a n s p o r t   n o t   c o n n e c t e d " ) 
 
                   r e t u r n   a w a i t   s e l f . r e a d e r . r e a d ( 6 5 5 3 5 ) 
 
   
 
           d e f   d a t a _ r e c e i v e d ( s e l f ,   d a t a ) : 
 
 d i f f   - - g i t   a / a i o p u l s e / u t i l s . p y   b / a i o p u l s e / u t i l s . p y 
 
 i n d e x   4 3 f 4 9 b 1 . . a 6 8 2 0 4 2   1 0 0 6 4 4 
 
 - - -   a / a i o p u l s e / u t i l s . p y 
 
 + + +   b / a i o p u l s e / u t i l s . p y 
 
 @ @   - 1 , 3 5   + 1 , 8 3   @ @ 
 
 - " " "   S e r i a l i s a t i o n   /   D e s e r i a l i s a t i o n   h e l p e r s   " " " 
 
 + " " " S e r i a l i s a t i o n   /   D e s e r i a l i s a t i o n   h e l p e r s . " " " 
 
 + f r o m   _ _ f u t u r e _ _   i m p o r t   a n n o t a t i o n s 
 
   
 
   
 
 - d e f   u n p a c k _ i n t ( b u f f e r ,   p t r ,   l e n g t h ) : 
 
 -         " " " U n p a c k   a n   i n t   o f   s p e c i f i e d   l e n g t h   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r " " " 
 
 + d e f   u n p a c k _ i n t ( b u f f e r :   b y t e s ,   p t r :   i n t ,   l e n g t h :   i n t )   - >   t u p l e [ i n t ,   i n t ] : 
 
 +         " " " U n p a c k   a n   i n t   o f   s p e c i f i e d   l e n g t h   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r . 
 
 + 
 
 +         A r g s : 
 
 +                 b u f f e r :   T h e   b y t e s   b u f f e r   t o   r e a d   f r o m . 
 
 +                 p t r :   C u r r e n t   p o s i t i o n   i n   t h e   b u f f e r . 
 
 +                 l e n g t h :   N u m b e r   o f   b y t e s   t o   r e a d . 
 
 + 
 
 +         R e t u r n s : 
 
 +                 T u p l e   o f   ( v a l u e ,   n e w _ p o i n t e r ) . 
 
 +         " " " 
 
           r e t u r n   ( 
 
                   i n t . f r o m _ b y t e s ( b u f f e r [ p t r   :   ( p t r   +   l e n g t h ) ] ,   " l i t t l e " ,   s i g n e d = F a l s e ) , 
 
                   p t r   +   l e n g t h , 
 
           ) 
 
   
 
   
 
 - d e f   p a c k _ i n t ( v a l u e ,   l e n g t h ) : 
 
 -         " " " U n p a c k   a n   i n t   f o r   s e r i a l i s a t i o n " " " 
 
 + d e f   p a c k _ i n t ( v a l u e :   i n t ,   l e n g t h :   i n t )   - >   b y t e s : 
 
 +         " " " P a c k   a n   i n t   f o r   s e r i a l i s a t i o n . 
 
 + 
 
 +         A r g s : 
 
 +                 v a l u e :   T h e   i n t e g e r   v a l u e   t o   p a c k . 
 
 +                 l e n g t h :   N u m b e r   o f   b y t e s   t o   u s e . 
 
 + 
 
 +         R e t u r n s : 
 
 +                 B y t e s   r e p r e s e n t a t i o n . 
 
 +         " " " 
 
           r e t u r n   v a l u e . t o _ b y t e s ( l e n g t h ,   " l i t t l e " ,   s i g n e d = F a l s e ) 
 
   
 
   
 
 - d e f   u n p a c k _ b y t e s ( b u f f e r ,   p t r ,   l e n g t h = N o n e ) : 
 
 -         " " " U n p a c k   a   s p e c i f i e d   n u m b e r   o f   b y t e s   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r " " " 
 
 + d e f   u n p a c k _ b y t e s ( 
 
 +         b u f f e r :   b y t e s ,   p t r :   i n t ,   l e n g t h :   i n t   |   N o n e   =   N o n e 
 
 + )   - >   t u p l e [ b y t e s ,   i n t ] : 
 
 +         " " " U n p a c k   a   s p e c i f i e d   n u m b e r   o f   b y t e s   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r . 
 
 + 
 
 +         A r g s : 
 
 +                 b u f f e r :   T h e   b y t e s   b u f f e r   t o   r e a d   f r o m . 
 
 +                 p t r :   C u r r e n t   p o s i t i o n   i n   t h e   b u f f e r . 
 
 +                 l e n g t h :   N u m b e r   o f   b y t e s   t o   r e a d ,   o r   N o n e   t o   r e a d   l e n g t h   p r e f i x . 
 
 + 
 
 +         R e t u r n s : 
 
 +                 T u p l e   o f   ( b y t e s ,   n e w _ p o i n t e r ) . 
 
 +         " " " 
 
           p t r _ n e w   =   p t r 
 
           i f   n o t   l e n g t h : 
 
                   l e n g t h ,   p t r _ n e w   =   u n p a c k _ i n t ( b u f f e r ,   p t r ,   2 ) 
 
           r e t u r n   ( b u f f e r [ ( p t r _ n e w )   :   ( p t r _ n e w   +   l e n g t h ) ] ,   p t r _ n e w   +   l e n g t h ) 
 
   
 
   
 
 - d e f   u n p a c k _ s t r i n g ( b u f f e r ,   p t r ,   l e n g t h = N o n e ) : 
 
 -         " " " U n p a c k   a   s p e c i f i e d   n u m b e r   o f   c h a r a c t e r s   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r " " " 
 
 + d e f   u n p a c k _ s t r i n g ( 
 
 +         b u f f e r :   b y t e s ,   p t r :   i n t ,   l e n g t h :   i n t   |   N o n e   =   N o n e 
 
 + )   - >   t u p l e [ s t r ,   i n t ] : 
 
 +         " " " U n p a c k   a   s p e c i f i e d   n u m b e r   o f   c h a r a c t e r s   f r o m   t h e   b u f f e r   a n d   a d v a n c e   t h e   p o i n t e r . 
 
 + 
 
 +         A r g s : 
 
 +                 b u f f e r :   T h e   b y t e s   b u f f e r   t o   r e a d   f r o m . 
 
 +                 p t r :   C u r r e n t   p o s i t i o n   i n   t h e   b u f f e r . 
 
 +                 l e n g t h :   N u m b e r   o f   b y t e s   t o   r e a d ,   o r   N o n e   t o   r e a d   l e n g t h   p r e f i x . 
 
 + 
 
 +         R e t u r n s : 
 
 +                 T u p l e   o f   ( s t r i n g ,   n e w _ p o i n t e r ) . 
 
 +         " " " 
 
           s t r _ n e w ,   p t r _ n e w   =   u n p a c k _ b y t e s ( b u f f e r ,   p t r ,   l e n g t h = N o n e ) 
 
           r e t u r n   ( s t r _ n e w . d e c o d e ( " u t f - 8 " ,   " i g n o r e " ) ,   p t r _ n e w ) 
 
   
 
   
 
 - d e f   u n p a c k _ r o l l e r _ p e r c e n t ( b u f f e r ,   p t r ) : 
 
 -         " " " U n p a c k   r o l l e r   c l o s e   p e r c e n t a g e . " " " 
 
 + d e f   u n p a c k _ r o l l e r _ p e r c e n t ( b u f f e r :   b y t e s ,   p t r :   i n t )   - >   t u p l e [ i n t ,   i n t ] : 
 
 +         " " " U n p a c k   r o l l e r   c l o s e   p e r c e n t a g e . 
 
 + 
 
 +         A r g s : 
 
 +                 b u f f e r :   T h e   b y t e s   b u f f e r   t o   r e a d   f r o m . 
 
 +                 p t r :   C u r r e n t   p o s i t i o n   i n   t h e   b u f f e r . 
 
 + 
 
 +         R e t u r n s : 
 
 +                 T u p l e   o f   ( p e r c e n t ,   n e w _ p o i n t e r ) . 
 
 +         " " " 
 
           p t r   + =   4 
 
           r o l l e r _ s t a t e ,   p t r   =   u n p a c k _ b y t e s ( b u f f e r ,   p t r ,   1 ) 
 
           p t r   + =   5     #   u n k n o w n   f i e l d 
 
 d i f f   - - g i t   a / p y p r o j e c t . t o m l   b / p y p r o j e c t . t o m l 
 
 i n d e x   8 0 d f d 3 a . . a 2 5 2 2 c e   1 0 0 6 4 4 
 
 - - -   a / p y p r o j e c t . t o m l 
 
 + + +   b / p y p r o j e c t . t o m l 
 
 @ @   - 4 , 7   + 4 , 7   @ @   b u i l d - b a c k e n d   =   " h a t c h l i n g . b u i l d " 
 
   
 
   [ p r o j e c t ] 
 
   n a m e   =   " a i o p u l s e " 
 
 - v e r s i o n   =   " 0 . 4 . 7 " 
 
 + v e r s i o n   =   " 0 . 5 . 0 " 
 
   a u t h o r s   =   [ 
 
       {   n a m e = " A l a n   M u r r a y " ,   e m a i l = " p y p i @ a t m u r r a y . n e t "   } , 
 
   ] 
 
 @ @   - 1 3 , 2 2   + 1 3 , 5 4   @ @   A s y n c h r o n o u s   l i b r a r y   t o   c o n t r o l   R o l l e a s e   A c m e d a   A u t o m a t e   r o l l e r   b l i n d s   v i a   a   v e r 
 
   " " " 
 
   r e a d m e   =   " R E A D M E . m d " 
 
   l i c e n s e   =   { f i l e   =   ' L I C E N S E ' } 
 
 - r e q u i r e s - p y t h o n   =   " > = 3 . 4 " 
 
 + r e q u i r e s - p y t h o n   =   " > = 3 . 1 0 " 
 
   c l a s s i f i e r s   =   [ 
 
           " D e v e l o p m e n t   S t a t u s   : :   4   -   B e t a " , 
 
           " I n t e n d e d   A u d i e n c e   : :   D e v e l o p e r s " , 
 
           " T o p i c   : :   S o f t w a r e   D e v e l o p m e n t   : :   L i b r a r i e s   : :   P y t h o n   M o d u l e s " , 
 
           " P r o g r a m m i n g   L a n g u a g e   : :   P y t h o n   : :   3 " , 
 
 +         " P r o g r a m m i n g   L a n g u a g e   : :   P y t h o n   : :   3 . 1 0 " , 
 
 +         " P r o g r a m m i n g   L a n g u a g e   : :   P y t h o n   : :   3 . 1 1 " , 
 
 +         " P r o g r a m m i n g   L a n g u a g e   : :   P y t h o n   : :   3 . 1 2 " , 
 
           " L i c e n s e   : :   O S I   A p p r o v e d   : :   A p a c h e   S o f t w a r e   L i c e n s e " , 
 
           " O p e r a t i n g   S y s t e m   : :   O S   I n d e p e n d e n t " , 
 
   ] 
 
   
 
 + [ p r o j e c t . o p t i o n a l - d e p e n d e n c i e s ] 
 
 + d e v   =   [ 
 
 +         " p y t e s t > = 7 . 0 " , 
 
 +         " p y t e s t - a s y n c i o > = 0 . 2 1 " , 
 
 +         " p y t e s t - c o v > = 4 . 0 " , 
 
 +         " m y p y > = 1 . 0 " , 
 
 +         " r u f f > = 0 . 4 " , 
 
 +         " b l a c k > = 2 4 . 0 " , 
 
 +         " b u i l d > = 1 . 0 " , 
 
 + ] 
 
 + 
 
   [ p r o j e c t . u r l s ] 
 
   H o m e p a g e   =   " h t t p s : / / g i t h u b . c o m / a t m u r r a y / a i o p u l s e " 
 
   I s s u e s   =   " h t t p s : / / g i t h u b . c o m / a t m u r r a y / a i o p u l s e / i s s u e s " 
 
   
 
 + [ t o o l . p y t e s t . i n i _ o p t i o n s ] 
 
 + a s y n c i o _ m o d e   =   " a u t o " 
 
 + t e s t p a t h s   =   [ " t e s t s " ] 
 
 + f i l t e r w a r n i n g s   =   [ 
 
 +         " i g n o r e : l o o p   p a r a m e t e r   i s   d e p r e c a t e d : D e p r e c a t i o n W a r n i n g " , 
 
 + ] 
 
 + 
 
 + [ t o o l . m y p y ] 
 
 + p y t h o n _ v e r s i o n   =   " 3 . 1 0 " 
 
 + w a r n _ r e t u r n _ a n y   =   t r u e 
 
 + w a r n _ u n u s e d _ c o n f i g s   =   t r u e 
 
 + d i s a l l o w _ u n t y p e d _ d e f s   =   f a l s e 
 
 + 
 
 + [ t o o l . r u f f ] 
 
 + t a r g e t - v e r s i o n   =   " p y 3 1 0 " 
 
 + l i n e - l e n g t h   =   8 8 
 
 + s e l e c t   =   [ " E " ,   " F " ,   " I " ,   " N " ,   " W " ,   " U P " ] 
 
 + 
 
   [ t o o l . b u m p v e r ] 
 
 - c u r r e n t _ v e r s i o n   =   " 0 . 4 . 7 " 
 
 + c u r r e n t _ v e r s i o n   =   " 0 . 5 . 0 " 
 
   v e r s i o n _ p a t t e r n   =   " M A J O R . M I N O R . P A T C H " 
 
   c o m m i t _ m e s s a g e     =   " B u m p   v e r s i o n   { o l d _ v e r s i o n }   - >   { n e w _ v e r s i o n } " 
 
   c o m m i t                     =   t r u e 
 
 d i f f   - - g i t   a / s e t u p . p y   b / s e t u p . p y 
 
 i n d e x   5 7 0 a 8 2 0 . . b 1 d 3 5 1 4   1 0 0 6 4 4 
 
 - - -   a / s e t u p . p y 
 
 + + +   b / s e t u p . p y 
 
 @ @   - 1 , 1 1   + 1 , 1 1   @ @ 
 
   " " " P i p   s e t u p   f i l e   f o r   a i o p u l s e   l i b r a r y . " " " 
 
   
 
 - f r o m   d i s t u t i l s . c o r e   i m p o r t   s e t u p 
 
 + f r o m   s e t u p t o o l s   i m p o r t   s e t u p 
 
   
 
   s e t u p ( 
 
           n a m e = " a i o p u l s e " , 
 
           p a c k a g e s = [ " a i o p u l s e " ] , 
 
 -         v e r s i o n = " 0 . 4 . 7 " , 
 
 +         v e r s i o n = " 0 . 5 . 0 " , 
 
           l i c e n s e = " a p a c h e - 2 . 0 " , 
 
           d e s c r i p t i o n = " P y t h o n   m o d u l e   f o r   R o l l e a s e   A c m e d a   A u t o m a t e   i n t e g r a t i o n . " , 
 
           l o n g _ d e s c r i p t i o n = o p e n ( " R E A D M E . m d " ) . r e a d ( ) , 
 
 @ @   - 1 3 , 1 2   + 1 3 , 1 2   @ @   s e t u p ( 
 
           a u t h o r = " A l a n   M u r r a y " , 
 
           a u t h o r _ e m a i l = " p y p i @ a t m u r r a y . n e t " , 
 
           u r l = " h t t p s : / / g i t h u b . c o m / a t m u r r a y / a i o p u l s e " , 
 
 -         d o w n l o a d _ u r l = " h t t p s : / / g i t h u b . c o m / a t m u r r a y / a i o p u l s e / a r c h i v e / v 0 . 4 . 7 . t a r . g z " , 
 
 +         d o w n l o a d _ u r l = " h t t p s : / / g i t h u b . c o m / a t m u r r a y / a i o p u l s e / a r c h i v e / v 0 . 5 . 0 . t a r . g z " , 
 
           k e y w o r d s = [ " a u t o m a t i o n " ] , 
 
 -         p y t h o n _ r e q u i r e s = " > = 3 . 4 " , 
 
 +         p y t h o n _ r e q u i r e s = " > = 3 . 1 0 " , 
 
           i n s t a l l _ r e q u i r e s = [ " a s y n c _ t i m e o u t " ] , 
 
           c l a s s i f i e r s = [ 
 
 -                 " D e v e l o p m e n t   S t a t u s   : :   3   -   A l p h a " , 
 
 +                 " D e v e l o p m e n t   S t a t u s   : :   4   -   B e t a " , 
 
                   " I n t e n d e d   A u d i e n c e   : :   D e v e l o p e r s " , 
 
                   " O p e r a t i n g   S y s t e m   : :   O S   I n d e p e n d e n t " , 
 
                   " T o p i c   : :   S o f t w a r e   D e v e l o p m e n t   : :   L i b r a r i e s   : :   P y t h o n   M o d u l e s " , 
 
 d i f f   - - g i t   a / t e s t s / c o n f t e s t . p y   b / t e s t s / c o n f t e s t . p y 
 
 i n d e x   2 3 1 0 2 b c . . e d 8 2 1 9 d   1 0 0 6 4 4 
 
 - - -   a / t e s t s / c o n f t e s t . p y 
 
 + + +   b / t e s t s / c o n f t e s t . p y 
 
 @ @   - 2 9 , 7   + 2 9 , 7   @ @   d e f   h u b ( e v e n t _ l o o p ,   m o c k _ t r a n s p o r t ) : 
 
           w i t h   p a t c h . o b j e c t ( a i o p u l s e . t r a n s p o r t ,   " H u b T r a n s p o r t T c p " ,   r e t u r n _ v a l u e = m o c k _ t r a n s p o r t ) : 
 
                   h   =   H u b ( h o s t = " 1 9 2 . 1 6 8 . 1 . 1 0 0 " ,   l o o p = e v e n t _ l o o p ) 
 
                   h . r u n n i n g   =   F a l s e 
 
 -                 h . a s y n c _ a d d _ j o b   =   M a g i c M o c k ( r e t u r n _ v a l u e = M a g i c M o c k ( ) ) 
 
 +                 h . _ s c h e d u l e _ c a l l b a c k   =   M a g i c M o c k ( r e t u r n _ v a l u e = M a g i c M o c k ( ) ) 
 
                   y i e l d   h 
 
   
 
   
 
 d i f f   - - g i t   a / t e s t s / t e s t _ c a l l b a c k s . p y   b / t e s t s / t e s t _ c a l l b a c k s . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . 9 f 2 0 1 3 c 
 
 - - -   / d e v / n u l l 
 
 + + +   b / t e s t s / t e s t _ c a l l b a c k s . p y 
 
 @ @   - 0 , 0   + 1 , 9 3   @ @ 
 
 + i m p o r t   a s y n c i o 
 
 + f r o m   u n i t t e s t . m o c k   i m p o r t   A s y n c M o c k ,   M a g i c M o c k 
 
 + 
 
 + i m p o r t   p y t e s t 
 
 + 
 
 + f r o m   a i o p u l s e . c a l l b a c k s   i m p o r t   C a l l b a c k M i x i n 
 
 + 
 
 + 
 
 + c l a s s   C o n c r e t e C a l l b a c k E n t i t y ( C a l l b a c k M i x i n ) : 
 
 +         " " " C o n c r e t e   i m p l e m e n t a t i o n   f o r   t e s t i n g . " " " 
 
 + 
 
 +         p a s s 
 
 + 
 
 + 
 
 + c l a s s   T e s t C a l l b a c k M i x i n : 
 
 +         @ p y t e s t . f i x t u r e 
 
 +         d e f   e n t i t y ( s e l f ) : 
 
 +                 r e t u r n   C o n c r e t e C a l l b a c k E n t i t y ( ) 
 
 + 
 
 +         d e f   t e s t _ i n i t _ e m p t y _ c a l l b a c k s ( s e l f ,   e n t i t y ) : 
 
 +                 a s s e r t   e n t i t y . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e _ n o t _ f o u n d ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   e n t i t y . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ m u l t i p l e _ s u b s c r i b e r s ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k 1   =   M a g i c M o c k ( ) 
 
 +                 c a l l b a c k 2   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k 1 ) 
 
 +                 e n t i t y . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k 2 ) 
 
 +                 a s s e r t   l e n ( e n t i t y . _ u p d a t e _ c a l l b a c k s )   = =   2 
 
 +                 a s s e r t   c a l l b a c k 1   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k 2   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k _ s y n c ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k _ w i t h _ a r g s ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( " a r g 1 " ,   " a r g 2 " ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e _ w i t h ( " a r g 1 " ,   " a r g 2 " ) 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k _ m u l t i p l e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k 1   =   M a g i c M o c k ( ) 
 
 +                 c a l l b a c k 2   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k 1 ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k 2 ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k 1 . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 +                 c a l l b a c k 2 . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k _ a s y n c ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   A s y n c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 + 
 
 +         d e f   t e s t _ n o t i f y _ c a l l b a c k _ c o r o u t i n e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l e d   =   F a l s e 
 
 + 
 
 +                 a s y n c   d e f   c a l l b a c k ( ) : 
 
 +                         n o n l o c a l   c a l l e d 
 
 +                         c a l l e d   =   T r u e 
 
 + 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( ) 
 
 +                 #   N o t e :   c o r o u t i n e   w o n ' t   e x e c u t e   w i t h o u t   e v e n t   l o o p   r u n n i n g 
 
 +                 #   T h i s   t e s t s   t h a t   i t   d o e s n ' t   r a i s e 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ c o n s t . p y   b / t e s t s / t e s t _ c o n s t . p y 
 
 i n d e x   8 f a e 8 b 9 . . 9 b 8 8 0 5 a   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ c o n s t . p y 
 
 + + +   b / t e s t s / t e s t _ c o n s t . p y 
 
 @ @   - 2 , 6   + 2 , 9   @ @   i m p o r t   p y t e s t 
 
   
 
   f r o m   a i o p u l s e . c o n s t   i m p o r t   ( 
 
           U p d a t e T y p e , 
 
 +         M e s s a g e T y p e , 
 
 +         C o m m a n d T y p e , 
 
 +         R e s p o n s e T y p e , 
 
           H E A D E R , 
 
           C O M M A N D _ D I S C O V E R , 
 
           R E S P O N S E _ D I S C O V E R , 
 
 @ @   - 2 6 , 2 0   + 2 9 , 5 2   @ @   f r o m   a i o p u l s e . c o n s t   i m p o r t   ( 
 
   ) 
 
   
 
   
 
 + c l a s s   T e s t M e s s a g e T y p e : 
 
 +         d e f   t e s t _ m e s s a g e _ t y p e _ v a l u e s ( s e l f ) : 
 
 +                 a s s e r t   M e s s a g e T y p e . H U B _ I N F O   = =   0 x 1 6 0 0 
 
 +                 a s s e r t   M e s s a g e T y p e . R O O M _ L I S T   = =   0 x 0 1 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . R O L L E R _ L I S T   = =   0 x 2 1 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . S C E N E _ L I S T   = =   0 x 3 3 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . T I M E R _ L I S T   = =   0 x 4 1 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . P O S I T I O N   = =   0 x 2 3 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . R O L L E R _ U P D A T E D   = =   0 x 2 5 0 1 
 
 +                 a s s e r t   M e s s a g e T y p e . R O L L E R _ H E A L T H   = =   0 x 2 B 0 1 
 
 + 
 
 +         d e f   t e s t _ m e s s a g e _ t y p e _ i s _ i n t ( s e l f ) : 
 
 +                 a s s e r t   i s i n s t a n c e ( M e s s a g e T y p e . H U B _ I N F O ,   i n t ) 
 
 + 
 
 + 
 
 + c l a s s   T e s t C o m m a n d T y p e : 
 
 +         d e f   t e s t _ c o m m a n d _ t y p e _ v a l u e s ( s e l f ) : 
 
 +                 a s s e r t   C o m m a n d T y p e . D I S C O V E R   = =   0 x 0 3 0 0 0 0 0 3 
 
 +                 a s s e r t   C o m m a n d T y p e . C O N N E C T   = =   0 x 0 3 0 0 0 0 0 6 
 
 +                 a s s e r t   C o m m a n d T y p e . L O G I N   = =   0 x 0 F 0 0 0 0 0 8 
 
 +                 a s s e r t   C o m m a n d T y p e . P I N G   = =   0 x 0 3 0 0 0 0 1 5 
 
 +                 a s s e r t   C o m m a n d T y p e . S E T I D   = =   0 x 2 8 0 0 0 0 9 0 
 
 +                 a s s e r t   C o m m a n d T y p e . G E T _ H U B _ I N F O   = =   0 x 1 E 0 0 0 0 9 0 
 
 +                 a s s e r t   C o m m a n d T y p e . M O V E _ T O   = =   0 x 3 4 0 0 0 0 9 0 
 
 +                 a s s e r t   C o m m a n d T y p e . M O V E   = =   0 x 2 D 0 0 0 0 9 0 
 
 +                 a s s e r t   C o m m a n d T y p e . G E T _ H E A L T H   = =   0 x 3 2 0 0 0 0 9 0 
 
 + 
 
 + 
 
 + c l a s s   T e s t R e s p o n s e T y p e : 
 
 +         d e f   t e s t _ r e s p o n s e _ t y p e _ v a l u e s ( s e l f ) : 
 
 +                 a s s e r t   R e s p o n s e T y p e . D I S C O V E R   = =   0 x 5 7 0 0 0 0 0 4 
 
 +                 a s s e r t   R e s p o n s e T y p e . C O N N E C T   = =   0 x 0 F 0 0 0 0 0 7 
 
 +                 a s s e r t   R e s p o n s e T y p e . L O G I N   = =   0 x 0 4 0 0 0 0 0 9 
 
 +                 a s s e r t   R e s p o n s e T y p e . P I N G   = =   0 x 0 3 0 0 0 0 1 6 
 
 +                 a s s e r t   R e s p o n s e T y p e . S E T I D   = =   0 x 0 3 0 0 0 0 9 1 
 
 +                 a s s e r t   R e s p o n s e T y p e . G E T _ H U B _ I N F O   = =   0 x 4 A 0 0 0 0 9 1 
 
 +                 a s s e r t   R e s p o n s e T y p e . M O V E _ T O   = =   0 x 3 4 0 0 0 0 9 1 
 
 + 
 
 + 
 
   c l a s s   T e s t U p d a t e T y p e : 
 
 -         d e f   t e s t _ e n u m _ v a l u e s ( s e l f ) : 
 
 -                 a s s e r t   U p d a t e T y p e . i n f o . v a l u e   = =   1 
 
 -                 a s s e r t   U p d a t e T y p e . r o l l e r s . v a l u e   = =   2 
 
 -                 a s s e r t   U p d a t e T y p e . r o o m s . v a l u e   = =   3 
 
 -                 a s s e r t   U p d a t e T y p e . s c e n e s . v a l u e   = =   4 
 
 -                 a s s e r t   U p d a t e T y p e . t i m e r s . v a l u e   = =   5 
 
 - 
 
 -         d e f   t e s t _ e n u m _ m e m b e r s ( s e l f ) : 
 
 -                 a s s e r t   U p d a t e T y p e ( 1 )   = =   U p d a t e T y p e . i n f o 
 
 -                 a s s e r t   U p d a t e T y p e ( 2 )   = =   U p d a t e T y p e . r o l l e r s 
 
 -                 a s s e r t   U p d a t e T y p e ( 3 )   = =   U p d a t e T y p e . r o o m s 
 
 -                 a s s e r t   U p d a t e T y p e ( 4 )   = =   U p d a t e T y p e . s c e n e s 
 
 -                 a s s e r t   U p d a t e T y p e ( 5 )   = =   U p d a t e T y p e . t i m e r s 
 
 +         d e f   t e s t _ u p d a t e _ t y p e _ v a l u e s ( s e l f ) : 
 
 +                 a s s e r t   U p d a t e T y p e . i n f o . n a m e   = =   " i n f o " 
 
 +                 a s s e r t   U p d a t e T y p e . r o l l e r s . n a m e   = =   " r o l l e r s " 
 
 +                 a s s e r t   U p d a t e T y p e . r o o m s . n a m e   = =   " r o o m s " 
 
 +                 a s s e r t   U p d a t e T y p e . s c e n e s . n a m e   = =   " s c e n e s " 
 
 +                 a s s e r t   U p d a t e T y p e . t i m e r s . n a m e   = =   " t i m e r s " 
 
   
 
   
 
   c l a s s   T e s t C o n s t a n t s : 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ e n t i t i e s . p y   b / t e s t s / t e s t _ e n t i t i e s . p y 
 
 n e w   f i l e   m o d e   1 0 0 6 4 4 
 
 i n d e x   0 0 0 0 0 0 0 . . a c f e d b 8 
 
 - - -   / d e v / n u l l 
 
 + + +   b / t e s t s / t e s t _ e n t i t i e s . p y 
 
 @ @   - 0 , 0   + 1 , 5 5   @ @ 
 
 + i m p o r t   a s y n c i o 
 
 + 
 
 + i m p o r t   p y t e s t 
 
 + f r o m   u n i t t e s t . m o c k   i m p o r t   M a g i c M o c k 
 
 + 
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
 + 
 
 + 
 
 + c l a s s   C o n c r e t e E n t i t y ( H u b E n t i t y ) : 
 
 +         " " " C o n c r e t e   i m p l e m e n t a t i o n   f o r   t e s t i n g . " " " 
 
 + 
 
 +         p a s s 
 
 + 
 
 + 
 
 + c l a s s   T e s t H u b E n t i t y : 
 
 +         @ p y t e s t . f i x t u r e 
 
 +         d e f   h u b _ m o c k ( s e l f ) : 
 
 +                 h u b   =   M a g i c M o c k ( ) 
 
 +                 h u b . h o s t   =   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " 
 
 +                 r e t u r n   h u b 
 
 + 
 
 +         @ p y t e s t . f i x t u r e 
 
 +         d e f   e n t i t y ( s e l f ,   h u b _ m o c k ) : 
 
 +                 r e t u r n   C o n c r e t e E n t i t y ( h u b = h u b _ m o c k ,   e n t i t y _ i d = 1 2 3 ) 
 
 + 
 
 +         d e f   t e s t _ i n i t _ w i t h _ i n t _ i d ( s e l f ,   h u b _ m o c k ) : 
 
 +                 e n t i t y   =   C o n c r e t e E n t i t y ( h u b = h u b _ m o c k ,   e n t i t y _ i d = 1 2 3 ) 
 
 +                 a s s e r t   e n t i t y . h u b   = =   h u b _ m o c k 
 
 +                 a s s e r t   e n t i t y . i d   = =   1 2 3 
 
 +                 a s s e r t   e n t i t y . n a m e   i s   N o n e 
 
 +                 a s s e r t   e n t i t y . i c o n   i s   N o n e 
 
 +                 a s s e r t   e n t i t y . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 + 
 
 +         d e f   t e s t _ i n i t _ w i t h _ b y t e s _ i d ( s e l f ,   h u b _ m o c k ) : 
 
 +                 e n t i t y   =   C o n c r e t e E n t i t y ( h u b = h u b _ m o c k ,   e n t i t y _ i d = b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " ) 
 
 +                 a s s e r t   e n t i t y . i d   = =   b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   e n t i t y . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   e n t i t y ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 e n t i t y . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 e n t i t y . n o t i f y _ c a l l b a c k ( ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ e r r o r s . p y   b / t e s t s / t e s t _ e r r o r s . p y 
 
 i n d e x   4 3 9 e 2 7 7 . . 1 4 8 f c e 7   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ e r r o r s . p y 
 
 + + +   b / t e s t s / t e s t _ e r r o r s . p y 
 
 @ @   - 4 1 , 3   + 4 1 , 4 5   @ @   c l a s s   T e s t E r r o r s : 
 
                   a s s e r t   i s s u b c l a s s ( C a n n o t C o n n e c t E x c e p t i o n ,   H u b B a s e E x c e p t i o n ) 
 
                   a s s e r t   i s s u b c l a s s ( I n v a l i d R e s p o n s e E x c e p t i o n ,   H u b B a s e E x c e p t i o n ) 
 
                   a s s e r t   i s s u b c l a s s ( H u b B a s e E x c e p t i o n ,   E x c e p t i o n ) 
 
 + 
 
 + 
 
 + c l a s s   T e s t H u b B a s e E x c e p t i o n : 
 
 +         d e f   t e s t _ b a s i c _ c r e a t i o n ( s e l f ) : 
 
 +                 e x c   =   H u b B a s e E x c e p t i o n ( " t e s t   m e s s a g e " ) 
 
 +                 a s s e r t   s t r ( e x c )   = =   " t e s t   m e s s a g e " 
 
 + 
 
 +         d e f   t e s t _ w i t h _ r e s p o n s e _ c o n t e x t ( s e l f ) : 
 
 +                 r e s p o n s e   =   b " \ x 0 0 \ x 0 1 \ x 0 2 \ x 0 3 " 
 
 +                 e x c   =   H u b B a s e E x c e p t i o n ( " t e s t   m e s s a g e " ,   r e s p o n s e = r e s p o n s e ) 
 
 +                 a s s e r t   e x c . r e s p o n s e   = =   r e s p o n s e 
 
 + 
 
 + 
 
 + c l a s s   T e s t I n v a l i d R e s p o n s e E x c e p t i o n : 
 
 +         d e f   t e s t _ b a s i c _ c r e a t i o n ( s e l f ) : 
 
 +                 e x c   =   I n v a l i d R e s p o n s e E x c e p t i o n ( " i n v a l i d   r e s p o n s e " ) 
 
 +                 a s s e r t   s t r ( e x c )   = =   " i n v a l i d   r e s p o n s e " 
 
 +                 a s s e r t   e x c . r e s p o n s e   i s   N o n e 
 
 + 
 
 +         d e f   t e s t _ w i t h _ r e s p o n s e ( s e l f ) : 
 
 +                 r e s p o n s e   =   b " \ x f f \ x f f \ x f f \ x f f " 
 
 +                 e x c   =   I n v a l i d R e s p o n s e E x c e p t i o n ( " i n v a l i d   h e a d e r " ,   r e s p o n s e = r e s p o n s e ) 
 
 +                 a s s e r t   e x c . r e s p o n s e   = =   r e s p o n s e 
 
 +                 a s s e r t   b " \ x f f \ x f f "   i n   e x c . r e s p o n s e 
 
 + 
 
 + 
 
 + c l a s s   T e s t N o t C o n n e c t e d E x c e p t i o n : 
 
 +         d e f   t e s t _ b a s i c _ c r e a t i o n ( s e l f ) : 
 
 +                 e x c   =   N o t C o n n e c t e d E x c e p t i o n ( " n o t   c o n n e c t e d " ) 
 
 +                 a s s e r t   s t r ( e x c )   = =   " n o t   c o n n e c t e d " 
 
 + 
 
 + 
 
 + c l a s s   T e s t C a n n o t C o n n e c t E x c e p t i o n : 
 
 +         d e f   t e s t _ b a s i c _ c r e a t i o n ( s e l f ) : 
 
 +                 e x c   =   C a n n o t C o n n e c t E x c e p t i o n ( " c o n n e c t i o n   r e f u s e d " ) 
 
 +                 a s s e r t   s t r ( e x c )   = =   " c o n n e c t i o n   r e f u s e d " 
 
 + 
 
 + 
 
 + c l a s s   T e s t N o t R u n n i n g E x c e p t i o n : 
 
 +         d e f   t e s t _ b a s i c _ c r e a t i o n ( s e l f ) : 
 
 +                 e x c   =   N o t R u n n i n g E x c e p t i o n ( " n o t   r u n n i n g " ) 
 
 +                 a s s e r t   s t r ( e x c )   = =   " n o t   r u n n i n g " 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ h u b . p y   b / t e s t s / t e s t _ h u b . p y 
 
 i n d e x   9 4 e a 1 2 b . . 0 1 a 7 f d 2   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ h u b . p y 
 
 + + +   b / t e s t s / t e s t _ h u b . p y 
 
 @ @   - 1 , 4   + 1 , 5   @ @ 
 
   i m p o r t   a s y n c i o 
 
 + i m p o r t   w a r n i n g s 
 
   f r o m   u n i t t e s t . m o c k   i m p o r t   A s y n c M o c k ,   M a g i c M o c k ,   P r o p e r t y M o c k ,   p a t c h ,   c a l l 
 
   
 
   i m p o r t   p y t e s t 
 
 @ @   - 3 0 , 7   + 3 1 , 7   @ @   c l a s s   T e s t H u b I n i t : 
 
                   a s s e r t   h u b . r o o m s   = =   { } 
 
                   a s s e r t   h u b . s c e n e s   = =   { } 
 
                   a s s e r t   h u b . t i m e r s   = =   { } 
 
 -                 a s s e r t   h u b . u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 +                 a s s e r t   h u b . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
   
 
           d e f   t e s t _ i n i t _ w i t h o u t _ h o s t ( s e l f ,   e v e n t _ l o o p ) : 
 
                   m o c k _ t r a n s p o r t   =   M a g i c M o c k ( s p e c = a i o p u l s e . t r a n s p o r t . H u b T r a n s p o r t T c p ) 
 
 @ @   - 5 0 , 4 8   + 5 1 , 4 6   @ @   c l a s s   T e s t H u b I n i t : 
 
                   a s s e r t   " v 1 . 0 "   i n   r e s u l t 
 
   
 
   
 
 + c l a s s   T e s t H u b D e p r e c a t i o n : 
 
 +         d e f   t e s t _ l o o p _ p a r a m e t e r _ d e p r e c a t i o n ( s e l f ,   e v e n t _ l o o p ,   m o c k _ t r a n s p o r t ) : 
 
 +                 " " " P a s s i n g   l o o p   p a r a m e t e r   s h o u l d   e m i t   D e p r e c a t i o n W a r n i n g . " " " 
 
 +                 w i t h   p a t c h . o b j e c t ( a i o p u l s e . t r a n s p o r t ,   " H u b T r a n s p o r t T c p " ,   r e t u r n _ v a l u e = m o c k _ t r a n s p o r t ) : 
 
 +                         w i t h   w a r n i n g s . c a t c h _ w a r n i n g s ( r e c o r d = T r u e )   a s   w : 
 
 +                                 w a r n i n g s . s i m p l e f i l t e r ( " a l w a y s " ) 
 
 +                                 H u b ( h o s t = " 1 9 2 . 1 6 8 . 1 . 1 0 0 " ,   l o o p = e v e n t _ l o o p ) 
 
 +                                 a s s e r t   l e n ( w )   = =   1 
 
 +                                 a s s e r t   i s s u b c l a s s ( w [ 0 ] . c a t e g o r y ,   D e p r e c a t i o n W a r n i n g ) 
 
 +                                 a s s e r t   " l o o p   p a r a m e t e r   i s   d e p r e c a t e d "   i n   s t r ( w [ 0 ] . m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ n o _ l o o p _ n o _ w a r n i n g ( s e l f ,   m o c k _ t r a n s p o r t ) : 
 
 +                 " " " W h e n   l o o p   i s   N o n e   a n d   g e t _ r u n n i n g _ l o o p   s u c c e e d s ,   n o   d e p r e c a t i o n   w a r n i n g . " " " 
 
 +                 w i t h   p a t c h . o b j e c t ( a i o p u l s e . t r a n s p o r t ,   " H u b T r a n s p o r t T c p " ,   r e t u r n _ v a l u e = m o c k _ t r a n s p o r t ) : 
 
 +                         w i t h   p a t c h ( " a s y n c i o . g e t _ r u n n i n g _ l o o p " )   a s   m o c k _ g e t _ l o o p : 
 
 +                                 m o c k _ g e t _ l o o p . r e t u r n _ v a l u e   =   M a g i c M o c k ( ) 
 
 +                                 w i t h   w a r n i n g s . c a t c h _ w a r n i n g s ( r e c o r d = T r u e )   a s   w : 
 
 +                                         w a r n i n g s . s i m p l e f i l t e r ( " a l w a y s " ) 
 
 +                                         H u b ( h o s t = " 1 9 2 . 1 6 8 . 1 . 1 0 0 " ) 
 
 +                                         a s s e r t   l e n ( w )   = =   0 
 
 +                                         m o c k _ g e t _ l o o p . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 + 
 
 + 
 
   c l a s s   T e s t H u b C a l l b a c k s : 
 
           d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   h u b ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   h u b . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   i n   h u b . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   i n   h u b . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   h u b ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 h u b . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 h u b . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
                   h u b . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   n o t   i n   h u b . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   h u b . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   h u b ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 h u b . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 h u b . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
                   h u b . n o t i f y _ c a l l b a c k ( c o n s t . U p d a t e T y p e . i n f o ) 
 
 -                 h u b . a s y n c _ a d d _ j o b . a s s e r t _ c a l l e d _ w i t h ( c a l l b a c k ,   c o n s t . U p d a t e T y p e . i n f o ) 
 
 - 
 
 - 
 
 - c l a s s   T e s t H u b A s y n c A d d J o b : 
 
 -         d e f   t e s t _ a s y n c _ a d d _ j o b _ c o r o u t i n e ( s e l f ,   h u b ) : 
 
 -                 a s y n c   d e f   f a k e _ c o r o ( ) : 
 
 -                         p a s s 
 
 - 
 
 -                 c o r o   =   f a k e _ c o r o ( ) 
 
 -                 t a s k   =   h u b . a s y n c _ a d d _ j o b ( c o r o ) 
 
 -                 a s s e r t   t a s k   i s   n o t   N o n e 
 
 -                 c o r o . c l o s e ( ) 
 
 - 
 
 -         d e f   t e s t _ a s y n c _ a d d _ j o b _ c o r o u t i n e _ f u n c t i o n ( s e l f ,   h u b ) : 
 
 -                 a s y n c   d e f   f a k e _ f u n c ( ) : 
 
 -                         p a s s 
 
 - 
 
 -                 t a s k   =   h u b . a s y n c _ a d d _ j o b ( f a k e _ f u n c ) 
 
 -                 a s s e r t   t a s k   i s   n o t   N o n e 
 
 - 
 
 -         d e f   t e s t _ a s y n c _ a d d _ j o b _ r e g u l a r _ f u n c t i o n ( s e l f ,   h u b ) : 
 
 -                 d e f   f a k e _ f u n c ( ) : 
 
 -                         p a s s 
 
 - 
 
 -                 t a s k   =   h u b . a s y n c _ a d d _ j o b ( f a k e _ f u n c ) 
 
 -                 a s s e r t   t a s k   i s   n o t   N o n e 
 
 +                 h u b . _ s c h e d u l e _ c a l l b a c k . a s s e r t _ c a l l e d _ w i t h ( c a l l b a c k ,   c o n s t . U p d a t e T y p e . i n f o ) 
 
   
 
   
 
   c l a s s   T e s t H u b C o n n e c t : 
 
 @ @   - 4 0 4 , 6   + 4 0 3 , 6 8   @ @   c l a s s   T e s t H u b R e s p o n s e H a n d l e r s : 
 
                   a s s e r t   r o l l e r _ m o c k . b a t t e r y   = =   1 9 
 
   
 
   
 
 + c l a s s   T e s t H u b B o u n d s C h e c k i n g : 
 
 +         d e f   t e s t _ r e s p o n s e _ h u b i n f o _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ h u b i n f o   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   9     #   l e s s   t h a n   1 0   b y t e s 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ h u b i n f o ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ r o l l e r _ u p d a t e d _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ r o l l e r _ u p d a t e d   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   9 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ r o l l e r _ u p d a t e d ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ r o o m l i s t _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ r o o m l i s t   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ r o o m l i s t ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ r o l l e r l i s t _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ r o l l e r l i s t   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ r o l l e r l i s t ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ s c e n e l i s t _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ s c e n e l i s t   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ s c e n e l i s t ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ t i m e r l i s t _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ t i m e r l i s t   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ t i m e r l i s t ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ a u t h i n f o _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ a u t h i n f o   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 4 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ a u t h i n f o ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ p o s i t i o n _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ p o s i t i o n   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ p o s i t i o n ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ r o l l e r h e a l t h _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ r o l l e r h e a l t h   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   1 1 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ r o l l e r h e a l t h ( s h o r t _ m e s s a g e ) 
 
 + 
 
 +         d e f   t e s t _ r e s p o n s e _ d i s c o v e r _ t o o _ s h o r t ( s e l f ,   h u b ) : 
 
 +                 " " " r e s p o n s e _ d i s c o v e r   s h o u l d   r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n   i f   m e s s a g e   t o o   s h o r t . " " " 
 
 +                 s h o r t _ m e s s a g e   =   b " \ x 0 0 "   *   9 
 
 +                 w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 +                         h u b . r e s p o n s e _ d i s c o v e r ( s h o r t _ m e s s a g e ) 
 
 + 
 
 + 
 
   c l a s s   T e s t H u b R e c M e s s a g e : 
 
           d e f   t e s t _ r e c _ m e s s a g e _ i n v a l i d _ f i r s t _ b y t e ( s e l f ,   h u b ) : 
 
                   w i t h   p y t e s t . r a i s e s ( I n v a l i d R e s p o n s e E x c e p t i o n ) : 
 
 @ @   - 6 1 3 , 6   + 6 7 4 , 3 0   @ @   c l a s s   T e s t H u b R u n S t o p : 
 
                   a s s e r t   h u b . r u n n i n g   i s   F a l s e 
 
                   h u b . d i s c o n n e c t . a s s e r t _ c a l l e d _ o n c e ( ) 
 
   
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ r u n _ i n v a l i d _ r e s p o n s e _ d i s c o n n e c t s ( s e l f ,   h u b ,   m o c k _ t r a n s p o r t ) : 
 
 +                 " " " I n v a l i d R e s p o n s e E x c e p t i o n   d u r i n g   c o n n e c t   s h o u l d   c a l l   d i s c o n n e c t . " " " 
 
 +                 h u b . h a n d s h a k e . c l e a r ( ) 
 
 + 
 
 +                 a s y n c   d e f   c o n n e c t _ a n d _ s t o p ( ) : 
 
 +                         h u b . r u n n i n g   =   F a l s e 
 
 +                         r a i s e   I n v a l i d R e s p o n s e E x c e p t i o n ( " t e s t " ) 
 
 + 
 
 +                 h u b . c o n n e c t   =   A s y n c M o c k ( s i d e _ e f f e c t = c o n n e c t _ a n d _ s t o p ) 
 
 +                 h u b . d i s c o n n e c t   =   A s y n c M o c k ( ) 
 
 +                 m o c k _ t r a n s p o r t . c l o s e   =   A s y n c M o c k ( ) 
 
 + 
 
 +                 a w a i t   h u b . r u n ( ) 
 
 +                 h u b . d i s c o n n e c t . a s s e r t _ c a l l e d ( ) 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ r u n _ i n v a l i d _ r e s p o n s e _ n o _ d u p l i c a t e _ c a t c h ( s e l f ,   h u b ,   m o c k _ t r a n s p o r t ) : 
 
 +                 " " " O n l y   o n e   I n v a l i d R e s p o n s e E x c e p t i o n   c a t c h   b l o c k   s h o u l d   e x i s t   i n   r u n ( ) . " " " 
 
 +                 i m p o r t   i n s p e c t 
 
 +                 s o u r c e   =   i n s p e c t . g e t s o u r c e ( h u b . r u n ) 
 
 +                 c o u n t   =   s o u r c e . c o u n t ( " e x c e p t   e r r o r s . I n v a l i d R e s p o n s e E x c e p t i o n " ) 
 
 +                 a s s e r t   c o u n t   = =   1 ,   f " E x p e c t e d   1   I n v a l i d R e s p o n s e E x c e p t i o n   c a t c h ,   f o u n d   { c o u n t } " 
 
 + 
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ s t o p _ a l r e a d y _ s t o p p e d ( s e l f ,   h u b ) : 
 
                   h u b . r u n n i n g   =   F a l s e 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ r o l l e r . p y   b / t e s t s / t e s t _ r o l l e r . p y 
 
 i n d e x   1 a 5 6 b 8 d . . e e 7 2 6 0 f   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ r o l l e r . p y 
 
 + + +   b / t e s t s / t e s t _ r o l l e r . p y 
 
 @ @   - 1 1 , 7   + 1 1 , 7   @ @   c l a s s   T e s t R o l l e r : 
 
           d e f   h u b _ m o c k ( s e l f ) : 
 
                   h u b   =   M a g i c M o c k ( ) 
 
                   h u b . h o s t   =   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " 
 
 -                 h u b . a s y n c _ a d d _ j o b   =   M a g i c M o c k ( r e t u r n _ v a l u e = M a g i c M o c k ( ) ) 
 
 +                 h u b . _ s c h e d u l e _ c a l l b a c k   =   M a g i c M o c k ( r e t u r n _ v a l u e = M a g i c M o c k ( ) ) 
 
                   r e t u r n   h u b 
 
   
 
           @ p y t e s t . f i x t u r e 
 
 @ @   - 3 1 , 7   + 3 1 , 1 1   @ @   c l a s s   T e s t R o l l e r : 
 
                   a s s e r t   r o l l e r . b a t t e r y   i s   N o n e 
 
                   a s s e r t   r o l l e r . c l o s e d _ p e r c e n t   i s   N o n e 
 
                   a s s e r t   r o l l e r . f l a g s   = =   0 
 
 -                 a s s e r t   r o l l e r . u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 +                 a s s e r t   r o l l e r . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 + 
 
 +         d e f   t e s t _ i n i t _ i n h e r i t s _ h u b _ e n t i t y ( s e l f ,   r o l l e r ) : 
 
 +                 a s s e r t   r o l l e r . h u b   i s   n o t   N o n e 
 
 +                 a s s e r t   r o l l e r . i d   = =   1 2 3 
 
   
 
           d e f   t e s t _ s t r ( s e l f ,   r o l l e r ) : 
 
                   r o l l e r . n a m e   =   " T e s t   B l i n d " 
 
 @ @   - 5 4 , 2 4   + 5 8 , 2 5   @ @   c l a s s   T e s t R o l l e r : 
 
           d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   r o l l e r ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   r o l l e r . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   i n   r o l l e r . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   i n   r o l l e r . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   r o l l e r ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 r o l l e r . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 r o l l e r . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
                   r o l l e r . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   n o t   i n   r o l l e r . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   r o l l e r . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e _ n o t _ f o u n d ( s e l f ,   r o l l e r ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   r o l l e r . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   r o l l e r . u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 +                 a s s e r t   r o l l e r . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
   
 
           d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   r o l l e r ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 r o l l e r . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 -                 r o l l e r . n o t i f y _ c a l l b a c k ( ) 
 
 -                 r o l l e r . h u b . a s y n c _ a d d _ j o b . a s s e r t _ c a l l e d _ w i t h ( c a l l b a c k ) 
 
 +                 r o l l e r . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 w i t h   p a t c h . o b j e c t ( r o l l e r ,   " _ s c h e d u l e _ c a l l b a c k " )   a s   m o c k _ s c h e d u l e : 
 
 +                         r o l l e r . n o t i f y _ c a l l b a c k ( ) 
 
 +                         m o c k _ s c h e d u l e . a s s e r t _ c a l l e d _ o n c e _ w i t h ( c a l l b a c k ) 
 
   
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ m o v e _ t o ( s e l f ,   r o l l e r ) : 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ r o o m . p y   b / t e s t s / t e s t _ r o o m . p y 
 
 i n d e x   6 5 f c 0 2 7 . . b d 6 0 8 1 c   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ r o o m . p y 
 
 + + +   b / t e s t s / t e s t _ r o o m . p y 
 
 @ @   - 3 , 6   + 3 , 7   @ @   f r o m   u n i t t e s t . m o c k   i m p o r t   A s y n c M o c k ,   M a g i c M o c k 
 
   i m p o r t   p y t e s t 
 
   
 
   f r o m   a i o p u l s e . r o o m   i m p o r t   R o o m 
 
 + f r o m   a i o p u l s e . e n t i t i e s   i m p o r t   H u b E n t i t y 
 
   
 
   
 
   c l a s s   T e s t R o o m : 
 
 @ @   - 1 0 , 1 9   + 1 1 , 2 2   @ @   c l a s s   T e s t R o o m : 
 
           d e f   h u b _ m o c k ( s e l f ) : 
 
                   h u b   =   M a g i c M o c k ( ) 
 
                   h u b . h o s t   =   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " 
 
 -                 h u b . a s y n c _ a d d _ j o b   =   M a g i c M o c k ( ) 
 
 +                 h u b . _ s c h e d u l e _ c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   r e t u r n   h u b 
 
   
 
           @ p y t e s t . f i x t u r e 
 
           d e f   r o o m ( s e l f ,   h u b _ m o c k ) : 
 
 -                 r   =   R o o m ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " ) 
 
 -                 r e t u r n   r 
 
 +                 r e t u r n   R o o m ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " ) 
 
   
 
           d e f   t e s t _ i n i t ( s e l f ,   r o o m ) : 
 
                   a s s e r t   r o o m . i d   = =   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " 
 
                   a s s e r t   r o o m . i c o n   i s   N o n e 
 
                   a s s e r t   r o o m . n a m e   i s   N o n e 
 
 -                 a s s e r t   r o o m . u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 +                 a s s e r t   r o o m . h u b   i s   n o t   N o n e 
 
 +                 a s s e r t   r o o m . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 + 
 
 +         d e f   t e s t _ i n h e r i t s _ f r o m _ h u b _ e n t i t y ( s e l f ,   r o o m ) : 
 
 +                 a s s e r t   i s i n s t a n c e ( r o o m ,   H u b E n t i t y ) 
 
   
 
           d e f   t e s t _ s t r ( s e l f ,   r o o m ) : 
 
                   r o o m . n a m e   =   " L i v i n g   R o o m " 
 
 @ @   - 3 4 , 2 8   + 3 8 , 2 2   @ @   c l a s s   T e s t R o o m : 
 
           d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   r o o m ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   r o o m . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   i n   r o o m . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   i n   r o o m . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   r o o m ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 r o o m . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 r o o m . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
                   r o o m . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   c a l l b a c k   n o t   i n   r o o m . u p d a t e _ c a l l b a c k s 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   r o o m . _ u p d a t e _ c a l l b a c k s 
 
   
 
           d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e _ n o t _ f o u n d ( s e l f ,   r o o m ) : 
 
                   c a l l b a c k   =   M a g i c M o c k ( ) 
 
                   r o o m . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 -                 a s s e r t   r o o m . u p d a t e _ c a l l b a c k s   = =   [ ] 
 
 - 
 
 -         d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   r o o m ) : 
 
 -                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 -                 r o o m . u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 -                 r o o m . n o t i f y _ c a l l b a c k ( ) 
 
 -                 r o o m . h u b . a s y n c _ a d d _ j o b . a s s e r t _ c a l l e d _ w i t h ( c a l l b a c k ) 
 
 +                 a s s e r t   r o o m . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
   
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ m o v e _ t o ( s e l f ,   r o o m ) : 
 
 -                 r o o m . i d   =   1     #   p a c k _ i n t   n e e d s   i n t ,   n o t   b y t e s 
 
 +                 r o o m . i d   =   1 
 
                   r o o m . h u b . s e n d _ c o m m a n d   =   A s y n c M o c k ( ) 
 
                   a w a i t   r o o m . m o v e _ t o ( 5 0 ) 
 
                   r o o m . h u b . s e n d _ c o m m a n d . a s s e r t _ a w a i t e d _ o n c e ( ) 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ s c e n e . p y   b / t e s t s / t e s t _ s c e n e . p y 
 
 i n d e x   4 0 1 7 3 8 c . . 4 a 9 5 9 5 6   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ s c e n e . p y 
 
 + + +   b / t e s t s / t e s t _ s c e n e . p y 
 
 @ @   - 1 , 3   + 1 , 7   @ @ 
 
 + i m p o r t   a s y n c i o 
 
 + 
 
 + f r o m   u n i t t e s t . m o c k   i m p o r t   M a g i c M o c k 
 
 + 
 
   i m p o r t   p y t e s t 
 
   
 
   f r o m   a i o p u l s e . s c e n e   i m p o r t   S c e n e 
 
 @ @   - 6 , 2 4   + 1 0 , 4 2   @ @   f r o m   a i o p u l s e . s c e n e   i m p o r t   S c e n e 
 
   c l a s s   T e s t S c e n e : 
 
           @ p y t e s t . f i x t u r e 
 
           d e f   h u b _ m o c k ( s e l f ) : 
 
 -                 r e t u r n   t y p e ( " H u b M o c k " ,   ( ) ,   { " h o s t " :   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " } ) ( ) 
 
 +                 h u b   =   M a g i c M o c k ( ) 
 
 +                 h u b . h o s t   =   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " 
 
 +                 r e t u r n   h u b 
 
   
 
           @ p y t e s t . f i x t u r e 
 
           d e f   s c e n e ( s e l f ,   h u b _ m o c k ) : 
 
 -                 r e t u r n   S c e n e ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " ) 
 
 +                 r e t u r n   S c e n e ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " ) 
 
   
 
           d e f   t e s t _ i n i t ( s e l f ,   s c e n e ) : 
 
 -                 a s s e r t   s c e n e . i d   = =   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " 
 
 -                 a s s e r t   s c e n e . i c o n   i s   N o n e 
 
 +                 a s s e r t   s c e n e . i d   = =   b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " 
 
                   a s s e r t   s c e n e . n a m e   i s   N o n e 
 
 +                 a s s e r t   s c e n e . i c o n   i s   N o n e 
 
 +                 a s s e r t   s c e n e . h u b   i s   n o t   N o n e 
 
 +                 a s s e r t   s c e n e . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
   
 
 -         d e f   t e s t _ s t r _ w i t h _ v a l u e s ( s e l f ,   s c e n e ) : 
 
 -                 s c e n e . n a m e   =   " T e s t   S c e n e " 
 
 -                 s c e n e . i c o n   =   3 
 
 +         d e f   t e s t _ s t r ( s e l f ,   s c e n e ) : 
 
 +                 s c e n e . n a m e   =   " M o v i e   N i g h t " 
 
 +                 s c e n e . i c o n   =   5 
 
                   r e s u l t   =   s t r ( s c e n e ) 
 
 -                 a s s e r t   " T e s t   S c e n e "   i n   r e s u l t 
 
 -                 a s s e r t   " I c o n :   3 "   i n   r e s u l t 
 
 +                 a s s e r t   " M o v i e   N i g h t "   i n   r e s u l t 
 
   
 
 -         d e f   t e s t _ s t r _ n o _ n a m e ( s e l f ,   s c e n e ) : 
 
 -                 r e s u l t   =   s t r ( s c e n e ) 
 
 -                 a s s e r t   " N o n e "   i n   r e s u l t   o r   " N a m e :   N o n e "   i n   r e s u l t 
 
 +         d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   s c e n e ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 s c e n e . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   i n   s c e n e . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   s c e n e ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 s c e n e . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 s c e n e . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   s c e n e . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   s c e n e ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 s c e n e . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 s c e n e . n o t i f y _ c a l l b a c k ( ) 
 
 +                 a w a i t   a s y n c i o . s l e e p ( 0 . 1 ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ t i m e r . p y   b / t e s t s / t e s t _ t i m e r . p y 
 
 i n d e x   5 1 b 5 e c b . . 4 a 5 1 0 9 1   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ t i m e r . p y 
 
 + + +   b / t e s t s / t e s t _ t i m e r . p y 
 
 @ @   - 1 , 3   + 1 , 6   @ @ 
 
 + #   t e s t s / t e s t _ t i m e r . p y 
 
 + f r o m   u n i t t e s t . m o c k   i m p o r t   M a g i c M o c k 
 
 + 
 
   i m p o r t   p y t e s t 
 
   
 
   f r o m   a i o p u l s e . t i m e r   i m p o r t   T i m e r 
 
 @ @   - 6 , 4 6   + 9 , 6 9   @ @   f r o m   a i o p u l s e . t i m e r   i m p o r t   T i m e r 
 
   c l a s s   T e s t T i m e r : 
 
           @ p y t e s t . f i x t u r e 
 
           d e f   h u b _ m o c k ( s e l f ) : 
 
 -                 h u b   =   t y p e ( " H u b M o c k " ,   ( ) ,   { " h o s t " :   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " } ) ( ) 
 
 -                 h u b . r o l l e r s   =   { } 
 
 -                 h u b . s c e n e s   =   { } 
 
 +                 h u b   =   M a g i c M o c k ( ) 
 
 +                 h u b . h o s t   =   " 1 9 2 . 1 6 8 . 1 . 1 0 0 " 
 
                   r e t u r n   h u b 
 
   
 
           @ p y t e s t . f i x t u r e 
 
           d e f   t i m e r ( s e l f ,   h u b _ m o c k ) : 
 
 -                 r e t u r n   T i m e r ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " ) 
 
 +                 r e t u r n   T i m e r ( h u b _ m o c k ,   b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " ) 
 
   
 
           d e f   t e s t _ i n i t ( s e l f ,   t i m e r ) : 
 
 -                 a s s e r t   t i m e r . i d   = =   b " \ x 0 1 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 \ x 0 0 " 
 
 -                 a s s e r t   t i m e r . i c o n   i s   N o n e 
 
 +                 a s s e r t   t i m e r . i d   = =   b " \ x 0 1 \ x 0 2 \ x 0 3 \ x 0 4 " 
 
                   a s s e r t   t i m e r . n a m e   i s   N o n e 
 
 +                 a s s e r t   t i m e r . i c o n   i s   N o n e 
 
                   a s s e r t   t i m e r . s t a t e   i s   N o n e 
 
                   a s s e r t   t i m e r . h o u r   i s   N o n e 
 
                   a s s e r t   t i m e r . m i n u t e   i s   N o n e 
 
                   a s s e r t   t i m e r . d a y s   i s   N o n e 
 
                   a s s e r t   t i m e r . e n t i t y   i s   N o n e 
 
 +                 a s s e r t   t i m e r . h u b   i s   n o t   N o n e 
 
 +                 a s s e r t   t i m e r . _ u p d a t e _ c a l l b a c k s   = =   [ ] 
 
   
 
 -         d e f   t e s t _ s t r _ a l l _ f i e l d s ( s e l f ,   t i m e r ) : 
 
 -                 t i m e r . n a m e   =   " M o r n i n g " 
 
 -                 t i m e r . i c o n   =   5 
 
 +         d e f   t e s t _ s t r ( s e l f ,   t i m e r ) : 
 
 +                 t i m e r . n a m e   =   " M o r n i n g   T i m e r " 
 
 +                 t i m e r . i c o n   =   2 
 
                   t i m e r . s t a t e   =   1 
 
                   t i m e r . h o u r   =   7 
 
                   t i m e r . m i n u t e   =   3 0 
 
 -                 t i m e r . d a y s   =   0 b 0 1 1 1 1 1 1 1 
 
 +                 t i m e r . d a y s   =   0 b 0 1 1 1 1 1 0 
 
                   r e s u l t   =   s t r ( t i m e r ) 
 
 -                 a s s e r t   " M o r n i n g "   i n   r e s u l t 
 
 -                 a s s e r t   " S t a t e :   1 "   i n   r e s u l t 
 
 -                 a s s e r t   " T i m e :   7 : 3 0 "   i n   r e s u l t 
 
 -                 a s s e r t   " E n t i t y :   N o n e "   i n   r e s u l t 
 
 - 
 
 -         d e f   t e s t _ s t r _ w i t h _ e n t i t y ( s e l f ,   t i m e r ,   h u b _ m o c k ) : 
 
 -                 r o l l e r _ m o c k   =   t y p e ( " R o l l e r M o c k " ,   ( ) ,   { " n a m e " :   " L i v i n g   R o o m " } ) ( ) 
 
 -                 t i m e r . e n t i t y   =   r o l l e r _ m o c k 
 
 -                 t i m e r . n a m e   =   " T e s t " 
 
 -                 t i m e r . i c o n   =   1 
 
 -                 t i m e r . s t a t e   =   1 
 
 -                 t i m e r . h o u r   =   8 
 
 -                 t i m e r . m i n u t e   =   0 
 
 -                 t i m e r . d a y s   =   0 
 
 +                 a s s e r t   " M o r n i n g   T i m e r "   i n   r e s u l t 
 
 +                 a s s e r t   " 7 : 3 0 "   i n   r e s u l t 
 
 + 
 
 +         d e f   t e s t _ s t r _ w i t h _ e n t i t y ( s e l f ,   t i m e r ) : 
 
 +                 t i m e r . n a m e   =   " M o r n i n g   T i m e r " 
 
 +                 t i m e r . e n t i t y   =   M a g i c M o c k ( ) 
 
 +                 t i m e r . e n t i t y . n a m e   =   " L i v i n g   R o o m   B l i n d " 
 
 +                 r e s u l t   =   s t r ( t i m e r ) 
 
 +                 a s s e r t   " L i v i n g   R o o m   B l i n d "   i n   r e s u l t 
 
 + 
 
 +         d e f   t e s t _ s t r _ w i t h o u t _ e n t i t y ( s e l f ,   t i m e r ) : 
 
 +                 t i m e r . n a m e   =   " M o r n i n g   T i m e r " 
 
                   r e s u l t   =   s t r ( t i m e r ) 
 
 -                 a s s e r t   " L i v i n g   R o o m "   i n   r e s u l t 
 
 +                 a s s e r t   " N o n e "   i n   r e s u l t 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ s u b s c r i b e ( s e l f ,   t i m e r ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 t i m e r . c a l l b a c k _ s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   i n   t i m e r . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ c a l l b a c k _ u n s u b s c r i b e ( s e l f ,   t i m e r ) : 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 t i m e r . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 +                 t i m e r . c a l l b a c k _ u n s u b s c r i b e ( c a l l b a c k ) 
 
 +                 a s s e r t   c a l l b a c k   n o t   i n   t i m e r . _ u p d a t e _ c a l l b a c k s 
 
 + 
 
 +         d e f   t e s t _ n o t i f y _ c a l l b a c k ( s e l f ,   t i m e r ) : 
 
 +                 i m p o r t   a s y n c i o 
 
 + 
 
 +                 c a l l b a c k   =   M a g i c M o c k ( ) 
 
 +                 t i m e r . _ u p d a t e _ c a l l b a c k s . a p p e n d ( c a l l b a c k ) 
 
 + 
 
 +                 a s y n c   d e f   r u n ( ) : 
 
 +                         t i m e r . n o t i f y _ c a l l b a c k ( ) 
 
 +                         a w a i t   a s y n c i o . s l e e p ( 0 ) 
 
 + 
 
 +                 a s y n c i o . r u n ( r u n ( ) ) 
 
 +                 c a l l b a c k . a s s e r t _ c a l l e d _ o n c e ( ) 
 
 d i f f   - - g i t   a / t e s t s / t e s t _ t r a n s p o r t . p y   b / t e s t s / t e s t _ t r a n s p o r t . p y 
 
 i n d e x   c 2 7 6 2 6 3 . . 9 b 2 7 c a 1   1 0 0 6 4 4 
 
 - - -   a / t e s t s / t e s t _ t r a n s p o r t . p y 
 
 + + +   b / t e s t s / t e s t _ t r a n s p o r t . p y 
 
 @ @   - 4 8 , 7   + 4 8 , 7   @ @   c l a s s   T e s t H u b T r a n s p o r t U d p : 
 
   
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ c o n n e c t ( s e l f ,   u d p ) : 
 
 -                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ e v e n t _ l o o p " )   a s   m o c k _ g e t _ l o o p : 
 
 +                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ r u n n i n g _ l o o p " )   a s   m o c k _ g e t _ l o o p : 
 
                           m o c k _ l o o p   =   M a g i c M o c k ( ) 
 
                           m o c k _ g e t _ l o o p . r e t u r n _ v a l u e   =   m o c k _ l o o p 
 
                           m o c k _ l o o p . c r e a t e _ d a t a g r a m _ e n d p o i n t   =   A s y n c M o c k ( 
 
 @ @   - 7 0 , 6   + 7 0 , 1 1   @ @   c l a s s   T e s t H u b T r a n s p o r t U d p : 
 
                   u d p . s e n d ( b " t e s t " ) 
 
                   u d p . t r a n s p o r t . s e n d t o . a s s e r t _ c a l l e d _ o n c e _ w i t h ( b " t e s t " ,   ( " 1 9 2 . 1 6 8 . 1 . 1 0 0 " ,   1 2 4 1 4 ) ) 
 
   
 
 +         d e f   t e s t _ s e n d _ n o t _ c o n n e c t e d ( s e l f ,   u d p ) : 
 
 +                 u d p . t r a n s p o r t   =   N o n e 
 
 +                 w i t h   p y t e s t . r a i s e s ( N o t C o n n e c t e d E x c e p t i o n ) : 
 
 +                         u d p . s e n d ( b " t e s t " ) 
 
 + 
 
           d e f   t e s t _ s e n d _ u s e s _ h o s t _ p o r t ( s e l f ,   u d p ) : 
 
                   u d p . t r a n s p o r t   =   M a g i c M o c k ( ) 
 
                   u d p . h o s t   =   " 1 0 . 0 . 0 . 5 " 
 
 @ @   - 7 9 , 6   + 8 4 , 7   @ @   c l a s s   T e s t H u b T r a n s p o r t U d p : 
 
   
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ r e c e i v e ( s e l f ,   u d p ) : 
 
 +                 u d p . t r a n s p o r t   =   M a g i c M o c k ( ) 
 
                   e x p e c t e d   =   ( b " r e s p o n s e " ,   ( " 1 9 2 . 1 6 8 . 1 . 1 0 0 " ,   1 2 4 1 4 ) ) 
 
                   u d p . r e c e i v e _ q u e u e . p u t _ n o w a i t ( e x p e c t e d ) 
 
                   r e s u l t   =   a w a i t   u d p . r e c e i v e ( ) 
 
 @ @   - 8 9 , 1 2   + 9 5 , 1 8   @ @   c l a s s   T e s t H u b T r a n s p o r t U d p : 
 
                   r e s u l t   =   u d p . r e c e i v e _ q u e u e . g e t _ n o w a i t ( ) 
 
                   a s s e r t   r e s u l t   = =   ( b " d a t a " ,   ( " 1 . 2 . 3 . 4 " ,   5 6 7 8 ) ) 
 
   
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ r e c e i v e _ n o t _ c o n n e c t e d ( s e l f ,   u d p ) : 
 
 +                 u d p . t r a n s p o r t   =   N o n e 
 
 +                 w i t h   p y t e s t . r a i s e s ( N o t C o n n e c t e d E x c e p t i o n ) : 
 
 +                         a w a i t   u d p . r e c e i v e ( ) 
 
 + 
 
   
 
   c l a s s   T e s t H u b T r a n s p o r t U d p B r o a d c a s t : 
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ c o n n e c t ( s e l f ) : 
 
                   t r a n s p o r t   =   H u b T r a n s p o r t U d p B r o a d c a s t ( ) 
 
 -                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ e v e n t _ l o o p " )   a s   m o c k _ g e t _ l o o p ,   \ 
 
 +                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ r u n n i n g _ l o o p " )   a s   m o c k _ g e t _ l o o p ,   \ 
 
                             p a t c h ( " s o c k e t . s o c k e t " )   a s   m o c k _ s o c k e t : 
 
                           m o c k _ l o o p   =   M a g i c M o c k ( ) 
 
                           m o c k _ g e t _ l o o p . r e t u r n _ v a l u e   =   m o c k _ l o o p 
 
 @ @   - 1 2 5 , 7   + 1 3 7 , 7   @ @   c l a s s   T e s t H u b T r a n s p o r t T c p : 
 
   
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ d o _ c o n n e c t i o n ( s e l f ,   t c p ) : 
 
 -                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ e v e n t _ l o o p " )   a s   m o c k _ g e t _ l o o p : 
 
 +                 w i t h   p a t c h . o b j e c t ( a s y n c i o ,   " g e t _ r u n n i n g _ l o o p " )   a s   m o c k _ g e t _ l o o p : 
 
                           m o c k _ l o o p   =   M a g i c M o c k ( ) 
 
                           m o c k _ g e t _ l o o p . r e t u r n _ v a l u e   =   m o c k _ l o o p 
 
                           m o c k _ l o o p . c r e a t e _ c o n n e c t i o n   =   A s y n c M o c k ( 
 
 @ @   - 2 1 1 , 6   + 2 2 3 , 1 3   @ @   c l a s s   T e s t H u b T r a n s p o r t T c p : 
 
                   w i t h   p y t e s t . r a i s e s ( N o t C o n n e c t e d E x c e p t i o n ) : 
 
                           a w a i t   t c p . r e c e i v e ( ) 
 
   
 
 +         @ p y t e s t . m a r k . a s y n c i o 
 
 +         a s y n c   d e f   t e s t _ r e c e i v e _ n o t _ c o n n e c t e d ( s e l f ,   t c p ) : 
 
 +                 t c p . w r i t e r   =   N o n e 
 
 +                 t c p . r e a d e r   =   N o n e 
 
 +                 w i t h   p y t e s t . r a i s e s ( N o t C o n n e c t e d E x c e p t i o n ) : 
 
 +                         a w a i t   t c p . r e c e i v e ( ) 
 
 + 
 
           @ p y t e s t . m a r k . a s y n c i o 
 
           a s y n c   d e f   t e s t _ c l o s e _ w i t h _ w r i t e r ( s e l f ,   t c p ) : 
 
                   m o c k _ w r i t e r   =   M a g i c M o c k ( ) 
 
 