Unnecessary else block after return

This commit is contained in:
Praveen Patidar 2022-11-11 17:21:27 +05:30
parent cc66213e57
commit e06e288aa0
4 changed files with 9 additions and 16 deletions

View file

@ -47,7 +47,7 @@ def find_best_app(module):
if len(matches) == 1: if len(matches) == 1:
return matches[0] return matches[0]
elif len(matches) > 1: if len(matches) > 1:
raise NoAppException( raise NoAppException(
"Detected multiple Flask applications in module" "Detected multiple Flask applications in module"
f" '{module.__name__}'. Use '{module.__name__}:name'" f" '{module.__name__}'. Use '{module.__name__}:name'"
@ -233,7 +233,6 @@ def locate_app(module_name, app_name, raise_if_not_found=True):
if app_name is None: if app_name is None:
return find_best_app(module) return find_best_app(module)
else:
return find_app_by_string(module, app_name) return find_app_by_string(module, app_name)

View file

@ -82,7 +82,6 @@ class _AppCtxGlobals:
""" """
if default is _sentinel: if default is _sentinel:
return self.__dict__.pop(name) return self.__dict__.pop(name)
else:
return self.__dict__.pop(name, default) return self.__dict__.pop(name, default)
def setdefault(self, name: str, default: t.Any = None) -> t.Any: def setdefault(self, name: str, default: t.Any = None) -> t.Any:

View file

@ -249,7 +249,6 @@ class Scaffold:
""" """
if self._static_folder is not None: if self._static_folder is not None:
return os.path.join(self.root_path, self._static_folder) return os.path.join(self.root_path, self._static_folder)
else:
return None return None
@static_folder.setter @static_folder.setter
@ -342,7 +341,6 @@ class Scaffold:
""" """
if self.template_folder is not None: if self.template_folder is not None:
return FileSystemLoader(os.path.join(self.root_path, self.template_folder)) return FileSystemLoader(os.path.join(self.root_path, self.template_folder))
else:
return None return None
def open_resource(self, resource: str, mode: str = "rb") -> t.IO[t.AnyStr]: def open_resource(self, resource: str, mode: str = "rb") -> t.IO[t.AnyStr]:
@ -743,7 +741,6 @@ class Scaffold:
if issubclass(exc_class, HTTPException): if issubclass(exc_class, HTTPException):
return exc_class, exc_class.code return exc_class, exc_class.code
else:
return exc_class, None return exc_class, None
@ -824,10 +821,9 @@ def _find_package_path(import_name):
search_locations = iter(root_spec.submodule_search_locations) search_locations = iter(root_spec.submodule_search_locations)
return os.path.dirname(next(search_locations)) return os.path.dirname(next(search_locations))
# a package (with __init__.py) # a package (with __init__.py)
elif root_spec.submodule_search_locations: if root_spec.submodule_search_locations:
return os.path.dirname(os.path.dirname(root_spec.origin)) return os.path.dirname(os.path.dirname(root_spec.origin))
# just a normal module # just a normal module
else:
return os.path.dirname(root_spec.origin) return os.path.dirname(root_spec.origin)
# we were unable to find the `package_path` using PEP 451 loaders # we were unable to find the `package_path` using PEP 451 loaders

View file

@ -54,7 +54,6 @@ class Request(RequestBase):
"""Read-only view of the ``MAX_CONTENT_LENGTH`` config key.""" """Read-only view of the ``MAX_CONTENT_LENGTH`` config key."""
if current_app: if current_app:
return current_app.config["MAX_CONTENT_LENGTH"] return current_app.config["MAX_CONTENT_LENGTH"]
else:
return None return None
@property @property