Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: appengine/components/components/auth/ipaddr.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Fixed third parties Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Utilities for working with IPv4 and IPv6 addresses.""" 5 """Utilities for working with IPv4 and IPv6 addresses."""
6 6
7 import collections 7 import collections
8 8
9 9
10 # Part of public API of 'auth' component, exposed by this module. 10 # Part of public API of 'auth' component, exposed by this module.
11 __all__ = [ 11 __all__ = [
12 'IP', 12 'IP',
13 'ip_from_string', 13 'ip_from_string',
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 It will also zero non significant bits of an IP address used as a subnet base. 158 It will also zero non significant bits of an IP address used as a subnet base.
159 159
160 Raises ValueError if subnet_str is not a valid subnet. 160 Raises ValueError if subnet_str is not a valid subnet.
161 """ 161 """
162 return subnet_to_string(subnet_from_string(subnet_str)) 162 return subnet_to_string(subnet_from_string(subnet_str))
163 163
164 164
165 def is_in_subnet(ip, subnet): 165 def is_in_subnet(ip, subnet):
166 """True if given IP instance belongs to Subnet.""" 166 """True if given IP instance belongs to Subnet."""
167 return ip.bits == subnet.bits and (ip.value & subnet.mask) == subnet.base 167 return ip.bits == subnet.bits and (ip.value & subnet.mask) == subnet.base
OLDNEW
« no previous file with comments | « appengine/components/components/auth/handler_test.py ('k') | appengine/components/components/auth/ipaddr_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698