okta-expression-parser 0.4.0__tar.gz → 0.4.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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: okta-expression-parser
3
- Version: 0.4.0
3
+ Version: 0.4.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
@@ -8,6 +8,7 @@ Requires-Python: >=3.11,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
11
12
  Requires-Dist: sly (>=0.5,<0.6)
12
13
  Description-Content-Type: text/markdown
13
14
 
@@ -42,14 +42,14 @@ class ExpressionLexer(Lexer):
42
42
  # String containing ignored characters
43
43
  ignore = " \t"
44
44
 
45
- AND = r"and|And|AND"
45
+ AND = r"and|And|AND|&&"
46
46
  NE = r"(!=|ne|NE|Ne)"
47
47
  NOT = r"!|not|Not|NOT"
48
48
  GTE = ">="
49
49
  GT = ">"
50
50
  LT = "<"
51
51
  LTE = "<="
52
- OR = r"or|OR|Or"
52
+ OR = r"or|OR|Or|\|\|"
53
53
  EQ = r"(==|eq|EQ|Eq)"
54
54
  BOOL = r"(true|false|True|False|TRUE|FALSE)"
55
55
  MEMBEROFGROUPCONTAINS = "isMemberOfGroupNameContains"
@@ -14,6 +14,19 @@ from .expression_classes.arrays import _ArrayType
14
14
  from .lexer import ExpressionLexer
15
15
 
16
16
 
17
+ # Sly doesn't really facilitate configuring logging from the caller, so we're going to
18
+ # suppress all logging below the level specified in the LOG_LEVEL environment variable.
19
+ log_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "EXCEPTION"]
20
+
21
+ log_level = environ.get("LOG_LEVEL", "ERROR")
22
+
23
+ log_rank = log_levels.index(log_level)
24
+
25
+ for level_name in list(reversed(log_levels))[:log_rank +1]:
26
+ log_attr = level_name.lower()
27
+ setattr(sly.yacc.SlyLogger, log_attr, lambda self, msg, *args, **kwargs: None)
28
+
29
+
17
30
  class ExpressionParser(sly.Parser):
18
31
  #: Writes grammar rules to a file for debugging
19
32
  debugfile = environ.get("OKTA_EXPRESSION_PARSER_LOG_FILE")
@@ -34,7 +47,7 @@ class ExpressionParser(sly.Parser):
34
47
  group_ids: List[str] = [],
35
48
  user_profile: Dict[str, Any] = {},
36
49
  log_to_stdout: bool = False,
37
- log_level: str = "INFO",
50
+ log_level: str = environ.get("LOG_LEVEL", "ERROR"),
38
51
  expression_classes: ModuleType = _default_expression_classes,
39
52
  group_data: dict = {},
40
53
  ) -> None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "okta-expression-parser"
3
- version = "0.4.0"
3
+ version = "0.4.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"