pyxecm 1.4__py3-none-any.whl → 1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyxecm might be problematic. Click here for more details.

pyxecm/helper/__init__.py CHANGED
@@ -1,4 +1,6 @@
1
1
  """pyxecm helper classes, not for direct use"""
2
+
2
3
  from .assoc import Assoc
3
4
  from .web import HTTP
4
5
  from .xml import XML
6
+ from .data import Data
pyxecm/helper/assoc.py CHANGED
@@ -73,11 +73,31 @@ class Assoc:
73
73
 
74
74
  @classmethod
75
75
  def is_html_escaped(cls, assoc_string: str) -> bool:
76
+ """Class method to check if an Extended ECM Assoc String
77
+ is HTML escaped.
78
+
79
+ Args:
80
+ assoc_string (str): the string to test for HTML escaping
81
+
82
+ Returns:
83
+ bool: True = string is HTML escaped, False if now
84
+ """
85
+
76
86
  decoded_string = html.unescape(assoc_string)
87
+
77
88
  return assoc_string != decoded_string
78
89
 
79
90
  @classmethod
80
91
  def unescape_html(cls, assoc_string: str) -> str:
92
+ """HTML unescape a a string
93
+
94
+ Args:
95
+ assoc_string (str): the string to unescape.
96
+
97
+ Returns:
98
+ str: unescaped string
99
+ """
100
+
81
101
  decoded_string = html.unescape(assoc_string)
82
102
  return decoded_string
83
103
 
@@ -165,7 +185,19 @@ class Assoc:
165
185
  @classmethod
166
186
  def extract_substring(
167
187
  cls, input_string: str, start_sequence: str, stop_sequence: str
168
- ):
188
+ ) -> str | None:
189
+ """A generic method to extract a substring that is delimited
190
+ by a strart and stop sequence.
191
+
192
+ Args:
193
+ input_string (str): Input string to search the delimited substring in.
194
+ start_sequence (str): Start esequence of characters.
195
+ stop_sequence (str): Stopß sequence of characters
196
+
197
+ Returns:
198
+ str | None: the deliminated substring or None if not found.
199
+ """
200
+
169
201
  start_index = input_string.find(start_sequence)
170
202
  if start_index == -1:
171
203
  return None
@@ -179,6 +211,17 @@ class Assoc:
179
211
 
180
212
  @classmethod
181
213
  def extract_assoc_string(cls, input_string: str, is_escaped: bool = False) -> str:
214
+ """Extract an Assoc from a string. The assoc is deliminated by A< ... >.
215
+
216
+ Args:
217
+ input_string (str): Input string that includes the Assoc as a substring.
218
+ is_escaped (bool, optional): Whether or not the input string includes the
219
+ assoc escaped or not.
220
+
221
+ Returns:
222
+ str: the assoc string
223
+ """
224
+
182
225
  if is_escaped:
183
226
  assoc_string = cls.extract_substring(input_string, "A&lt;", "&gt;")
184
227
  else: