def _notifications(self):
if not self.username or not self.auth_token:<EOL><INDENT>if not self.notification_warning:<EOL><INDENT>self.py3.notify_user(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL>self.notification_warning = True<EOL><DEDENT>return "<STR_LIT:?>"<EOL><DEDENT>if self.notifications == "<STR_LIT:all>" or not self.repo:<EOL><INDENT>url = self.url_api + "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>url = self.url_api + "<STR_LIT>" + self.repo + "<STR_LIT>"<EOL><DEDENT>url += "<STR_LIT>"<EOL>try:<EOL><INDENT>info = self.py3.request(url, auth=(self.username, self.auth_token))<EOL><DEDENT>except (self.py3.RequestException):<EOL><INDENT>return<EOL><DEDENT>if info.status_code == <NUM_LIT:200>:<EOL><INDENT>links = info.headers.get("<STR_LIT>")<EOL>if not links:<EOL><INDENT>return len(info.json())<EOL><DEDENT>last_page = <NUM_LIT:1><EOL>for link in links.split("<STR_LIT:U+002C>"):<EOL><INDENT>if '<STR_LIT>' in link:<EOL><INDENT>last_url = link[link.find("<STR_LIT:<>") + <NUM_LIT:1> : link.find("<STR_LIT:>>")]<EOL>parsed = urlparse.urlparse(last_url)<EOL>last_page = int(urlparse.parse_qs(parsed.query)["<STR_LIT>"][<NUM_LIT:0>])<EOL><DEDENT><DEDENT>if last_page == <NUM_LIT:1>:<EOL><INDENT>return len(info.json())<EOL><DEDENT>try:<EOL><INDENT>last_page_info = self.py3.request(<EOL>last_url, auth=(self.username, self.auth_token)<EOL>)<EOL><DEDENT>except self.py3.RequestException:<EOL><INDENT>return<EOL><DEDENT>return len(info.json()) * (last_page - <NUM_LIT:1>) + len(last_page_info.json())<EOL><DEDENT>if info.status_code == <NUM_LIT>:<EOL><INDENT>if not self.repo_warning:<EOL><INDENT>self.py3.notify_user("<STR_LIT>")<EOL>self.repo_warning = True<EOL><DEDENT><DEDENT>
Get the number of unread notifications.