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

Adding ruff rule A #4232

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# -- Project information -----------------------------------------------------

project = "OpenTelemetry Python"
copyright = "OpenTelemetry Authors" # pylint: disable=redefined-builtin
docs_copyright = "OpenTelemetry Authors" # pylint: disable=redefined-builtin
Copy link
Contributor

Choose a reason for hiding this comment

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

I am pretty sure we cannot change sphinx configuration for pleasing some lint rules 😅 see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-copyright

Copy link
Member

Choose a reason for hiding this comment

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

Can ignore this too

author = "OpenTelemetry Authors"


Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-api/src/opentelemetry/baggage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def _is_valid_value(value: object) -> bool:
parts = str(value).split(";")
is_valid_value = _VALUE_PATTERN.fullmatch(parts[0]) is not None
if len(parts) > 1: # one or more properties metadata
for property in parts[1:]:
if _PROPERT_PATTERN.fullmatch(property) is None:
for properties in parts[1:]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe prop instead since this looks like is one property?

Copy link
Author

@Neema-Joju Neema-Joju Oct 22, 2024

Choose a reason for hiding this comment

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

prop, properties or no change?

Copy link
Member

Choose a reason for hiding this comment

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

I would use prop

if _PROPERT_PATTERN.fullmatch(properties) is None:
is_valid_value = False
break
return is_valid_value
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ select = [
"PLC", # pylint convention
"PLE", # pylint error
"Q", # flake8-quotes
"A", # flake8-builtins
]

ignore = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def start_span(
context = SpanContextShim(span.get_span_context())
return SpanShim(self, context, span)

def inject(self, span_context, format: object, carrier: object):
def inject(self, span_context, formats: object, carrier: object):
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure we can rename function parameters because a linter rule does not like it :)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, in this case, I think we can just ignore it.

"""Injects ``span_context`` into ``carrier``.

See base class for more details.
Expand All @@ -703,7 +703,7 @@ def inject(self, span_context, format: object, carrier: object):
# TODO: Support Format.BINARY once it is supported in
# opentelemetry-python.

if format not in self._supported_formats:
if formats not in self._supported_formats:
raise UnsupportedFormatException

propagator = get_global_textmap()
Expand All @@ -715,7 +715,7 @@ def inject(self, span_context, format: object, carrier: object):
ctx = set_span_in_context(span)
propagator.inject(carrier, context=ctx)

def extract(self, format: object, carrier: object):
def extract(self, formats: object, carrier: object):
"""Returns an ``opentracing.SpanContext`` instance extracted from a
``carrier``.

Expand All @@ -737,7 +737,7 @@ def extract(self, format: object, carrier: object):
# uses the configured propagators in opentelemetry.propagators.
# TODO: Support Format.BINARY once it is supported in
# opentelemetry-python.
if format not in self._supported_formats:
if formats not in self._supported_formats:
raise UnsupportedFormatException

propagator = get_global_textmap()
Expand Down