1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-02 03:12:25 +01:00

fixed merge conflicts

This commit is contained in:
chetanjangir0
2025-04-12 17:22:18 +05:30
22 changed files with 196 additions and 148 deletions

View File

@@ -12,13 +12,15 @@ def compare_highlighted_versions(root_old, root_new):
print(" -", root_old)
print(" -", root_new)
has_changes = False
# Used to check for newly added files that don't have a test
unknown_files = {strip_root(p) for p in glob.glob(path.join(root_new, "*", "*"))}
for path_old in glob.glob(path.join(root_old, "*", "*")):
filename = path.basename(path_old)
dirname = path.basename(path.dirname(path_old))
rel_path = strip_root(path_old)
unknown_files.discard(rel_path)
path_new = path.join(root_new, rel_path)
path_new = path.join(root_new, dirname, filename)
print("\n========== {}/{}".format(dirname, filename))
print("\n========== {}".format(rel_path))
with open(path_old) as file_old:
lines_old = file_old.readlines()
@@ -39,11 +41,21 @@ def compare_highlighted_versions(root_old, root_new):
has_changes = True
else:
print("No changes")
print()
for f in unknown_files:
print("\n========== {}: No fixture for this language, run update.sh".format(f))
has_changes = True
print()
return has_changes
def strip_root(p: str) -> str:
filename = path.basename(p)
dirname = path.basename(path.dirname(p))
return path.join(dirname, filename)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="This script compares two directories that were created "

View File

@@ -0,0 +1,27 @@
package main
import "core:fmt"
import "core:math"
Vector :: struct {
 components: []f64,
}
euclidean_distance :: proc(v1: Vector, v2: Vector) -> f64 {
 if len(v1.components) != len(v2.components) {
 panic("Vectors must be same dimension")
 }
 sum: f64 = 0.0;
 for i, comp in v1.components {
 diff := comp - v2.components[i];
 sum += diff * diff;
 }
 return math.sqrt(sum);
}
main :: proc() {
 v1: Vector = Vector{components = []f64{1.0, 2.0, 3.0}};
 v2: Vector = Vector{components = []f64{4.0, 6.0, 8.0}};
 dist: f64 = euclidean_distance(v1, v2);
 fmt.println("Distance:", dist);
}

View File

@@ -0,0 +1,27 @@
package main
import "core:fmt"
import "core:math"
Vector :: struct {
components: []f64,
}
euclidean_distance :: proc(v1: Vector, v2: Vector) -> f64 {
if len(v1.components) != len(v2.components) {
panic("Vectors must be same dimension")
}
sum: f64 = 0.0;
for i, comp in v1.components {
diff := comp - v2.components[i];
sum += diff * diff;
}
return math.sqrt(sum);
}
main :: proc() {
v1: Vector = Vector{components = []f64{1.0, 2.0, 3.0}};
v2: Vector = Vector{components = []f64{4.0, 6.0, 8.0}};
dist: f64 = euclidean_distance(v1, v2);
fmt.println("Distance:", dist);
}