Skip to content

Commit acd53e3

Browse files
committed
pyright ignore
Signed-off-by: emdneto <[email protected]>
1 parent 6adb7ac commit acd53e3

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def create_gauge( # type: ignore # pylint: disable=no-self-use
447447
name: str,
448448
unit: str = "",
449449
description: str = "",
450-
) -> Gauge:
450+
) -> Gauge: # pyright: ignore [reportReturnType]
451451
"""Creates a ``Gauge`` instrument
452452
453453
Args:

opentelemetry-api/src/opentelemetry/util/_decorator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ def __enter__(self) -> R:
6262
except StopIteration:
6363
raise RuntimeError("generator didn't yield") from None
6464

65-
def __call__(self, func: V) -> V:
65+
def __call__(self, func: V) -> V: # pyright: ignore [reportIncompatibleMethodOverride]
6666
if asyncio.iscoroutinefunction(func):
6767

6868
@functools.wraps(func) # type: ignore
69-
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R:
69+
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R: # pyright: ignore [reportInvalidTypeVarUse]
7070
with self._recreate_cm(): # type: ignore
7171
return await func(*args, **kwargs) # type: ignore
7272

@@ -78,8 +78,8 @@ def _agnosticcontextmanager(
7878
func: "Callable[P, Iterator[R]]",
7979
) -> "Callable[P, _AgnosticContextManager[R]]":
8080
@functools.wraps(func)
81-
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]:
82-
return _AgnosticContextManager(func, args, kwargs)
81+
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]: # pyright: ignore [reportInvalidTypeVarUse]
82+
return _AgnosticContextManager(func, args, kwargs) # pyright: ignore [reportArgumentType]
8383

8484
# Ignoring the type to keep the original signature of the function
8585
return helper # type: ignore[return-value]

opentelemetry-api/tests/trace/test_globals.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ class TestUseSpanException(Exception):
143143
raise TestUseSpanException("test error")
144144

145145
self.assertEqual(
146-
test_span.recorded_status.status_code, StatusCode.ERROR
146+
test_span.recorded_status.status_code, # pyright: ignore [reportAttributeAccessIssue]
147+
StatusCode.ERROR,
147148
)
148149
self.assertEqual(
149-
test_span.recorded_status.description,
150+
test_span.recorded_status.description, # pyright: ignore [reportAttributeAccessIssue]
150151
"TestUseSpanException: test error",
151152
)

opentelemetry-api/tests/util/test_once.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def test_once_single_thread(self):
2424
self.assertEqual(once_func.call_count, 0)
2525

2626
# first call should run
27-
called = once.do_once(once_func)
27+
called = once.do_once(once_func) # pyright: ignore [reportArgumentType]
2828
self.assertTrue(called)
2929
self.assertEqual(once_func.call_count, 1)
3030

3131
# subsequent calls do nothing
32-
called = once.do_once(once_func)
32+
called = once.do_once(once_func) # pyright: ignore [reportArgumentType]
3333
self.assertFalse(called)
3434
self.assertEqual(once_func.call_count, 1)
3535

@@ -38,7 +38,7 @@ def test_once_many_threads(self):
3838
once = Once()
3939

4040
def run_concurrently() -> bool:
41-
return once.do_once(once_func)
41+
return once.do_once(once_func) # pyright: ignore [reportArgumentType]
4242

4343
results = self.run_with_many_threads(run_concurrently, num_threads=100)
4444

0 commit comments

Comments
 (0)