File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
openapi_spec_validator/schemas Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
"""OpenAIP spec validator schemas utils module."""
2
+ import sys
2
3
from os import path
3
4
from typing import Any
4
5
from typing import Hashable
5
6
from typing import Mapping
6
7
from typing import Tuple
7
8
8
- import importlib_resources
9
+ if sys .version_info >= (3 , 9 ):
10
+ from importlib .resources import as_file , files
11
+ else :
12
+ from importlib_resources import as_file , files
9
13
from jsonschema_spec .readers import FilePathReader
10
14
11
15
12
16
def get_schema (version : str ) -> Tuple [Mapping [Hashable , Any ], str ]:
13
17
schema_path = f"resources/schemas/v{ version } /schema.json"
14
- ref = importlib_resources . files ("openapi_spec_validator" ) / schema_path
15
- with importlib_resources . as_file (ref ) as resource_path :
18
+ ref = files ("openapi_spec_validator" ) / schema_path
19
+ with as_file (ref ) as resource_path :
16
20
schema_path_full = path .join (path .dirname (__file__ ), resource_path )
17
21
return FilePathReader (schema_path_full ).read ()
18
22
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ openapi-schema-validator = "^0.3.2"
49
49
python = " ^3.7.0"
50
50
PyYAML = " >=5.1"
51
51
requests = {version = " *" , optional = true }
52
- importlib-resources = " ^5.8.0"
52
+ importlib-resources = { version = " ^5.8.0" , python = " <3.9 " }
53
53
jsonschema-spec = " ^0.1.1"
54
54
lazy-object-proxy = " ^1.7.1"
55
55
You can’t perform that action at this time.
0 commit comments