11#!/usr/bin/env python3
2- """ Control a Unifi Controller via Python"""
2+ """ Control a Unifi Controller via Python. """
33from requests import Session
44import json
55import os
@@ -59,7 +59,7 @@ def __exit__(self, *args):
5959 """
6060 self .logout ()
6161
62- def _check_status_code (self ,code ):
62+ def _check_status_code (self , code ):
6363 status_codes = {400 : "Invalid credentials" ,
6464 401 : "Invalid login, or login has expired" ,
6565 403 : "Current user not authorized to perform action" }
@@ -72,13 +72,11 @@ def _check_status_code(self,code):
7272 raise LoggedInException (status_codes [code ])
7373
7474 def _filter (self , filters : Dict [str , Union [str , Pattern ]], data : list ) -> list :
75- """
76- Apply a set of filters to data
77- """
75+ """Apply a set of filters to data."""
7876 for term , value in filters .items ():
79- value_re = value if isinstance (value , Pattern ) else re .compile (value )
77+ value_re = value if isinstance (value , Pattern ) else re .compile (value )
8078
81- data = [x for x in data if term in x .keys () and re .fullmatch (value_re , x [term ])]
79+ data = [x for x in data if term in x .keys () and re .fullmatch (value_re , x [term ])]
8280 return data
8381
8482 def login (self ):
0 commit comments