Skip to content

Commit 16962d8

Browse files
committed
use type for ignore
Signed-off-by: emdneto <[email protected]>
1 parent e7ad8ba commit 16962d8

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-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: # pyright: ignore [reportReturnType]
450+
) -> Gauge: # type: 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: # pyright: ignore [reportIncompatibleMethodOverride]
65+
def __call__(self, func: V) -> V: # type: ignore[reportIncompatibleMethodOverride]
6666
if asyncio.iscoroutinefunction(func):
6767

6868
@functools.wraps(func) # type: ignore
69-
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R: # pyright: ignore [reportInvalidTypeVarUse]
69+
async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R: # type: 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]: # pyright: ignore [reportInvalidTypeVarUse]
82-
return _AgnosticContextManager(func, args, kwargs) # pyright: ignore [reportArgumentType]
81+
def helper(*args: Pargs, **kwargs: Pkwargs) -> _AgnosticContextManager[R]: # type: ignore[reportInvalidTypeVarUse]
82+
return _AgnosticContextManager(func, args, kwargs) # type: 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ class TestUseSpanException(Exception):
155155
raise TestUseSpanException("test error")
156156

157157
self.assertEqual(
158-
test_span.recorded_status.status_code, # pyright: ignore [reportAttributeAccessIssue]
158+
test_span.recorded_status.status_code, # type: ignore[reportAttributeAccessIssue]
159159
StatusCode.ERROR,
160160
)
161161
self.assertEqual(
162-
test_span.recorded_status.description, # pyright: ignore [reportAttributeAccessIssue]
162+
test_span.recorded_status.description, # type: ignore[reportAttributeAccessIssue]
163163
"TestUseSpanException: test error",
164164
)

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) # pyright: ignore [reportArgumentType]
27+
called = once.do_once(once_func) # type: 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) # pyright: ignore [reportArgumentType]
32+
called = once.do_once(once_func) # type: 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) # pyright: ignore [reportArgumentType]
41+
return once.do_once(once_func) # type: ignore[reportArgumentType]
4242

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

0 commit comments

Comments
 (0)