parameters: (sys_version=None)
return_statement: return result
docstring: Returns a parsed version of Python's sys.version as tuple
          (name, version, branch, revision, buildno, builddate, compiler)
          referring to the Python implementation name, version, branch,
          revision, build number, build date/time as string and the compiler
          identification string.
  
          Note that unlike the Python sys.version, the returned value
          for the Python version will always include the patchlevel (it
          defaults to '.0').
  
          The function returns empty strings for tuple entries that
          cannot be determined.
  
          sys_version may be given to parse an alternative version
          string, e.g. if the version was read from a different Python
          interpreter.
docstring_summary: Returns a parsed version of Python's sys.version as tuple
          (name, version, branch, revision, buildno, builddate, compiler)
          referring to the Python implementation name, version, branch,
          revision, build number, build date/time as string and the compiler
          identification string.
docstring_tokens: Returns a parsed version of Python s sys . version as tuple ( name version branch revision buildno builddate compiler ) referring to the Python implementation name version branch revision build number build date / time as string and the compiler identification string .
function: def _sys_version(sys_version=None):
  
      """ Returns a parsed version of Python's sys.version as tuple
          (name, version, branch, revision, buildno, builddate, compiler)
          referring to the Python implementation name, version, branch,
          revision, build number, build date/time as string and the compiler
          identification string.
  
          Note that unlike the Python sys.version, the returned value
          for the Python version will always include the patchlevel (it
          defaults to '.0').
  
          The function returns empty strings for tuple entries that
          cannot be determined.
  
          sys_version may be given to parse an alternative version
          string, e.g. if the version was read from a different Python
          interpreter.
  
      """
      # Get the Python version
      if sys_version is None:
          sys_version = sys.version
  
      # Try the cache first
      result = _sys_version_cache.get(sys_version, None)
      if result is not None:
          return result
  
      # Parse it
      if 'IronPython' in sys_version:
          # IronPython
          name = 'IronPython'
          if sys_version.startswith('IronPython'):
              match = _ironpython_sys_version_parser.match(sys_version)
          else:
              match = _ironpython26_sys_version_parser.match(sys_version)
  
          if match is None:
              raise ValueError(
                  'failed to parse IronPython sys.version: %s' %
                  repr(sys_version))
  
          version, alt_version, compiler = match.groups()
          buildno = ''
          builddate = ''
  
      elif sys.platform.startswith('java'):
          # Jython
          name = 'Jython'
          match = _sys_version_parser.match(sys_version)
          if match is None:
              raise ValueError(
                  'failed to parse Jython sys.version: %s' %
                  repr(sys_version))
          version, buildno, builddate, buildtime, _ = match.groups()
          if builddate is None:
              builddate = ''
          compiler = sys.platform
  
      elif "PyPy" in sys_version:
          # PyPy
          name = "PyPy"
          match = _pypy_sys_version_parser.match(sys_version)
          if match is None:
              raise ValueError("failed to parse PyPy sys.version: %s" %
                               repr(sys_version))
          version, buildno, builddate, buildtime = match.groups()
          compiler = ""
  
      else:
          # CPython
          match = _sys_version_parser.match(sys_version)
          if match is None:
              raise ValueError(
                  'failed to parse CPython sys.version: %s' %
                  repr(sys_version))
          version, buildno, builddate, buildtime, compiler = \
                match.groups()
          name = 'CPython'
          if builddate is None:
              builddate = ''
          elif buildtime:
              builddate = builddate + ' ' + buildtime
  
      if hasattr(sys, 'subversion'):
          # sys.subversion was added in Python 2.5
          _, branch, revision = sys.subversion
      else:
          branch = ''
          revision = ''
  
      # Add the patchlevel version if missing
      l = string.split(version, '.')
      if len(l) == 2:
          l.append('0')
          version = string.join(l, '.')
  
      # Build and cache the result
      result = (name, version, branch, revision, buildno, builddate, compiler)
      _sys_version_cache[sys_version] = result
      return result
function_tokens: def _sys_version ( sys_version = None ) : # Get the Python version if sys_version is None : sys_version = sys . version # Try the cache first result = _sys_version_cache . get ( sys_version , None ) if result is not None : return result # Parse it if 'IronPython' in sys_version : # IronPython name = 'IronPython' if sys_version . startswith ( 'IronPython' ) : match = _ironpython_sys_version_parser . match ( sys_version ) else : match = _ironpython26_sys_version_parser . match ( sys_version ) if match is None : raise ValueError ( 'failed to parse IronPython sys.version: %s' % repr ( sys_version ) ) version , alt_version , compiler = match . groups ( ) buildno = '' builddate = '' elif sys . platform . startswith ( 'java' ) : # Jython name = 'Jython' match = _sys_version_parser . match ( sys_version ) if match is None : raise ValueError ( 'failed to parse Jython sys.version: %s' % repr ( sys_version ) ) version , buildno , builddate , buildtime , _ = match . groups ( ) if builddate is None : builddate = '' compiler = sys . platform elif "PyPy" in sys_version : # PyPy name = "PyPy" match = _pypy_sys_version_parser . match ( sys_version ) if match is None : raise ValueError ( "failed to parse PyPy sys.version: %s" % repr ( sys_version ) ) version , buildno , builddate , buildtime = match . groups ( ) compiler = "" else : # CPython match = _sys_version_parser . match ( sys_version ) if match is None : raise ValueError ( 'failed to parse CPython sys.version: %s' % repr ( sys_version ) ) version , buildno , builddate , buildtime , compiler = match . groups ( ) name = 'CPython' if builddate is None : builddate = '' elif buildtime : builddate = builddate + ' ' + buildtime if hasattr ( sys , 'subversion' ) : # sys.subversion was added in Python 2.5 _ , branch , revision = sys . subversion else : branch = '' revision = '' # Add the patchlevel version if missing l = string . split ( version , '.' ) if len ( l ) == 2 : l . append ( '0' ) version = string . join ( l , '.' ) # Build and cache the result result = ( name , version , branch , revision , buildno , builddate , compiler ) _sys_version_cache [ sys_version ] = result return result