MCPcopy Index your code
hub / github.com/scottrogowski/code2flow / determine_language

Function determine_language

code2flow/engine.py:268–282  ·  view source on GitHub ↗

Given a list of filepaths, determine the language from the first valid extension :param list[str] individual_files: :rtype: str

(individual_files)

Source from the content-addressed store, hash-verified

266
267
268def determine_language(individual_files):
269 """
270 Given a list of filepaths, determine the language from the first
271 valid extension
272
273 :param list[str] individual_files:
274 :rtype: str
275 """
276 for source, _ in individual_files:
277 suffix = source.rsplit('.', 1)[-1]
278 if suffix in LANGUAGES:
279 logging.info("Implicitly detected language as %r.", suffix)
280 return suffix
281 raise AssertionError(f"Language could not be detected from input {individual_files}. ",
282 "Try explicitly passing the language flag.")
283
284
285def get_sources_and_language(raw_source_paths, language):

Callers 1

get_sources_and_languageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected