Python selectors._fileobj_to_fd() Examples
The following are 6
code examples of selectors._fileobj_to_fd().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
selectors
, or try the search function
.
Example #1
Source File: selector_events.py From Imogen with MIT License | 6 votes |
def _ensure_fd_no_transport(self, fd): fileno = fd if not isinstance(fileno, int): try: fileno = int(fileno.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError(f"Invalid file object: {fd!r}") from None try: transport = self._transports[fileno] except KeyError: pass else: if not transport.is_closing(): raise RuntimeError( f'File descriptor {fd!r} is used by transport ' f'{transport!r}')
Example #2
Source File: _asyncio_test_utils.py From txaio with MIT License | 6 votes |
def _ensure_fd_no_transport(self, fd): if not isinstance(fd, int): try: fd = int(fd.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError("Invalid file object: " "{!r}".format(fd)) from None try: transport = self._transports[fd] except KeyError: pass else: raise RuntimeError( 'File descriptor {!r} is used by transport {!r}'.format( fd, transport))
Example #3
Source File: selector_events.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
def _ensure_fd_no_transport(self, fd): fileno = fd if not isinstance(fileno, int): try: fileno = int(fileno.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError(f"Invalid file object: {fd!r}") from None try: transport = self._transports[fileno] except KeyError: pass else: if not transport.is_closing(): raise RuntimeError( f'File descriptor {fd!r} is used by transport ' f'{transport!r}')
Example #4
Source File: selector_events.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _ensure_fd_no_transport(self, fd): fileno = fd if not isinstance(fileno, int): try: fileno = int(fileno.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError(f"Invalid file object: {fd!r}") from None try: transport = self._transports[fileno] except KeyError: pass else: if not transport.is_closing(): raise RuntimeError( f'File descriptor {fd!r} is used by transport ' f'{transport!r}')
Example #5
Source File: selector_events.py From android_universal with MIT License | 6 votes |
def _ensure_fd_no_transport(self, fd): fileno = fd if not isinstance(fileno, int): try: fileno = int(fileno.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError(f"Invalid file object: {fd!r}") from None try: transport = self._transports[fileno] except KeyError: pass else: if not transport.is_closing(): raise RuntimeError( f'File descriptor {fd!r} is used by transport ' f'{transport!r}')
Example #6
Source File: utils.py From android_universal with MIT License | 6 votes |
def _ensure_fd_no_transport(self, fd): if not isinstance(fd, int): try: fd = int(fd.fileno()) except (AttributeError, TypeError, ValueError): # This code matches selectors._fileobj_to_fd function. raise ValueError("Invalid file object: " "{!r}".format(fd)) from None try: transport = self._transports[fd] except KeyError: pass else: raise RuntimeError( 'File descriptor {!r} is used by transport {!r}'.format( fd, transport))