Skip to content

Commit

Permalink
🔖 Release 3.5.2 (#91)
Browse files Browse the repository at this point in the history
**Fixed**
- ImportError in an attempt to retrieve `ConnectionInfo`.

**Changed**
- General performance improvements.
  • Loading branch information
Ousret authored Mar 5, 2024
1 parent 40e1d6a commit a33ac11
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
9 changes: 9 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Release History
===============

3.5.2 (2024-03-05)
------------------

**Fixed**
- ImportError in an attempt to retrieve `ConnectionInfo`.

**Changed**
- General performance improvements.

3.5.1 (2024-03-04)
------------------

Expand Down
4 changes: 2 additions & 2 deletions src/niquests/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
__url__: str = "https://niquests.readthedocs.io"

__version__: str
__version__ = "3.5.1"
__version__ = "3.5.2"

__build__: int = 0x030501
__build__: int = 0x030502
__author__: str = "Kenneth Reitz"
__author_email__: str = "[email protected]"
__license__: str = "Apache-2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/niquests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def lazy(self) -> bool:
Determine if response isn't received and is actually a placeholder.
Only significant if request was sent through a multiplexed connection.
"""
return hasattr(self, "raw") and self.raw is None and hasattr(self, "_promise")
return self.raw is None and hasattr(self, "_promise")

def _gather(self) -> None:
"""internals used for lazy responses. Do not try to access this unless you know what you are doing."""
Expand All @@ -1012,6 +1012,7 @@ def __getattribute__(self, item):
)
else:
self._gather()

return super().__getattribute__(item)

def __enter__(self):
Expand Down
12 changes: 5 additions & 7 deletions src/niquests/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import threading
import typing
from collections import OrderedDict
from collections.abc import Mapping, MutableMapping

from .exceptions import InvalidHeader
Expand All @@ -18,15 +17,15 @@
def _ensure_str_or_bytes(
key: typing.Any, value: typing.Any
) -> tuple[bytes | str, bytes | str]:
if isinstance(key, (bytes, str)) and isinstance(value, (bytes, str)):
return key, value
if isinstance(
value,
(
float,
int,
),
):
if isinstance(key, bytes):
key = key.decode()
value = str(value)
if isinstance(key, (bytes, str)) is False or (
value is not None and isinstance(value, (bytes, str)) is False
Expand Down Expand Up @@ -63,14 +62,13 @@ class CaseInsensitiveDict(MutableMapping):
"""

def __init__(self, data=None, **kwargs) -> None:
self._store: MutableMapping[
bytes | str, tuple[bytes | str, bytes | str]
] = OrderedDict()
self._store: MutableMapping[bytes | str, tuple[bytes | str, bytes | str]] = {}
if data is None:
data = {}
upstream_dict: bool = hasattr(data, "getlist")
if upstream_dict:
data = dict(data)
self.update(data, **kwargs)
return
normalized_items = []
for k, v in data.items() if hasattr(data, "items") else data:
normalized_items.append(
Expand Down
4 changes: 2 additions & 2 deletions src/niquests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
)
from netrc import NetrcParseError, netrc

from urllib3 import ConnectionInfo

from ._compat import HAS_LEGACY_URLLIB3

if HAS_LEGACY_URLLIB3 is False:
Expand All @@ -50,6 +48,7 @@
AsyncResolverDescription,
AsyncManyResolver,
)
from urllib3 import ConnectionInfo
else:
from urllib3_future.util import make_headers, parse_url # type: ignore[assignment]
from urllib3_future.contrib.resolver import ( # type: ignore[assignment]
Expand All @@ -63,6 +62,7 @@
AsyncResolverDescription,
AsyncManyResolver,
)
from urllib3_future import ConnectionInfo # type: ignore[assignment]

from .__version__ import __version__
from .cookies import cookiejar_from_dict
Expand Down

0 comments on commit a33ac11

Please sign in to comment.