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

Add audeer.set_or_delete_env_variable() #164

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

hagenw
Copy link
Member

@hagenw hagenw commented Dec 4, 2024

Adds audeer.set_or_delete_env_variable() to set an environment variable to the provided value, or delete it if the value is None. This helper function is quite useful for writing test fixtures that modify environment variables.

Summary by Sourcery

New Features:

  • Introduce audeer.set_or_delete_env_variable() to manage environment variables by setting them to a given value or deleting them if the value is None.

Copy link

sourcery-ai bot commented Dec 4, 2024

Reviewer's Guide by Sourcery

This PR introduces a new utility function set_or_delete_env_variable() in the audeer library that provides a convenient way to manage environment variables. The function is implemented as a simple wrapper around os.environ operations, allowing both setting and deletion of environment variables based on the provided value.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added a new utility function to manage environment variables
  • Implemented function to set environment variable when value is provided
  • Added logic to delete environment variable when value is None
  • Added function documentation with clear parameter descriptions
audeer/core/utils.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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

Successfully merging this pull request may close these issues.

1 participant