codiff 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. codiff/__init__.py +1 -0
  2. codiff/__main__.py +5 -0
  3. codiff/cli.py +247 -0
  4. codiff/db/__init__.py +16 -0
  5. codiff/db/engine.py +31 -0
  6. codiff/db/models.py +119 -0
  7. codiff/db/operations.py +238 -0
  8. codiff/diff/__init__.py +1 -0
  9. codiff/diff/analysis.py +145 -0
  10. codiff/diff/differ.py +45 -0
  11. codiff/diff/engine.py +80 -0
  12. codiff/diff/indexer.py +134 -0
  13. codiff/diff/snapshot.py +325 -0
  14. codiff/export/__init__.py +5 -0
  15. codiff/export/json.py +43 -0
  16. codiff/export/mermaid.py +475 -0
  17. codiff/export/terminal.py +866 -0
  18. codiff/languages/__init__.py +29 -0
  19. codiff/languages/parser.py +214 -0
  20. codiff/languages/python/__init__.py +0 -0
  21. codiff/languages/python/parser.py +927 -0
  22. codiff/languages/python/resolver.py +178 -0
  23. codiff/languages/repository.py +245 -0
  24. codiff/languages/resolver.py +582 -0
  25. codiff/languages/typescript/__init__.py +0 -0
  26. codiff/languages/typescript/parser.py +612 -0
  27. codiff/languages/typescript/resolver.py +95 -0
  28. codiff/mcp_server.py +83 -0
  29. codiff/schema/__init__.py +25 -0
  30. codiff/schema/diff.py +110 -0
  31. codiff/schema/parsing.py +76 -0
  32. codiff/setup.py +103 -0
  33. codiff/utils/__init__.py +0 -0
  34. codiff/utils/args.py +114 -0
  35. codiff/utils/files.py +62 -0
  36. codiff/utils/git.py +101 -0
  37. codiff/utils/instructions.py +14 -0
  38. codiff/utils/instructions.yaml +50 -0
  39. codiff/utils/terminal.py +10 -0
  40. codiff-0.1.0.dist-info/METADATA +487 -0
  41. codiff-0.1.0.dist-info/RECORD +45 -0
  42. codiff-0.1.0.dist-info/WHEEL +5 -0
  43. codiff-0.1.0.dist-info/entry_points.txt +3 -0
  44. codiff-0.1.0.dist-info/licenses/LICENSE +201 -0
  45. codiff-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,582 @@
