python icon indicating copy to clipboard operation
python copied to clipboard

Avoid shadowing important built-ins in the example code

Open rafrafek opened this issue 1 year ago • 11 comments

What type of PR is this? cleanup(?)

/kind cleanup

What this PR does / why we need it:

Fixes a lot of potential issues when someone tries to use the code from the example.

Changes in naming:

  • type to type_: The variable type is renamed to type_. In Python, type is a built-in name for a function that returns the type of an object. Using type as a variable name can shadow this built-in function, which could lead to confusion or errors in the code. Renaming it to type_ avoids this potential issue.
  • object to object_: Similarly, object is a built-in type in Python (for instance, object is the base class for all classes in Python). Using object as a variable name can also overshadow the built-in object type, which can lead to bugs or misunderstandings. Renaming it to object_ avoids this issue.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change? NONE

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


rafrafek avatar Dec 01 '23 16:12 rafrafek

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: rafrafek / name: Rafał (f6c65df10f057066569f09cd4214392f21185645)

Welcome @rafrafek!

It looks like this is your first PR to kubernetes-client/python 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Dec 01 '23 16:12 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rafrafek Once this PR has been reviewed and has the lgtm label, please assign yliaog for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Dec 01 '23 16:12 k8s-ci-robot

Please sign the CLA

roycaihw avatar Feb 12 '24 17:02 roycaihw

@roycaihw done!

rafrafek avatar Feb 12 '24 17:02 rafrafek

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 12 '24 18:05 k8s-triage-robot

Bump.

/remove-lifecycle stale

rafrafek avatar May 12 '24 18:05 rafrafek