utils¶
gramfuzz will work with most native Python types, as well
as any gramfuzz.fields.Field type.
gramfuzz uses the gramfuzz.utils.val function to convert
values into data.
For native Python types, str() is used to convert the
object into a string.
For gramfuzz.fields.Field classes, a new instance is created,
and then build() is called on the created instance.
For gramfuzz.fields.Field instances, build() is simply
called on the instance.
utils Reference Documentation¶
Gramfuzz utility functions
-
gramfuzz.utils.maybe_binstr(val)[source]¶ Maybe convert
valto a binary string IF the value is a string type
-
gramfuzz.utils.val(val, pre=None, shortest=False)[source]¶ Build the provided value, while properly handling native Python types,
gramfuzz.fields.Fieldinstances, andgramfuzz.fields.Fieldsubclasses.- Parameters
pre (list) – The prerequisites list
- Returns
str