pyxecm 1.3.0__py3-none-any.whl → 1.5__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.

@@ -12,7 +12,7 @@ translateV3: Translate a string from one language to another using the Google Tr
12
12
  """
13
13
 
14
14
  __author__ = "Dr. Marc Diefenbruch"
15
- __copyright__ = "Copyright 2023, OpenText"
15
+ __copyright__ = "Copyright 2024, OpenText"
16
16
  __credits__ = ["Kai-Philip Gatzweiler"]
17
17
  __maintainer__ = "Dr. Marc Diefenbruch"
18
18
  __email__ = "mdiefenb@opentext.com"
@@ -25,7 +25,7 @@ logger = logging.getLogger("pyxecm.customizer.translate")
25
25
 
26
26
  class Translator:
27
27
  """Class for translation of of strings based on the Google Translate API.
28
- The class supports V2 and V3 translation APIs
28
+ The class supports V2 and V3 translation APIs
29
29
  """
30
30
 
31
31
  _config = None
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
@@ -12,7 +12,7 @@ dictToString: converting an Assoc dict to an Assoc string
12
12
  """
13
13
 
14
14
  __author__ = "Dr. Marc Diefenbruch"
15
- __copyright__ = "Copyright 2023, OpenText"
15
+ __copyright__ = "Copyright 2024, OpenText"
16
16
  __credits__ = ["Kai-Philip Gatzweiler"]
17
17
  __maintainer__ = "Dr. Marc Diefenbruch"
18
18
  __email__ = "mdiefenb@opentext.com"
@@ -22,8 +22,7 @@ import html
22
22
 
23
23
 
24
24
  class Assoc:
25
- """Class to handle Extended ECM Assoc data structures.
26
- """
25
+ """Class to handle Extended ECM Assoc data structures."""
27
26
 
28
27
  @classmethod
29
28
  def is_unicode_escaped(cls, assoc_string: str) -> bool:
@@ -41,7 +40,6 @@ class Assoc:
41
40
 
42
41
  return len(matches) > 0
43
42
 
44
-
45
43
  @classmethod
46
44
  def escape_unicode(cls, assoc_string: str) -> str:
47
45
  """Escape / Encode a given string in Unicode
@@ -53,11 +51,10 @@ class Assoc:
53
51
  str: Escaped string
54
52
  """
55
53
 
56
- encoded_string = assoc_string.encode('unicode_escape') # .decode()
54
+ encoded_string = assoc_string.encode("unicode_escape") # .decode()
57
55
 
58
56
  return encoded_string
59
57
 
60
-
61
58
  @classmethod
62
59
  def unescape_unicode(cls, assoc_string: str) -> str:
63
60
  """Unescape / Decode a given string
@@ -168,7 +165,19 @@ class Assoc:
168
165
  @classmethod
169
166
  def extract_substring(
170
167
  cls, input_string: str, start_sequence: str, stop_sequence: str
171
- ):
168
+ ) -> str | None:
169
+ """A generic method to extract a substring that is delimited
170
+ by a strart and stop sequence.
171
+
172
+ Args:
173
+ input_string (str): Input string to search the delimited substring in.
174
+ start_sequence (str): Start esequence of characters.
175
+ stop_sequence (str): Stopß sequence of characters
176
+
177
+ Returns:
178
+ str | None: the deliminated substring or None if not found.
179
+ """
180
+
172
181
  start_index = input_string.find(start_sequence)
173
182
  if start_index == -1:
174
183
  return None
@@ -182,6 +191,17 @@ class Assoc:
182
191
 
183
192
  @classmethod
184
193
  def extract_assoc_string(cls, input_string: str, is_escaped: bool = False) -> str:
194
+ """Extract an Assoc from a string. The assoc is deliminated by A< ... >.
195
+
196
+ Args:
197
+ input_string (str): Input string that includes the Assoc as a substring.
198
+ is_escaped (bool, optional): Whether or not the input string includes the
199
+ assoc escaped or not.
200
+
201
+ Returns:
202
+ str: the assoc string
203
+ """
204
+
185
205
  if is_escaped:
186
206
  assoc_string = cls.extract_substring(input_string, "A&lt;", "&gt;")
187
207
  else: