Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions codebase_rag/constants/ast_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
# The first parameter of a method that names the instance or class; a
# signature change keeps it in place and never remaps it.
PY_RECEIVER_NAMES = frozenset({"self", "cls"})
# A method reached through the class rather than an instance passes its
# receiver explicitly: `type(obj).f(obj, a)`, `obj.__class__.f(obj, a)`.
PY_TYPE_BUILTIN = "type"
PY_CLASS_ATTRIBUTE = "__class__"
TS_PY_SUBSCRIPT = "subscript"
# The `subscript` node's index field (`os.environ["K"]` -> the `"K"` string).
TS_PY_FIELD_SUBSCRIPT = "subscript"
Expand Down
19 changes: 19 additions & 0 deletions codebase_rag/constants/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,10 @@ class DiffMarker:
"it to self or cls first"
)
SIGNATURE_STAGE_FAILED = "Cannot stage the signature change: {error}"
SIGNATURE_SOURCE_CHANGED = (
"Cannot stage the signature change: {files} changed on disk after the "
"change was planned; retry once the tree is settled"
)
SIGNATURE_BAD_PARAM = (
"Not a parameter: `{text}` (expected `name`, `name: type`, `name = default` "
"or `name: type = default`)"
Expand All @@ -1001,6 +1005,9 @@ class DiffMarker:
SIGNATURE_REQUIRED_AFTER_DEFAULT = (
"Parameter {name} has no default but comes after a defaulted parameter"
)
SIGNATURE_INVALID_HEADER = (
"The new parameter list of {qn} is not valid Python ({error}): `{text}`"
)
SIGNATURE_BODY_REBINDS = (
"Cannot rename parameter {old} of {qn} to {new}: `{old}` is used inside a "
"nested scope, or re-bound by a global, nonlocal or import statement, in "
Expand All @@ -1019,6 +1026,10 @@ class DiffMarker:
"Cannot rename parameter {old} of {qn} to {new}: `{new}` is already used "
"in its body"
)
SIGNATURE_NEW_NAME_TAKEN = (
"Cannot add parameter {name} to {qn}: `{name}` is already used in its "
"body, which would start reading the parameter instead"
)
SIGNATURE_HIERARCHY_MISMATCH = (
"Cannot change the signature of {qn}: its override {member} declares "
"({theirs}) where {qn} declares ({ours}); make the hierarchy agree first"
Expand Down Expand Up @@ -1057,6 +1068,14 @@ class DiffMarker:
)
SIGNATURE_SITE_NO_VALUE = "no value for `{name}`; map it or give it a default"
SIGNATURE_SITE_OVERLAPS = "its arguments overlap another edit of this change"
SIGNATURE_SITE_DROPS_EFFECT = (
"passes `{text}` for a dropped parameter, and leaving it out would skip "
"the code it runs"
)
SIGNATURE_SITE_EXPLICIT_RECEIVER = (
"reaches the method through its class and passes the receiver as an "
"argument (`{text}`); rewrite it by hand"
)
SIGNATURE_PLANNED = "{count} site(s) would be rewritten, {skipped} left unmapped"
SIGNATURE_PARSE_FAILED = "Signature change rolled back: {files} would no longer parse"
SIGNATURE_CONTRACT_FAILED = (
Expand Down
Loading
Loading