OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # Copyright 2013 Google Inc. All Rights Reserved. | 2 # Copyright 2013 Google Inc. All Rights Reserved. |
3 # | 3 # |
4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
7 # | 7 # |
8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # | 9 # |
10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 @property | 99 @property |
100 def url_string(self): | 100 def url_string(self): |
101 raise NotImplementedError('url_string not overridden') | 101 raise NotImplementedError('url_string not overridden') |
102 | 102 |
103 @property | 103 @property |
104 def versionless_url_string(self): | 104 def versionless_url_string(self): |
105 raise NotImplementedError('versionless_url_string not overridden') | 105 raise NotImplementedError('versionless_url_string not overridden') |
106 | 106 |
107 def __eq__(self, other): | 107 def __eq__(self, other): |
108 return self.url_string == other.url_string | 108 return isinstance(other, StorageUrl) and self.url_string == other.url_string |
109 | 109 |
110 def __hash__(self): | 110 def __hash__(self): |
111 return hash(self.url_string) | 111 return hash(self.url_string) |
112 | 112 |
113 | 113 |
114 class _FileUrl(StorageUrl): | 114 class _FileUrl(StorageUrl): |
115 """File URL class providing parsing and convenience methods. | 115 """File URL class providing parsing and convenience methods. |
116 | 116 |
117 This class assists with usage and manipulation of an | 117 This class assists with usage and manipulation of an |
118 (optionally wildcarded) file URL string. Depending on the string | 118 (optionally wildcarded) file URL string. Depending on the string |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 def ContainsWildcard(url_string): | 315 def ContainsWildcard(url_string): |
316 """Checks whether url_string contains a wildcard. | 316 """Checks whether url_string contains a wildcard. |
317 | 317 |
318 Args: | 318 Args: |
319 url_string: URL string to check. | 319 url_string: URL string to check. |
320 | 320 |
321 Returns: | 321 Returns: |
322 bool indicator. | 322 bool indicator. |
323 """ | 323 """ |
324 return bool(WILDCARD_REGEX.search(url_string)) | 324 return bool(WILDCARD_REGEX.search(url_string)) |
OLD | NEW |