public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/
Date: Sun,  7 Mar 2021 15:17:33 +0000 (UTC)	[thread overview]
Message-ID: <1615127866.9eea2af22c9e51475a4adba57fdded3a2a88c886.zmedico@gentoo> (raw)

commit:     9eea2af22c9e51475a4adba57fdded3a2a88c886
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  7 14:18:44 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Mar  7 14:37:46 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9eea2af2

_writer: Use async and await syntax

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/util/futures/_asyncio/streams.py | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lib/portage/util/futures/_asyncio/streams.py b/lib/portage/util/futures/_asyncio/streams.py
index ea5882dd3..7a8d4a3e0 100644
--- a/lib/portage/util/futures/_asyncio/streams.py
+++ b/lib/portage/util/futures/_asyncio/streams.py
@@ -1,4 +1,4 @@
-# Copyright 2018-2020 Gentoo Authors
+# Copyright 2018-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
@@ -9,7 +9,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
 	'_emerge.PipeReader:PipeReader',
 	'portage.util.futures:asyncio',
 )
-from portage.util.futures.compat_coroutine import coroutine
 
 
 def _reader(input_file, loop=None):
@@ -55,8 +54,7 @@ class _Reader:
 			self._pipe_reader = None
 
 
-@coroutine
-def _writer(output_file, content, loop=None):
+async def _writer(output_file, content, loop=DeprecationWarning):
 	"""
 	Asynchronously write bytes to output file. The output file is
 	assumed to be in non-blocking mode. If an EnvironmentError
@@ -68,10 +66,9 @@ def _writer(output_file, content, loop=None):
 	@type output_file: file object
 	@param content: content to write
 	@type content: bytes
-	@param loop: asyncio.AbstractEventLoop (or compatible)
-	@type loop: event loop
+	@param loop: deprecated
 	"""
-	loop = asyncio._wrap_loop(loop)
+	loop = asyncio.get_event_loop()
 	fd = output_file.fileno()
 	while content:
 		try:
@@ -82,7 +79,7 @@ def _writer(output_file, content, loop=None):
 			waiter = loop.create_future()
 			loop.add_writer(fd, lambda: waiter.done() or waiter.set_result(None))
 			try:
-				yield waiter
+				await waiter
 			finally:
 				# The loop and output file may have been closed.
 				if not loop.is_closed():


             reply	other threads:[~2021-03-07 15:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 15:17 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-01  7:02 [gentoo-commits] proj/portage:master commit in: lib/portage/util/futures/_asyncio/ Zac Medico
2024-09-01  7:02 Zac Medico
2024-09-01  7:02 Zac Medico
2024-08-31 19:20 Zac Medico
2024-08-19 14:49 Zac Medico
2024-08-19 14:49 Zac Medico
2024-02-22 15:36 Zac Medico
2024-02-21 16:00 Zac Medico
2021-09-20  5:36 Zac Medico
2021-03-07  5:28 Zac Medico
2021-03-06  9:14 Zac Medico
2020-12-07  8:41 Zac Medico
2020-08-03 19:30 Zac Medico
2020-06-18 18:06 Zac Medico
2020-02-29  4:33 Zac Medico
2019-10-18  3:43 Zac Medico
2019-05-18 22:25 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1615127866.9eea2af22c9e51475a4adba57fdded3a2a88c886.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox