Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-starlette for 
openSUSE:Factory checked in at 2022-05-30 12:43:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-starlette (Old)
 and      /work/SRC/openSUSE:Factory/.python-starlette.new.2254 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-starlette"

Mon May 30 12:43:22 2022 rev:7 rq:979641 version:0.19.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-starlette/python-starlette.changes        
2022-04-19 09:58:31.139584116 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-starlette.new.2254/python-starlette.changes  
    2022-05-30 12:43:57.132390675 +0200
@@ -1,0 +2,12 @@
+Sat May 28 15:16:15 UTC 2022 - Michael Str??der <[email protected]>
+
+- Update to 0.19.1:
+  * Fixed
+    - Fix inference of Route.name when created from methods #1553.
+    - Avoid TypeError on websocket.disconnect when code is None #1574.
+  * Deprecated
+    - Deprecate WS_1004_NO_STATUS_RCVD and WS_1005_ABNORMAL_CLOSURE in favor
+      of WS_1005_NO_STATUS_RCVD and WS_1006_ABNORMAL_CLOSURE, as the previous
+      constants didn't match the WebSockets specs #1580.
+
+-------------------------------------------------------------------

Old:
----
  starlette-0.19.0.tar.gz

New:
----
  starlette-0.19.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-starlette.spec ++++++
--- /var/tmp/diff_new_pack.nTCg9F/_old  2022-05-30 12:43:58.024391862 +0200
+++ /var/tmp/diff_new_pack.nTCg9F/_new  2022-05-30 12:43:58.028391868 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python3-%{**}}
 %define skip_python2 1
 Name:           python-starlette
-Version:        0.19.0
+Version:        0.19.1
 Release:        0
 Summary:        Lightweight ASGI framework/toolkit
 License:        BSD-3-Clause

