File tree Expand file tree Collapse file tree 8 files changed +9
-12
lines changed Expand file tree Collapse file tree 8 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1- include src/warnet/schema/*.json
21graft images
32graft manifests
43graft scripts
Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+
3+ SRC_DIR = Path (__file__ ).parent
File renamed without changes.
File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import argparse
22import base64
33import importlib
4- import importlib .resources as pkg_resources
54import io
65import json
76import logging
2726from .services import ServiceType
2827from .utils import gen_config_dir
2928from .warnet import Warnet
29+ from warnet import SRC_DIR
3030
3131WARNET_SERVER_PORT = 9276
3232CONFIG_DIR_ALREADY_EXISTS = 32001
@@ -96,7 +96,7 @@ def healthy(self):
9696
9797 def setup_logging (self ):
9898 os .makedirs (os .path .dirname (self .log_file_path ), exist_ok = True )
99- with pkg_resources . open_text ( "warnet.logging_config" , "config .json" ) as f :
99+ with open ( SRC_DIR / "logging_config .json" ) as f :
100100 logging_config = json .load (f )
101101 logging_config ["handlers" ]["file" ]["filename" ] = str (self .log_file_path )
102102 logging .config .dictConfig (logging_config )
Original file line number Diff line number Diff line change 1616from jsonschema import validate
1717from test_framework .messages import ser_uint256
1818from test_framework .p2p import MESSAGEMAP
19-
20- from .schema import SCHEMA
19+ from warnet import SRC_DIR
2120
2221logger = logging .getLogger ("utils" )
2322
2726WEIGHTED_TAGS = [
2827 tag for index , tag in enumerate (reversed (SUPPORTED_TAGS )) for _ in range (index + 1 )
2928]
30- GRAPH_SCHEMA_PATH = SCHEMA / "graph_schema.json"
3129
3230
3331class NonErrorFilter (logging .Filter ):
@@ -465,7 +463,7 @@ def convert_unsupported_attributes(graph: nx.Graph):
465463
466464
467465def load_schema ():
468- with open (GRAPH_SCHEMA_PATH ) as schema_file :
466+ with open (SRC_DIR / "graph_schema.json" ) as schema_file :
469467 return json .load (schema_file )
470468
471469
Original file line number Diff line number Diff line change 11import atexit
2- import importlib .resources as pkg_resources
32import json
43import logging
54import logging .config
1110from tempfile import mkdtemp
1211from time import sleep
1312
13+ from warnet import SRC_DIR
1414from warnet .cli .rpc import rpc_call
1515from warnet .utils import exponential_backoff
1616from warnet .warnet import Warnet
@@ -39,7 +39,7 @@ def setup_environment(self):
3939 self .network = True
4040
4141 def setup_logging (self ):
42- with pkg_resources . open_text ( "warnet.logging_config" , "config .json" ) as f :
42+ with open ( SRC_DIR / "logging_config .json" ) as f :
4343 logging_config = json .load (f )
4444 logging_config ["handlers" ]["file" ]["filename" ] = str (self .logfilepath )
4545 logging .config .dictConfig (logging_config )
You can’t perform that action at this time.
0 commit comments