You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
STYLE: Linting python files and making it fully typed (#298)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#36303](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/36303)
>
[AB#38478](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/38478)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #22
-------------------------------------------------------------------
### Summary
This pull request refactors the `mssql_python` package to improve type
safety and code clarity by adding explicit type annotations throughout
the codebase. The changes mainly focus on the `__init__.py` and
`auth.py` modules, updating function signatures, global variables, and
constants to use Python type hints. This will help with static analysis,
improve IDE support, and make the code easier to understand and
maintain.
### Type Annotation Improvements
* Added type annotations to global variables, constants, and function
signatures in `mssql_python/__init__.py`, including SQL constants and
configuration settings.
* Updated function signatures in `mssql_python/auth.py` to use type
hints for parameters and return types, such as changing raw
`list`/`dict` usage to `List[str]`, `Dict[int, bytes]`, and
`Optional[...]`.
### Code Quality and Consistency
* Improved formatting for multi-line statements and error messages, and
standardized quote usage for strings.
* Updated class and method definitions to use explicit type annotations
for attributes and properties, especially in the `Settings` and custom
module classes.
### Minor Logic and Readability Enhancements
* Improved parameter exclusion logic and connection string validation
for authentication handling in `auth.py`.
* Ensured that sensitive parameters are more robustly excluded from
connection strings.
These changes collectively enhance the maintainability and robustness of
the codebase by leveraging Python's type system and improving code
readability.
0 commit comments