MCPcopy Index your code
hub / github.com/ComposioHQ/composio / get_source_link

Function get_source_link

python/scripts/generate-docs.py:126–143  ·  view source on GitHub ↗

Get GitHub source link for an object.

(obj: griffe_t.Object)

Source from the content-addressed store, hash-verified

124
125
126def get_source_link(obj: griffe_t.Object) -> str | None:
127 """Get GitHub source link for an object."""
128 if not hasattr(obj, "filepath") or not obj.filepath:
129 return None
130 try:
131 raw_filepath = obj.filepath
132 # Handle case where filepath might be a list (griffe edge case)
133 if isinstance(raw_filepath, list):
134 resolved_path: Path | None = raw_filepath[0] if raw_filepath else None
135 else:
136 resolved_path = raw_filepath
137 if not resolved_path:
138 return None
139 rel_path = resolved_path.relative_to(PACKAGE_DIR)
140 except ValueError:
141 return None
142 line = obj.lineno if hasattr(obj, "lineno") and obj.lineno else 1
143 return f"{GITHUB_BASE}/{rel_path}#L{line}"
144
145
146def format_type(annotation: Any) -> str:

Callers 2

extract_class_infoFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…