properly transitioning two animations in the following scenario: considering an character swinging a sword, there are two animations: "swing" and "parry", if I play the "parry" animation while the "swing" animation is still in process
You have two animations and you want to blend between them. Which is not what you asked (XY problem).
Using the AnimationPlayer, you can specify transition times between any two animations. Including an animation and itself, which happens when you tell Godot to play an animation while that same animation is playing.
In the animation panel (in the bottom of the editor), with the first animation selected ("swing" in your example), click on the "Animation" button and select "Edit Transitions". It will open the Cross-Animation Blend Times dialog for that selected animation.
The dialog will show all the animations with a number attached, 0 by default. That is the time in which Godot will blend the animation, in seconds.
The 0 (default) means instantaneous. That is, if you play another animation ("parry" in your example), it will snap to the start values of that animation… Which is not what you want. Instead increase the time.
Note that Godot will not interpolate to the start values of the new animation, it will interpolate to the current values of the new animation playing.
To reiterate the scenario, while the first animation (say "swing") is playing, you play the second animation (say "parry").
The second animation plays, but the values set will not be those in the animation. Instead they will be some interpolation between the current values and those in the animation. The interpolation will be such that at the start the current value is unaltered, and after whatever time you configured in the Cross-Animation Blend Times dialog, the value is what is in the animation.
And yes, that is a linear interpolation. At least as far as I can tell, keep in mind that we rarely want the transition to be long.
If you replace the initial values of an animation with the current values, then the animation would meet values of the animation at the second key frame.
You can make the transition time match the second key frame instead. Not exactly the same, given that you can have tracks with key frames at different times that do not line up, and you can control how each track interpolates. However the approach I present here is much less work (no code at all).
If you don't want a linear interpolation, or you want to interpolate between more than two animations, please use an AnimationTree. See also Controlling animation states.