Datasets:
michaelmior
commited on
Exclude some additional schemas
Browse files- data/test.jsonl.gz +2 -2
- data/train.jsonl.gz +2 -2
- data/validation.jsonl.gz +2 -2
- train_split.py +2 -4
- validate_schemas.py +19 -0
data/test.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e29f0f20dba83e0a15297f0411ec1d8644b174bb48fcdea0ce1d83d0abb92c40
|
3 |
+
size 1118078
|
data/train.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:07aa22ac52077d44ab69d39efc391414707f21bb3ea49ded7a0bd477efebd9f0
|
3 |
+
size 14192760
|
data/validation.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80a44f0d51e8215789f6288f56e9a6da45d57e794f772084797a28e6445ce90c
|
3 |
+
size 1807245
|
train_split.py
CHANGED
@@ -22,9 +22,7 @@ def files_list(licenses):
|
|
22 |
files = [
|
23 |
f
|
24 |
for f in data_path.rglob("*.json")
|
25 |
-
if f.is_file()
|
26 |
-
and "node_modules" not in f.parts
|
27 |
-
and licenses["/".join(f.parts[1:3])] in PERMISSIVE_LICENSES
|
28 |
]
|
29 |
return files
|
30 |
|
@@ -164,7 +162,7 @@ def main(similarity, split, seed, commits_file, licenses_file, languages_file):
|
|
164 |
if __name__ == "__main__":
|
165 |
parser = argparse.ArgumentParser()
|
166 |
parser.add_argument("--similarity", default=None, type=float)
|
167 |
-
parser.add_argument("--seed", default=
|
168 |
parser.add_argument("--split", default=0.8, type=float)
|
169 |
parser.add_argument("--commits_file", default="commits.json")
|
170 |
parser.add_argument("--licenses_file", default="licenses.json")
|
|
|
22 |
files = [
|
23 |
f
|
24 |
for f in data_path.rglob("*.json")
|
25 |
+
if f.is_file() and licenses["/".join(f.parts[1:3])] in PERMISSIVE_LICENSES
|
|
|
|
|
26 |
]
|
27 |
return files
|
28 |
|
|
|
162 |
if __name__ == "__main__":
|
163 |
parser = argparse.ArgumentParser()
|
164 |
parser.add_argument("--similarity", default=None, type=float)
|
165 |
+
parser.add_argument("--seed", default=38, type=int)
|
166 |
parser.add_argument("--split", default=0.8, type=float)
|
167 |
parser.add_argument("--commits_file", default="commits.json")
|
168 |
parser.add_argument("--licenses_file", default="licenses.json")
|
validate_schemas.py
CHANGED
@@ -8,6 +8,16 @@ import jsonschema
|
|
8 |
from tqdm.contrib.concurrent import process_map
|
9 |
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def process_file(schema_file):
|
12 |
# Calculate the path of the new file
|
13 |
new_schema_file = Path("valid_data", *schema_file.parts[1:])
|
@@ -16,11 +26,20 @@ def process_file(schema_file):
|
|
16 |
if not schema_file.is_file() and not new_schema_file.is_file():
|
17 |
return
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
try:
|
20 |
schema = json5.load(open(schema_file))
|
21 |
except ValueError:
|
22 |
return
|
23 |
|
|
|
|
|
|
|
|
|
24 |
vcls = jsonschema.validators.validator_for(schema)
|
25 |
try:
|
26 |
vcls.check_schema(schema)
|
|
|
8 |
from tqdm.contrib.concurrent import process_map
|
9 |
|
10 |
|
11 |
+
IGNORE_PATHS = [
|
12 |
+
"node_modules",
|
13 |
+
"site-packages",
|
14 |
+
"draft2019-09",
|
15 |
+
"draft2020-12",
|
16 |
+
"draft-next",
|
17 |
+
"vendor",
|
18 |
+
]
|
19 |
+
|
20 |
+
|
21 |
def process_file(schema_file):
|
22 |
# Calculate the path of the new file
|
23 |
new_schema_file = Path("valid_data", *schema_file.parts[1:])
|
|
|
26 |
if not schema_file.is_file() and not new_schema_file.is_file():
|
27 |
return
|
28 |
|
29 |
+
# Skip files in ignored directories
|
30 |
+
for path in IGNORE_PATHS:
|
31 |
+
if path in schema_file.parts or path in new_schema_file.parts:
|
32 |
+
return
|
33 |
+
|
34 |
try:
|
35 |
schema = json5.load(open(schema_file))
|
36 |
except ValueError:
|
37 |
return
|
38 |
|
39 |
+
# Skip meta schemas
|
40 |
+
if schema.get("$id").startswith("https://json-schema.org/"):
|
41 |
+
continue
|
42 |
+
|
43 |
vcls = jsonschema.validators.validator_for(schema)
|
44 |
try:
|
45 |
vcls.check_schema(schema)
|