5151def  import_devtools (ver ):
5252    """Attempt to load the current latest available devtools into the module 
5353    cache for use later.""" 
54- 
55-     warnings .warn (
56-         "import_devtools() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
57-         DeprecationWarning , 
58-         stacklevel = 2 )
5954    global  devtools 
6055    global  version 
6156    version  =  ver 
@@ -85,11 +80,6 @@ def get_connection_context(fn_name):
8580    If there is no current connection, raise a ``RuntimeError`` with a 
8681    helpful message. 
8782    """ 
88- 
89-     warnings .warn (
90-         "get_connection_context() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
91-         DeprecationWarning , 
92-         stacklevel = 2 )
9383    try :
9484        return  _connection_context .get ()
9585    except  LookupError :
@@ -102,11 +92,6 @@ def get_session_context(fn_name):
10292    If there is no current session, raise a ``RuntimeError`` with a 
10393    helpful message. 
10494    """ 
105- 
106-     warnings .warn (
107-         "get_session_context() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
108-         DeprecationWarning , 
109-         stacklevel = 2 )
11095    try :
11196        return  _session_context .get ()
11297    except  LookupError :
@@ -117,11 +102,6 @@ def get_session_context(fn_name):
117102def  connection_context (connection ):
118103    """This context manager installs ``connection`` as the session context for 
119104    the current Trio task.""" 
120- 
121-     warnings .warn (
122-         "connection_context() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
123-         DeprecationWarning , 
124-         stacklevel = 2 )
125105    token  =  _connection_context .set (connection )
126106    try :
127107        yield 
@@ -133,11 +113,6 @@ def connection_context(connection):
133113def  session_context (session ):
134114    """This context manager installs ``session`` as the session context for the 
135115    current Trio task.""" 
136- 
137-     warnings .warn (
138-         "session_context() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
139-         DeprecationWarning , 
140-         stacklevel = 2 )
141116    token  =  _session_context .set (session )
142117    try :
143118        yield 
@@ -152,11 +127,6 @@ def set_global_connection(connection):
152127    This is generally not recommended, except it may be necessary in 
153128    certain use cases such as running inside Jupyter notebook. 
154129    """ 
155- 
156-     warnings .warn (
157-         "set_global_connection() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
158-         DeprecationWarning , 
159-         stacklevel = 2 )
160130    global  _connection_context 
161131    _connection_context  =  contextvars .ContextVar ("_connection_context" , default = connection )
162132
@@ -168,11 +138,6 @@ def set_global_session(session):
168138    This is generally not recommended, except it may be necessary in 
169139    certain use cases such as running inside Jupyter notebook. 
170140    """ 
171- 
172-     warnings .warn (
173-         "set_global_session() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
174-         DeprecationWarning , 
175-         stacklevel = 2 )
176141    global  _session_context 
177142    _session_context  =  contextvars .ContextVar ("_session_context" , default = session )
178143
@@ -238,10 +203,6 @@ async def execute(self, cmd: typing.Generator[dict, T, typing.Any]) -> T:
238203        :param cmd: any CDP command 
239204        :returns: a CDP result 
240205        """ 
241-         warnings .warn (
242-             "execute() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
243-             DeprecationWarning , 
244-             stacklevel = 2 )
245206        cmd_id  =  next (self .id_iter )
246207        cmd_event  =  trio .Event ()
247208        self .inflight_cmd [cmd_id ] =  cmd , cmd_event 
@@ -269,10 +230,6 @@ async def execute(self, cmd: typing.Generator[dict, T, typing.Any]) -> T:
269230    def  listen (self , * event_types , buffer_size = 10 ):
270231        """Return an async iterator that iterates over events matching the 
271232        indicated types.""" 
272-         warnings .warn (
273-             "listen() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
274-             DeprecationWarning , 
275-             stacklevel = 2 )
276233        sender , receiver  =  trio .open_memory_channel (buffer_size )
277234        for  event_type  in  event_types :
278235            self .channels [event_type ].add (sender )
@@ -286,10 +243,6 @@ async def wait_for(self, event_type: typing.Type[T], buffer_size=10) -> typing.A
286243        an async with block. The block will not exit until the indicated 
287244        event is received. 
288245        """ 
289-         warnings .warn (
290-             "wait_for() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
291-             DeprecationWarning , 
292-             stacklevel = 2 )
293246        sender : trio .MemorySendChannel 
294247        receiver : trio .MemoryReceiveChannel 
295248        sender , receiver  =  trio .open_memory_channel (buffer_size )
@@ -305,10 +258,6 @@ def _handle_data(self, data):
305258
306259        :param dict data: a JSON dictionary 
307260        """ 
308-         warnings .warn (
309-             "handle_date() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
310-             DeprecationWarning , 
311-             stacklevel = 2 )
312261        if  "id"  in  data :
313262            self ._handle_cmd_response (data )
314263        else :
@@ -320,10 +269,6 @@ def _handle_cmd_response(self, data):
320269
321270        :param dict data: response as a JSON dictionary 
322271        """ 
323-         warnings .warn (
324-             "handle_cmd_response() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
325-             DeprecationWarning , 
326-             stacklevel = 2 )
327272        cmd_id  =  data ["id" ]
328273        try :
329274            cmd , event  =  self .inflight_cmd .pop (cmd_id )
@@ -350,10 +295,6 @@ def _handle_event(self, data):
350295
351296        :param dict data: event as a JSON dictionary 
352297        """ 
353-         warnings .warn (
354-             "_handle_event() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
355-             DeprecationWarning , 
356-             stacklevel = 2 )
357298        global  devtools 
358299        event  =  devtools .util .parse_json_event (data )
359300        logger .debug ("Received event: %s" , event )
@@ -398,10 +339,6 @@ async def dom_enable(self):
398339        This keeps track of concurrent callers and only disables DOM 
399340        events when all callers have exited. 
400341        """ 
401-         warnings .warn (
402-             "dom_enable() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
403-             DeprecationWarning , 
404-             stacklevel = 2 )
405342        global  devtools 
406343        async  with  self ._dom_enable_lock :
407344            self ._dom_enable_count  +=  1 
@@ -423,10 +360,6 @@ async def page_enable(self):
423360        This keeps track of concurrent callers and only disables page 
424361        events when all callers have exited. 
425362        """ 
426-         warnings .warn (
427-             "page_enable() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
428-             DeprecationWarning , 
429-             stacklevel = 2 )
430363        global  devtools 
431364        async  with  self ._page_enable_lock :
432365            self ._page_enable_count  +=  1 
@@ -470,10 +403,6 @@ async def aclose(self):
470403        ``CdpConnectionClosed`` after the CDP connection is closed. It 
471404        is safe to call this multiple times. 
472405        """ 
473-         warnings .warn (
474-             "aclose() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
475-             DeprecationWarning , 
476-             stacklevel = 2 )
477406        await  self .ws .aclose ()
478407
479408    @asynccontextmanager  
@@ -485,21 +414,13 @@ async def open_session(self, target_id) -> typing.AsyncIterator[CdpSession]:
485414        dom.get_document()`` and it will execute on the current session 
486415        automatically. 
487416        """ 
488-         warnings .warn (
489-             "open_session() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
490-             DeprecationWarning , 
491-             stacklevel = 2 )
492417        session  =  await  self .connect_session (target_id )
493418        with  session_context (session ):
494419            yield  session 
495420
496421    async  def  connect_session (self , target_id ) ->  "CdpSession" :
497422        """Returns a new :class:`CdpSession` connected to the specified 
498423        target.""" 
499-         warnings .warn (
500-             "connect_session() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
501-             DeprecationWarning , 
502-             stacklevel = 2 )
503424        global  devtools 
504425        session_id  =  await  self .execute (devtools .target .attach_to_target (target_id , True ))
505426        session  =  CdpSession (self .ws , session_id , target_id )
@@ -509,10 +430,6 @@ async def connect_session(self, target_id) -> "CdpSession":
509430    async  def  _reader_task (self ):
510431        """Runs in the background and handles incoming messages: dispatching 
511432        responses to commands and events to listeners.""" 
512-         warnings .warn (
513-             "render_task() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
514-             DeprecationWarning , 
515-             stacklevel = 2 )
516433        global  devtools 
517434        while  True :
518435            try :
@@ -562,11 +479,7 @@ async def open_cdp(url) -> typing.AsyncIterator[CdpConnection]:
562479    you want to use multiple connections concurrently, it is recommended 
563480    to open each on in a separate task. 
564481    """ 
565-     
566-     warnings .warn (
567-             "open_cdp() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
568-             DeprecationWarning , 
569-             stacklevel = 2 )
482+ 
570483    async  with  trio .open_nursery () as  nursery :
571484        conn  =  await  connect_cdp (nursery , url )
572485        try :
@@ -590,10 +503,6 @@ async def connect_cdp(nursery, url) -> CdpConnection:
590503    current task. This argument is for unusual use cases, such as 
591504    running inside of a notebook. 
592505    """ 
593-     warnings .warn (
594-             "connect_cdp() is now deprecated for Firefox. Please migrate to the new BiDi implementations" , 
595-             DeprecationWarning , 
596-             stacklevel = 2 )
597506    ws  =  await  connect_websocket_url (nursery , url , max_message_size = MAX_WS_MESSAGE_SIZE )
598507    cdp_conn  =  CdpConnection (ws )
599508    nursery .start_soon (cdp_conn ._reader_task )
0 commit comments