Skip to content

Commit 1eb24e9

Browse files
authored
fix(mypy): fix a couple of mypy issues (backport #3416) (#3417) (#3420)
* fix(mypy): fix a couple of mypy issues (#3416) (cherry picked from commit 4a9714c) * remove unnecesary ignore comment Co-authored-by: Julien Danjou <[email protected]> Co-authored-by: brettlangdon <[email protected]> (cherry picked from commit 6c8249e) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent d0187b3 commit 1eb24e9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ddtrace/internal/compat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def process_time_ns():
121121
if sys.version_info.major < 3:
122122
getrandbits = random.SystemRandom().getrandbits
123123
else:
124-
getrandbits = random.getrandbits
124+
# Use a wrapper that allows passing k as a kwargs like in Python 2
125+
def getrandbits(k):
126+
return random.getrandbits(k)
125127

126128

127129
if sys.version_info.major < 3:

ddtrace/internal/utils/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, method, maxsize):
7171

7272
def __get__(self, obj, objtype=None):
7373
# type: (Any, Optional[Type]) -> F
74-
cached_method = cached(self._maxsize)(self._method.__get__(obj, objtype)) # type: ignore[attr-defined]
74+
cached_method = cached(self._maxsize)(self._method.__get__(obj, objtype))
7575
setattr(obj, self._method.__name__, cached_method)
7676
return cached_method
7777

ddtrace/internal/utils/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ def _get_original_method(thing, key):
8989
if inspect.isclass(patchable) or inspect.ismodule(patchable):
9090
setattr(patchable, key, dest)
9191
elif hasattr(patchable, "__class__"):
92-
setattr(patchable, key, dest.__get__(patchable, patchable.__class__)) # type: ignore[attr-defined]
92+
setattr(patchable, key, dest.__get__(patchable, patchable.__class__))

0 commit comments

Comments
 (0)