MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / detect_import_style

Method detect_import_style

core/preferences.py:156–162  ·  view source on GitHub ↗

Detect import style from file content.

(cls, content: str)

Source from the content-addressed store, hash-verified

154
155 @classmethod
156 def detect_import_style(cls, content: str) -> Optional[str]:
157 """Detect import style from file content."""
158 scores = defaultdict(int)
159 for style, pattern in cls.IMPORT_STYLES.items():
160 matches = re.findall(pattern, content, re.MULTILINE)
161 scores[style] = len(matches)
162 return max(scores, key=scores.get) if scores else None
163
164 @classmethod
165 def detect_type_hints(cls, content: str) -> Optional[str]:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected