File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 1010
1111from corsheaders .conf import conf
1212
13- re_type = type (re .compile ("" ))
14-
1513
1614def check_settings (** kwargs : Any ) -> list [CheckMessage ]:
1715 errors : list [CheckMessage ] = []
@@ -122,7 +120,7 @@ def check_settings(**kwargs: Any) -> list[CheckMessage]:
122120 allowed_regexes_alias = "CORS_ALLOWED_ORIGIN_REGEXES"
123121 else :
124122 allowed_regexes_alias = "CORS_ORIGIN_REGEX_WHITELIST"
125- if not is_sequence (conf .CORS_ALLOWED_ORIGIN_REGEXES , (str , re_type )):
123+ if not is_sequence (conf .CORS_ALLOWED_ORIGIN_REGEXES , (str , re . Pattern )):
126124 errors .append (
127125 Error (
128126 f"{ allowed_regexes_alias } should be a sequence of strings and/or compiled regexes." ,
@@ -135,8 +133,8 @@ def check_settings(**kwargs: Any) -> list[CheckMessage]:
135133 Error ("CORS_EXPOSE_HEADERS should be a sequence." , id = "corsheaders.E008" )
136134 )
137135
138- if not isinstance (conf .CORS_URLS_REGEX , (str , re_type )):
139- errors .append (
136+ if not isinstance (conf .CORS_URLS_REGEX , (str , re . Pattern )):
137+ errors .append ( # type: ignore [unreachable]
140138 Error ("CORS_URLS_REGEX should be a string or regex." , id = "corsheaders.E009" )
141139 )
142140
You can’t perform that action at this time.
0 commit comments