Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce code duplication in method signatures throughout the code base #2254

Open
parthea opened this issue Nov 19, 2024 · 0 comments
Open

Reduce code duplication in method signatures throughout the code base #2254

parthea opened this issue Nov 19, 2024 · 0 comments
Assignees

Comments

@parthea
Copy link
Contributor

parthea commented Nov 19, 2024

See the diff in PR https://github.com/googleapis/gapic-generator-python/pull/2253/files which shows changes to the following code which appears throughout the code base

        retry: OptionalRetry = gapic_v1.method.DEFAULT,
        timeout: Union[float, object] = gapic_v1.method.DEFAULT,
        metadata: Sequence[Tuple[str, str]] = (),
    )

We can reduce code duplication by using common code for a common method signature. As a pre-requisite, we need to fix the following issues

Address the inconsistency with the default values in timeout.

See here

retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,

and here

Address the inconsistency in the type for Async REST and Async Mixins and pagers, where we have bothOptionalAsyncRetry and OptionalRetry defined as the type for retry

See here

OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]

and here

and here
OptionalAsyncRetry

OptionalAsyncRetry = Union[retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants