parameters: (self, sources)
return_statement: return lang
docstring: Detect the language of a given file, or list of files. Uses
          language_map, and language_order to do the job.
docstring_summary: Detect the language of a given file, or list of files. Uses
          language_map, and language_order to do the job.
docstring_tokens: Detect the language of a given file or list of files . Uses language_map and language_order to do the job .
function: def detect_language(self, sources):
          """Detect the language of a given file, or list of files. Uses
          language_map, and language_order to do the job.
          """
          if not isinstance(sources, list):
              sources = [sources]
          lang = None
          index = len(self.language_order)
          for source in sources:
              base, ext = os.path.splitext(source)
              extlang = self.language_map.get(ext)
              try:
                  extindex = self.language_order.index(extlang)
                  if extindex < index:
                      lang = extlang
                      index = extindex
              except ValueError:
                  pass
          return lang
function_tokens: def detect_language ( self , sources ) : if not isinstance ( sources , list ) : sources = [ sources ] lang = None index = len ( self . language_order ) for source in sources : base , ext = os . path . splitext ( source ) extlang = self . language_map . get ( ext ) try : extindex = self . language_order . index ( extlang ) if extindex < index : lang = extlang index = extindex except ValueError : pass return lang