mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
initial working x509 cert parser
This commit is contained in:
18
jc/utils.py
18
jc/utils.py
@ -140,21 +140,27 @@ def compatibility(mod_name: str, compatible: List, quiet: bool = False) -> None:
|
||||
])
|
||||
|
||||
|
||||
def has_data(data: str) -> bool:
|
||||
def has_data(data: Union[str, bytes]) -> bool:
|
||||
"""
|
||||
Checks if the input contains data. If there are any non-whitespace
|
||||
characters then return `True`, else return `False`.
|
||||
Checks if the string input contains data. If there are any
|
||||
non-whitespace characters then return `True`, else return `False`.
|
||||
|
||||
For bytes, returns True if there is any data.
|
||||
|
||||
Parameters:
|
||||
|
||||
data: (string) input to check whether it contains data
|
||||
data: (string, bytes) input to check whether it contains data
|
||||
|
||||
Returns:
|
||||
|
||||
Boolean True if input string (data) contains non-whitespace
|
||||
characters, otherwise False
|
||||
characters, otherwise False. For bytes data, returns
|
||||
True if there is any data, otherwise False.
|
||||
"""
|
||||
return bool(data and not data.isspace())
|
||||
if isinstance(data, str):
|
||||
return bool(data and not data.isspace())
|
||||
|
||||
return bool(data)
|
||||
|
||||
|
||||
def convert_to_int(value: Union[str, float]) -> Optional[int]:
|
||||
|
Reference in New Issue
Block a user