From b845ec34af73d20a5a0d25f36fe09977f7ca6d7b Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Wed, 12 Jul 2023 13:19:51 -0700 Subject: [PATCH 1/2] Making some style and format fixes. --- src/firebase_functions/core.py | 8 ++++---- src/firebase_functions/https_fn.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/firebase_functions/core.py b/src/firebase_functions/core.py index 8747e46..e4b3610 100644 --- a/src/firebase_functions/core.py +++ b/src/firebase_functions/core.py @@ -24,7 +24,7 @@ @_dataclass.dataclass(frozen=True) class CloudEvent(_typing.Generic[T]): """ - A Cloud Event is the base of a cross-platform format for encoding a serverless event. + A CloudEvent is the base of a cross-platform format for encoding a serverless event. More information can be found at https://github.com/cloudevents/spec """ @@ -60,15 +60,15 @@ class CloudEvent(_typing.Generic[T]): subject: str | None """ - The resource, provided by source, that this event relates to + The resource, provided by source, that this event relates to. """ @_dataclass.dataclass(frozen=True) class Change(_typing.Generic[T]): """ - * The Functions interface for events that change state, such as - * Realtime Database `on_value_written`. + The Cloud Functions interface for events that change state, such as + Realtime Database `on_value_written`. """ before: T diff --git a/src/firebase_functions/https_fn.py b/src/firebase_functions/https_fn.py index a656d96..8df6270 100644 --- a/src/firebase_functions/https_fn.py +++ b/src/firebase_functions/https_fn.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -"""Module for Cloud Functions that listen to HTTPS endpoints. +"""Module for functions that listen to HTTPS endpoints. These can be raw web requests and Callable RPCs. """ # pylint: disable=protected-access @@ -32,7 +32,7 @@ class FunctionsErrorCode(str, _enum.Enum): """ - The set of Firebase Functions status codes. The codes are the same at the + The set of Cloud Functions status codes. The codes are the same as the ones exposed by gRPC here: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md """ @@ -54,7 +54,7 @@ class FunctionsErrorCode(str, _enum.Enum): Client specified an invalid argument. Note that this differs from `failed-precondition`. `invalid-argument` indicates arguments that are problematic regardless of the state of the system - (e.g. an invalid field name). + (such an invalid field name). """ DEADLINE_EXCEEDED = "deadline-exceeded" @@ -120,7 +120,7 @@ class FunctionsErrorCode(str, _enum.Enum): INTERNAL = "internal" """ Internal errors. Means some invariants expected by - underlying system has been broken. If you see one of these errors, + underlying system have been broken. If you see one of these errors, something is very broken. """ @@ -208,7 +208,7 @@ class _HttpErrorCode: """ Standard error codes and HTTP statuses for different ways a request can fail, as defined by: -https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto +https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto. This map is used primarily to convert from a client error code string to to the HTTP format error code string and status, and make sure it's in the supported set. @@ -282,12 +282,12 @@ class AuthData: uid: str """ - User ID of the Id token. + User ID of the ID token. """ token: dict[str, _typing.Any] """ - The Id token's decoded claims. + The ID token's decoded claims. """ @@ -409,7 +409,7 @@ def _on_call_handler(func: _C2, request: Request, def on_request(**kwargs) -> _typing.Callable[[_C1], _C1]: """ Handler which handles HTTPS requests. - Requires a function that takes a Request and Response object, same signature as an Flask app. + Requires a function that takes a ``Request`` and ``Response`` object, the same signature as a Flask app. Example: @@ -450,7 +450,7 @@ def on_request_wrapped(request: Request) -> Response: def on_call(**kwargs) -> _typing.Callable[[_C2], _C2]: """ Declares a callable method for clients to call using a Firebase SDK. - Requires a function that takes a CallableRequest. + Requires a function that takes a ``CallableRequest``. Example: @@ -465,7 +465,7 @@ def example(request: CallableRequest) -> Any: :rtype: :exc:`typing.Callable` \\[ \\[ :exc:`firebase_functions.https.CallableRequest` \\[ :exc:`object` \\] \\], :exc:`object` \\] - A function that takes a CallableRequest and returns an :exc:`object`. + A function that takes a ``CallableRequest`` and returns an :exc:`object`. """ options = HttpsOptions(**kwargs) From 4cb739caf21b5c7acccf01bbbab6ca1cdbe40bd4 Mon Sep 17 00:00:00 2001 From: Eric Gilmore Date: Wed, 12 Jul 2023 17:28:09 -0700 Subject: [PATCH 2/2] Found a typo in the typo fixes. --- src/firebase_functions/https_fn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/firebase_functions/https_fn.py b/src/firebase_functions/https_fn.py index 8df6270..5cd3be9 100644 --- a/src/firebase_functions/https_fn.py +++ b/src/firebase_functions/https_fn.py @@ -54,7 +54,7 @@ class FunctionsErrorCode(str, _enum.Enum): Client specified an invalid argument. Note that this differs from `failed-precondition`. `invalid-argument` indicates arguments that are problematic regardless of the state of the system - (such an invalid field name). + (such as an invalid field name). """ DEADLINE_EXCEEDED = "deadline-exceeded"