mirror of https://github.com/nucypher/nucypher.git
Fix pathlib usage
parent
a69a41b73e
commit
9f87a5d1f5
|
@ -20,8 +20,8 @@ from pathlib import Path
|
|||
from typing import List
|
||||
import random
|
||||
|
||||
_HERE = Path(__file__)
|
||||
with open(_HERE.parent / 'web_colors.json') as f:
|
||||
_HERE = Path(__file__).parent
|
||||
with open(_HERE / 'web_colors.json') as f:
|
||||
_COLORS = json.load(f)['colors']
|
||||
|
||||
_SYMBOLS = {
|
||||
|
|
|
@ -61,7 +61,7 @@ def get_config_filepaths(config_class: Type[CharacterConfiguration], config_root
|
|||
# updated glob pattern for secondary configuration files accommodates for:
|
||||
# 1. configuration files with "0x..." checksum address as suffix - including older ursula config files
|
||||
# 2. newer (ursula) configuration files which use signing_pub_key[:8] as hex as the suffix
|
||||
glob_pattern = f'{str(config_root)}/{config_class.NAME}-[0-9a-fA-F]*.{config_class._CONFIG_FILE_EXTENSION}'
|
||||
glob_pattern = f'{config_root.absolute()}/{config_class.NAME}-[0-9a-fA-F]*.{config_class._CONFIG_FILE_EXTENSION}'
|
||||
|
||||
secondary_config_files = sorted(glob.glob(glob_pattern)) # sort list to make order deterministic
|
||||
config_files = [*default_config_file, *secondary_config_files]
|
||||
|
@ -114,7 +114,7 @@ def handle_missing_configuration_file(character_config_class: Type[CharacterConf
|
|||
if name == StakeHolderConfiguration.NAME.capitalize():
|
||||
init_command = 'stake init-stakeholder'
|
||||
message = MISSING_CONFIGURATION_FILE.format(name=name, init_command=init_command)
|
||||
raise click.FileError(filename=str(config_file_location), hint=message)
|
||||
raise click.FileError(filename=str(config_file_location.absolute()), hint=message)
|
||||
|
||||
|
||||
def handle_invalid_configuration_file(emitter: StdoutEmitter,
|
||||
|
|
|
@ -648,7 +648,8 @@ class CharacterConfiguration(BaseConfiguration):
|
|||
|
||||
# Assemble
|
||||
payload.update(dict(node_storage=node_storage, max_gas_price=max_gas_price))
|
||||
for key in ['keyring_root', 'db_filepath']:
|
||||
# TODO: Move this to implementation of respective classes?
|
||||
for key in ['keyring_root', 'db_filepath', 'filepath', 'config_root', 'registry_filepath']:
|
||||
if key in payload:
|
||||
payload[key] = Path(payload[key])
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ class UrsulaConfiguration(CharacterConfiguration):
|
|||
worker_address=self.worker_address,
|
||||
rest_host=self.rest_host,
|
||||
rest_port=self.rest_port,
|
||||
db_filepath=self.db_filepath.absolute(),
|
||||
db_filepath=self.db_filepath,
|
||||
availability_check=self.availability_check,
|
||||
)
|
||||
return {**super().static_payload(), **payload}
|
||||
|
|
|
@ -70,7 +70,7 @@ class AnalyzeGas:
|
|||
# Logging
|
||||
LOG_NAME = 'estimate-gas'
|
||||
LOG_FILENAME = '{}.log.json'.format(LOG_NAME)
|
||||
OUTPUT_DIR = Path(__file__) / 'results'
|
||||
OUTPUT_DIR = Path(__file__).parent / 'results'
|
||||
JSON_OUTPUT_FILENAME = '{}.json'.format(LOG_NAME)
|
||||
|
||||
_PATTERN = re.compile(r'''
|
||||
|
|
Loading…
Reference in New Issue