okta-expression-parser 0.2.0__tar.gz → 0.2.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: okta-expression-parser
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Returns a boolean by passing Okta profile data to an Okta Expression using Okta Expression Language
5
5
  Author: Mathew Moon
6
6
  Author-email: me@mathewmoon.net
@@ -87,12 +87,18 @@ class String:
87
87
  return default
88
88
 
89
89
  @classmethod
90
- def substring(val: str, start: int, end: int):
90
+ def substring(self, val: str, start: int, end: int):
91
91
  """Return a substring of val starting at index start"""
92
+ if not isinstance(val, str):
93
+ return ""
94
+
95
+ if end > len(val):
96
+ end = -1
97
+
92
98
  return val[int(start) : int(end)]
93
99
 
94
100
  @classmethod
95
- def substringAfter(val: str, search: str):
101
+ def substringAfter(self, val: str, search: str):
96
102
  try:
97
103
  start = str(val).index(str(search))
98
104
  except ValueError:
@@ -101,7 +107,7 @@ class String:
101
107
  return val[start:]
102
108
 
103
109
  @classmethod
104
- def substringBefore(val: str, search: str):
110
+ def substringBefore(self, val: str, search: str):
105
111
  """Return substring of val starting after the index of search string"""
106
112
  try:
107
113
  end = str(val).index(str(search))
@@ -292,7 +292,8 @@ class ExpressionParser(sly.Parser):
292
292
  return False
293
293
 
294
294
  val = p.operand
295
- if not isinstance(val, list):
295
+
296
+ if not isinstance(val, tuple):
296
297
  val = [val]
297
298
 
298
299
  res = list(set(self.__group_ids) & set(val))
@@ -306,7 +307,6 @@ class ExpressionParser(sly.Parser):
306
307
  if not self.__group_ids:
307
308
  return False
308
309
 
309
- # return p.operand.lower() in self.__group_ids
310
310
  return p.operand in self.__group_ids
311
311
 
312
312
  @_("condition error") # noqa: 821
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "okta-expression-parser"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  description = "Returns a boolean by passing Okta profile data to an Okta Expression using Okta Expression Language"
5
5
  authors = ["Mathew Moon <me@mathewmoon.net>"]
6
6
  readme = "README.md"