1
+ """Language-agnostic base class for call resolvers.
2
+
3
+ Concrete subclasses supply:
4
+ - instance_keyword ('self' for Python, 'this' for TypeScript)
5
+ - constructor_method_name ('__init__' for Python, 'constructor' for TypeScript)
6
+ - _compute_mro() (C3 for Python, linear for TypeScript)
7
+ - _resolve_super_call() (language-specific super() handling)
8
+
9
+ All resolution strategies that don't depend on language-specific semantics
10
+ live here: import resolution, internal resolution, variable method calls,
11
+ return-type-based resolution, and the method-name fallback.
12
+ """
13
+
14
+ import math
15
+ import os
16
+ import threading
17
+ from abc import ABC, abstractmethod
18
+ from concurrent.futures import ProcessPoolExecutor
19
+ from typing import Dict, List
20
+
21
+ # Set to the active resolver instance before creating the worker pool so that
22
+ # forked worker processes inherit it via copy-on-write without pickling.
23
+ _mp_resolver_instance: "BaseCallResolver | None" = None
24
+
25
+
26
+ def _resolve_batch_mp(func_indices: list) -> list:
27
+ """Resolve a batch of functions by index in a forked worker process.
28
+
29
+ Returns [(func_id, resolved_calls)] — only strings, cheap to pickle back.
30
+ The resolver state (lookup dicts, function list) is inherited from the
31
+ parent process via fork/CoW; no pickling of FunctionChunk objects needed.
32
+ """
33
+ assert _mp_resolver_instance is not None
34
+ resolver: "BaseCallResolver" = _mp_resolver_instance
35
+ results: list[tuple[str, list[str]]] = []
36
+ for i in func_indices:
37
+ func = resolver.functions[i]
38
+ if not func.calls:
39
+ results.append((func.id, []))
40
+ continue
41
+ resolved_calls: list[str] = []
42
+ for call in func.calls:
43
+ r = resolver._resolve_single_call(call, func)
44
+ if r:
45
+ resolved_calls.extend(r)
46
+ results.append((func.id, resolved_calls))
47
+ return results
48
+
49
+
50
+ class BaseCallResolver(ABC):
51
+ """Resolves raw call strings to fully-qualified function_id strings."""
52
+
53
+ def __init__(
54
+ self,
55
+ functions: List,
56
+ classes: List,
57
+ imports: Dict[str, str],
58
+ modules_dict: Dict[str, str],
59
+ package_exports: Dict[str, str] | None = None,
60
+ ):
61
+ self.functions = functions
62
+ self.classes = classes
63
+ self.imports = imports
64
+ self.modules_dict = modules_dict
65
+ self.package_exports = package_exports or {}
66
+
67
+ self.all_function_names = {func.name for func in functions}
68
+ self.all_class_names = {cls.name for cls in classes}
69
+ self.all_internals = self.all_function_names.union(self.all_class_names)
70
+
71
+ self.class_id_map = {cls.name: cls.id for cls in classes}
72
+ self.all_function_ids = {func.id for func in functions}
73
+
74
+ self.method_name_to_ids: Dict[str, List[str]] = {}
75
+ for func in functions:
76
+ if func.name not in self.method_name_to_ids:
77
+ self.method_name_to_ids[func.name] = []
78
+ self.method_name_to_ids[func.name].append(func.id)
79
+
80
+ self.self_calls_by_func_id: Dict[str, List[str]] = {}
81
+ instance_kw = self.instance_keyword
82
+ for func in functions:
83
+ if func.calls:
84
+ instance_methods = []
85
+ for call in func.calls:
86
+ parts = call.split(".")
87
+ if parts[0] == instance_kw and len(parts) == 2:
88
+ instance_methods.append(parts[1])
89
+ if instance_methods:
90
+ self.self_calls_by_func_id[func.id] = instance_methods
91
+
92
+ self.return_type_map = {func.id: func.return_type for func in functions if func.return_type}
93
+
94
+ self._mro_cache: Dict[str, List[str]] = {}
95
+ self._mro_tls = threading.local()
96
+
97
+ self.subclass_map: Dict[str, set] = {cls.name: set() for cls in classes}
98
+ for cls in classes:
99
+ for superclass_raw in cls.superclasses or []:
100
+ parent = self._clean_superclass_name(superclass_raw)
101
+ if parent in self.subclass_map:
102
+ self.subclass_map[parent].add(cls.name)
103
+
104
+ # ------------------------------------------------------------------
105
+ # Abstract interface
106
+ # ------------------------------------------------------------------
107
+
108
+ @property
109
+ @abstractmethod
110
+ def instance_keyword(self) -> str:
111
+ """Keyword used to refer to the current instance ('self' or 'this')."""
112
+
113
+ @property
114
+ @abstractmethod
115
+ def constructor_method_name(self) -> str:
116
+ """Name of the constructor method ('__init__' or 'constructor')."""
117
+
118
+ @abstractmethod
119
+ def _compute_mro(self, class_name: str) -> List[str]:
120
+ """Return the MRO list for *class_name* (most-derived first)."""
121
+
122
+ @abstractmethod
123
+ def _resolve_super_call(self, parts: List[str], function) -> List[str]:
124
+ """Resolve a super()/super.xxx() call to fully-qualified IDs."""
125
+
126
+ # ------------------------------------------------------------------
127
+ # Language-agnostic hooks with sensible defaults
128
+ # ------------------------------------------------------------------
129
+
130
+ def _resolve_cls_call(self, parts: List[str], function) -> str | None:
131
+ """Resolve cls.xxx() calls. Default: no-op (Python-specific behaviour)."""
132
+ return None
133
+
134
+ # Subclasses may override this set with language-specific decorator names
135
+ BUILTIN_DECORATORS: set[str] = {
136
+ "staticmethod",
137
+ "classmethod",
138
+ "property",
139
+ "abstractmethod",
140
+ "dataclass",
141
+ "contextmanager",
142
+ "lru_cache",
143
+ "cached_property",
144
+ }
145
+
146
+ # ------------------------------------------------------------------
147
+ # Public entry point
148
+ # ------------------------------------------------------------------
149
+
150
+ def resolve_all_calls(self, max_workers: int = 10, resolve_subset: List | None = None) -> List:
151
+ to_resolve = resolve_subset if resolve_subset is not None else self.functions
152
+ if not to_resolve:
153
+ return []
154
+
155
+ # Map each function object to its position in self.functions.
156
+ # Workers receive indices (ints) rather than FunctionChunk objects so
157
+ # the fork-inherited resolver state is used directly — no pickling of
158
+ # the large function list.
159
+ func_index_map = {id(f): i for i, f in enumerate(self.functions)}
160
+ indices = [func_index_map[id(f)] for f in to_resolve]
161
+
162
+ n_batches = max(1, max_workers * 4)
163
+ batch_size = math.ceil(len(indices) / n_batches)
164
+ batches = [indices[i : i + batch_size] for i in range(0, len(indices), batch_size)]
165
+
166
+ id_to_func = {f.id: f for f in self.functions}
167
+
168
+ global _mp_resolver_instance
169
+ _mp_resolver_instance = self
170
+ try:
171
+ with ProcessPoolExecutor(max_workers=max_workers) as pool:
172
+ for batch_result in pool.map(_resolve_batch_mp, batches, chunksize=1):
173
+ for func_id, resolved_calls in batch_result:
174
+ id_to_func[func_id].calls = resolved_calls
175
+ finally:
176
+ _mp_resolver_instance = None
177
+
178
+ resolved = [id_to_func[f.id] for f in to_resolve]
179
+ self._resolve_decorator_calls(resolved)
180
+ return resolved
181
+
182
+ # ------------------------------------------------------------------
183
+ # Decorator resolution
184
+ # ------------------------------------------------------------------
185
+
186
+ def _resolve_decorator_calls(self, resolved_functions: List) -> None:
187
+ """Add decorated-function call edges to their decorator functions."""
188
+ func_by_id = {f.id: f for f in resolved_functions}
189
+ for func in resolved_functions:
190
+ if not func.decorators:
191
+ continue
192
+ resolved_dec_ids = []
193
+ for dec_text in func.decorators:
194
+ dec_name = dec_text.split("(")[0].strip() if "(" in dec_text else dec_text.strip()
195
+ if dec_name.split(".")[-1] in self.BUILTIN_DECORATORS:
196
+ continue
197
+ dec_ids = self._resolve_single_call(dec_name, func)
198
+ if dec_ids:
199
+ resolved_dec_ids.append(dec_ids[0])
200
+ if not resolved_dec_ids:
201
+ continue
202
+ chain = resolved_dec_ids + [func.id]
203
+ for i in range(len(chain) - 1):
204
+ caller_id, callee_id = chain[i], chain[i + 1]
205
+ if caller_id in func_by_id:
206
+ caller_func = func_by_id[caller_id]
207
+ if caller_func.calls is None:
208
+ caller_func.calls = []
209
+ if callee_id not in caller_func.calls:
210
+ caller_func.calls.append(callee_id)
211
+
212
+ # ------------------------------------------------------------------
213
+ # Per-function resolution
214
+ # ------------------------------------------------------------------
215
+
216
+ def _resolve_function_calls(self, function):
217
+ if not function.calls:
218
+ function.calls = []
219
+ return function
220
+ resolved_calls = []
221
+ for call in function.calls:
222
+ resolved_call_list = self._resolve_single_call(call, function)
223
+ if resolved_call_list:
224
+ resolved_calls.extend(resolved_call_list)
225
+ function.calls = resolved_calls
226
+ return function
227
+
228
+ # ------------------------------------------------------------------
229
+ # Return-type helpers (used by var_sources resolution)
230
+ # ------------------------------------------------------------------
231
+
232
+ @staticmethod
233
+ def _extract_class_from_generic_type(type_str: str):
234
+ primitives = {"int", "str", "float", "bool", "bytes", "None", "Any", "object"}
235
+ type_str = type_str.strip()
236
+ if type_str in primitives:
237
+ return None
238
+ if "[" not in type_str:
239
+ if type_str and type_str[0].isupper() and type_str not in primitives:
240
+ return type_str
241
+ return None
242
+ bracket_pos = type_str.index("[")
243
+ wrapper = type_str[:bracket_pos].strip()
244
+ inner = type_str[bracket_pos + 1 : -1].strip() if type_str.endswith("]") else None
245
+ if inner is None:
246
+ return None
247
+ skip_wrappers = {
248
+ "Dict",
249
+ "Mapping",
250
+ "MutableMapping",
251
+ "DefaultDict",
252
+ "OrderedDict",
253
+ "Tuple",
254
+ "Set",
255
+ "FrozenSet",
256
+ }
257
+ if wrapper in skip_wrappers:
258
+ return None
259
+ if wrapper == "Generator":
260
+ parts = BaseCallResolver._split_generic_params(inner)
261
+ return BaseCallResolver._extract_class_from_generic_type(parts[0]) if parts else None
262
+ params = BaseCallResolver._split_generic_params(inner)
263
+ if len(params) == 1:
264
+ return BaseCallResolver._extract_class_from_generic_type(params[0])
265
+ if wrapper in ("Union", "Optional") and len(params) == 2:
266
+ if params[1].strip() == "None":
267
+ return BaseCallResolver._extract_class_from_generic_type(params[0])
268
+ if params[0].strip() == "None":
269
+ return BaseCallResolver._extract_class_from_generic_type(params[1])
270
+ return None
271
+
272
+ @staticmethod
273
+ def _split_generic_params(inner: str) -> list:
274
+ parts, depth, current = [], 0, []
275
+ for ch in inner:
276
+ if ch == "[":
277
+ depth += 1
278
+ current.append(ch)
279
+ elif ch == "]":
280
+ depth -= 1
281
+ current.append(ch)
282
+ elif ch == "," and depth == 0:
283
+ parts.append("".join(current).strip())
284
+ current = []
285
+ else:
286
+ current.append(ch)
287
+ if current:
288
+ parts.append("".join(current).strip())
289
+ return parts
290
+
291
+ def _get_return_type_of_source(self, raw_call: str, function):
292
+ resolved_list = self._resolve_single_call(raw_call, function, _resolving_source=True)
293
+ if not resolved_list:
294
+ return None
295
+ for resolved_id in resolved_list:
296
+ if resolved_id in self.return_type_map:
297
+ return self.return_type_map[resolved_id]
298
+ return None
299
+
300
+ def _resolve_var_source_type(self, source_expr: str, function):
301
+ if source_expr.startswith("@iter:"):
302
+ iter_var = source_expr[6:]
303
+ if function.var_sources and iter_var in function.var_sources:
304
+ inner_source = function.var_sources[iter_var]
305
+ return_type = self._resolve_source_to_return_type(inner_source, function)
306
+ else:
307
+ return None
308
+ if not return_type:
309
+ return None
310
+ return self._extract_class_from_generic_type(return_type)
311
+ elif source_expr.startswith("@iter_call:"):
312
+ raw_call = source_expr[11:]
313
+ return_type = self._get_return_type_of_source(raw_call, function)
314
+ if not return_type:
315
+ return None
316
+ return self._extract_class_from_generic_type(return_type)
317
+ else:
318
+ return_type = self._get_return_type_of_source(source_expr, function)
319
+ if not return_type:
320
+ return None
321
+ return self._extract_class_from_generic_type(return_type)
322
+
323
+ def _resolve_source_to_return_type(self, source_expr: str, function):
324
+ if source_expr.startswith("@iter_call:"):
325
+ return self._get_return_type_of_source(source_expr[11:], function)
326
+ elif source_expr.startswith("@iter:"):
327
+ return None
328
+ else:
329
+ return self._get_return_type_of_source(source_expr, function)
330
+
331
+ # ------------------------------------------------------------------
332
+ # Core resolution dispatcher
333
+ # ------------------------------------------------------------------
334
+
335
+ def _resolve_single_call(self, call: str, function, _resolving_source=False) -> List[str]:
336
+ parts = call.split(".")
337
+ first_part = parts[0]
338
+
339
+ if first_part.startswith("super"):
340
+ return self._resolve_super_call(parts, function)
341
+
342
+ if first_part == self.instance_keyword:
343
+ return self._resolve_self_call(parts, function)
344
+
345
+ if (first_part == "cls" or first_part.startswith("cls(")) and function.class_name:
346
+ resolved = self._resolve_cls_call(parts, function)
347
+ if resolved:
348
+ return [resolved]
349
+
350
+ if function.var_types and first_part in function.var_types:
351
+ resolved_calls = self._resolve_variable_method_call(parts, function)
352
+ if resolved_calls:
353
+ return resolved_calls
354
+
355
+ if not _resolving_source and function.var_sources and first_part in function.var_sources:
356
+ class_name = self._resolve_var_source_type(function.var_sources[first_part], function)
357
+ if class_name and class_name in self.all_class_names:
358
+ resolved = self._resolve_method_for_class(class_name, parts)
359
+ if resolved:
360
+ return [resolved]
361
+
362
+ if first_part in self.imports:
363
+ resolved = self._resolve_imported_call(parts, first_part)
364
+ if resolved:
365
+ return self._expand_class_hierarchy(resolved)
366
+ return []
367
+
368
+ if first_part in self.all_internals:
369
+ resolved = self._resolve_internal_call(parts, function)
370
+ if resolved:
371
+ return self._expand_class_hierarchy(resolved)
372
+ return []
373
+
374
+ if len(parts) >= 2 and first_part not in self.imports:
375
+ fallback = self._resolve_by_method_name_fallback(parts)
376
+ if fallback:
377
+ return fallback
378
+
379
+ return []
380
+
381
+ # ------------------------------------------------------------------
382
+ # Class hierarchy helpers
383
+ # ------------------------------------------------------------------
384
+
385
+ def _expand_class_hierarchy(self, resolved_call: str) -> List[str]:
386
+ last_part = resolved_call.split(".")[-1]
387
+ if last_part not in self.all_class_names:
388
+ return [resolved_call]
389
+ init_call = self._find_init_for_class(last_part)
390
+ return [init_call] if init_call else []
391
+
392
+ def _find_init_for_class(self, class_name: str) -> str | None:
393
+ return self._find_method_in_mro(class_name, self.constructor_method_name)
394
+
395
+ def _class_has_method(self, class_name: str, method_name: str) -> bool:
396
+ class_full_id = self.class_id_map.get(class_name)
397
+ if not class_full_id:
398
+ return False
399
+ return f"{class_full_id}.{method_name}" in self.all_function_ids
400
+
401
+ def _find_method_in_mro(self, class_name: str, method_name: str) -> str | None:
402
+ for mro_class in self._compute_mro(class_name):
403
+ if mro_class not in self.class_id_map:
404
+ continue
405
+ if self._class_has_method(mro_class, method_name):
406
+ return f"{self.class_id_map[mro_class]}.{method_name}"
407
+ return None
408
+
409
+ def _resolve_method_for_class(self, class_name: str, parts: list):
410
+ if class_name not in self.class_id_map:
411
+ return None
412
+ class_full_id = self.class_id_map[class_name]
413
+ if len(parts) == 1:
414
+ resolved = self._find_method_in_mro(class_name, "__call__")
415
+ return resolved if resolved else f"{class_full_id}.__call__"
416
+ method_name = parts[1]
417
+ resolved = self._find_method_in_mro(class_name, method_name)
418
+ return resolved if resolved else f"{class_full_id}.{method_name}"
419
+
420
+ def _clean_superclass_name(self, superclass: str) -> str | None:
421
+ if "[" in superclass:
422
+ superclass = superclass.split("[")[0]
423
+ return superclass.strip()
424
+
425
+ def _resolve_superclass(self, superclass_name: str, child_class) -> str | None:
426
+ if superclass_name in self.class_id_map:
427
+ return self.class_id_map[superclass_name]
428
+ if superclass_name in self.imports:
429
+ return self.imports[superclass_name]
430
+ child_module = ".".join(child_class.id.split(".")[:-1])
431
+ potential_path = f"{child_module}.{superclass_name}"
432
+ if potential_path in self.class_id_map.values():
433
+ return potential_path
434
+ return None
435
+
436
+ # ------------------------------------------------------------------
437
+ # Specific resolution strategies
438
+ # ------------------------------------------------------------------
439
+
440
+ def _file_path_to_module_key(self, file_path: str) -> str:
441
+ """Convert a file path to its module lookup key (strips extension, uses dots)."""
442
+ base, _ = os.path.splitext(file_path)
443
+ return base.replace("/", ".")
444
+
445
+ def _resolve_self_call(self, parts: List[str], function) -> List[str]:
446
+ if not function.class_name:
447
+ return []
448
+ file_path_key = self._file_path_to_module_key(function.file_path)
449
+ if file_path_key not in self.modules_dict:
450
+ return []
451
+ module_path = self.modules_dict[file_path_key]
452
+ if len(parts) == 1:
453
+ return [f"{module_path}.{function.class_name}"]
454
+ method_name = parts[1]
455
+ resolved = self._find_method_in_mro(function.class_name, method_name)
456
+ if not resolved:
457
+ if method_name in self.all_internals:
458
+ return [f"{module_path}.{function.class_name}.{method_name}"]
459
+ return []
460
+ return [resolved]
461
+
462
+ def _resolve_imported_call(self, parts: List[str], import_alias: str) -> str | None:
463
+ full_import_path = self.imports[import_alias]
464
+ if len(parts) == 1:
465
+ resolved = full_import_path
466
+ else:
467
+ resolved = f"{full_import_path}.{'.'.join(parts[1:])}"
468
+ return self._resolve_through_package_exports(resolved)
469
+
470
+ def _resolve_through_package_exports(self, path: str) -> str | None:
471
+ normalized = path.replace(".__init__.", ".").replace(".__init__", "")
472
+ if normalized in self.package_exports:
473
+ return self.package_exports[normalized]
474
+ parts = normalized.split(".")
475
+ for i in range(len(parts) - 1, 0, -1):
476
+ potential_export = ".".join(parts[: i + 1])
477
+ if potential_export in self.package_exports:
478
+ real_base = self.package_exports[potential_export]
479
+ remaining = parts[i + 1 :]
480
+ return f"{real_base}.{'.'.join(remaining)}" if remaining else real_base
481
+ return path
482
+
483
+ def _resolve_internal_call(self, parts: List[str], function) -> str | None:
484
+ file_path_key = self._file_path_to_module_key(function.file_path)
485
+ if file_path_key not in self.modules_dict:
486
+ return None
487
+ module_path = self.modules_dict[file_path_key]
488
+ if len(parts) == 1:
489
+ call_name = parts[0]
490
+ nested_path = f"{module_path}.{function.name}.{call_name}"
491
+ if nested_path in self.all_function_ids:
492
+ return nested_path
493
+ if function.nested:
494
+ sibling_path = f"{module_path}.{function.nested}.{call_name}"
495
+ if sibling_path in self.all_function_ids:
496
+ return sibling_path
497
+ return f"{module_path}.{'.'.join(parts)}"
498
+
499
+ def _resolve_variable_method_call(self, parts: List[str], function) -> List[str]:
500
+ var_name = parts[0]
501
+ class_refs = function.var_types.get(var_name)
502
+ if not class_refs:
503
+ return []
504
+ resolved = []
505
+ for class_ref in class_refs:
506
+ is_class_ref = class_ref.startswith("@ref:")
507
+ if is_class_ref:
508
+ class_ref = class_ref[5:]
509
+ class_name = class_ref.split(".")[-1]
510
+ if class_name not in self.all_class_names or class_name not in self.class_id_map:
511
+ continue
512
+ class_full_id = self.class_id_map[class_name]
513
+ if len(parts) == 1:
514
+ if is_class_ref:
515
+ r = self._find_method_in_mro(class_name, self.constructor_method_name)
516
+ resolved.append(r or f"{class_full_id}.{self.constructor_method_name}")
517
+ else:
518
+ r = self._find_method_in_mro(class_name, "__call__")
519
+ resolved.append(r or f"{class_full_id}.__call__")
520
+ else:
521
+ method_name = parts[1]
522
+ r = self._find_method_in_mro(class_name, method_name)
523
+ resolved.append(r or f"{class_full_id}.{method_name}")
524
+ return resolved
525
+
526
+ def _resolve_by_method_name_fallback(self, parts: List[str]) -> List[str]:
527
+ method_name = parts[-1]
528
+ builtin_methods = {
529
+ "append",
530
+ "extend",
531
+ "insert",
532
+ "remove",
533
+ "pop",
534
+ "clear",
535
+ "index",
536
+ "count",
537
+ "sort",
538
+ "reverse",
539
+ "copy",
540
+ "get",
541
+ "set",
542
+ "keys",
543
+ "values",
544
+ "items",
545
+ "update",
546
+ "format",
547
+ "split",
548
+ "join",
549
+ "strip",
550
+ "replace",
551
+ "find",
552
+ "startswith",
553
+ "endswith",
554
+ "lower",
555
+ "upper",
556
+ "encode",
557
+ "decode",
558
+ "read",
559
+ "write",
560
+ "close",
561
+ "open",
562
+ "flush",
563
+ "seek",
564
+ "tell",
565
+ "__init__",
566
+ "__call__",
567
+ "__str__",
568
+ "__repr__",
569
+ "__len__",
570
+ "__iter__",
571
+ "__next__",
572
+ "__getitem__",
573
+ "__setitem__",
574
+ "__delitem__",
575
+ "__contains__",
576
+ }
577
+ if method_name in builtin_methods:
578
+ return []
579
+ if method_name not in self.method_name_to_ids:
580
+ return []
581
+ matching_ids = self.method_name_to_ids[method_name]
582
+ return matching_ids if len(matching_ids) == 1 else []
File without changes