Skip to content

Commit

Permalink
Trimming of extra quotation marks
Browse files Browse the repository at this point in the history
  • Loading branch information
impratikjaiswal committed Jun 25, 2024
1 parent 010fa9a commit 203701f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion asn1_play/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

from incremental import Version

__version__ = Version("asn1_play", 8, 2, 0)
__version__ = Version("asn1_play", 8, 2, 1)
__all__ = ["__version__"]
9 changes: 9 additions & 0 deletions asn1_play/main/convert/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ def prepare_config_data(data):
return file_dic


def clear_quotation_marks(v):
if isinstance(v, str):
if (v.startswith('"') and v.endswith('"')) or (v.startswith("'") and v.endswith("'")) or (
v.startswith('"""') and v.endswith('"""')):
v = v[1:-1]
return v


def parse_config(config_data):
asn1_schema = None
asn1_object = None
Expand All @@ -184,6 +192,7 @@ def parse_config(config_data):
if v:
# Trim Garbage data
v = PhUtil.trim_white_spaces_in_str(v)
v = clear_quotation_marks(v)
if v in ['None']:
v = None
config_data[k] = v
Expand Down
10 changes: 9 additions & 1 deletion asn1_play/main/data_type/unit_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,21 @@ def set_data_pool(self):
'asn1_element': SGP_22.RSPDefinitions.StoreMetadataRequest
},
{
PhKeys.REMARKS: 'Web Request; asn1_object;',
PhKeys.REMARKS: 'Web Request; asn1_schema; asn1_object;',
'input_data': 'BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640',
'input_format': Formats.DER,
'output_format': Formats.ASN1,
'asn1_schema': 'GSMA_SGP_22_v3_0_0',
'asn1_object': 'StoreMetadataRequest',
},
{
PhKeys.REMARKS: 'Web Request; asn1_schema; asn1_object; Extra Quotation',
'input_data': '"BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640"',
'input_format': Formats.DER,
'output_format': Formats.ASN1,
'asn1_schema': 'GSMA_SGP_22_v3_0_0',
'asn1_object': 'StoreMetadataRequest',
},
{
PhKeys.REMARKS: 'Web Request; asn1_object_alternate;',
'input_data': 'BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640',
Expand Down
24 changes: 18 additions & 6 deletions asn1_play/test/log/pycharm_SGP22_v3_0_0-epp_v3_2.log
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ User Name is Pratik Jaiswal
--------------------------------------------------------------------------------
User Account is impra
--------------------------------------------------------------------------------
Time Stamp is Tuesday, Jun 25 2024, 11:02:49:450885, IST (GMT+0530)
Time Stamp is Tuesday, Jun 25 2024, 12:03:05:897787, IST (GMT+0530)
--------------------------------------------------------------------------------
Git Summary is b78c697; (HEAD -> main, tag: v8.1.0, origin/main, origin/HEAD); 2024-06-24 10:17:05 +0530; imPratik <impratikjaiswal@gmail.com>; support of SGP 32 v1.1
Git Summary is 010fa9a; (HEAD -> main); 2024-06-25 11:10:45 +0530; imPratik <impratikjaiswal@gmail.com>; logs updated with SGP32 1.1 support
--------------------------------------------------------------------------------
pythonHelpers version is v3.1.3
--------------------------------------------------------------------------------
Expand Down Expand Up @@ -7879,9 +7879,21 @@ Output Data:
profilePolicyRules '01'B -- ppr1 --
}
--------------------------------------------------------------------------------
*********************************************** Web Request; asn1_object ***********************************************
Remarks: Web Request; asn1_object
Info => Transaction Id: s4qk8mlc6dl6; Mode: Encoding_Mode; Asn1 Element: StoreMetadataRequest; Input Format: der; Output Format: asn1
***************************************** Web Request; asn1_schema; asn1_object ****************************************
Remarks: Web Request; asn1_schema; asn1_object
Info => Transaction Id: brif0xt8vgbq; Mode: Encoding_Mode; Asn1 Element: StoreMetadataRequest; Input Format: der; Output Format: asn1
Input Data: BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640
Output Data:
{
iccid '989209012143658709F5'H,
serviceProviderName "SP Name 1",
profileName "Operational Profile Name 1",
profilePolicyRules '01'B -- ppr1 --
}
--------------------------------------------------------------------------------
******************************** Web Request; asn1_schema; asn1_object; Extra Quotation ********************************
Remarks: Web Request; asn1_schema; asn1_object; Extra Quotation
Info => Transaction Id: fipwsge273t4; Mode: Encoding_Mode; Asn1 Element: StoreMetadataRequest; Input Format: der; Output Format: asn1
Input Data: BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640
Output Data:
{
Expand All @@ -7893,7 +7905,7 @@ Output Data:
--------------------------------------------------------------------------------
****************************************** Web Request; asn1_object_alternate ******************************************
Remarks: Web Request; asn1_object_alternate
Info => Transaction Id: 9kpps06y1ii6; Mode: Encoding_Mode; Input Format: der; Output Format: asn1
Info => Transaction Id: 3bx7nl89khq2; Mode: Encoding_Mode; Input Format: der; Output Format: asn1
Input Data: BF25375A0A989209012143658709F591095350204E616D652031921A4F7065726174696F6E616C2050726F66696C65204E616D65203199020640
Output Data:
{
Expand Down

0 comments on commit 203701f

Please sign in to comment.