From d5eecf100f06a75475b7879f6d96b6d46c2233a6 Mon Sep 17 00:00:00 2001 From: Neeraj Kashyap Date: Sat, 25 Sep 2021 08:56:22 -0700 Subject: [PATCH] Fixed mypy issue --- crawlers/mooncrawl/mooncrawl/nft/ethereum.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crawlers/mooncrawl/mooncrawl/nft/ethereum.py b/crawlers/mooncrawl/mooncrawl/nft/ethereum.py index c115d769..794cfe91 100644 --- a/crawlers/mooncrawl/mooncrawl/nft/ethereum.py +++ b/crawlers/mooncrawl/mooncrawl/nft/ethereum.py @@ -306,12 +306,16 @@ def label_erc721_addresses( # Postgres cannot store the following unicode code point in a string: \u0000 # Therefore, we replace that code point with the empty string to avoid errors: # https://stackoverflow.com/a/31672314 - contract_name = contract_info.name.replace("\\u0000", "").replace( - "\x00", "" - ) - contract_symbol = contract_info.symbol.replace("\\u0000", "").replace( - "\x00", "" - ) + contract_name: Optional[str] = None + if contract_info.name is not None: + contract_name = contract_info.name.replace("\\u0000", "").replace( + "\x00", "" + ) + contract_symbol: Optional[str] = None + if contract_info.symbol is not None: + contract_symbol = contract_info.symbol.replace("\\u0000", "").replace( + "\x00", "" + ) labels.append( EthereumLabel(