Skip to content

Commit eabec3c

Browse files
committed
Fix linter errors
1 parent 1f51d42 commit eabec3c

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

examples/noise/noise_examples.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
2. **Protocol Validation**: Testing valid (/noise) and invalid (/noise/value)
1616
addresses.
1717
3. **Binary Encoding/Decoding**: Working with binary representations.
18-
4. **Multiaddr Integration**: Using 'noise' in a realistic multiaddr string
18+
4. **Multiaddr Integration**: Using 'noise' in a realistic multiaddr string
1919
(e.g., /ip4/127.0.0.1/tcp/12345/noise).
2020
5. **Error Handling**: Demonstrating errors when a value is incorrectly
2121
provided.
@@ -29,7 +29,7 @@
2929
==================================================
3030
=== Basic Noise Usage ===
3131
Original Noise: /noise
32-
Protocols: ['noise']
32+
Protocols: ['noise']
3333
Binary length: 2 bytes
3434
Valid Noise address: True
3535
@@ -38,22 +38,22 @@
3838
Valid: True
3939
Protocols: ['noise']
4040
41-
Testing invalid Noise (with value): /noise/somevalue
42-
Valid: False
41+
Testing invalid Noise (with value): /noise/somevalue
42+
Valid: False
4343
Error: Protocol 'noise' does not take an argument
4444
4545
=== Binary Encoding/Decoding ===
46-
Noise binary operations:
47-
Original: /noise
48-
Binary: 2 bytes
46+
Noise binary operations:
47+
Original: /noise
48+
Binary: 2 bytes
4949
Round-trip: /noise Match: True
5050
5151
=== Multiaddr Integration ===
5252
Complex multiaddr with Noise:
53-
Address: /ip4/127.0.0.1/tcp/12345/noise/p2p/Qm...
54-
Protocols: ['ip4', 'tcp', 'noise', 'p2p']
53+
Address: /ip4/127.0.0.1/tcp/12345/noise/p2p/Qm...
54+
Protocols: ['ip4', 'tcp', 'noise', 'p2p']
5555
Has 'noise' protocol: True
56-
56+
5757
==================================================
5858
All examples completed!
5959
```
@@ -83,6 +83,7 @@
8383

8484
NOISE_ADDR = "/noise"
8585

86+
8687
def basic_noise_usage():
8788
"""
8889
Basic Noise usage example.
@@ -92,9 +93,9 @@ def basic_noise_usage():
9293
- Extracting protocol information
9394
- Getting binary representation
9495
"""
95-
96-
print(f'Original Noise: {NOISE_ADDR}')
97-
96+
97+
print(f"Original Noise: {NOISE_ADDR}")
98+
9899
try:
99100
ma = Multiaddr(NOISE_ADDR)
100101
print(f"Protocols: {[p.name for p in ma.protocols()]}")
@@ -109,7 +110,8 @@ def basic_noise_usage():
109110
print(f"Error: {e}")
110111
print("Valid Noise address: False")
111112

112-
def protocol_validation():
113+
114+
def protocol_validation():
113115
"""
114116
Demonstrate protocol validation.
115117
@@ -140,7 +142,8 @@ def protocol_validation():
140142
print(" Valid: False")
141143
print(f" Error: {e}")
142144

143-
def binary_encoding_decoding():
145+
146+
def binary_encoding_decoding():
144147
"""
145148
Demonstrate binary encoding and decoding.
146149
@@ -166,9 +169,10 @@ def binary_encoding_decoding():
166169

167170
except Exception as e:
168171
print(f" Error: {e}")
169-
170-
def multiaddr_integration():
171-
"""
172+
173+
174+
def multiaddr_integration():
175+
"""
172176
Demonstrate Noise protocol integration with other protocols.
173177
174178
This function shows:
@@ -191,12 +195,13 @@ def multiaddr_integration():
191195
print(f" Protocols: {protocols}")
192196

193197
# Check for 'noise' protocol
194-
has_noise = 'noise' in protocols
198+
has_noise = "noise" in protocols
195199
print(f" Has 'noise' protocol: {has_noise}")
196200

197201
except Exception as e:
198202
print(f" Error: {e}")
199-
203+
204+
200205
def main():
201206
"""
202207
Run all Noise protocol examples.
@@ -231,6 +236,7 @@ def main():
231236
print("\nExamples interrupted by user")
232237
except Exception as e:
233238
print(f"\nUnexpected error: {e}")
234-
239+
240+
235241
if __name__ == "__main__":
236242
main()

0 commit comments

Comments
 (0)