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 · 1 comment
Open
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.

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]

@vchudnov-g
Copy link
Contributor

We should get back to this clean-up task.

@vchudnov-g vchudnov-g added type: cleanup An internal cleanup or hygiene concern. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

3 participants