chore: small cleanup
This commit is contained in:
		
							parent
							
								
									a3a3f55234
								
							
						
					
					
						commit
						6ac1dc88d2
					
				@ -198,10 +198,10 @@ class CmdCtrl:
 | 
			
		||||
 | 
			
		||||
    def notify(self, v):
 | 
			
		||||
        if logg.root.level <= logging.INFO:
 | 
			
		||||
            print(v)
 | 
			
		||||
            print("\033[96m" + v + "\033[0m")
 | 
			
		||||
 | 
			
		||||
    def ouch(self, v):
 | 
			
		||||
        print(v)
 | 
			
		||||
        print("\033[91m" + v + "\033[0m")
 | 
			
		||||
 | 
			
		||||
    def write(self, v):
 | 
			
		||||
        print(v)
 | 
			
		||||
 | 
			
		||||
@ -109,26 +109,30 @@ def execute(ctrl):
 | 
			
		||||
        encrypter=ctrl.encrypter,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    ctrl.notify("resolving metadata for address {}".format(user_address_normal))
 | 
			
		||||
    r = None
 | 
			
		||||
    ctrl.write(
 | 
			
		||||
        f"""
 | 
			
		||||
Phone: {ctrl.get("_IDENTIFIER")}
 | 
			
		||||
Network address: {add_0x(user_address)}
 | 
			
		||||
Chain: {ctrl.chain().common_name()}"""
 | 
			
		||||
    )
 | 
			
		||||
    ctrl.notify("resolving metadata for address {}".format(user_address_normal))
 | 
			
		||||
    try:
 | 
			
		||||
        r = user_address_store.by_address(
 | 
			
		||||
            user_address_normal, update=ctrl.get("_FORCE")
 | 
			
		||||
        )
 | 
			
		||||
    except MetadataNotFoundError as e:
 | 
			
		||||
        ctrl.ouch("could not resolve metadata for user: {}".format(e))
 | 
			
		||||
 | 
			
		||||
    ctrl.write(
 | 
			
		||||
        f"""Phone: {ctrl.get("_IDENTIFIER")}
 | 
			
		||||
Network address: {add_0x(user_address)}
 | 
			
		||||
Chain: {ctrl.chain().common_name()}
 | 
			
		||||
        if r:
 | 
			
		||||
            ctrl.write(
 | 
			
		||||
                f"""
 | 
			
		||||
Name: { str(r)}
 | 
			
		||||
Registered: {datetime.datetime.fromtimestamp(r.date_registered).ctime()}
 | 
			
		||||
Gender: {r.gender}
 | 
			
		||||
Location: {r.location["area_name"]}
 | 
			
		||||
Products: {",".join(r.products)}
 | 
			
		||||
Tags: {",".join(r.tags)}"""
 | 
			
		||||
    )
 | 
			
		||||
            )
 | 
			
		||||
    except MetadataNotFoundError as e:
 | 
			
		||||
        ctrl.ouch(f"MetadataNotFoundError: Could not resolve metadata for user {e}\n")
 | 
			
		||||
 | 
			
		||||
    tx_lines = []
 | 
			
		||||
    seen_tokens = {}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user