Skip to content

Commit

Permalink
Fixed typo (py2) #1
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaHOH committed Nov 29, 2020
1 parent a109945 commit c6aefdc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion extproxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
extproxy.restore_items()
"""

__version__ = "0.1.4"
__version__ = "1.0.0"
__author__ = "SeaHOH<[email protected]>"

from .extra import *
Expand Down
14 changes: 7 additions & 7 deletions extproxy/socket_inet_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ def inet_ntop(family, ip_packed):


def _explode_ip_string(ip_string):
if ip_string[:1] = "[":
if ip_string[:1] == "[":
ip_string = [1:-1]
assert 1 < len(ip_string) < 40, 0
assert 1 < len(ip_string) < 40
if ip_string[:1] == ":":
assert ip_string[:2] == "::", 0
assert ip_string[:2] == "::"
ip_string = "0" + ip_string
if ip_string[-1:] == ":":
assert ip_string[-2:] == "::", 0
assert ip_string[-2:] == "::"
ip_string = ip_string + "0"

d_clns = ip_string.count("::")
assert d_clns == 0 or d_clns == 1 and ip_string.count(":::") == 0, 0
assert d_clns == 0 or d_clns == 1 and ip_string.count(":::") == 0

clns = ip_string.count(":")
m_clns = 6 if "." in ip_string[-4:] else 7
if d_clns:
assert 1 < clns <= m_clns, 0
assert 1 < clns <= m_clns
exploded = "0".join([":"] * (2 + m_clns - clns))
ip_string = ip_string.replace("::", exploded, 1)
else:
assert clns == m_clns, 0
assert clns == m_clns

return ip_string

Expand Down

0 comments on commit c6aefdc

Please sign in to comment.