Python socket._fileobject() Examples

The following are code examples for showing how to use socket._fileobject(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

Example 1
Project: oil   Author: oilshell   File: test_socket.py    (license) View Source Project 6 votes vote down vote up
def testClose(self):
        class MockSocket:
            closed = False
            def flush(self): pass
            def close(self): self.closed = True

        # must not close unless we request it: the original use of _fileobject
        # by module socket requires that the underlying socket not be closed until
        # the _socketobject that created the _fileobject is closed
        s = MockSocket()
        f = socket._fileobject(s)
        f.close()
        self.assertTrue(not s.closed)

        s = MockSocket()
        f = socket._fileobject(s, close=True)
        f.close()
        self.assertTrue(s.closed) 
Example 2
Project: python2-tracer   Author: extremecoders-re   File: test_socket.py    (license) View Source Project 6 votes vote down vote up
def testClose(self):
        class MockSocket:
            closed = False
            def flush(self): pass
            def close(self): self.closed = True

        # must not close unless we request it: the original use of _fileobject
        # by module socket requires that the underlying socket not be closed until
        # the _socketobject that created the _fileobject is closed
        s = MockSocket()
        f = socket._fileobject(s)
        f.close()
        self.assertTrue(not s.closed)

        s = MockSocket()
        f = socket._fileobject(s, close=True)
        f.close()
        self.assertTrue(s.closed) 
Example 3
Project: python-   Author: secondtonone1   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 4
Project: my-first-blog   Author: AnkurBegining   File: securetransport.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 5
Project: my-first-blog   Author: AnkurBegining   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 6
Project: my-first-blog   Author: AnkurBegining   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 7
Project: kinect-2-libras   Author: inessadl   File: ssl.py    (Apache License 2.0) View Source Project 5 votes vote down vote up
def makefile(self, mode='r', bufsize=-1):

        """Make and return a file-like object that
        works with the SSL connection.  Just use the code
        from the socket module."""

        self._makefile_refs += 1
        # close=True so as to decrement the reference count when done with
        # the file-like object.
        return _fileobject(self, mode, bufsize, close=True) 
Example 8
Project: googletranslate.popclipext   Author: wizyoung   File: securetransport.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 9
Project: googletranslate.popclipext   Author: wizyoung   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 10
Project: Projects   Author: it2school   File: securetransport.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 11
Project: Projects   Author: it2school   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 12
Project: pip-update-requirements   Author: alanhamlett   File: securetransport.py    (BSD 2-Clause "Simplified" License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 13
Project: pip-update-requirements   Author: alanhamlett   File: pyopenssl.py    (BSD 2-Clause "Simplified" License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 14
Project: aws-waf-security-automation   Author: cerbo   File: pyopenssl.py    (Apache License 2.0) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 15
Project: code   Author: ActiveState   File: recipe-573444.py    (MIT License) View Source Project 5 votes vote down vote up
def setup(self):
        self.connection = self.request
        self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
        self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) 
Example 16
Project: code   Author: ActiveState   File: recipe-496786.py    (MIT License) View Source Project 5 votes vote down vote up
def setup(self):
        self.connection = self.request
        self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
        self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) 
Example 17
Project: electrum-martexcoin-server   Author: martexcoin   File: stratum_http.py    (license) View Source Project 5 votes vote down vote up
def setup(self):
        self.connection = self.request
        self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
        self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) 
Example 18
Project: swjtu-pyscraper   Author: Desgard   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 19
Project: noc-orchestrator   Author: DirceuSilvaLabs   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 20
Project: noc-orchestrator   Author: DirceuSilvaLabs   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 21
Project: noc-orchestrator   Author: DirceuSilvaLabs   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 22
Project: noc-orchestrator   Author: DirceuSilvaLabs   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 23
Project: noc-orchestrator   Author: DirceuSilvaLabs   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 24
Project: jira_worklog_scanner   Author: pgarneau   File: securetransport.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 25
Project: jira_worklog_scanner   Author: pgarneau   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 26
Project: jira_worklog_scanner   Author: pgarneau   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 27
Project: workflows.kyoyue   Author: wizyoung   File: securetransport.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 28
Project: workflows.kyoyue   Author: wizyoung   File: pyopenssl.py    (MIT License) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 29
Project: zanph   Author: zanph   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 30
Project: zanph   Author: zanph   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 31
Project: hostapd-mana   Author: adde88   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 32
Project: hostapd-mana   Author: adde88   File: ssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode='r', bufsize=-1):

        """Make and return a file-like object that
        works with the SSL connection.  Just use the code
        from the socket module."""

        self._makefile_refs += 1
        # close=True so as to decrement the reference count when done with
        # the file-like object.
        return _fileobject(self, mode, bufsize, close=True) 
Example 33
Project: YoWhenReady   Author: jnsdrtlf   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 34
Project: azure-python-siteextensions   Author: Azure   File: ssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode='r', bufsize=-1):

        """Make and return a file-like object that
        works with the SSL connection.  Just use the code
        from the socket module."""

        self._makefile_refs += 1
        # close=True so as to decrement the reference count when done with
        # the file-like object.
        return _fileobject(self, mode, bufsize, close=True) 
Example 35
Project: Sci-Finder   Author: snverse   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 36
Project: Sci-Finder   Author: snverse   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 37
Project: purelove   Author: hucmosin   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 38
Project: alexa-stackoverflow   Author: benvand   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 39
Project: devsecops-example-helloworld   Author: boozallen   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 40
Project: devsecops-example-helloworld   Author: boozallen   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 41
Project: harbour-sailfinder   Author: DylanVanAssche   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 42
Project: harbour-sailfinder   Author: DylanVanAssche   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 43
Project: QXSConsolas   Author: qxsch   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 44
Project: ascii-art-py   Author: blinglnav   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 45
Project: Texty   Author: sarthfrey   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 46
Project: ghostlines-robofont   Author: ghostlines   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 47
Project: ghostlines-robofont   Author: ghostlines   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 48
Project: lbryum-server   Author: lbryio   File: stratum_http.py    (license) View Source Project 5 votes vote down vote up
def setup(self):
        self.connection = self.request
        self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
        self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) 
Example 49
Project: Dshield   Author: ywjt   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True) 
Example 50
Project: atc_alexa   Author: ckuzma   File: pyopenssl.py    (license) View Source Project 5 votes vote down vote up
def makefile(self, mode, bufsize=-1):
        self._makefile_refs += 1
        return _fileobject(self, mode, bufsize, close=True)