Robot Framework
platform.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import os
17 import sys
18 
19 
20 PY_VERSION = sys.version_info[:3]
21 PYPY = 'PyPy' in sys.version
22 UNIXY = os.sep == '/'
23 WINDOWS = not UNIXY
24 RERAISED_EXCEPTIONS = (KeyboardInterrupt, SystemExit, MemoryError)
25 
26 # Part of the deprecated Python 2/3 compatibility layer. For more details see
27 # the comment in `utils/__init__.py`. This constant was added to support
28 # SSHLibrary: https://github.com/robotframework/SSHLibrary/issues/401
29 PY2 = False
30 
31 
32 def isatty(stream):
33  # first check if buffer was detached
34  if hasattr(stream, 'buffer') and stream.buffer is None:
35  return False
36  if not hasattr(stream, 'isatty'):
37  return False
38  try:
39  return stream.isatty()
40  except ValueError: # Occurs if file is closed.
41  return False
def isatty(stream)
Definition: platform.py:32