surrealdb.py icon indicating copy to clipboard operation
surrealdb.py copied to clipboard

Draft: Fix return types of some `Surreal` methods

Open Wouterkoorn opened this issue 3 months ago • 0 comments

Change some return types from List[Dict, Any] to Unions[Dict[str, Any], List[Dict, Any]], or the Optional[...], variant of that.

What is the motivation?

Fix the currently incomplete/wrong return type annotations of some Surreal (WS/RPC client) methods. Improving developer experience of users.

Type of Change

  • [ ] 📚 Examples / docs / tutorials / dependencies update
  • [X] 🔧 Bug fix (non-breaking change which fixes an issue)
  • [ ] 🥂 Improvement (non-breaking change which improves an existing feature)
  • [ ] 🚀 New feature (non-breaking change which adds functionality)
  • [ ] 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] 🔐 Security fix

What does this change do?

Changes the return type of some methods from List[Dict[str, Any]] to

  • Union[Dict[str, Any], List[Dict[str, Any]]] for create, update, and merge
  • Optional[Union[Dict[str, Any], List[Dict[str, Any]]]] for select and delete

What is your testing strategy?

mypy returned OK pre-commit returned OK ./scripts/run_tests.sh returned OK

Is this related to any issues?

Yes: https://github.com/surrealdb/surrealdb.py/issues/97 This PR is regarding the first "1." propose solution in the above referenced issue.

Have you read the Contributing Guidelines?

Wouterkoorn avatar Apr 01 '24 23:04 Wouterkoorn