++++++ starlette-0.19.0.tar.gz -> starlette-0.19.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/docs/release-notes.md 
new/starlette-0.19.1/docs/release-notes.md
--- old/starlette-0.19.0/docs/release-notes.md  2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/docs/release-notes.md  2022-04-22 07:26:15.000000000 
+0200
@@ -1,3 +1,15 @@
+## 0.19.1
+
+April 22, 2022
+
+### Fixed
+* Fix inference of `Route.name` when created from methods 
[#1553](https://github.com/encode/starlette/pull/1553).
+* Avoid `TypeError` on `websocket.disconnect` when code is `None` 
[#1574](https://github.com/encode/starlette/pull/1574).
+
+### Deprecated
+* Deprecate `WS_1004_NO_STATUS_RCVD` and `WS_1005_ABNORMAL_CLOSURE` in favor 
of `WS_1005_NO_STATUS_RCVD` and `WS_1006_ABNORMAL_CLOSURE`, as the previous 
constants didn't match the [WebSockets 
specs](https://www.iana.org/assignments/websocket/websocket.xhtml) 
[#1580](https://github.com/encode/starlette/pull/1580).
+
+
 ## 0.19.0
 
 March 9, 2022
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/requirements.txt 
new/starlette-0.19.1/requirements.txt
--- old/starlette-0.19.0/requirements.txt       2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/requirements.txt       2022-04-22 07:26:15.000000000 
+0200
@@ -3,12 +3,12 @@
 
 # Testing
 autoflake==1.4
-black==22.1.0
+black==22.3.0
 coverage==6.2
 databases[sqlite]==0.5.5
-flake8==4.0.1
+flake8==3.9.2
 isort==5.10.1
-mypy==0.931
+mypy==0.942
 types-requests==2.26.3
 types-contextvars==2.4.2
 types-PyYAML==6.0.4
@@ -17,8 +17,8 @@
 trio==0.19.0
 
 # Documentation
-mkdocs==1.2.3
-mkdocs-material==8.1.3
+mkdocs==1.3.0
+mkdocs-material==8.2.8
 mkautodoc==0.1.0
 
 # Packaging
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/setup.cfg 
new/starlette-0.19.1/setup.cfg
--- old/starlette-0.19.0/setup.cfg      2022-03-09 19:43:11.000000000 +0100
+++ new/starlette-0.19.1/setup.cfg      2022-04-22 07:26:15.000000000 +0200
@@ -5,8 +5,12 @@
 [mypy]
 disallow_untyped_defs = True
 ignore_missing_imports = True
+no_implicit_optional = True
 show_error_codes = True
 
+[mypy-starlette.testclient]
+no_implicit_optional = False
+
 [mypy-tests.*]
 disallow_untyped_defs = False
 check_untyped_defs = True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/__init__.py 
new/starlette-0.19.1/starlette/__init__.py
--- old/starlette-0.19.0/starlette/__init__.py  2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/__init__.py  2022-04-22 07:26:15.000000000 
+0200
@@ -1 +1 @@
-__version__ = "0.19.0"
+__version__ = "0.19.1"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/_pep562.py 
new/starlette-0.19.1/starlette/_pep562.py
--- old/starlette-0.19.0/starlette/_pep562.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/starlette-0.19.1/starlette/_pep562.py   2022-04-22 07:26:15.000000000 
+0200
@@ -0,0 +1,62 @@
+# flake8: noqa
+"""
+Backport of PEP 562.
+https://pypi.org/search/?q=pep562
+Licensed under MIT
+Copyright (c) 2018 Isaac Muse <[email protected]>
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated
+documentation files (the "Software"), to deal in the Software without 
restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense, 
and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so, subject to 
the following conditions:
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions
+of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+"""
+import sys
+from typing import Any, Callable, List, Optional
+
+
+class Pep562:
+    """
+    Backport of PEP 562 <https://pypi.org/search/?q=pep562>.
+    Wraps the module in a class that exposes the mechanics to override 
`__dir__` and `__getattr__`.
+    The given module will be searched for overrides of `__dir__` and 
`__getattr__` and use them when needed.
+    """
+
+    def __init__(self, name: str) -> None:  # pragma: no cover
+        """Acquire `__getattr__` and `__dir__`, but only replace module for 
versions less than Python 3.7."""
+
+        self._module = sys.modules[name]
+        self._get_attr = getattr(self._module, "__getattr__", None)
+        self._get_dir: Optional[Callable[..., List[str]]] = getattr(
+            self._module, "__dir__", None
+        )
+        sys.modules[name] = self  # type: ignore[assignment]
+
+    def __dir__(self) -> List[str]:  # pragma: no cover
+        """Return the overridden `dir` if one was provided, else apply `dir` 
to the module."""
+
+        return self._get_dir() if self._get_dir else dir(self._module)
+
+    def __getattr__(self, name: str) -> Any:  # pragma: no cover
+        """
+        Attempt to retrieve the attribute from the module, and if missing, use 
the overridden function if present.
+        """
+
+        try:
+            return getattr(self._module, name)
+        except AttributeError:
+            if self._get_attr:
+                return self._get_attr(name)
+            raise
+
+
+def pep562(module_name: str) -> None:  # pragma: no cover
+    """Helper function to apply PEP 562."""
+
+    if sys.version_info < (3, 7):
+        Pep562(module_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/applications.py 
new/starlette-0.19.1/starlette/applications.py
--- old/starlette-0.19.0/starlette/applications.py      2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/applications.py      2022-04-22 
07:26:15.000000000 +0200
@@ -41,17 +41,22 @@
     def __init__(
         self,
         debug: bool = False,
-        routes: typing.Sequence[BaseRoute] = None,
-        middleware: typing.Sequence[Middleware] = None,
-        exception_handlers: typing.Mapping[
-            typing.Any,
-            typing.Callable[
-                [Request, Exception], typing.Union[Response, 
typing.Awaitable[Response]]
-            ],
+        routes: typing.Optional[typing.Sequence[BaseRoute]] = None,
+        middleware: typing.Optional[typing.Sequence[Middleware]] = None,
+        exception_handlers: typing.Optional[
+            typing.Mapping[
+                typing.Any,
+                typing.Callable[
+                    [Request, Exception],
+                    typing.Union[Response, typing.Awaitable[Response]],
+                ],
+            ]
+        ] = None,
+        on_startup: typing.Optional[typing.Sequence[typing.Callable]] = None,
+        on_shutdown: typing.Optional[typing.Sequence[typing.Callable]] = None,
+        lifespan: typing.Optional[
+            typing.Callable[["Starlette"], typing.AsyncContextManager]
         ] = None,
-        on_startup: typing.Sequence[typing.Callable] = None,
-        on_shutdown: typing.Sequence[typing.Callable] = None,
-        lifespan: typing.Callable[["Starlette"], typing.AsyncContextManager] = 
None,
     ) -> None:
         # The lifespan context function is a newer style that replaces
         # on_startup / on_shutdown handlers. Use one or the other, not both.
@@ -124,7 +129,7 @@
         return self.router.on_event(event_type)
 
     def mount(
-        self, path: str, app: ASGIApp, name: str = None
+        self, path: str, app: ASGIApp, name: typing.Optional[str] = None
     ) -> None:  # pragma: nocover
         """
         We no longer document this API, and its usage is discouraged.
@@ -141,7 +146,7 @@
         self.router.mount(path, app=app, name=name)
 
     def host(
-        self, host: str, app: ASGIApp, name: str = None
+        self, host: str, app: ASGIApp, name: typing.Optional[str] = None
     ) -> None:  # pragma: no cover
         """
         We no longer document this API, and its usage is discouraged.
@@ -180,8 +185,8 @@
         self,
         path: str,
         route: typing.Callable,
-        methods: typing.List[str] = None,
-        name: str = None,
+        methods: typing.Optional[typing.List[str]] = None,
+        name: typing.Optional[str] = None,
         include_in_schema: bool = True,
     ) -> None:  # pragma: no cover
         self.router.add_route(
@@ -189,7 +194,7 @@
         )
 
     def add_websocket_route(
-        self, path: str, route: typing.Callable, name: str = None
+        self, path: str, route: typing.Callable, name: typing.Optional[str] = 
None
     ) -> None:  # pragma: no cover
         self.router.add_websocket_route(path, route, name=name)
 
@@ -205,8 +210,8 @@
     def route(
         self,
         path: str,
-        methods: typing.List[str] = None,
-        name: str = None,
+        methods: typing.Optional[typing.List[str]] = None,
+        name: typing.Optional[str] = None,
         include_in_schema: bool = True,
     ) -> typing.Callable:  # pragma: nocover
         """
@@ -234,7 +239,7 @@
         return decorator
 
     def websocket_route(
-        self, path: str, name: str = None
+        self, path: str, name: typing.Optional[str] = None
     ) -> typing.Callable:  # pragma: nocover
         """
         We no longer document this decorator style API, and its usage is 
discouraged.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/authentication.py 
new/starlette-0.19.1/starlette/authentication.py
--- old/starlette-0.19.0/starlette/authentication.py    2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/authentication.py    2022-04-22 
07:26:15.000000000 +0200
@@ -20,7 +20,7 @@
 def requires(
     scopes: typing.Union[str, typing.Sequence[str]],
     status_code: int = 403,
-    redirect: str = None,
+    redirect: typing.Optional[str] = None,
 ) -> typing.Callable:
     scopes_list = [scopes] if isinstance(scopes, str) else list(scopes)
 
@@ -110,7 +110,7 @@
 
 
 class AuthCredentials:
-    def __init__(self, scopes: typing.Sequence[str] = None):
+    def __init__(self, scopes: typing.Optional[typing.Sequence[str]] = None):
         self.scopes = [] if scopes is None else list(scopes)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/background.py 
new/starlette-0.19.1/starlette/background.py
--- old/starlette-0.19.0/starlette/background.py        2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/background.py        2022-04-22 
07:26:15.000000000 +0200
@@ -29,7 +29,7 @@
 
 
 class BackgroundTasks(BackgroundTask):
-    def __init__(self, tasks: typing.Sequence[BackgroundTask] = None):
+    def __init__(self, tasks: typing.Optional[typing.Sequence[BackgroundTask]] 
= None):
         self.tasks = list(tasks) if tasks else []
 
     def add_task(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/config.py 
new/starlette-0.19.1/starlette/config.py
--- old/starlette-0.19.0/starlette/config.py    2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/config.py    2022-04-22 07:26:15.000000000 
+0200
@@ -52,7 +52,7 @@
 class Config:
     def __init__(
         self,
-        env_file: typing.Union[str, Path] = None,
+        env_file: typing.Optional[typing.Union[str, Path]] = None,
         environ: typing.Mapping[str, str] = environ,
     ) -> None:
         self.environ = environ
@@ -88,12 +88,18 @@
         ...
 
     def __call__(
-        self, key: str, cast: typing.Callable = None, default: typing.Any = 
undefined
+        self,
+        key: str,
+        cast: typing.Optional[typing.Callable] = None,
+        default: typing.Any = undefined,
     ) -> typing.Any:
         return self.get(key, cast, default)
 
     def get(
-        self, key: str, cast: typing.Callable = None, default: typing.Any = 
undefined
+        self,
+        key: str,
+        cast: typing.Optional[typing.Callable] = None,
+        default: typing.Any = undefined,
     ) -> typing.Any:
         if key in self.environ:
             value = self.environ[key]
@@ -118,7 +124,7 @@
         return file_values
 
     def _perform_cast(
-        self, key: str, value: typing.Any, cast: typing.Callable = None
+        self, key: str, value: typing.Any, cast: 
typing.Optional[typing.Callable] = None
     ) -> typing.Any:
         if cast is None or value is None:
             return value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/endpoints.py 
new/starlette-0.19.1/starlette/endpoints.py
--- old/starlette-0.19.0/starlette/endpoints.py 2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/endpoints.py 2022-04-22 07:26:15.000000000 
+0200
@@ -80,7 +80,9 @@
                     data = await self.decode(websocket, message)
                     await self.on_receive(websocket, data)
                 elif message["type"] == "websocket.disconnect":
-                    close_code = int(message.get("code", 
status.WS_1000_NORMAL_CLOSURE))
+                    close_code = int(
+                        message.get("code") or status.WS_1000_NORMAL_CLOSURE
+                    )
                     break
         except Exception as exc:
             close_code = status.WS_1011_INTERNAL_ERROR
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/exceptions.py 
new/starlette-0.19.1/starlette/exceptions.py
--- old/starlette-0.19.0/starlette/exceptions.py        2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/exceptions.py        2022-04-22 
07:26:15.000000000 +0200
@@ -10,7 +10,10 @@
 
 class HTTPException(Exception):
     def __init__(
-        self, status_code: int, detail: str = None, headers: dict = None
+        self,
+        status_code: int,
+        detail: typing.Optional[str] = None,
+        headers: typing.Optional[dict] = None,
     ) -> None:
         if detail is None:
             detail = http.HTTPStatus(status_code).phrase
@@ -27,8 +30,8 @@
     def __init__(
         self,
         app: ASGIApp,
-        handlers: typing.Mapping[
-            typing.Any, typing.Callable[[Request, Exception], Response]
+        handlers: typing.Optional[
+            typing.Mapping[typing.Any, typing.Callable[[Request, Exception], 
Response]]
         ] = None,
         debug: bool = False,
     ) -> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/starlette-0.19.0/starlette/middleware/authentication.py 
new/starlette-0.19.1/starlette/middleware/authentication.py
--- old/starlette-0.19.0/starlette/middleware/authentication.py 2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/middleware/authentication.py 2022-04-22 
07:26:15.000000000 +0200
@@ -16,8 +16,8 @@
         self,
         app: ASGIApp,
         backend: AuthenticationBackend,
-        on_error: typing.Callable[
-            [HTTPConnection, AuthenticationError], Response
+        on_error: typing.Optional[
+            typing.Callable[[HTTPConnection, AuthenticationError], Response]
         ] = None,
     ) -> None:
         self.app = app
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/middleware/base.py 
new/starlette-0.19.1/starlette/middleware/base.py
--- old/starlette-0.19.0/starlette/middleware/base.py   2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/middleware/base.py   2022-04-22 
07:26:15.000000000 +0200
@@ -13,7 +13,9 @@
 
 
 class BaseHTTPMiddleware:
-    def __init__(self, app: ASGIApp, dispatch: DispatchFunction = None) -> 
None:
+    def __init__(
+        self, app: ASGIApp, dispatch: typing.Optional[DispatchFunction] = None
+    ) -> None:
         self.app = app
         self.dispatch_func = self.dispatch if dispatch is None else dispatch
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/middleware/cors.py 
new/starlette-0.19.1/starlette/middleware/cors.py
--- old/starlette-0.19.0/starlette/middleware/cors.py   2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/middleware/cors.py   2022-04-22 
07:26:15.000000000 +0200
@@ -18,7 +18,7 @@
         allow_methods: typing.Sequence[str] = ("GET",),
         allow_headers: typing.Sequence[str] = (),
         allow_credentials: bool = False,
-        allow_origin_regex: str = None,
+        allow_origin_regex: typing.Optional[str] = None,
         expose_headers: typing.Sequence[str] = (),
         max_age: int = 600,
     ) -> None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/middleware/errors.py 
new/starlette-0.19.1/starlette/middleware/errors.py
--- old/starlette-0.19.0/starlette/middleware/errors.py 2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/middleware/errors.py 2022-04-22 
07:26:15.000000000 +0200
@@ -135,7 +135,10 @@
     """
 
     def __init__(
-        self, app: ASGIApp, handler: typing.Callable = None, debug: bool = 
False
+        self,
+        app: ASGIApp,
+        handler: typing.Optional[typing.Callable] = None,
+        debug: bool = False,
     ) -> None:
         self.app = app
         self.handler = handler
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/middleware/trustedhost.py 
new/starlette-0.19.1/starlette/middleware/trustedhost.py
--- old/starlette-0.19.0/starlette/middleware/trustedhost.py    2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/middleware/trustedhost.py    2022-04-22 
07:26:15.000000000 +0200
@@ -11,7 +11,7 @@
     def __init__(
         self,
         app: ASGIApp,
-        allowed_hosts: typing.Sequence[str] = None,
+        allowed_hosts: typing.Optional[typing.Sequence[str]] = None,
         www_redirect: bool = True,
     ) -> None:
         if allowed_hosts is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/requests.py 
new/starlette-0.19.1/starlette/requests.py
--- old/starlette-0.19.0/starlette/requests.py  2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/requests.py  2022-04-22 07:26:15.000000000 
+0200
@@ -65,7 +65,7 @@
     any functionality that is common to both `Request` and `WebSocket`.
     """
 
-    def __init__(self, scope: Scope, receive: Receive = None) -> None:
+    def __init__(self, scope: Scope, receive: typing.Optional[Receive] = None) 
-> None:
         assert scope["type"] in ("http", "websocket")
         self.scope = scope
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/responses.py 
new/starlette-0.19.1/starlette/responses.py
--- old/starlette-0.19.0/starlette/responses.py 2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/responses.py 2022-04-22 07:26:15.000000000 
+0200
@@ -38,9 +38,9 @@
         self,
         content: typing.Any = None,
         status_code: int = 200,
-        headers: typing.Mapping[str, str] = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ) -> None:
         self.status_code = status_code
         if media_type is not None:
@@ -56,7 +56,9 @@
             return content
         return content.encode(self.charset)
 
-    def init_headers(self, headers: typing.Mapping[str, str] = None) -> None:
+    def init_headers(
+        self, headers: typing.Optional[typing.Mapping[str, str]] = None
+    ) -> None:
         if headers is None:
             raw_headers: typing.List[typing.Tuple[bytes, bytes]] = []
             populate_content_length = True
@@ -97,10 +99,10 @@
         self,
         key: str,
         value: str = "",
-        max_age: int = None,
-        expires: int = None,
+        max_age: typing.Optional[int] = None,
+        expires: typing.Optional[int] = None,
         path: str = "/",
-        domain: str = None,
+        domain: typing.Optional[str] = None,
         secure: bool = False,
         httponly: bool = False,
         samesite: str = "lax",
@@ -133,7 +135,7 @@
         self,
         key: str,
         path: str = "/",
-        domain: str = None,
+        domain: typing.Optional[str] = None,
         secure: bool = False,
         httponly: bool = False,
         samesite: str = "lax",
@@ -178,9 +180,9 @@
         self,
         content: typing.Any,
         status_code: int = 200,
-        headers: dict = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[dict] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ) -> None:
         super().__init__(content, status_code, headers, media_type, background)
 
@@ -199,8 +201,8 @@
         self,
         url: typing.Union[str, URL],
         status_code: int = 307,
-        headers: typing.Mapping[str, str] = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ) -> None:
         super().__init__(
             content=b"", status_code=status_code, headers=headers, 
background=background
@@ -213,9 +215,9 @@
         self,
         content: typing.Any,
         status_code: int = 200,
-        headers: typing.Mapping[str, str] = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ) -> None:
         if isinstance(content, typing.AsyncIterable):
             self.body_iterator = content
@@ -268,12 +270,12 @@
         self,
         path: typing.Union[str, "os.PathLike[str]"],
         status_code: int = 200,
-        headers: typing.Mapping[str, str] = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
-        filename: str = None,
-        stat_result: os.stat_result = None,
-        method: str = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
+        filename: typing.Optional[str] = None,
+        stat_result: typing.Optional[os.stat_result] = None,
+        method: typing.Optional[str] = None,
         content_disposition_type: str = "attachment",
     ) -> None:
         self.path = path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/routing.py 
new/starlette-0.19.1/starlette/routing.py
--- old/starlette-0.19.0/starlette/routing.py   2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/routing.py   2022-04-22 07:26:15.000000000 
+0200
@@ -84,7 +84,7 @@
 
 
 def get_name(endpoint: typing.Callable) -> str:
-    if inspect.isfunction(endpoint) or inspect.isclass(endpoint):
+    if inspect.isroutine(endpoint) or inspect.isclass(endpoint):
         return endpoint.__name__
     return endpoint.__class__.__name__
 
@@ -192,8 +192,8 @@
         path: str,
         endpoint: typing.Callable,
         *,
-        methods: typing.List[str] = None,
-        name: str = None,
+        methods: typing.Optional[typing.List[str]] = None,
+        name: typing.Optional[str] = None,
         include_in_schema: bool = True,
     ) -> None:
         assert path.startswith("/"), "Routed paths must start with '/'"
