Skip to content

Commit

Permalink
Switched from trio.open_cancel_scope() (deprecated) to trio.CancelSco…
Browse files Browse the repository at this point in the history
…pe()
  • Loading branch information
Max-7 committed Feb 15, 2019
1 parent 718e571 commit a676415
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion parsec/core/backend_connection/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async def _event_listener_manager(self):
return

async def _event_pump(self, *, task_status=trio.TASK_STATUS_IGNORED):
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
async with backend_cmds_factory(
self.device.organization_addr,
self.device.device_id,
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def _task(*, task_status=trio.TASK_STATUS_IGNORED):

stopped = trio.Event()
try:
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:

async def stop():
cancel_scope.cancel()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/gui/bootstrap_organization_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def _trio_bootstrap_organization(
):
portal = trio.BlockingTrioPortal()
queue.put(portal)
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
queue.put(cancel_scope)
try:
root_signing_key = SigningKey.generate()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/gui/claim_device_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def _trio_claim_device(
):
portal = trio.BlockingTrioPortal()
queue.put(portal)
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
queue.put(cancel_scope)
try:
async with backend_anonymous_cmds_factory(addr) as cmds:
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/gui/claim_user_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def _trio_claim_user(
):
portal = trio.BlockingTrioPortal()
queue.put(portal)
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
queue.put(cancel_scope)
try:
async with backend_anonymous_cmds_factory(addr) as cmds:
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/gui/register_device_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def _handle_invite_and_create_device(
queue, qt_on_done, qt_on_error, core, device_name, token
):
try:
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
queue.put(cancel_scope)
await invite_and_create_device(core.device, core.backend_cmds, device_name, token)
qt_on_done.emit()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/gui/register_user_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def _handle_invite_and_create_user(
queue, qt_on_done, qt_on_error, core, username, token, is_admin
):
try:
with trio.open_cancel_scope() as cancel_scope:
with trio.CancelScope() as cancel_scope:
queue.put(cancel_scope)
await invite_and_create_user(core.device, core.backend_cmds, username, token, is_admin)
qt_on_done.emit()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/messages_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _on_backend_offline(event):
while True:
try:

with trio.open_cancel_scope() as process_message_cancel_scope:
with trio.CancelScope() as process_message_cancel_scope:
event_bus.send("message_monitor.reconnection_message_processing.started")
try:
await fs.process_last_messages()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/mountpoint/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _wakeup_fuse():
except OSError:
pass

with trio.open_cancel_scope(shield=True):
with trio.CancelScope(shield=True):
if stop:
logger.info("Stopping fuse thread...")
fuse_operations.schedule_exit()
Expand Down
2 changes: 1 addition & 1 deletion parsec/core/sync_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def run(self, *, task_status=trio.TASK_STATUS_IGNORED):
self.event_bus.send("sync_monitor.disconnected")

async def _monitoring(self):
with trio.open_cancel_scope() as self._monitoring_cancel_scope:
with trio.CancelScope() as self._monitoring_cancel_scope:
self.event_bus.send("sync_monitor.reconnection_sync.started")
try:
await self.fs.full_sync()
Expand Down

0 comments on commit a676415

Please sign in to comment.