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

feat: add items iterator #38

Merged
merged 1 commit into from
Oct 21, 2024
Merged

feat: add items iterator #38

merged 1 commit into from
Oct 21, 2024

Conversation

P403n1x87
Copy link
Collaborator

We extend the public API with an iterator that allows retrieving all the configuration items. This returns a mapping between attribute paths and environment variable instances. We also attach the full variable name to each EnvVariable instance, which is accessible via the full_name property.

if not overwrite:
overlap = set(cls.__dict__.keys()) & set(to_include.keys())
if overlap:
raise ValueError("Configuration clashes detected: {}".format(overlap))

own_prefix = _normalized(getattr(cls, "__prefix__", ""))

if namespace is not None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Code Quality Violation

Found too many nested ifs within this condition (...read more)

Too many nested loops make the code hard to read and understand. Simplify your code by removing nesting levels and separate code in small units.

View in Datadog  Leave us feedback  Documentation

Comment on lines +443 to +445
if own_prefix:
v._full_name = f"{own_prefix}_{v._full_name}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Code Quality Violation

too many nesting levels (...read more)

Avoid to nest too many loops together. Having too many loops make your code harder to understand.
Prefer to organize your code in functions and unit of code you can clearly understand.

Learn More

View in Datadog  Leave us feedback  Documentation

Comment on lines +431 to +433
if isinstance(v, EnvVariable):
v._full_name = f"{own_prefix}_{v._full_name}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Code Quality Violation

too many nesting levels (...read more)

Avoid to nest too many loops together. Having too many loops make your code harder to understand.
Prefer to organize your code in functions and unit of code you can clearly understand.

Learn More

View in Datadog  Leave us feedback  Documentation

We extend the public API with an iterator that allows retrieving
all the configuration items. This returns a mapping between
attribute paths and environment variable instances. We also attach
the full variable name to each EnvVariable instance, which is
accessible via the ``full_name`` property.
@P403n1x87 P403n1x87 merged commit 397c93f into main Oct 21, 2024
12 checks passed
@P403n1x87 P403n1x87 deleted the feat/items-iterator branch October 21, 2024 15:35
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.

2 participants