def thread(self):
        """Extract thread name if available (lazy)."""
        if not self._thread_calculated:
            self._thread_calculated = True

            split_tokens = self.split_tokens

            if not self.datetime_nextpos:
                return None
            if len(split_tokens) <= self.datetime_nextpos:
                return None

            connection_token = split_tokens[self.datetime_nextpos]
            match = re.match(r'^\[([^\]]*)\]$', connection_token)
            if match:
                self._thread = match.group(1)

            if self._thread is not None:
                if self._thread in ['initandlisten', 'mongosMain']:
                    if len(split_tokens) >= 5 and split_tokens[-5][0] == '#':
                        self._conn = 'conn' + split_tokens[-5][1:]
                elif self._thread.startswith('conn'):
                    self._conn = self._thread
        return self._thread
def thread ( self ) : if not self . _thread_calculated : self . _thread_calculated = True split_tokens = self . split_tokens if not self . datetime_nextpos : return None if len ( split_tokens ) <= self . datetime_nextpos : return None connection_token = split_tokens [ self . datetime_nextpos ] match = re . match ( r'^\[([^\]]*)\]$' , connection_token ) if match : self . _thread = match . group ( 1 ) if self . _thread is not None : if self . _thread in [ 'initandlisten' , 'mongosMain' ] : if len ( split_tokens ) >= 5 and split_tokens [ - 5 ] [ 0 ] == '#' : self . _conn = 'conn' + split_tokens [ - 5 ] [ 1 : ] elif self . _thread . startswith ( 'conn' ) : self . _conn = self . _thread return self . _thread
Extract thread name if available (lazy).