-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the datatypes_utils.py to the autosarfactory implementation cor…
…responding to each of the releases
- Loading branch information
Girish Chandran
committed
Nov 29, 2023
1 parent
11f4bd6
commit f868234
Showing
11 changed files
with
407 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def get_int_value(text): | ||
text = text.strip() | ||
if len(text) > 1 and text[:1] == '0': | ||
second_char = text[1:2] | ||
if second_char == 'x' or second_char == 'X': | ||
# hexa-decimal value | ||
return int(text[2:], 16) | ||
elif second_char == 'b' or second_char == 'B': | ||
# binary value | ||
return int(text[2:], 2) | ||
else: | ||
try: | ||
# octal value | ||
return int(text[2:], 8) | ||
except: | ||
# return as decimal value if the oct conversion doesn't work in the try | ||
return int(text) | ||
else: | ||
# decimal value | ||
return int(text) | ||
|
||
|
||
def get_float_value(text): | ||
text = text.strip() | ||
return float(text) | ||
|
||
|
||
def get_bool_value(text): | ||
text = text.strip() | ||
if text == '1' or text.lower() == 'true': | ||
return True | ||
else: | ||
return False | ||
|
||
|
||
def get_string_value(text): | ||
return text.strip() |
Oops, something went wrong.