Skip to content

Conversation

@R2RITO
Copy link

@R2RITO R2RITO commented Dec 20, 2017

Added support for byte encoding on python3 in the getNetworkISO method since it is not automatically converted from bytes to ascii or unicode strings.

Added function to raise an InvalidValueType exception, used to avoid repeating code.
Added verification on type for the bit setting methods, on iso creation and on usage of setBit method. Bit type verification only for types A, N, ANS.

Arturo Voltattorni Castaño added 2 commits December 20, 2017 09:50
…it types A, N, and ANS, ValueTypeError raised when trying to set a value that is not a valid type
@ducminhgd
Copy link
Owner

@dat07cs, I do not maintain this repository anymore, please help me to verify if this update from @R2RITO resolves issues that he or she mentioned or not.

Thank you both!

@R2RITO
Copy link
Author

R2RITO commented Dec 21, 2017 via email

raise ValueToLarge('Error: value up to size! Bit[%s] of type %s limit size = %s' % (
bit, self.getBitType(bit), self.getBitLimit(bit)))

if not value.isalpha():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit Type A can have alpha, including blank, characters

raise ValueToLarge('Error: value up to size! Bit[%s] of type %s limit size = %s' % (
bit, self.getBitType(bit), self.getBitLimit(bit)))

if not value.isalnum():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit Type ANS can have alphanumeric and special characters

if bitType == 'N' and not value.isdecimal():
self.__raiseValueTypeError(cont)

if bitType == 'A' and not value.isalpha():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said, bit type A can have blank character

bit, self.getBitType(bit), self.getBitLimit(bit)))

if not value.isdecimal():
__raiseValueTypeError(bit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot self

Copy link
Collaborator

@dat07cs dat07cs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. miss reference to "self" object
  2. bit type A can have blank character
  3. bit type ANS can have special characters

…idity, added function to set bits of type AN
Copy link
Author

@R2RITO R2RITO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected the errors, added a new function and restructured some of the code. Please review.

Thanks

@ducminhgd ducminhgd merged commit 8eb2a95 into ducminhgd:master Dec 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants