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/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:67f54736-2849-037e-3c78-7f48fef8f0d7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9944:19CE2B:90ADBE:C75DEA:698E0E16 |
| html-safe-nonce | 1be50e4366e40d8b19f303eaf1de7830e246544a30c0e50d505956baa446624f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTQ0OjE5Q0UyQjo5MEFEQkU6Qzc1REVBOjY5OEUwRTE2IiwidmlzaXRvcl9pZCI6IjYxMDIzODExNTE4NzUxMDgzNzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 317cc2f6b2118f2762fea01df4e8305aef806b206c6b94ff8b54227a0c9b0633 |
| hovercard-subject-tag | pull_request:1971272916 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/files |
| 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 | fdf74c91c9ac187cc5cd7b14d4af2d6ef3e18136d002f5d36253f8538e97ee4c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1a5a3e7bbfb3486980e340c242368684156fba87 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width