<jupyter_start><jupyter_text>Bipolar field<jupyter_code>from konfoo import Index, Byteorder, Bipolar, Bipolar2, Bipolar4<jupyter_output><empty_output><jupyter_text>Item Item type of the `field` class.<jupyter_code>Bipolar.item_type<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `bit` field.<jupyter_code>Bipolar.is_bit()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `boolean` field.<jupyter_code>Bipolar.is_bool()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `decimal` number field.<jupyter_code>Bipolar.is_decimal()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `floating point` number field.<jupyter_code>Bipolar.is_float()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `pointer` field.<jupyter_code>Bipolar.is_pointer()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `stream` field.<jupyter_code>Bipolar.is_stream()<jupyter_output><empty_output><jupyter_text>Checks if the `field` class is a `string` field.<jupyter_code>Bipolar.is_string()<jupyter_output><empty_output><jupyter_text>Field<jupyter_code>bipolar = Bipolar(bits_integer=2, bit_size=16, align_to=None, byte_order='auto')
bipolar = Bipolar(2, 16)<jupyter_output><empty_output><jupyter_text>Field view<jupyter_code>bipolar
str(bipolar)
repr(bipolar)<jupyter_output><empty_output><jupyter_text>Field name<jupyter_code>bipolar.name<jupyter_output><empty_output><jupyter_text>Field index<jupyter_code>bipolar.index<jupyter_output><empty_output><jupyter_text>Byte `index` of the `field` within the `byte stream`.<jupyter_code>bipolar.index.byte<jupyter_output><empty_output><jupyter_text>Bit offset relative to the byte `index` of the `field` within the `byte stream`.<jupyter_code>bipolar.index.bit<jupyter_output><empty_output><jupyter_text>Absolute address of the `field` within the `data source`.<jupyter_code>bipolar.index.address<jupyter_output><empty_output><jupyter_text>Base address of the `byte stream` within the `data source`.<jupyter_code>bipolar.index.base_address<jupyter_output><empty_output><jupyter_text>Indexes the `field` and returns the `index` after the `field`.<jupyter_code>bipolar.index_field(index=Index())<jupyter_output><empty_output><jupyter_text>Field alignment<jupyter_code>bipolar.alignment<jupyter_output><empty_output><jupyter_text>Byte size of the `field group` which the `field` is *aligned* to.<jupyter_code>bipolar.alignment.byte_size<jupyter_output><empty_output><jupyter_text>Bit offset of the `field` within its *aligned* `field group`.<jupyter_code>bipolar.alignment.bit_offset<jupyter_output><empty_output><jupyter_text>Field size<jupyter_code>bipolar.bit_size<jupyter_output><empty_output><jupyter_text>Field byte order<jupyter_code>bipolar.byte_order
bipolar.byte_order.value
bipolar.byte_order.name
bipolar.byte_order = 'auto'
bipolar.byte_order = Byteorder.auto<jupyter_output><empty_output><jupyter_text>Field value Checks if the decimal `field` is signed or unsigned.<jupyter_code>bipolar.signed<jupyter_output><empty_output><jupyter_text>Maximal decimal `field` value.<jupyter_code>bipolar.max()<jupyter_output><empty_output><jupyter_text>Minimal decimal `field` value.<jupyter_code>bipolar.min()<jupyter_output><empty_output><jupyter_text>Returns the bipolar `field` value as a floating point number.<jupyter_code>bipolar.value<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value *aligned* to its `field group` as a number of bytes.<jupyter_code>bytes(bipolar)
bytes(bipolar).hex()<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as an integer number.<jupyter_code>int(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as an floating point number.<jupyter_code>float(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as a lowercase hexadecimal string prefixed with `0x`.<jupyter_code>hex(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as a binary string prefixed with `0b`.<jupyter_code>bin(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as an octal string prefixed with `0o`.<jupyter_code>oct(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as a boolean value.<jupyter_code>bool(bipolar)<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as a signed integer number.<jupyter_code>bipolar.as_signed()<jupyter_output><empty_output><jupyter_text>Returns the decimal `field` value as an unsigned integer number.<jupyter_code>bipolar.as_unsigned()<jupyter_output><empty_output><jupyter_text>Field metadata Returns the ``meatadata`` of the ``field`` as an ordered dictionary.<jupyter_code>bipolar.describe()<jupyter_output><empty_output><jupyter_text>Deserialize<jupyter_code>bipolar.deserialize(bytes.fromhex('0100'), byte_order='little')
bipolar.value
bytes(bipolar)
bytes(bipolar).hex()
int(bipolar)
float(bipolar)
hex(bipolar)
bin(bipolar)
oct(bipolar)
bool(bipolar)<jupyter_output><empty_output><jupyter_text>Serialize<jupyter_code>buffer = bytearray()
bipolar.value = -1
bipolar.value = -1.0
bipolar.value = -0x1
bipolar.value = -0b1
bipolar.value = -0o1
bipolar.value = True
bipolar.value = -1.0
bipolar.serialize(buffer, byte_order='little')
buffer.hex()
bytes(bipolar).hex()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1175932699341624, 'fraction_numerical': 0.004754937820043892, 'mean_word_length': 11.898584905660377, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 157, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '39', 'dir': 'jupyter-structured-clean-dedup', 'id': '510364', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2087, 'n_tokens_neox': 1995, 'n_words': 320, 'path': 'notebooks/fields/Bipolar field.ipynb', 'repo_name': 'JoeVirtual/KonFoo', 'size': '5468'}