def _by_version_descending(names):
 def _by_version(name):
  '\n        Parse each component of the filename\n        '
  (name, ext) = os.path.splitext(name)
  parts = itertools.chain(name.split('-'), [ext])
  return [packaging.version.parse(part) for part in parts]
 return sorted(names, key=_by_version, reverse=True)

def _by_version_descending ( names ) : def _by_version ( name ) : ( name , ext ) = os . path . splitext ( name ) parts = itertools . chain ( name . split ( '-' ) , [ ext ] ) return [ packaging . version . parse ( part ) for part in parts ] return sorted ( names , key = _by_version , reverse = True )
given a list of filenames .