Skip to content

Commit d69e90f

Browse files
Tighten polling string-type branch checks
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 378bcd8 commit d69e90f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hyperbrowser/client/polling.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _normalized_exception_text(exc: Exception) -> str:
6868

6969

7070
def _coerce_operation_name_component(value: object, *, fallback: str) -> str:
71-
if isinstance(value, str) and type(value) is str:
71+
if type(value) is str:
7272
return value
7373
try:
7474
normalized_value = str(value)
@@ -159,8 +159,7 @@ def _validate_operation_name(operation_name: str) -> None:
159159
)
160160
try:
161161
contains_control_character = any(
162-
ord(character) < 32 or ord(character) == 127
163-
for character in operation_name
162+
ord(character) < 32 or ord(character) == 127 for character in operation_name
164163
)
165164
except HyperbrowserError:
166165
raise
@@ -389,8 +388,10 @@ def _normalize_status_code_for_retry(status_code: object) -> Optional[int]:
389388
status_text = _decode_ascii_bytes_like(status_code)
390389
elif isinstance(status_code, (bytes, bytearray)):
391390
status_text = _decode_ascii_bytes_like(status_code)
392-
elif isinstance(status_code, str):
391+
elif type(status_code) is str:
393392
status_text = status_code
393+
elif isinstance(status_code, str):
394+
status_text = None
394395
else:
395396
status_text = _decode_ascii_bytes_like(status_code)
396397

0 commit comments

Comments
 (0)