-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from MetalHurlant/improve_cisco_ip_helper
Cisco IP helper improvement
- Loading branch information
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def valid_ip_v4(address): | ||
parts = address.split(".") | ||
for item in parts: | ||
if not item.isdigit() or not 0 <= int(item) <= 255: | ||
raise InvalidIpError | ||
if len(parts) != 4: | ||
raise IncompleteIpError | ||
return True | ||
|
||
|
||
class InvalidIpError(Exception): | ||
pass | ||
|
||
|
||
class IncompleteIpError(Exception): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters