From 4a11cf007f50de03fbd4461158b1c7bbe96c7208 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Sun, 27 Jan 2019 19:26:18 -0500 Subject: [PATCH] remove unused settings and constants --- lbrynet/conf.py | 38 ------------------------ lbrynet/extras/daemon/analytics.py | 5 +++- tests/unit/lbrynet_daemon/test_Daemon.py | 17 ----------- 3 files changed, 4 insertions(+), 56 deletions(-) diff --git a/lbrynet/conf.py b/lbrynet/conf.py index 8c1e16396..c220b3e8d 100644 --- a/lbrynet/conf.py +++ b/lbrynet/conf.py @@ -16,29 +16,11 @@ log = logging.getLogger(__name__) NOT_SET = type(str('NOT_SET'), (object,), {}) T = typing.TypeVar('T') -KB = 2 ** 10 -MB = 2 ** 20 - -ANALYTICS_ENDPOINT = 'https://api.segment.io/v1' -ANALYTICS_TOKEN = 'Ax5LZzR1o3q3Z3WjATASDwR5rKyHH0qOIRIbLmMXn2H=' -API_ADDRESS = 'lbryapi' -APP_NAME = 'LBRY' -BLOBFILES_DIR = 'blobfiles' -CRYPTSD_FILE_EXTENSION = '.cryptsd' CURRENCIES = { 'BTC': {'type': 'crypto'}, 'LBC': {'type': 'crypto'}, 'USD': {'type': 'fiat'}, } -ICON_PATH = 'icons' if 'win' in sys.platform else 'app.icns' -LOG_FILE_NAME = 'lbrynet.log' -LOG_POST_URL = 'https://lbry.io/log-upload' -MAX_BLOB_REQUEST_SIZE = 64 * KB -MAX_HANDSHAKE_SIZE = 64 * KB -MAX_REQUEST_SIZE = 64 * KB -MAX_RESPONSE_INFO_SIZE = 64 * KB -MAX_BLOB_INFOS_TO_REQUEST = 20 -PROTOCOL_PREFIX = 'lbry' SLACK_WEBHOOK = ( 'nUE0pUZ6Yl9bo29epl5moTSwnl5wo20ip2IlqzywMKZiIQSFZR5' 'AHx4mY0VmF0WQZ1ESEP9kMHZlp1WzJwWOoKN3ImR1M2yUAaMyqGZ=' @@ -471,7 +453,6 @@ class CLIConfig(BaseConfig): class Config(CLIConfig): - data_dir = Path("Directory path to store blobs.", metavar='DIR') download_dir = Path( "Directory path to place assembled files downloaded from LBRY.", @@ -486,20 +467,12 @@ class Config(CLIConfig): "Whether to share usage stats and diagnostic info with LBRY.", True, previous_names=['upload_log', 'upload_log', 'share_debug_info'] ) - - # claims set to expire within this many blocks will be - # automatically renewed after startup (if set to 0, renews - # will not be made automatically) - auto_renew_claim_height_delta = Integer("", 0) cache_time = Integer("", 150) - data_rate = Float("points/megabyte", .0001) - delete_blobs_on_remove = Toggle("", True) dht_node_port = Integer("", 4444) download_timeout = Float("", 30.0) blob_download_timeout = Float("", 20.0) peer_connect_timeout = Float("", 3.0) node_rpc_timeout = Float("", constants.rpc_timeout) - is_generous_host = Toggle("", True) announce_head_blobs_only = Toggle("", True) concurrent_announcers = Integer("", 10) known_dht_nodes = Servers("", [ @@ -509,26 +482,15 @@ class Config(CLIConfig): ('lbrynet4.lbry.io', 4444) # ASIA ]) max_connections_per_stream = Integer("", 5) - seek_head_blob_first = Toggle("", True) max_key_fee = MaxKeyFee("", {'currency': 'USD', 'amount': 50.0}) - min_info_rate = Float("points/1000 infos", .02) - min_valuable_hash_rate = Float("points/1000 infos", .05) - min_valuable_info_rate = Float("points/1000 infos", .05) peer_port = Integer("", 3333) - pointtrader_server = String("", 'http://127.0.0.1:2424') - reflector_port = Integer("", 5566) # if reflect_uploads is True, send files to reflector after publishing (as well as a periodic check in the # event the initial upload failed or was disconnected part way through, provided the auto_re_reflect_interval > 0) reflect_uploads = Toggle("", True) - auto_re_reflect_interval = Integer("set to 0 to disable", 86400) reflector_servers = Servers("", [ ('reflector.lbry.io', 5566) ]) - run_reflector_server = Toggle("adds reflector to components_to_skip unless True", False) - sd_download_timeout = Integer("", 3) - peer_search_timeout = Integer("", 60) use_upnp = Toggle("", True) - use_keyring = Toggle("", False) blockchain_name = String("", 'lbrycrd_main') lbryum_servers = Servers("", [ ('lbryumx1.lbry.io', 50001), diff --git a/lbrynet/extras/daemon/analytics.py b/lbrynet/extras/daemon/analytics.py index 1e9c607d8..3ac005b6a 100644 --- a/lbrynet/extras/daemon/analytics.py +++ b/lbrynet/extras/daemon/analytics.py @@ -5,9 +5,12 @@ import logging import aiohttp from lbrynet import utils -from lbrynet.conf import Config, ANALYTICS_ENDPOINT, ANALYTICS_TOKEN +from lbrynet.conf import Config from lbrynet.extras import system_info +ANALYTICS_ENDPOINT = 'https://api.segment.io/v1' +ANALYTICS_TOKEN = 'Ax5LZzR1o3q3Z3WjATASDwR5rKyHH0qOIRIbLmMXn2H=' + # Things We Track SERVER_STARTUP = 'Server Startup' SERVER_STARTUP_SUCCESS = 'Server Startup Success' diff --git a/tests/unit/lbrynet_daemon/test_Daemon.py b/tests/unit/lbrynet_daemon/test_Daemon.py index adb47c262..2a2918ffd 100644 --- a/tests/unit/lbrynet_daemon/test_Daemon.py +++ b/tests/unit/lbrynet_daemon/test_Daemon.py @@ -84,15 +84,6 @@ class TestCostEst(unittest.TestCase): result = yield f2d(daemon.get_est_cost("test", size)) self.assertEqual(result, correct_result) - def test_fee_and_ungenerous_data(self): - conf = Config(is_generous_host=False) - size = 10000000 - fake_fee_amount = 4.5 - correct_result = size / 10 ** 6 * conf.data_rate + fake_fee_amount - daemon = get_test_daemon(conf, with_fee=True) - result = yield f2d(daemon.get_est_cost("test", size)) - self.assertEqual(result, round(correct_result, 1)) - def test_generous_data_and_no_fee(self): size = 10000000 correct_result = 0.0 @@ -100,14 +91,6 @@ class TestCostEst(unittest.TestCase): result = yield f2d(daemon.get_est_cost("test", size)) self.assertEqual(result, correct_result) - def test_ungenerous_data_and_no_fee(self): - conf = Config(is_generous_host=False) - size = 10000000 - correct_result = size / 10 ** 6 * conf.data_rate - daemon = get_test_daemon(conf) - result = yield f2d(daemon.get_est_cost("test", size)) - self.assertEqual(result, round(correct_result, 1)) - @unittest.SkipTest class TestJsonRpc(unittest.TestCase):