-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding ruff, running pre-commit hooks, small fixes and documentation (#…
…1303) This doesn't contribute an Eval but slightly improves the developer experience for contributors.
- Loading branch information
1 parent
0dc0ba4
commit dd96814
Showing
39 changed files
with
669 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import sys | ||
|
||
import yaml | ||
|
||
|
||
def get_first_key(file_path): | ||
with open(file_path, 'r') as yaml_file: | ||
with open(file_path, "r") as yaml_file: | ||
content = yaml.safe_load(yaml_file) | ||
first_key = next(iter(content)) | ||
return first_key | ||
|
||
|
||
if __name__ == "__main__": | ||
yaml_file_path = sys.argv[1] | ||
print(get_first_key(yaml_file_path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
from pytest import mark | ||
|
||
from evals.elsuite.utils import fuzzy_match, normalize | ||
|
||
@mark.parametrize("s, expected", [ | ||
("", ""), | ||
("Hello", "hello"), | ||
("hello\nworld", "hello world"), | ||
]) | ||
|
||
@mark.parametrize( | ||
"s, expected", | ||
[ | ||
("", ""), | ||
("Hello", "hello"), | ||
("hello\nworld", "hello world"), | ||
], | ||
) | ||
def test_normalize(s: str, expected: str): | ||
assert normalize(s) == expected | ||
|
||
@mark.parametrize("s1, s2, expected", [ | ||
("", "", True), | ||
("x", "", False), | ||
("Hello", "Hello", True), | ||
("hello", "othello", True), | ||
("hello", "oh tello", False), | ||
("Hello World", "foo\nhello world", True), | ||
("who's there?", "whos there", True), | ||
("who's there?", "whosthere", False), | ||
("an apple a day that the", "apple day that", True), | ||
]) | ||
|
||
@mark.parametrize( | ||
"s1, s2, expected", | ||
[ | ||
("", "", True), | ||
("x", "", False), | ||
("Hello", "Hello", True), | ||
("hello", "othello", True), | ||
("hello", "oh tello", False), | ||
("Hello World", "foo\nhello world", True), | ||
("who's there?", "whos there", True), | ||
("who's there?", "whosthere", False), | ||
("an apple a day that the", "apple day that", True), | ||
], | ||
) | ||
def test_fuzzy_match(s1: str, s2: str, expected: bool): | ||
assert fuzzy_match(s1, s2) == expected | ||
assert fuzzy_match(s2, s1) == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.