As an element is valid and contains text, extract it and return Added filter to words that has spaces between them, they for sure are not valid username Error looks like: "User: 'NOVEMBER 5' |> followers: unknown |> following: unknown |> relationship ratio: unknown"
(elem)
| 2140 | |
| 2141 | |
| 2142 | def extract_text_from_element(elem): |
| 2143 | """ |
| 2144 | As an element is valid and contains text, extract it and return |
| 2145 | Added filter to words that has spaces between them, they for sure are not valid username |
| 2146 | Error looks like: "User: 'NOVEMBER 5' |> followers: unknown |> following: unknown |> relationship ratio: unknown" |
| 2147 | ^^^^^^^^^^^^^^^^^ |
| 2148 | """ |
| 2149 | |
| 2150 | # if element is valid and contains text withou spaces |
| 2151 | if elem and hasattr(elem, "text") and elem.text and not re.search("\s", elem.text): |
| 2152 | return elem.text |
| 2153 | |
| 2154 | # if the element is not valid, return None |
| 2155 | return None |
| 2156 | |
| 2157 | |
| 2158 | def truncate_float(number, precision, round=False): |
no outgoing calls
no test coverage detected