Skip to content

Commit

Permalink
Merge branch 'main' into feature/pd/jira-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
pdemro committed Sep 11, 2024
2 parents bc6c924 + 55fec07 commit 18dfade
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 106 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/crate-ci/typos
rev: v1.24.1
rev: v1.24.5
hooks:
- id: typos
files: \.(py|md|rst|yaml|toml)
exclude: pyproject.toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.6.4
hooks:
# Run the linter.
- id: ruff
Expand Down
16 changes: 8 additions & 8 deletions config/coding_challenge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,27 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: ThoughtActionParser
env_variables:
WINDOW: 100
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
command_files:
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: Last5Observations
demonstrations:
- trajectories/demonstrations/human_thought__swe-bench-HumanEvalFix-python__lcb__t-0.00__p-0.95__c-4.00__install-0/humanevalfix-python-0.traj
- trajectories/demonstrations/human_thought__swe-bench-HumanEvalFix-python__lcb__t-0.00__p-0.95__c-4.00__install-0/humanevalfix-python-0.traj
18 changes: 9 additions & 9 deletions config/commands/defaults.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
_print() {
local total_lines=$(awk 'END {print NR}' $CURRENT_FILE)
echo "[File: $(realpath $CURRENT_FILE) ($total_lines lines total)]"
local total_lines=$(awk 'END {print NR}' "$CURRENT_FILE")
echo "[File: $(realpath "$CURRENT_FILE") ($total_lines lines total)]"
lines_above=$(jq -n "$CURRENT_LINE - $WINDOW/2" | jq '[0, .] | max | floor')
lines_below=$(jq -n "$total_lines - $CURRENT_LINE - $WINDOW/2" | jq '[0, .] | max | round')
if [ $lines_above -gt 0 ]; then
echo "($lines_above more lines above)"
fi
cat $CURRENT_FILE | grep -n $ | head -n $(jq -n "[$CURRENT_LINE + $WINDOW/2, $WINDOW/2] | max | floor") | tail -n $(jq -n "$WINDOW")
cat "$CURRENT_FILE" | grep -n $ | head -n $(jq -n "[$CURRENT_LINE + $WINDOW/2, $WINDOW/2] | max | floor") | tail -n $(jq -n "$WINDOW")
if [ $lines_below -gt 0 ]; then
echo "($lines_below more lines below)"
fi
Expand All @@ -18,14 +18,14 @@ _constrain_line() {
echo "No file open. Use the open command first."
return
fi
local max_line=$(awk 'END {print NR}' $CURRENT_FILE)
local max_line=$(awk 'END {print NR}' "$CURRENT_FILE")
local half_window=$(jq -n "$WINDOW/2" | jq 'floor')
export CURRENT_LINE=$(jq -n "[$CURRENT_LINE, $max_line - $half_window] | min")
export CURRENT_LINE=$(jq -n "[$CURRENT_LINE, $half_window] | max")
}

# @yaml
# signature: open <path> [<line_number>]
# signature: open "<path>" [<line_number>]
# docstring: opens the file at the given path in the editor. If line_number is provided, the window will be move to include that line
# arguments:
# path:
Expand All @@ -39,14 +39,14 @@ _constrain_line() {
open() {
if [ -z "$1" ]
then
echo "Usage: open <file>"
echo "Usage: open \"<file>\""
return
fi
# Check if the second argument is provided
if [ -n "$2" ]; then
# Check if the provided argument is a valid number
if ! [[ $2 =~ ^[0-9]+$ ]]; then
echo "Usage: open <file> [<line_number>]"
echo "Usage: open \"<file>\" [<line_number>]"
echo "Error: <line_number> must be a number"
return # Exit if the line number is not valid
fi
Expand All @@ -68,7 +68,7 @@ open() {
fi

if [ -f "$1" ]; then
export CURRENT_FILE=$(realpath $1)
export CURRENT_FILE=$(realpath "$1")
export CURRENT_LINE=$line_number
_constrain_line
_print
Expand Down Expand Up @@ -108,7 +108,7 @@ goto() {
echo "Error: <line> must be a number"
return
fi
local max_line=$(awk 'END {print NR}' $CURRENT_FILE)
local max_line=$(awk 'END {print NR}' "$CURRENT_FILE")
if [ $1 -gt $max_line ]
then
echo "Error: <line> must be less than or equal to $max_line"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,33 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: ThoughtActionParser
env_variables:
WINDOW: 200
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
START_INDEX: 0
END_INDEX: 0
START_CURSOR: 0
END_CURSOR: 0
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
END_CURSOR_MARK: '"<<<<< END CURSOR >>>>>"' # these have to use double quotes
command_files:
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: DefaultHistoryProcessor
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,33 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: ThoughtActionParser
env_variables:
WINDOW: 200
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
START_INDEX: 0
END_INDEX: 0
START_CURSOR: 0
END_CURSOR: 0
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
END_CURSOR_MARK: '"<<<<< END CURSOR >>>>>"' # these have to use double quotes
command_files:
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: Last5Observations
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,27 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: ThoughtActionParser
env_variables:
WINDOW: 100
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
command_files:
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: DefaultHistoryProcessor
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,27 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: ThoughtActionParser
env_variables:
WINDOW: 100
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
command_files:
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
- config/commands/defaults.sh
- config/commands/search.sh
- config/commands/edit_linting.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: Last5Observations
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__default_sys-env_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,33 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: XMLThoughtActionParser
env_variables:
WINDOW: 200
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
START_INDEX: 0
END_INDEX: 0
START_CURSOR: 0
END_CURSOR: 0
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
END_CURSOR_MARK: '"<<<<< END CURSOR >>>>>"' # these have to use double quotes
command_files:
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: DefaultHistoryProcessor
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,33 @@ state_command:
code: |
state() {
local working_dir="$PWD";
if [ -z $CURRENT_FILE ]; then
if [ -z "$CURRENT_FILE" ]; then
echo '{"open_file": "n/a", "working_dir": "'$working_dir'"}';
else
echo '{"open_file": "'$(realpath $CURRENT_FILE)'", "working_dir": "'$working_dir'"}';
echo '{"open_file": "'$(realpath "$CURRENT_FILE")'", "working_dir": "'$working_dir'"}';
fi
};
parse_function: XMLThoughtActionParser
env_variables:
WINDOW: 200
OVERLAP: 2
CURRENT_LINE: 0
CURRENT_FILE: ''
CURRENT_FILE: ""
SEARCH_RESULTS: ()
SEARCH_FILES: ()
SEARCH_INDEX: 0
START_INDEX: 0
END_INDEX: 0
START_CURSOR: 0
END_CURSOR: 0
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
START_CURSOR_MARK: '"<<<<< START CURSOR >>>>>"' # these have to use double quotes
END_CURSOR_MARK: '"<<<<< END CURSOR >>>>>"' # these have to use double quotes
command_files:
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
- config/commands/cursors_defaults.sh
- config/commands/cursors_edit_linting.sh
- config/commands/search.sh
- config/commands/_split_string.py
parse_command: ParseCommandDetailed
history_processor: Last5Observations
demonstrations:
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
- trajectories/demonstrations/replay__marshmallow-code__marshmallow-1867__xml_sys-env_cursors_window100__t-0.20__p-0.95__c-2.00__install-1/marshmallow-code__marshmallow-1867.traj
Loading

0 comments on commit 18dfade

Please sign in to comment.