Skip to content

Commit 43263cd

Browse files
committed
BUG#38072835: Authentication OCI plugin option parameters not being supported by the aio connector
Added support for OCI authentication connection options for the async implementation of the connector. Fixed linting and typing issues. Change-Id: I384dafad3ab1f27921972456f0b4b3a93116792d
1 parent 73b60b0 commit 43263cd

File tree

9 files changed

+18
-12
lines changed

9 files changed

+18
-12
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ v9.4.0
1515
- WL#16963: Update the OpenTelemetry version
1616
- WL#16962: Update the Python Protobuf version
1717
- WL#16954: Make sdist packages pip installable
18+
- BUG#38072835: Authentication OCI plugin option parameters not being supported by the aio connector
1819
- BUG#37868219: RPM packages have incorrect copyright year in their metadata
1920
- BUG#37859771: mysql/connector python version 9.3.0 has a regression which cannot persist binary data with percent signs in it
2021
- BUG#37820231: Text based django ORM filters doesn't work with Connector/Python

mysql-connector-python/lib/mysql/connector/aio/abstracts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ def __init__(
212212
tls_versions: Optional[List[str]] = None,
213213
tls_ciphersuites: Optional[List[str]] = None,
214214
loop: Optional[asyncio.AbstractEventLoop] = None,
215+
oci_config_file: Optional[str] = None,
216+
oci_config_profile: Optional[str] = None,
215217
):
216218
# private (shouldn't be manipulated directly internally)
217219
self.__charset: Optional[Charset] = None
@@ -283,8 +285,10 @@ def __init__(
283285
self._have_next_result: bool = False
284286
self._unread_result: bool = False
285287
self._in_transaction: bool = False
286-
self._oci_config_file: Optional[str] = None
287-
self._oci_config_profile: Optional[str] = None
288+
self._oci_config_file: Optional[str] = oci_config_file
289+
"""Path to the configuration file."""
290+
self._oci_config_profile: Optional[str] = oci_config_profile
291+
"""Profile name."""
288292
self._webauthn_callback: Optional[Union[str, Callable[[str], None]]] = (
289293
webauthn_callback
290294
)

mysql-connector-python/lib/mysql/connector/aio/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ async def get_rows(
891891
if not self.unread_result:
892892
raise InternalError("No result set available")
893893

894-
rows: Tuple[List[Tuple[Any, ...]], Optional[EofPacketType]] = ([], None)
894+
rows = ([], None) # type: ignore[var-annotated]
895895
try:
896896
read_timeout = kwargs.get("read_timeout", None)
897897
if binary:

mysql-connector-python/lib/mysql/connector/aio/plugins/authentication_webauthn_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> Optional[bytes]:
195195
if device is not None:
196196
logger.debug("WebAuthn - Use USB HID channel")
197197
elif CTAP_PCSC_DEVICE_AVAILABLE:
198-
device = next(CtapPcscDevice.list_devices(), None) # type: ignore[arg-type]
198+
device = next(CtapPcscDevice.list_devices(), None)
199199

200200
if device is None:
201201
raise errors.InterfaceError("No FIDO device found")

mysql-connector-python/lib/mysql/connector/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ def get_rows(
815815
if not self.unread_result:
816816
raise InternalError("No result set available")
817817

818-
rows: Tuple[List[Tuple], Optional[EofPacketType]] = ([], None)
818+
rows = ([], None) # type: ignore[var-annotated]
819819
try:
820820
read_timeout = kwargs.get("read_timeout", None)
821821
if binary:
@@ -1285,7 +1285,7 @@ def set_allow_local_infile_in_path(self, path: str) -> None:
12851285
"""
12861286
self._allow_local_infile_in_path = path
12871287

1288-
@MySQLConnectionAbstract.use_unicode.setter # type: ignore
1288+
@MySQLConnectionAbstract.use_unicode.setter
12891289
def use_unicode(self, value: bool) -> None:
12901290
self._use_unicode = value
12911291
if self.converter:

mysql-connector-python/lib/mysql/connector/django/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def __getattr__(self, attr: str) -> bool:
352352
raise AttributeError
353353

354354
def get_connection_params(self) -> Dict[str, Any]:
355-
kwargs = {
355+
kwargs: dict = {
356356
"consume_results": True,
357357
}
358358

mysql-connector-python/lib/mysql/connector/opentelemetry/instrumentation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ def wrapper(
547547
kwargs[OPTION_CNX_TRACER] = tracer
548548

549549
# attach connection span
550+
# pylint: disable=not-context-manager
550551
with trace.use_span(kwargs[OPTION_CNX_SPAN], end_on_exit=False) as cnx_span:
551552
# Add basic net information.
552553
set_connection_span_attrs(None, cnx_span, kwargs)

mysql-connector-python/lib/mysql/connector/plugins/authentication_webauthn_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def auth_response(self, auth_data: bytes, **kwargs: Any) -> Optional[bytes]:
194194
if device is not None:
195195
logger.debug("WebAuthn - Use USB HID channel")
196196
elif CTAP_PCSC_DEVICE_AVAILABLE:
197-
device = next(CtapPcscDevice.list_devices(), None) # type: ignore[arg-type]
197+
device = next(CtapPcscDevice.list_devices(), None)
198198

199199
if device is None:
200200
raise errors.InterfaceError("No FIDO device found")

mysqlx-connector-python/lib/mysqlx/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def __init__(self, settings: Dict[str, Any]) -> None:
728728

729729
if "host" in settings and settings["host"]:
730730
self._routers.append(
731-
{ # type: ignore[arg-type]
731+
{
732732
"host": settings.get("host"),
733733
"port": settings.get("port", None),
734734
}
@@ -1288,7 +1288,7 @@ def execute_sql_scalar(self, sql: StatementType) -> int:
12881288
result.fetch_all()
12891289
if result.count == 0:
12901290
raise InterfaceError("No data found")
1291-
return result[0][0] # type: ignore[index]
1291+
return result[0][0]
12921292

12931293
@catch_network_exception
12941294
def get_row_result(self, cmd: str, fields: Dict[str, Any]) -> RowResult:
@@ -1645,7 +1645,7 @@ def add_connection(self, cnx: Optional[PooledConnection] = None) -> None:
16451645
raise PoolError("Connection instance not subclass of PooledSession")
16461646
if cnx.is_server_disconnected():
16471647
self.remove_connections()
1648-
cnx.close() # type: ignore[attr-defined]
1648+
cnx.close()
16491649

16501650
self.queue_connection(cnx)
16511651

@@ -2362,7 +2362,7 @@ def get_default_schema(self) -> Optional[Schema]:
23622362
.fetch_all()
23632363
)
23642364
try:
2365-
if res[0][0] == schema: # type: ignore[index]
2365+
if res[0][0] == schema:
23662366
return Schema(self, schema)
23672367
except IndexError:
23682368
raise ProgrammingError(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy