Skip to content

Commit

Permalink
Better method docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KimiNewt committed Mar 22, 2017
1 parent 04c15da commit 0a6162f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/pyshark/packet/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,27 @@ def showname_key(self):
@property
def binary_value(self):
"""
Returns the raw value of this field (as a binary string)
Converts this field to binary (assuming it's a binary string)
"""
return binascii.unhexlify(self.raw_value)

@property
def int_value(self):
"""
Returns the raw value of this field (as an integer).
Returns the int value of this field (assuming it's an integer integer).
"""
return int(self.raw_value)

@property
def hex_value(self):
"""
Returns the raw value of this field (as an integer in base 16).
Returns the int value of this field if it's in base 16 (either as a normal number or in
a "0xFFFF"-style hex value)
"""
return int(self.raw_value, 16)

base16_value = hex_value


class LayerFieldsContainer(str, Pickleable):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/pyshark/packet/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __getattr__(self, item):
for layer in self.layers:
if layer.layer_name == item:
return layer
raise AttributeError()
raise AttributeError("No attribute named %s" % item)

@property
def highest_layer(self):
Expand Down
2 changes: 1 addition & 1 deletion src/pyshark/tshark/tshark_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def duplicate_object_hook(ordered_pairs):
"""Warn on duplicate keys."""
"""Make lists out of duplicate keys."""
json_dict = {}
for key, val in ordered_pairs:
existing_val = json_dict.get(key)
Expand Down
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="pyshark",
version="0.3.7.1",
version="0.3.7.2",
packages=find_packages(),
package_data={'': ['*.ini', '*.pcapng']},
# Temporarily using trollis 1.0.4 until issue https://github.com/haypo/trollius/issues/4 is resolved.
Expand Down

0 comments on commit 0a6162f

Please sign in to comment.