Fix PYRE_MISSING_ANNOTATIONS issues in fbcode/deeplearning/projects/sam3_release/sam3/model/io_utils.py
Differential Revision: D102576637 fbshipit-source-id: 76378a87b33ee16a736b79c32e312751a69913f0
This commit is contained in:
committed by
meta-codesync[bot]
parent
875ed6fa5a
commit
eef9c1e86a
@@ -7,7 +7,9 @@ import os
|
|||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import types
|
||||||
from threading import Condition, get_ident, Lock, Thread
|
from threading import Condition, get_ident, Lock, Thread
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
@@ -492,7 +494,7 @@ class FIFOLock:
|
|||||||
self._waiters = queue.Queue()
|
self._waiters = queue.Queue()
|
||||||
self._condition = Condition()
|
self._condition = Condition()
|
||||||
|
|
||||||
def acquire(self):
|
def acquire(self) -> None:
|
||||||
ident = get_ident()
|
ident = get_ident()
|
||||||
with self._condition:
|
with self._condition:
|
||||||
self._waiters.put(ident)
|
self._waiters.put(ident)
|
||||||
@@ -511,7 +513,12 @@ class FIFOLock:
|
|||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.acquire()
|
self.acquire()
|
||||||
|
|
||||||
def __exit__(self, t, v, tb):
|
def __exit__(
|
||||||
|
self,
|
||||||
|
t: Optional[type[BaseException]],
|
||||||
|
v: Optional[BaseException],
|
||||||
|
tb: Optional[types.TracebackType],
|
||||||
|
) -> None:
|
||||||
self.release()
|
self.release()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user