Add exclude for E1101: Module 'nh3' has no 'clean' member

--False Positive--
Issue tracking (fix planned for pylint 4.0.0)
https://github.com/messense/nh3/issues/18
https://github.com/pylint-dev/pylint/issues/8756
This commit is contained in:
Zedifus 2024-02-02 19:51:17 +00:00
parent 75f918fe13
commit ef691eda5c
3 changed files with 28 additions and 11 deletions

View File

@ -106,7 +106,7 @@ class BaseHandler(tornado.web.RequestHandler):
if type(text) in self.nobleach: if type(text) in self.nobleach:
logger.debug("Auto-bleaching - bypass type") logger.debug("Auto-bleaching - bypass type")
return text return text
return nh3.clean(text) return nh3.clean(text) # pylint: disable=no-member
def get_argument( def get_argument(
self, self,

View File

@ -80,7 +80,9 @@ class PanelHandler(BaseHandler):
) in self.controller.crafty_perms.list_defined_crafty_permissions(): ) in self.controller.crafty_perms.list_defined_crafty_permissions():
argument = int( argument = int(
float( float(
nh3.clean(self.get_argument(f"permission_{permission.name}", "0")) nh3.clean(
self.get_argument(f"permission_{permission.name}", "0")
) # pylint: disable=no-member
) )
) )
if argument: if argument:
@ -89,7 +91,9 @@ class PanelHandler(BaseHandler):
) )
q_argument = int( q_argument = int(
float(nh3.clean(self.get_argument(f"quantity_{permission.name}", "0"))) float(
nh3.clean(self.get_argument(f"quantity_{permission.name}", "0"))
) # pylint: disable=no-member
) )
if q_argument: if q_argument:
server_quantity[permission.name] = q_argument server_quantity[permission.name] = q_argument
@ -503,7 +507,9 @@ class PanelHandler(BaseHandler):
template = "panel/dashboard.html" template = "panel/dashboard.html"
elif page == "server_detail": elif page == "server_detail":
subpage = nh3.clean(self.get_argument("subpage", "")) subpage = nh3.clean(
self.get_argument("subpage", "")
) # pylint: disable=no-member
server_id = self.check_server_id() server_id = self.check_server_id()
# load page the user was on last # load page the user was on last
@ -1362,7 +1368,9 @@ class PanelHandler(BaseHandler):
template = "panel/panel_edit_user_apikeys.html" template = "panel/panel_edit_user_apikeys.html"
elif page == "remove_user": elif page == "remove_user":
user_id = nh3.clean(self.get_argument("id", None)) user_id = nh3.clean(
self.get_argument("id", None)
) # pylint: disable=no-member
if ( if (
not superuser not superuser

View File

@ -29,8 +29,12 @@ class PublicHandler(BaseHandler):
# self.clear_cookie("user_data") # self.clear_cookie("user_data")
def get(self, page=None): def get(self, page=None):
error = nh3.clean(self.get_argument("error", "Invalid Login!")) error = nh3.clean(
error_msg = nh3.clean(self.get_argument("error_msg", "")) self.get_argument("error", "Invalid Login!")
) # pylint: disable=no-member
error_msg = nh3.clean(
self.get_argument("error_msg", "")
) # pylint: disable=no-member
page_data = { page_data = {
"version": self.helper.get_version_string(), "version": self.helper.get_version_string(),
@ -87,8 +91,12 @@ class PublicHandler(BaseHandler):
) )
def post(self, page=None): def post(self, page=None):
error = nh3.clean(self.get_argument("error", "Invalid Login!")) error = nh3.clean(
error_msg = nh3.clean(self.get_argument("error_msg", "")) self.get_argument("error", "Invalid Login!")
) # pylint: disable=no-member
error_msg = nh3.clean(
self.get_argument("error_msg", "")
) # pylint: disable=no-member
page_data = { page_data = {
"version": self.helper.get_version_string(), "version": self.helper.get_version_string(),
@ -108,10 +116,11 @@ class PublicHandler(BaseHandler):
if self.request.query: if self.request.query:
next_page = "/login?" + self.request.query next_page = "/login?" + self.request.query
entered_username = nh3.clean(self.get_argument("username")) entered_username = nh3.clean(
self.get_argument("username")
) # pylint: disable=no-member
entered_password = self.get_argument("password") entered_password = self.get_argument("password")
# pylint: disable=no-member
try: try:
user_id = HelperUsers.get_user_id_by_name(entered_username.lower()) user_id = HelperUsers.get_user_id_by_name(entered_username.lower())
user_data = HelperUsers.get_user_model(user_id) user_data = HelperUsers.get_user_model(user_id)