created initial textnode class
This commit is contained in:
		
							
								
								
									
										15
									
								
								src/textnode.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/textnode.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
class TextNode:
 | 
			
		||||
    def __init__(self, text, text_type, url=None) -> None:
 | 
			
		||||
        self.text = text
 | 
			
		||||
        self.text_type = text_type
 | 
			
		||||
        self.url = url
 | 
			
		||||
 | 
			
		||||
    def __eq__(self, other_node) -> bool:
 | 
			
		||||
        return (
 | 
			
		||||
            self.text == other_node.text
 | 
			
		||||
            and self.text_type == other_node.text_type
 | 
			
		||||
            and self.url == other_node.url
 | 
			
		||||
        )
 | 
			
		||||
    
 | 
			
		||||
    def __repr__(self) -> str:
 | 
			
		||||
        return f"TextNode({self.text}, {self.text_type}, {self.url})"
 | 
			
		||||
		Reference in New Issue
	
	Block a user