-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,182 additions
and
542 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
coverage | ||
pytest | ||
pytest-cov | ||
git+https://github.com/mverteuil/pytest-ipdb.git |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
import io | ||
import json | ||
import jsonschema | ||
from . import helpers | ||
|
||
|
||
def validate(source): | ||
"""Validate a CSV Dialect source file.""" | ||
|
||
schemafile = os.path.abspath(os.path.join( | ||
os.path.dirname(os.path.dirname(__file__)), 'schemas', | ||
'csv-dialect-description-format.json')) | ||
|
||
with io.open(schemafile) as stream: | ||
schema = json.load(stream) | ||
|
||
try: | ||
source = helpers.load_json_source(source) | ||
jsonschema.validate(source, schema) | ||
return True | ||
|
||
except (jsonschema.ValidationError, ValueError, TypeError): | ||
return False |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
import os | ||
import io | ||
import json | ||
import jsonschema | ||
from . import helpers | ||
|
||
|
||
def validate(source): | ||
"""Validate a Data Package source file. | ||
Args: | ||
* source | ||
""" | ||
|
||
schemafile = os.path.abspath(os.path.join( | ||
os.path.dirname(os.path.dirname(__file__)), 'schemas', | ||
'data-package.json')) | ||
|
||
with io.open(schemafile) as stream: | ||
schema = json.load(stream) | ||
|
||
try: | ||
source = helpers.load_json_source(source) | ||
jsonschema.validate(source, schema) | ||
return True, schema | ||
|
||
except (jsonschema.ValidationError, ValueError, TypeError): | ||
return False, None |
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.