-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring suggestins #1
base: main
Are you sure you want to change the base?
Conversation
Hi, by removing test.sh you have broken the CI pipeline. The reason for having a generic test.sh is so that the CI pipeline can be language independed. I intend to do more languages besides python |
Hi, please rebase. I've moved the CI code into a ci.sh file. As far as i can tell adding pyproject.toml broke the CI because now pytest is not included in the requirements.txt |
Sorry, didn't see your answer in time! |
def get_node(p: Position) -> Node: | ||
result = nodes.get_node(p) | ||
if result is None: | ||
return Node(Position(0, 0), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This here is my "tricky" fix for p.y=-1
. It occurs in the "standard-test-case"!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit puzzled. This is only possible if len(nodes.nodes[0] - 1) = -1
or next_pos.y = -1
.
The first case occurs if the second file is empty. Second case occurs if I forgot a guard inside compute_node
. In particular, this would mean that the cast is not current.
next_pos = candidate2 | ||
length = node2.length | ||
else: | ||
next_pos = candidate1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order for next_pos.y = -1
we would need to enter this branch with node1 is None
(as there is a guard inside get_node). However, if node1 is None
, then either branch 1 or 2 will be entered depending on node1 is None
.
So im not seeing what should be wrong here.
I saw it in the debugger! :-)
…On Mon, Apr 22, 2024, 05:26 Orasund ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In diffFiles/src/diff_files.py
<#1 (comment)>:
> + length = result.nodes[next_pos.x][next_pos.y].length + 1
+ else:
+ candidate1 = Position(i1, i2 - 1)
+ candidate2 = Position(i1 - 1, i2)
+ node1 = result.get_node(candidate1)
+ node2 = result.get_node(candidate2)
+
+ # find the candidate with the bigger length
+ if node1 is None and node2 is None:
+ next_pos = None
+ length = 0
+ elif node2 is not None and (node1 is None or node1.length < node2.length):
+ next_pos = candidate2
+ length = node2.length
+ else:
+ next_pos = candidate1
In order for next_pos.y = -1 we would need to enter this branch with node1
is None (as there is a guard inside get_node). However, if node1 is None,
then either branch 1 or 2 will be entered depending on node1 is None.
So im not seeing what should be wrong here.
—
Reply to this email directly, view it on GitHub
<#1 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA3LHWLL5KSQ5M63R7NB5ADY6R7PJAVCNFSM6AAAAABGRIUFCWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAMJTGY4TSNRRGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thanks a lot. I found the missing guard:
|
I tried adding your guard in the hope that I could then reduce the second closure |
Oh! bad luck :/ Hope it's no a dealbreaker. Sadly, I don't have the time to look more into it. |
My first shot at a github pull-request.
More may follow...