2828)
2929
3030
31- def is_ip (val : celtypes .Value , ver : typing .Optional [celtypes .Value ] = None ) -> celpy .Result :
31+ def cel_is_ip (val : celtypes .Value , ver : typing .Optional [celtypes .Value ] = None ) -> celpy .Result :
3232 """Return True if the string is an IPv4 or IPv6 address, optionally limited to a specific version.
3333
3434 Version 0 or None means either 4 or 6. Passing a version other than 0, 4, or 6 always returns False.
@@ -68,7 +68,7 @@ def _is_ip(string: str, version: int) -> bool:
6868 return valid
6969
7070
71- def is_ip_prefix (val : celtypes .Value , * args ) -> celpy .Result :
71+ def cel_is_ip_prefix (val : celtypes .Value , * args ) -> celpy .Result :
7272 """Return True if the string is a valid IP with prefix length, optionally
7373 limited to a specific version (v4 or v6), and optionally requiring the host
7474 portion to be all zeros.
@@ -125,7 +125,7 @@ def _is_ip_prefix(string: str, version: int, *, strict=False) -> bool:
125125 return valid
126126
127127
128- def is_email (string : celtypes .Value ) -> celpy .Result :
128+ def cel_is_email (string : celtypes .Value ) -> celpy .Result :
129129 """Return True if the string is an email address, for example "foo@example.com".
130130
131131 Conforms to the definition for a valid email address from the HTML standard.
@@ -141,7 +141,7 @@ def is_email(string: celtypes.Value) -> celpy.Result:
141141 return celtypes .BoolType (m )
142142
143143
144- def is_uri (string : celtypes .Value ) -> celpy .Result :
144+ def cel_is_uri (string : celtypes .Value ) -> celpy .Result :
145145 """Return True if the string is a URI, for example "https://example.com/foo/bar?baz=quux#frag".
146146
147147 URI is defined in the internet standard RFC 3986.
@@ -155,7 +155,7 @@ def is_uri(string: celtypes.Value) -> celpy.Result:
155155 return celtypes .BoolType (valid )
156156
157157
158- def is_uri_ref (string : celtypes .Value ) -> celpy .Result :
158+ def cel_is_uri_ref (string : celtypes .Value ) -> celpy .Result :
159159 """Return True if the string is a URI Reference - a URI such as "https://example.com/foo/bar?baz=quux#frag" or
160160 a Relative Reference such as "./foo/bar?query".
161161
@@ -170,7 +170,7 @@ def is_uri_ref(string: celtypes.Value) -> celpy.Result:
170170 return celtypes .BoolType (valid )
171171
172172
173- def is_hostname (val : celtypes .Value ) -> celpy .Result :
173+ def cel_is_hostname (val : celtypes .Value ) -> celpy .Result :
174174 """Returns True if the string is a valid hostname, for example "foo.example.com".
175175
176176 A valid hostname follows the rules below:
@@ -238,7 +238,7 @@ def _is_port(val: str) -> bool:
238238 return False
239239
240240
241- def is_host_and_port (string : celtypes .Value , port_required : celtypes .Value ) -> celpy .Result :
241+ def cel_is_host_and_port (string : celtypes .Value , port_required : celtypes .Value ) -> celpy .Result :
242242 """Return True if the string is a valid host/port pair, for example "example.com:8080".
243243
244244 If the argument `port_required` is True, the port is required. If the argument
@@ -287,14 +287,14 @@ def _is_host_and_port(val: str, *, port_required=False) -> bool:
287287 return (_is_hostname (host ) or _is_ip (host , 4 )) and _is_port (port )
288288
289289
290- def is_nan (val : celtypes .Value ) -> celpy .Result :
290+ def cel_is_nan (val : celtypes .Value ) -> celpy .Result :
291291 if not isinstance (val , celtypes .DoubleType ):
292292 msg = "invalid argument, expected double"
293293 raise celpy .CELEvalError (msg )
294294 return celtypes .BoolType (math .isnan (val ))
295295
296296
297- def is_inf (val : celtypes .Value , sign : typing .Optional [celtypes .Value ] = None ) -> celpy .Result :
297+ def cel_is_inf (val : celtypes .Value , sign : typing .Optional [celtypes .Value ] = None ) -> celpy .Result :
298298 if not isinstance (val , celtypes .DoubleType ):
299299 msg = "invalid argument, expected double"
300300 raise celpy .CELEvalError (msg )
@@ -312,7 +312,7 @@ def is_inf(val: celtypes.Value, sign: typing.Optional[celtypes.Value] = None) ->
312312 return celtypes .BoolType (math .isinf (val ))
313313
314314
315- def unique (val : celtypes .Value ) -> celpy .Result :
315+ def cel_unique (val : celtypes .Value ) -> celpy .Result :
316316 if not isinstance (val , celtypes .ListType ):
317317 msg = "invalid argument, expected list"
318318 raise celpy .CELEvalError (msg )
@@ -767,8 +767,6 @@ def __h16(self) -> bool:
767767 # Error converting to number
768768 return False
769769
770- return True
771-
772770 def __hex_dig (self ) -> bool :
773771 """Report whether the current position is a hex digit.
774772
@@ -1579,16 +1577,16 @@ def make_extra_funcs(locale: str) -> dict[str, celpy.CELFunction]:
15791577 # Missing standard functions
15801578 "format" : string_fmt .format ,
15811579 # protovalidate specific functions
1582- "isNan" : is_nan ,
1583- "isInf" : is_inf ,
1584- "isIp" : is_ip ,
1585- "isIpPrefix" : is_ip_prefix ,
1586- "isEmail" : is_email ,
1587- "isUri" : is_uri ,
1588- "isUriRef" : is_uri_ref ,
1589- "isHostname" : is_hostname ,
1590- "isHostAndPort" : is_host_and_port ,
1591- "unique" : unique ,
1580+ "isNan" : cel_is_nan ,
1581+ "isInf" : cel_is_inf ,
1582+ "isIp" : cel_is_ip ,
1583+ "isIpPrefix" : cel_is_ip_prefix ,
1584+ "isEmail" : cel_is_email ,
1585+ "isUri" : cel_is_uri ,
1586+ "isUriRef" : cel_is_uri_ref ,
1587+ "isHostname" : cel_is_hostname ,
1588+ "isHostAndPort" : cel_is_host_and_port ,
1589+ "unique" : cel_unique ,
15921590 }
15931591
15941592
0 commit comments