Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
george42-ctds committed Jan 9, 2025
1 parent 70b1c1c commit af74846
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions gdcdictionary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from dictionaryutils import DataDictionary as GDCDictionary

SCHEMA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "schemas")
Expand Down
18 changes: 9 additions & 9 deletions gdcdictionary/schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"""

from __future__ import print_function

import argparse
import copy
import glob
Expand Down Expand Up @@ -99,14 +97,14 @@ def assert_link_is_also_prop(link, properties, s_id):
), f"Entity '{s_id}' has '{link}' as a link but not property"

for link in [
schema_link ["name"]
schema_link["name"]
for schema_link in schema_value["links"]
if "name" in schema_link
]:
assert_link_is_also_prop(link, schema_properties, s_id)
for subgroup in [
schema_link["subgroup"]
for schema_link in schema_value["links"]
for schema_link in schema_value["links"]
if "name" not in schema_link
]:
for link in [
Expand All @@ -121,9 +119,9 @@ class SchemaTest(unittest.TestCase):
def setUp(self):
self.dictionary = gdcdictionary
with open(
os.path.join(CUR_DIR, "schemas", "_definitions.yaml"),
"r",
encoding="utf8",
os.path.join(CUR_DIR, "schemas", "_definitions.yaml"),
"r",
encoding="utf8",
) as def_file:
self.definitions = yaml.safe_load(def_file)

Expand All @@ -135,7 +133,8 @@ def test_valid_files(self):
"""Test files that are expected to be valid"""
for path in glob.glob(os.path.join(DATA_DIR, "valid", "*.json")):
print(f"Validating {path}")
doc = json.load(open(path, "r", encoding="utf8"))
with open(path, "r", encoding="utf8") as json_file:
doc = json.load(json_file)
print(doc)
if isinstance(doc, dict):
self.add_system_props(doc)
Expand All @@ -151,7 +150,8 @@ def test_invalid_files(self):
"""Test files that are expected to be invalid"""
for path in glob.glob(os.path.join(DATA_DIR, "invalid", "*.json")):
print(f"Validating {path}")
doc = json.load(open(path, "r", encoding="utf8"))
with open(path, "r", encoding="utf8") as json_file:
doc = json.load(json_file)
if isinstance(doc, dict):
self.add_system_props(doc)
with self.assertRaises(ValidationError):
Expand Down

0 comments on commit af74846

Please sign in to comment.