Skip to content

Commit ca725c5

Browse files
committed
move json files out of subfolders
1 parent 2417311 commit ca725c5

File tree

8 files changed

+9
-12
lines changed

8 files changed

+9
-12
lines changed

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include src/warnet/schema/*.json
21
graft images
32
graft manifests
43
graft scripts

src/warnet/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from pathlib import Path
2+
3+
SRC_DIR = Path(__file__).parent
File renamed without changes.
File renamed without changes.

src/warnet/schema/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/warnet/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import argparse
22
import base64
33
import importlib
4-
import importlib.resources as pkg_resources
54
import io
65
import json
76
import logging
@@ -27,6 +26,7 @@
2726
from .services import ServiceType
2827
from .utils import gen_config_dir
2928
from .warnet import Warnet
29+
from warnet import SRC_DIR
3030

3131
WARNET_SERVER_PORT = 9276
3232
CONFIG_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)

src/warnet/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
from jsonschema import validate
1717
from test_framework.messages import ser_uint256
1818
from test_framework.p2p import MESSAGEMAP
19-
20-
from .schema import SCHEMA
19+
from warnet import SRC_DIR
2120

2221
logger = logging.getLogger("utils")
2322

@@ -27,7 +26,6 @@
2726
WEIGHTED_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

3331
class NonErrorFilter(logging.Filter):
@@ -465,7 +463,7 @@ def convert_unsupported_attributes(graph: nx.Graph):
465463

466464

467465
def 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

test/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import atexit
2-
import importlib.resources as pkg_resources
32
import json
43
import logging
54
import logging.config
@@ -11,6 +10,7 @@
1110
from tempfile import mkdtemp
1211
from time import sleep
1312

13+
from warnet import SRC_DIR
1414
from warnet.cli.rpc import rpc_call
1515
from warnet.utils import exponential_backoff
1616
from 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)

0 commit comments

Comments
 (0)