Title: google.cloud.ndb stubs incorrect argument for various validators · Issue #7103 · python/typeshed · GitHub
Open Graph Title: google.cloud.ndb stubs incorrect argument for various validators · Issue #7103 · python/typeshed
X Title: google.cloud.ndb stubs incorrect argument for various validators · Issue #7103 · python/typeshed
Description: I have some code using google.cloud.ndb that has started failing pytype checks. The core of it is: from google.cloud import ndb def validate_url(prop, value): # some assert on value return value def validate_jqqb(prop, value): # some ret...
Open Graph Description: I have some code using google.cloud.ndb that has started failing pytype checks. The core of it is: from google.cloud import ndb def validate_url(prop, value): # some assert on value return value de...
X Description: I have some code using google.cloud.ndb that has started failing pytype checks. The core of it is: from google.cloud import ndb def validate_url(prop, value): # some assert on value return value de...
Opengraph URL: https://github.com/python/typeshed/issues/7103
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"google.cloud.ndb stubs incorrect argument for various validators","articleBody":"I have [some code](https://github.com/davidn/filter-feed/blob/9f6e616c9c39667a0b421358ef498d4bc1617c2d/filter_feed.py) using `google.cloud.ndb` that has started failing pytype checks. The core of it is:\r\n\r\n```py\r\nfrom google.cloud import ndb\r\n\r\ndef validate_url(prop, value):\r\n # some assert on value\r\n return value\r\n\r\ndef validate_jqqb(prop, value):\r\n # some \r\n return value\r\n\r\nclass FilterFeed(ndb.Model):\r\n url = ndb.StringProperty(required=True, validator=validate_url)\r\n query_builder = ndb.JsonProperty(required=True, validator=validate_jqqb)\r\n```\r\n\r\nSince last year, this started failing pytype with error:\r\n\r\n```\r\nFile \"/home/david/Projects/filter-feed/filter_feed.py\", line 19, in FilterFeed: Function JsonProperty.__init__ was called with the wrong arguments [wrong-arg-types]\r\n Expected: (self, name, compressed, json_type, indexed, repeated, required, default, choices, validator: Optional[Callable[[google.cloud.ndb.model.Property], object]] = ..., ...)\r\n Actually passed: (self, required, validator: Callable[[Any, Any], Any])\r\n\r\nFor more details, see https://google.github.io/pytype/errors.html#wrong-arg-types\r\nninja: build stopped: subcommand failed.\r\n```\r\n\r\nThis appears to be because #5821 introduced [an ndb stub](https://github.com/python/typeshed/blob/master/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi) that defines validators as `Callable[[Property], object]` while [upstream](https://github.com/googleapis/python-ndb/blob/main/google/cloud/ndb/model.py) defines it as `Callable[[~google.cloud.ndb.model.Property, Any], bool]` in docstrings.","author":{"url":"https://github.com/davidn","@type":"Person","name":"davidn"},"datePublished":"2022-02-02T04:59:37Z","url":"https://github.com/python/typeshed/issues/7103"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b4145ad4-d3e0-dec7-71b3-38451ea4bf85 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AD5C:30263F:2521222:32985F8:6B0038CD |
| html-safe-nonce | 519c3e9095f97fae94e6cf7ee125b66ae1e3a2b7f072c29ede4336a550703e38 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDVDOjMwMjYzRjoyNTIxMjIyOjMyOTg1Rjg6NkIwMDM4Q0QiLCJ2aXNpdG9yX2lkIjoiNDI5MDM2MzE0MDA5ODUwNDkwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b0923dcf658e2594efe21a1603c0ee96036c4abf9ee9d93e6abfce79cd23201b |
| hovercard-subject-tag | issue:1121512088 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/typeshed/7103/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e85ddc89b9ff294e28a275cf4c3a419f48b6c49042c6b90809b94bf75d98307e/python/typeshed/issues/7103 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e85ddc89b9ff294e28a275cf4c3a419f48b6c49042c6b90809b94bf75d98307e/python/typeshed/issues/7103 |
| og:image:alt | I have some code using google.cloud.ndb that has started failing pytype checks. The core of it is: from google.cloud import ndb def validate_url(prop, value): # some assert on value return value de... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | davidn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width