Title: feat: cache IANA TLDs for faster lookups by salty-horse · Pull Request #390 · python-validators/validators · GitHub
Open Graph Title: feat: cache IANA TLDs for faster lookups by salty-horse · Pull Request #390 · python-validators/validators
X Title: feat: cache IANA TLDs for faster lookups by salty-horse · Pull Request #390 · python-validators/validators
Description: Follow-up to the discussion in #362. I wasn't sure what was meant by using dataclass, as this isn't a data-first class. I used a regular class, instead. One thing that's obviously missing is tests. I'm not familiar with pytest, and don't know how to re-run the existing domain tests after running the new "load" function. Here are some basic timing results: $ python -m timeit -s 'import validators' 'validators.domain("example.com", consider_tld=True)' 5000 loops, best of 5: 63.5 usec per loop $ python -m timeit -s 'import validators; validators.load_iana_tlds_to_memory()' 'validators.domain("example.com", consider_tld=True)' 50000 loops, best of 5: 4.63 usec per loop $ python -m timeit -s 'import validators' 'validators.domain("example.blabla", consider_tld=True)' 1000 loops, best of 5: 200 usec per loop $ python -m timeit -s 'import validators; validators.load_iana_tlds_to_memory()' 'validators.domain("example.blabla", consider_tld=True)' 20000 loops, best of 5: 16.5 usec per loop
Open Graph Description: Follow-up to the discussion in #362. I wasn't sure what was meant by using dataclass, as this isn't a data-first class. I used a regular class, instead. One thing that's obviously missi...
X Description: Follow-up to the discussion in #362. I wasn't sure what was meant by using dataclass, as this isn't a data-first class. I used a regular class, instead. One thing that's obv...
Opengraph URL: https://github.com/python-validators/validators/pull/390
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:a63ebb7d-eee2-2931-e084-049cad06df74 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | AF90:130B0:9697CA:C3CF74:698EB692 |
| html-safe-nonce | 813e9ba26014c556f751eb37e9f7951035eccb4f2fdd4e10e37d8e0bd5dba9b2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjkwOjEzMEIwOjk2OTdDQTpDM0NGNzQ6Njk4RUI2OTIiLCJ2aXNpdG9yX2lkIjoiMzkyMzg1MTMxNTU5NjE0NjMyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae5344af97eeda6e55c746e1f293fb585841bdd250bb2267cd6b3cf9e9145ce1 |
| hovercard-subject-tag | pull_request:1971272916 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-validators/validators/pull/390/checks |
| twitter:image | https://avatars.githubusercontent.com/u/28355?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/28355?s=400&v=4 |
| og:image:alt | Follow-up to the discussion in #362. I wasn't sure what was meant by using dataclass, as this isn't a data-first class. I used a regular class, instead. One thing that's obviously missi... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/python-validators/validators git https://github.com/python-validators/validators.git |
| octolytics-dimension-user_id | 113113270 |
| octolytics-dimension-user_login | python-validators |
| octolytics-dimension-repository_id | 13642984 |
| octolytics-dimension-repository_nwo | python-validators/validators |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13642984 |
| octolytics-dimension-repository_network_root_nwo | python-validators/validators |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width