okta-expression-parser 0.2.0__tar.gz → 0.2.1__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.1
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))
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "okta-expression-parser"
3
- version = "0.2.0"
3
+ version = "0.2.1"
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"