Replace flake8 with ruff and apply consistent linting rules across the entire codebase. Update type annotations, quotation marks, and other style-related changes to comply with the new standards.
* Add debug Q-expr print function
* Change old __unicode__ methods to __str__ format
* Move __unicode__ methods to __str__
* Rewrite AND Q-expressions to safe form
* Make Q-expr debug print method use nicer format
* Document rewrite_q_expr function
* Rewrite/improve queries' test
* Document some more code
* Reorganize and document queryset module
* Add more tests for queries
* Use generic relation attribute instead instead of 'eav_values'
* Update docstring
* Fix a typo
* Move up a variable
* Rename a function
* Check if 'in' filter rhs is not a QuerySet
* Add newline to the end of file
* Fix typo; tweak docstring