Skip to content

Commit 3ad8ce5

Browse files
authored
Merge pull request #4790 from opsmill/pog-furb116
Fix FURB116 Replace `bin` call with f-string
2 parents 57baceb + ace3531 commit 3ad8ce5

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

backend/infrahub/core/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ def convert_ip_to_binary_str(
184184
obj: Union[ipaddress.IPv6Network, ipaddress.IPv4Network, ipaddress.IPv4Interface, ipaddress.IPv6Interface],
185185
) -> str:
186186
if isinstance(obj, (ipaddress.IPv6Network, ipaddress.IPv4Network)):
187-
prefix_bin = bin(int(obj.network_address))[2:]
187+
prefix_bin = f"{int(obj.network_address):b}"
188188
return prefix_bin.zfill(obj.max_prefixlen)
189189

190-
ip_bin = bin(int(obj))[2:]
190+
ip_bin = f"{int(obj):b}"
191191
return ip_bin.zfill(obj.max_prefixlen)
192192

193193

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ ignore = [
489489
"C414", # Unnecessary `list` call within `sorted()`
490490
"C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
491491
"FURB113", # Use `networks.extend(...)` instead of repeatedly calling `networks.append()`
492-
"FURB116", # Replace `bin` call with f-string
493492
"FURB118", # Use `operator.itemgetter(1)` instead of defining a lambda
494493
"FURB140", # Use `itertools.starmap` instead of the generator
495494
"FURB171", # Membership test against single-item container

0 commit comments

Comments
 (0)