Skip to content

Commit 526473c

Browse files
committed
clearing out some DeprecationWarnings
1 parent fcd4183 commit 526473c

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

juju/client/connection.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ class Monitor:
163163

164164
def __init__(self, connection):
165165
self.connection = weakref.ref(connection)
166-
self.reconnecting = asyncio.Lock(loop=connection.loop)
167-
self.close_called = asyncio.Event(loop=connection.loop)
166+
self.reconnecting = asyncio.Lock()
167+
self.close_called = asyncio.Event()
168168

169169
@property
170170
def status(self):
@@ -434,7 +434,7 @@ async def _pinger(self):
434434
async def _do_ping():
435435
try:
436436
await pinger_facade.Ping()
437-
await asyncio.sleep(10, loop=self.loop)
437+
await asyncio.sleep(10)
438438
except CancelledError:
439439
pass
440440

@@ -636,7 +636,7 @@ async def _try_endpoint(endpoint, cacert, delay):
636636
0.1 * i))
637637
for i, (endpoint, cacert) in enumerate(endpoints)]
638638
for attempt in range(self._retries + 1):
639-
for task in asyncio.as_completed(tasks, loop=self.loop):
639+
for task in asyncio.as_completed(tasks):
640640
try:
641641
result = await task
642642
break
@@ -805,7 +805,7 @@ async def login(self):
805805

806806
class _Task:
807807
def __init__(self, task, loop):
808-
self.stopped = asyncio.Event(loop=loop)
808+
self.stopped = asyncio.Event()
809809
self.stopped.set()
810810
self.task = task
811811
self.loop = loop

juju/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,9 @@ def __init__(
594594
self.state = ModelState(self)
595595
self._info = None
596596
self._mode = None
597-
self._watch_stopping = asyncio.Event(loop=self._connector.loop)
598-
self._watch_stopped = asyncio.Event(loop=self._connector.loop)
599-
self._watch_received = asyncio.Event(loop=self._connector.loop)
597+
self._watch_stopping = asyncio.Event()
598+
self._watch_stopped = asyncio.Event()
599+
self._watch_received = asyncio.Event()
600600
self._watch_stopped.set()
601601

602602
self._charmhub = CharmHub(self)
@@ -1145,7 +1145,7 @@ async def _wait(self, entity_type, entity_id, action, predicate=None):
11451145
has a 'completed' status. See the _Observer class for details.
11461146
11471147
"""
1148-
q = asyncio.Queue(loop=self._connector.loop)
1148+
q = asyncio.Queue()
11491149

11501150
async def callback(delta, old, new, model):
11511151
await q.put(delta.get_id())

juju/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,9 @@ async def run_with_interrupt(task, *events, loop=None):
123123
:param loop: Optional event loop to use other than the default.
124124
"""
125125
loop = loop or asyncio.get_event_loop()
126-
task = asyncio.ensure_future(task, loop=loop)
126+
task = asyncio.ensure_future(task)
127127
event_tasks = [loop.create_task(event.wait()) for event in events]
128128
done, pending = await asyncio.wait([task] + event_tasks,
129-
loop=loop,
130129
return_when=asyncio.FIRST_COMPLETED)
131130
for f in pending:
132131
f.cancel() # cancel unfinished tasks

0 commit comments

Comments
 (0)