@@ -276,7 +276,7 @@
 
 class WebSocketRoute(BaseRoute):
     def __init__(
-        self, path: str, endpoint: typing.Callable, *, name: str = None
+        self, path: str, endpoint: typing.Callable, *, name: 
typing.Optional[str] = None
     ) -> None:
         assert path.startswith("/"), "Routed paths must start with '/'"
         self.path = path
@@ -336,9 +336,9 @@
     def __init__(
         self,
         path: str,
-        app: ASGIApp = None,
-        routes: typing.Sequence[BaseRoute] = None,
-        name: str = None,
+        app: typing.Optional[ASGIApp] = None,
+        routes: typing.Optional[typing.Sequence[BaseRoute]] = None,
+        name: typing.Optional[str] = None,
     ) -> None:
         assert path == "" or path.startswith("/"), "Routed paths must start 
with '/'"
         assert (
@@ -426,7 +426,9 @@
 
 
 class Host(BaseRoute):
-    def __init__(self, host: str, app: ASGIApp, name: str = None) -> None:
+    def __init__(
+        self, host: str, app: ASGIApp, name: typing.Optional[str] = None
+    ) -> None:
         self.host = host
         self.app = app
         self.name = name
@@ -537,12 +539,14 @@
 class Router:
     def __init__(
         self,
-        routes: typing.Sequence[BaseRoute] = None,
+        routes: typing.Optional[typing.Sequence[BaseRoute]] = None,
         redirect_slashes: bool = True,
-        default: ASGIApp = None,
-        on_startup: typing.Sequence[typing.Callable] = None,
-        on_shutdown: typing.Sequence[typing.Callable] = None,
-        lifespan: typing.Callable[[typing.Any], typing.AsyncContextManager] = 
None,
+        default: typing.Optional[ASGIApp] = None,
+        on_startup: typing.Optional[typing.Sequence[typing.Callable]] = None,
+        on_shutdown: typing.Optional[typing.Sequence[typing.Callable]] = None,
+        lifespan: typing.Optional[
+            typing.Callable[[typing.Any], typing.AsyncContextManager]
+        ] = None,
     ) -> None:
         self.routes = [] if routes is None else list(routes)
         self.redirect_slashes = redirect_slashes
@@ -700,7 +704,7 @@
     # The following usages are now discouraged in favour of configuration
     # ??during Router.__init__(...)
     def mount(
-        self, path: str, app: ASGIApp, name: str = None
+        self, path: str, app: ASGIApp, name: typing.Optional[str] = None
     ) -> None:  # pragma: nocover
         """
         We no longer document this API, and its usage is discouraged.
@@ -718,7 +722,7 @@
         self.routes.append(route)
 
     def host(
-        self, host: str, app: ASGIApp, name: str = None
+        self, host: str, app: ASGIApp, name: typing.Optional[str] = None
     ) -> None:  # pragma: no cover
         """
         We no longer document this API, and its usage is discouraged.
@@ -739,8 +743,8 @@
         self,
         path: str,
         endpoint: typing.Callable,
-        methods: typing.List[str] = None,
-        name: str = None,
+        methods: typing.Optional[typing.List[str]] = None,
+        name: typing.Optional[str] = None,
         include_in_schema: bool = True,
     ) -> None:  # pragma: nocover
         route = Route(
@@ -753,7 +757,7 @@
         self.routes.append(route)
 
     def add_websocket_route(
-        self, path: str, endpoint: typing.Callable, name: str = None
+        self, path: str, endpoint: typing.Callable, name: typing.Optional[str] 
= None
     ) -> None:  # pragma: no cover
         route = WebSocketRoute(path, endpoint=endpoint, name=name)
         self.routes.append(route)
@@ -761,8 +765,8 @@
     def route(
         self,
         path: str,
-        methods: typing.List[str] = None,
-        name: str = None,
+        methods: typing.Optional[typing.List[str]] = None,
+        name: typing.Optional[str] = None,
         include_in_schema: bool = True,
     ) -> typing.Callable:  # pragma: nocover
         """
@@ -790,7 +794,7 @@
         return decorator
 
     def websocket_route(
-        self, path: str, name: str = None
+        self, path: str, name: typing.Optional[str] = None
     ) -> typing.Callable:  # pragma: nocover
         """
         We no longer document this decorator style API, and its usage is 
discouraged.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/staticfiles.py 
new/starlette-0.19.1/starlette/staticfiles.py
--- old/starlette-0.19.0/starlette/staticfiles.py       2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/staticfiles.py       2022-04-22 
07:26:15.000000000 +0200
@@ -39,8 +39,10 @@
     def __init__(
         self,
         *,
-        directory: PathLike = None,
-        packages: typing.List[typing.Union[str, typing.Tuple[str, str]]] = 
None,
+        directory: typing.Optional[PathLike] = None,
+        packages: typing.Optional[
+            typing.List[typing.Union[str, typing.Tuple[str, str]]]
+        ] = None,
         html: bool = False,
         check_dir: bool = True,
     ) -> None:
@@ -54,8 +56,10 @@
 
     def get_directories(
         self,
-        directory: PathLike = None,
-        packages: typing.List[typing.Union[str, typing.Tuple[str, str]]] = 
None,
+        directory: typing.Optional[PathLike] = None,
+        packages: typing.Optional[
+            typing.List[typing.Union[str, typing.Tuple[str, str]]]
+        ] = None,
     ) -> typing.List[PathLike]:
         """
         Given `directory` and `packages` arguments, return a list of all the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/status.py 
new/starlette-0.19.1/starlette/status.py
--- old/starlette-0.19.0/starlette/status.py    2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/starlette/status.py    2022-04-22 07:26:15.000000000 
+0200
@@ -5,6 +5,93 @@
 
 And RFC 2324 - https://tools.ietf.org/html/rfc2324
 """
+import sys
+import warnings
+from typing import List
+
+from starlette._pep562 import pep562
+
+__all__ = (
+    "HTTP_100_CONTINUE",
+    "HTTP_101_SWITCHING_PROTOCOLS",
+    "HTTP_102_PROCESSING",
+    "HTTP_103_EARLY_HINTS",
+    "HTTP_200_OK",
+    "HTTP_201_CREATED",
+    "HTTP_202_ACCEPTED",
+    "HTTP_203_NON_AUTHORITATIVE_INFORMATION",
+    "HTTP_204_NO_CONTENT",
+    "HTTP_205_RESET_CONTENT",
+    "HTTP_206_PARTIAL_CONTENT",
+    "HTTP_207_MULTI_STATUS",
+    "HTTP_208_ALREADY_REPORTED",
+    "HTTP_226_IM_USED",
+    "HTTP_300_MULTIPLE_CHOICES",
+    "HTTP_301_MOVED_PERMANENTLY",
+    "HTTP_302_FOUND",
+    "HTTP_303_SEE_OTHER",
+    "HTTP_304_NOT_MODIFIED",
+    "HTTP_305_USE_PROXY",
+    "HTTP_306_RESERVED",
+    "HTTP_307_TEMPORARY_REDIRECT",
+    "HTTP_308_PERMANENT_REDIRECT",
+    "HTTP_400_BAD_REQUEST",
+    "HTTP_401_UNAUTHORIZED",
+    "HTTP_402_PAYMENT_REQUIRED",
+    "HTTP_403_FORBIDDEN",
+    "HTTP_404_NOT_FOUND",
+    "HTTP_405_METHOD_NOT_ALLOWED",
+    "HTTP_406_NOT_ACCEPTABLE",
+    "HTTP_407_PROXY_AUTHENTICATION_REQUIRED",
+    "HTTP_408_REQUEST_TIMEOUT",
+    "HTTP_409_CONFLICT",
+    "HTTP_410_GONE",
+    "HTTP_411_LENGTH_REQUIRED",
+    "HTTP_412_PRECONDITION_FAILED",
+    "HTTP_413_REQUEST_ENTITY_TOO_LARGE",
+    "HTTP_414_REQUEST_URI_TOO_LONG",
+    "HTTP_415_UNSUPPORTED_MEDIA_TYPE",
+    "HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE",
+    "HTTP_417_EXPECTATION_FAILED",
+    "HTTP_418_IM_A_TEAPOT",
+    "HTTP_421_MISDIRECTED_REQUEST",
+    "HTTP_422_UNPROCESSABLE_ENTITY",
+    "HTTP_423_LOCKED",
+    "HTTP_424_FAILED_DEPENDENCY",
+    "HTTP_425_TOO_EARLY",
+    "HTTP_426_UPGRADE_REQUIRED",
+    "HTTP_428_PRECONDITION_REQUIRED",
+    "HTTP_429_TOO_MANY_REQUESTS",
+    "HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE",
+    "HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS",
+    "HTTP_500_INTERNAL_SERVER_ERROR",
+    "HTTP_501_NOT_IMPLEMENTED",
+    "HTTP_502_BAD_GATEWAY",
+    "HTTP_503_SERVICE_UNAVAILABLE",
+    "HTTP_504_GATEWAY_TIMEOUT",
+    "HTTP_505_HTTP_VERSION_NOT_SUPPORTED",
+    "HTTP_506_VARIANT_ALSO_NEGOTIATES",
+    "HTTP_507_INSUFFICIENT_STORAGE",
+    "HTTP_508_LOOP_DETECTED",
+    "HTTP_510_NOT_EXTENDED",
+    "HTTP_511_NETWORK_AUTHENTICATION_REQUIRED",
+    "WS_1000_NORMAL_CLOSURE",
+    "WS_1001_GOING_AWAY",
+    "WS_1002_PROTOCOL_ERROR",
+    "WS_1003_UNSUPPORTED_DATA",
+    "WS_1005_NO_STATUS_RCVD",
+    "WS_1006_ABNORMAL_CLOSURE",
+    "WS_1007_INVALID_FRAME_PAYLOAD_DATA",
+    "WS_1008_POLICY_VIOLATION",
+    "WS_1009_MESSAGE_TOO_BIG",
+    "WS_1010_MANDATORY_EXT",
+    "WS_1011_INTERNAL_ERROR",
+    "WS_1012_SERVICE_RESTART",
+    "WS_1013_TRY_AGAIN_LATER",
+    "WS_1014_BAD_GATEWAY",
+    "WS_1015_TLS_HANDSHAKE",
+)
+
 HTTP_100_CONTINUE = 100
 HTTP_101_SWITCHING_PROTOCOLS = 101
 HTTP_102_PROCESSING = 102
@@ -79,8 +166,8 @@
 WS_1001_GOING_AWAY = 1001
 WS_1002_PROTOCOL_ERROR = 1002
 WS_1003_UNSUPPORTED_DATA = 1003
-WS_1004_NO_STATUS_RCVD = 1004
-WS_1005_ABNORMAL_CLOSURE = 1005
+WS_1005_NO_STATUS_RCVD = 1005
+WS_1006_ABNORMAL_CLOSURE = 1006
 WS_1007_INVALID_FRAME_PAYLOAD_DATA = 1007
 WS_1008_POLICY_VIOLATION = 1008
 WS_1009_MESSAGE_TOO_BIG = 1009
@@ -90,3 +177,30 @@
 WS_1013_TRY_AGAIN_LATER = 1013
 WS_1014_BAD_GATEWAY = 1014
 WS_1015_TLS_HANDSHAKE = 1015
+
+
+__deprecated__ = {"WS_1004_NO_STATUS_RCVD": 1004, "WS_1005_ABNORMAL_CLOSURE": 
1005}
+
+
+def __getattr__(name: str) -> int:
+    deprecation_changes = {
+        "WS_1004_NO_STATUS_RCVD": "WS_1005_NO_STATUS_RCVD",
+        "WS_1005_ABNORMAL_CLOSURE": "WS_1006_ABNORMAL_CLOSURE",
+    }
+    deprecated = __deprecated__.get(name)
+    if deprecated:
+        stacklevel = 3 if sys.version_info >= (3, 7) else 4
+        warnings.warn(
+            f"'{name}' is deprecated. Use '{deprecation_changes[name]}' 
instead.",
+            category=DeprecationWarning,
+            stacklevel=stacklevel,
+        )
+        return deprecated
+    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
+
+
+def __dir__() -> List[str]:
+    return sorted(list(__all__) + list(__deprecated__.keys()))  # pragma: no 
cover
+
+
+pep562(__name__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/templating.py 
new/starlette-0.19.1/starlette/templating.py
--- old/starlette-0.19.0/starlette/templating.py        2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/templating.py        2022-04-22 
07:26:15.000000000 +0200
@@ -8,11 +8,14 @@
 try:
     import jinja2
 
-    # @contextfunction renamed to @pass_context in Jinja 3.0, to be removed in 
3.1
+    # @contextfunction was renamed to @pass_context in Jinja 3.0, and was 
removed in 3.1
+    # hence we try to get pass_context (most installs will be >=3.1)
+    # and fall back to contextfunction,
+    # adding a type ignore for mypy to let us access an attribute that may not 
exist
     if hasattr(jinja2, "pass_context"):
         pass_context = jinja2.pass_context
     else:  # pragma: nocover
-        pass_context = jinja2.contextfunction
+        pass_context = jinja2.contextfunction  # type: ignore[attr-defined]
 except ImportError:  # pragma: nocover
     jinja2 = None  # type: ignore
 
@@ -25,9 +28,9 @@
         template: typing.Any,
         context: dict,
         status_code: int = 200,
-        headers: typing.Mapping[str, str] = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ):
         self.template = template
         self.context = context
@@ -85,9 +88,9 @@
         name: str,
         context: dict,
         status_code: int = 200,
-        headers: typing.Mapping[str, str] = None,
-        media_type: str = None,
-        background: BackgroundTask = None,
+        headers: typing.Optional[typing.Mapping[str, str]] = None,
+        media_type: typing.Optional[str] = None,
+        background: typing.Optional[BackgroundTask] = None,
     ) -> _TemplateResponse:
         if "request" not in context:
             raise ValueError('context must include a "request" key')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/starlette/websockets.py 
