Skip to content

Commit 3e08600

Browse files
committed
chore: removed all print DEBUG statements
1 parent d87ff32 commit 3e08600

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

multiaddr/transforms.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,9 @@ def size_for_addr(codec: CodecBase, buf_io: io.BytesIO) -> int:
8787

8888

8989
def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[str]], None, None]:
90-
print(f"[DEBUG] Parsing string: {string}")
9190
if not string:
92-
print("[DEBUG] Empty string error")
9391
raise exceptions.StringParseError("Empty string", string)
9492
if not string.startswith('/'):
95-
print("[DEBUG] Must begin with / error")
9693
raise exceptions.StringParseError("Must begin with /", string)
9794
# consume trailing slashes
9895
string = string.rstrip('/')
@@ -102,13 +99,10 @@ def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[st
10299
sp.pop(0)
103100
while sp:
104101
element = sp.pop(0)
105-
print(f"[DEBUG] Element: '{element}' Remaining: {sp}")
106102
if not element: # Skip empty elements from multiple slashes
107-
print("[DEBUG] Skipping empty element")
108103
continue
109104
try:
110105
proto = protocol_with_name(element)
111-
print(f"[DEBUG] Found protocol: {proto.name}")
112106
if proto.codec is None:
113107
# Create a dummy codec with size 0 for protocols without a codec
114108
codec = CodecBase()
@@ -117,49 +111,40 @@ def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[st
117111
else:
118112
codec = codec_by_name(proto.codec)
119113
except (ImportError, exceptions.ProtocolNotFoundError) as exc:
120-
print(f"[DEBUG] Unknown Protocol: {element}")
121114
raise exceptions.StringParseError("Unknown Protocol", string, element) from exc
122115
value = None
123116
if codec is not None and codec.SIZE != 0:
124117
if proto.name == 'unix':
125118
# For unix, join all remaining elements as the value
126119
path_value = '/'.join(sp) if sp else ''
127120
if not path_value:
128-
print(f"[DEBUG] Protocol {proto.name} requires path but none left")
129121
raise exceptions.StringParseError("Protocol requires path", string, proto.name)
130122
try:
131123
codec.to_bytes(proto, path_value)
132124
value = path_value
133-
print(f"[DEBUG] Using path value '{value}' for protocol {proto.name}")
134125
sp.clear() # All remaining elements are part of the path
135126
except Exception as exc:
136-
print(f"[DEBUG] Invalid path value '{path_value}' for protocol {proto.name}")
137127
raise exceptions.StringParseError(
138128
f"Invalid path value for protocol {proto.name}",
139129
string,
140130
proto.name,
141131
exc
142132
) from exc
143133
else:
144-
print(f"[DEBUG] Protocol {proto.name} requires a value. Remaining: {sp}")
145134
# Skip empty elements for value
146135
while sp and not sp[0]:
147-
print("[DEBUG] Skipping empty element for value")
148136
sp.pop(0)
149137
if not sp:
150-
print(f"[DEBUG] Protocol {proto.name} requires address but none left")
151138
raise exceptions.StringParseError(
152139
"Protocol requires address",
153140
string,
154141
proto.name
155142
)
156143
next_elem = sp[0]
157-
print(f"[DEBUG] Next element for value: '{next_elem}'")
158144
# First try to validate as value for current protocol
159145
try:
160146
codec.to_bytes(proto, next_elem)
161147
value = sp.pop(0)
162-
print(f"[DEBUG] Using value '{value}' for protocol {proto.name}")
163148
except Exception as exc:
164149
# If value validation fails, check if it's a protocol name
165150
if next_elem.isalnum():
@@ -169,9 +154,6 @@ def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[st
169154
# If we have a protocol that requires a value and we're seeing
170155
# another protocol,
171156
# raise a StringParseError
172-
print(
173-
f"[DEBUG] Next element '{next_elem}' is a protocol name. Error!"
174-
)
175157
raise exceptions.StringParseError(
176158
f"Protocol {proto.name} requires a value",
177159
string,
@@ -180,7 +162,6 @@ def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[st
180162
)
181163
except exceptions.ProtocolNotFoundError:
182164
# If it's not a protocol name, raise the original value validation error
183-
print(f"[DEBUG] Invalid value '{next_elem}' for protocol {proto.name}")
184165
raise exceptions.StringParseError(
185166
f"Invalid value for protocol {proto.name}",
186167
string,
@@ -189,7 +170,6 @@ def string_iter(string: str) -> Generator[Tuple[Protocol, CodecBase, Optional[st
189170
) from exc
190171
else:
191172
# If it's not alphanumeric, raise the original value validation error
192-
print(f"[DEBUG] Invalid value '{next_elem}' for protocol {proto.name}")
193173
raise exceptions.StringParseError(
194174
f"Invalid value for protocol {proto.name}",
195175
string,

0 commit comments

Comments
 (0)