remove unused checksum, add typing

This commit is contained in:
Victor Shyba 2019-07-13 01:58:57 -03:00 committed by Lex Berezhny
parent d9460dcd9e
commit 510d88fff1
3 changed files with 4 additions and 7 deletions

View file

@ -22,9 +22,6 @@ CURRENCIES = {
'LBC': {'type': 'crypto'}, 'LBC': {'type': 'crypto'},
'USD': {'type': 'fiat'}, 'USD': {'type': 'fiat'},
} }
HEADERS_FILE_SHA256_CHECKSUM = (
590383, '71ff515ab728467a35a1484ca8c29ad2bfae3ea77753f9d3dfc64743121e7129'
)
class Setting(typing.Generic[T]): class Setting(typing.Generic[T]):

View file

@ -165,4 +165,4 @@ class ComponentManager:
raise NameError(component_name) raise NameError(component_name)
def has_component(self, component_name): def has_component(self, component_name):
return any(component.component_name == component_name for component in self.components) return any(component for component in self.components if component_name == component.component_name)

View file

@ -119,7 +119,7 @@ class HeadersComponent(Component):
def _round_progress(self, local_height, remote_height): def _round_progress(self, local_height, remote_height):
return min(max(math.ceil(float(local_height) / float(remote_height) * 100), 0), 100) return min(max(math.ceil(float(local_height) / float(remote_height) * 100), 0), 100)
async def get_status(self): async def get_status(self) -> dict:
progress = None progress = None
if self.is_downloading_headers: if self.is_downloading_headers:
progress = self._headers_progress_percent progress = self._headers_progress_percent
@ -161,7 +161,7 @@ class HeadersComponent(Component):
self.headers.bytes_size, final_size_after_download self.headers.bytes_size, final_size_after_download
) )
def local_header_file_size(self): def local_header_file_size(self) -> int:
if os.path.isfile(self.headers_file): if os.path.isfile(self.headers_file):
return os.stat(self.headers_file).st_size return os.stat(self.headers_file).st_size
return 0 return 0
@ -175,7 +175,7 @@ class HeadersComponent(Component):
except OSError: except OSError:
log.exception("Failed to download headers using https.") log.exception("Failed to download headers using https.")
async def should_download_headers_from_s3(self): async def should_download_headers_from_s3(self) -> bool:
if self.conf.blockchain_name != "lbrycrd_main": if self.conf.blockchain_name != "lbrycrd_main":
return False return False
s3_headers_depth = self.conf.s3_headers_depth s3_headers_depth = self.conf.s3_headers_depth