new/starlette-0.19.1/starlette/websockets.py
--- old/starlette-0.19.0/starlette/websockets.py        2022-03-09 
19:43:11.000000000 +0100
+++ new/starlette-0.19.1/starlette/websockets.py        2022-04-22 
07:26:15.000000000 +0200
@@ -13,7 +13,7 @@
 
 
 class WebSocketDisconnect(Exception):
-    def __init__(self, code: int = 1000, reason: str = None) -> None:
+    def __init__(self, code: int = 1000, reason: typing.Optional[str] = None) 
-> None:
         self.code = code
         self.reason = reason or ""
 
@@ -88,8 +88,8 @@
 
     async def accept(
         self,
-        subprotocol: str = None,
-        headers: typing.Iterable[typing.Tuple[bytes, bytes]] = None,
+        subprotocol: typing.Optional[str] = None,
+        headers: typing.Optional[typing.Iterable[typing.Tuple[bytes, bytes]]] 
= None,
     ) -> None:
         headers = headers or []
 
@@ -174,14 +174,16 @@
         else:
             await self.send({"type": "websocket.send", "bytes": 
text.encode("utf-8")})
 
-    async def close(self, code: int = 1000, reason: str = None) -> None:
+    async def close(
+        self, code: int = 1000, reason: typing.Optional[str] = None
+    ) -> None:
         await self.send(
             {"type": "websocket.close", "code": code, "reason": reason or ""}
         )
 
 
 class WebSocketClose:
-    def __init__(self, code: int = 1000, reason: str = None) -> None:
+    def __init__(self, code: int = 1000, reason: typing.Optional[str] = None) 
-> None:
         self.code = code
         self.reason = reason or ""
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/tests/test_routing.py 
new/starlette-0.19.1/tests/test_routing.py
--- old/starlette-0.19.0/tests/test_routing.py  2022-03-09 19:43:11.000000000 
+0100
+++ new/starlette-0.19.1/tests/test_routing.py  2022-04-22 07:26:15.000000000 
+0200
@@ -1,4 +1,5 @@
 import functools
+import typing
 import uuid
 
 import pytest
@@ -710,3 +711,38 @@
         match="Duplicated param names id, name at path 
/{id}/{name}/{id}/{name}",
     ):
         Route("/{id}/{name}/{id}/{name}", user)
+
+
+class Endpoint:
+    async def my_method(self, request):
+        ...  # pragma: no cover
+
+    @classmethod
+    async def my_classmethod(cls, request):
+        ...  # pragma: no cover
+
+    @staticmethod
+    async def my_staticmethod(request):
+        ...  # pragma: no cover
+
+    def __call__(self, request):
+        ...  # pragma: no cover
+
+
[email protected](
+    "endpoint, expected_name",
+    [
+        pytest.param(func_homepage, "func_homepage", id="function"),
+        pytest.param(Endpoint().my_method, "my_method", id="method"),
+        pytest.param(Endpoint.my_classmethod, "my_classmethod", 
id="classmethod"),
+        pytest.param(
+            Endpoint.my_staticmethod,
+            "my_staticmethod",
+            id="staticmethod",
+        ),
+        pytest.param(Endpoint(), "Endpoint", id="object"),
+        pytest.param(lambda request: ..., "<lambda>", id="lambda"),
+    ],
+)
+def test_route_name(endpoint: typing.Callable, expected_name: str):
+    assert Route(path="/", endpoint=endpoint).name == expected_name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/starlette-0.19.0/tests/test_status.py 
new/starlette-0.19.1/tests/test_status.py
--- old/starlette-0.19.0/tests/test_status.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/starlette-0.19.1/tests/test_status.py   2022-04-22 07:26:15.000000000 
+0200
@@ -0,0 +1,25 @@
+import importlib
+
+import pytest
+
+
[email protected](
+    "constant,msg",
+    (
+        (
+            "WS_1004_NO_STATUS_RCVD",
+            "'WS_1004_NO_STATUS_RCVD' is deprecated. "
+            "Use 'WS_1005_NO_STATUS_RCVD' instead.",
+        ),
+        (
+            "WS_1005_ABNORMAL_CLOSURE",
+            "'WS_1005_ABNORMAL_CLOSURE' is deprecated. "
+            "Use 'WS_1006_ABNORMAL_CLOSURE' instead.",
+        ),
+    ),
+)
+def test_deprecated_types(constant: str, msg: str) -> None:
+    with pytest.warns(DeprecationWarning) as record:
+        getattr(importlib.import_module("starlette.status"), constant)
+        assert len(record) == 1
+        assert msg in str(record.list[0])

Reply via email to