tellaro-query-language 0.2.3__py3-none-any.whl → 0.2.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.
@@ -1,30 +1,32 @@
1
1
  tql/__init__.py,sha256=eqti5Fmu8EjD-NbCwqb1UKGJQ0OpWJLREsVMqqn6Hs4,1260
2
2
  tql/analyzer.py,sha256=Sfzj6f7YzqylT8HIL9hDbXdhl0lf8q8DNoafrxkD-F8,15456
3
3
  tql/cache/__init__.py,sha256=GIzIEMZUZEYJj72sAhuVLEG-OJEKUG2srUWNM3Ix-T8,213
4
- tql/cache/base.py,sha256=CwLpobv4WR7WSz99JVWAHNn-XQTtqr38Yg5UiWNXPiA,3192
5
- tql/cache/memory.py,sha256=1kDfyODBCDi5UvSP_f_7UhHVmug-sLnrsMYvm4C4cxo,5978
6
- tql/cache/redis.py,sha256=ZU_IsVDvpSYpNvPfnZ4iulJDODpEGx3c4dkXLzPzPVc,2309
7
- tql/core.py,sha256=ZNtxNJSZqotJ-3z9kg8Nc2lKDoeR9Bspe8k7VrXp0Ow,49363
4
+ tql/cache/base.py,sha256=RyS4PDX9W4l_Zu0-TeGM4ZpM6eW29flz6AD7zS4e1PI,4032
5
+ tql/cache/memory.py,sha256=vb7Dx0-MfT0U1ocQBO8IacoJrzndcBymeQBP4YtRrxs,7260
6
+ tql/cache/redis.py,sha256=Z_yYeyPKrm1vqelLjbIGy3dRTobfRdyQbic31KXeiDU,3321
7
+ tql/cli.py,sha256=dxvYvq0TmLWS5vHAkhdgTUlJK42vORjH8ttNkjIcgqM,15257
8
+ tql/core.py,sha256=_OlFGTrvJ8cBz3OliRxSz-IbD6e1t_nYC5YZFVkOAfc,58413
8
9
  tql/core_components/README.md,sha256=Rm7w4UHdQ0vPBEFybE5b62IOvSA5Nzq2GRvtBHOapmc,3068
9
10
  tql/core_components/__init__.py,sha256=v8BBybPlqV7dkVY9mw1mblvqyAFJZ7Pf_bEc-jAL7FI,643
10
11
  tql/core_components/file_operations.py,sha256=Jr0kkxz_OP2KHOAsIr7KMtYe_lbu8LuBUySt2LQbjJw,3925
11
12
  tql/core_components/opensearch_operations.py,sha256=zgxGiDpXyPW0ZUX-StpZXxf84s8eLxSymAGM5UUJimk,55253
12
13
  tql/core_components/stats_operations.py,sha256=aqTGAqIFvR6EkSbJEd0qft8Ldy8uiTrK2XI9o5bZUOs,8014
13
14
  tql/core_components/validation_operations.py,sha256=_VPXh0HABBjsXF99jFT7B6-5QAPsADOCy6poinGrxeE,22454
14
- tql/evaluator.py,sha256=W2PbD0umxKORlb9npPgg985I7eYxc9QsXUtiZsgOPCk,17889
15
+ tql/evaluator.py,sha256=6BtC0njH_aR_lXiU6GU5vM5MRhQeSoxL7F95xh-2-ho,17903
15
16
  tql/evaluator_components/README.md,sha256=c59yf2au34yPhrru7JWgGop_ORteB6w5vfMhsac8j3k,3882
16
17
  tql/evaluator_components/__init__.py,sha256=DourRUSYXWPnCghBFj7W0YfMeymT3X8YTDCwnLIyP1c,535
17
18
  tql/evaluator_components/field_access.py,sha256=BuXvL9jlv4H77neT70Vh7_qokmzs-d4EbSDA2FB1IT0,6435
18
- tql/evaluator_components/special_expressions.py,sha256=K6M5pW4Re2kEqxfxj9sc7I_M1tU3pn6LKJ2AfjHeciA,12917
19
- tql/evaluator_components/value_comparison.py,sha256=Woo8bNwIARdfe7F7ApYD5xi4NrrPwhdem_5ZKSik-t4,21369
20
- tql/exceptions.py,sha256=hatIixXci6p57J9RrkfdvmKM_2i-JKb8ViL2kU4z7a8,5550
19
+ tql/evaluator_components/special_expressions.py,sha256=prhXnVRnFfmecgmuTz0fsefTA1clb2eyyYf-zPtzXGs,15703
20
+ tql/evaluator_components/value_comparison.py,sha256=a0Vo3BWyPxMtEgAKtUuaN0HN9Arc0A7BUVrxgZyH6_o,21200
21
+ tql/exceptions.py,sha256=GVssdBp9134Wyk1bWbcLQFU9U8yQKl5zzquTTrM22A0,5620
22
+ tql/field_type_inference.py,sha256=KOazjp8CK6s9vwOcFkQrdOwcazOwHqSIhYgX8hWCiDo,9700
21
23
  tql/geoip_normalizer.py,sha256=tvie-5xevJEeLp2KmjoXDjYdND8AvyVE7lCO8qgUzGY,10486
22
24
  tql/mutator_analyzer.py,sha256=OWx3k5lK5aFHWU9Ez6DaIhenEZDxj9CbB0vM71xqUTw,55670
23
25
  tql/mutators/__init__.py,sha256=eTK8sRw4KXXnTZTn5ETIqwcaIek5rSUIVyZsxTwNNHA,6966
24
26
  tql/mutators/base.py,sha256=4Ze_x1sTO11OILXfcF2XN7ttyHcZ4gwn96UXFMMaC6M,2523
25
27
  tql/mutators/dns.py,sha256=1IKgHolFLRMR4TOgK0AiLjz5vDtFiqO328mVF4Vzk3s,14428
26
28
  tql/mutators/encoding.py,sha256=yt12BJrHAIJfBesP8VOSfVlvJqB1yOmEeT_8QDPvNN8,7985
27
- tql/mutators/geo.py,sha256=fFQSg_Li3KjFKS3TI26yDzrDpWsmC3MfmgcsxYoQMgM,14507
29
+ tql/mutators/geo.py,sha256=H-_5oDvuYaAG8Re17RkGjzCc6Z07YHd7Cr95g6JbnyE,16188
28
30
  tql/mutators/list.py,sha256=949ZrKKhL4INkH2Od8bq7Ey80kFX_23PEfRKueG82cU,7084
29
31
  tql/mutators/network.py,sha256=1lZpmKt1GoTfNxiXUmSXkTwJIzPQZnQEgU7ojpBSm3A,5458
30
32
  tql/mutators/security.py,sha256=XyWuPxgpCi-igHKmkbP0_0V-evOc3FG2a1igY8rQRX4,9256
@@ -34,23 +36,24 @@ tql/opensearch_components/README.md,sha256=gt-qLmmach8Kh7-QwLZmoAxxIL79XIG1EDqJu
34
36
  tql/opensearch_components/__init__.py,sha256=_zIZY8Fns7mkEcY6w2p9FNRBXtEmmPFFJEcFRfrVyXA,514
35
37
  tql/opensearch_components/field_mapping.py,sha256=fj388cKVyDXLJKi8giSiGHL9zg4cFRzy0VJ6nIsppSo,18102
36
38
  tql/opensearch_components/lucene_converter.py,sha256=OvYTZHNBktPGow1fsVm4TMlvxHSmWrnqo42lFZNxXTo,13175
37
- tql/opensearch_components/query_converter.py,sha256=vLoBqv7W3ntqUH6hcuT4PDJkGkAGSQCxMvAWC482c0g,41971
39
+ tql/opensearch_components/query_converter.py,sha256=INjX6hd-1dlCdCn_dGSBnub2mpNyUBpHXhHA5WoBQX4,41985
38
40
  tql/opensearch_mappings.py,sha256=sVLlQlE3eGD7iNNZ_m4F4j5GVzQAJhZyCqDKYRhLRh8,11531
39
- tql/opensearch_stats.py,sha256=l1VsHp1hFzsz8VFFD42M4xwlVgKkjptLs8TFB0wqqRw,24478
40
- tql/parser.py,sha256=t1bpL1hrHVpLZKeEP_DxMszlYUbh7QiudFDYxZtlc5s,80286
41
+ tql/opensearch_stats.py,sha256=sxJ4KziV-Yv1kvjo22souxjBQH3chmlm4lAgEhRBtyA,24530
42
+ tql/parser.py,sha256=y4LKYuNqE74Xx5UpHZBZE6PlVaRBiwr5i49NeMJW-jU,80383
41
43
  tql/parser_components/README.md,sha256=lvQX72ckq2zyotGs8QIHHCIFqaA7bOHwkP44wU8Zoiw,2322
42
44
  tql/parser_components/__init__.py,sha256=zBwHBMPJyHSBbaOojf6qTrJYjJg5A6tPUE8nHFdRiQs,521
43
45
  tql/parser_components/ast_builder.py,sha256=erHoeKAMzobswoRIXB9xcsZbzQ5-2ZwaYfQgRWoUAa8,9653
44
46
  tql/parser_components/error_analyzer.py,sha256=qlCD9vKyW73aeKQYI33P1OjIWSJ3LPd08wuN9cis2fU,4012
45
47
  tql/parser_components/field_extractor.py,sha256=eUEkmiYWX2OexanFqhHeX8hcIkRlfIcgMB667e0HRYs,4629
46
48
  tql/parser_components/grammar.py,sha256=h58RBshZHXgbP1EmNwmf7dny-fgVloNg-qN4Rivross,20599
47
- tql/post_processor.py,sha256=hItSj1VaQwCf2rbRQzLaMfAWR5RqMTpvDP-_X0HVhVo,51697
48
- tql/scripts.py,sha256=2iryuAWqIxYoFA7R5hIzC6NE72ihTH9kIZd1-thKPTM,4331
49
- tql/stats_evaluator.py,sha256=xJoTaBCBiKzQ0HuITGhTA41dVpeDhIMU9EMguCh_VG0,22427
49
+ tql/post_processor.py,sha256=5w_rP0V-t3AC7iAFLnlDxUtawcDFovbhbRsoZxt9yP4,51787
50
+ tql/scripts.py,sha256=DUY0H5IoGs_CNdG_oxITvLiCNVsogb2RJqUs2xXOs24,4319
51
+ tql/stats_evaluator.py,sha256=2qnjeH5Qx14qpHDS_YJn9jRPeoPUfkeiYJabBagdfRs,36126
50
52
  tql/stats_transformer.py,sha256=MT-4rDWZSySgn4Fuq9H0c-mvwFYLM6FqWpPv2rHX-rE,7588
53
+ tql/streaming_file_processor.py,sha256=cftWhYcvUo984P3ALf2CO3FoCQPJPe_2s2HLcXTp5UQ,12437
51
54
  tql/validators.py,sha256=e9MlX-zQ_O3M8YP8vXyMjKU8iiJMTh6mMK0iv0_4gTY,3771
52
- tellaro_query_language-0.2.3.dist-info/LICENSE,sha256=zRhQ85LnW55fWgAjQctckwQ67DX5Jmt64lq343ThZFU,1063
53
- tellaro_query_language-0.2.3.dist-info/METADATA,sha256=jRsW9n1nhyQb7m0qZd4F7h-q_ZoH_WzfVcCJMzC9P3c,15740
54
- tellaro_query_language-0.2.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
55
- tellaro_query_language-0.2.3.dist-info/entry_points.txt,sha256=H43APfGBMsZkKsUCnFTaqprQPW-Kce2yz2qsBL3dZrw,164
56
- tellaro_query_language-0.2.3.dist-info/RECORD,,
55
+ tellaro_query_language-0.2.6.dist-info/LICENSE,sha256=eWf8lkuXlVX_8WiDpUgQvzxc1cxCeVne_e6P-pVJpwM,3038
56
+ tellaro_query_language-0.2.6.dist-info/METADATA,sha256=FJV1TPy9q1SQt0eReXeVJw8XcMr2-OkGMEMF9Y99J5Q,21857
57
+ tellaro_query_language-0.2.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
58
+ tellaro_query_language-0.2.6.dist-info/entry_points.txt,sha256=D0lbIGUYuDyfcYeqju1rWcMBFzft4sZtfIlw5uPNx5g,181
59
+ tellaro_query_language-0.2.6.dist-info/RECORD,,
@@ -4,4 +4,5 @@ cov=tql.scripts:run_coverage
4
4
  lint=tql.scripts:run_lint
5
5
  lint-all=tql.scripts:run_lint_all
6
6
  tests=tql.scripts:run_tests
7
+ tql=tql.cli:main
7
8
 
tql/cache/base.py CHANGED
@@ -40,7 +40,7 @@ class CacheManager:
40
40
  """
41
41
  return None
42
42
 
43
- def set(self, key: str, value: Any, ttl: Optional[int] = None) -> None:
43
+ def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
44
44
  """Store a value in the cache.
45
45
 
46
46
  Args:
@@ -48,20 +48,54 @@ class CacheManager:
48
48
  value: The value to cache. Can be any Python object.
49
49
  ttl: Time-to-live in seconds. If None or 0, the value never expires.
50
50
 
51
+ Returns:
52
+ True if the value was successfully stored.
53
+
51
54
  Example:
52
55
  >>> cache.set("config", {"debug": True}, ttl=300) # Cache for 5 minutes
53
56
  >>> cache.set("permanent", {"version": "1.0"}) # Never expires
54
57
  """
58
+ return True
55
59
 
56
- def delete(self, key: str) -> None:
60
+ def delete(self, key: str) -> bool:
57
61
  """Remove a value from the cache.
58
62
 
59
63
  Args:
60
64
  key: The cache key to delete.
61
65
 
66
+ Returns:
67
+ True if the key existed and was deleted, False otherwise.
68
+
62
69
  Example:
63
70
  >>> cache.delete("expired_key")
64
71
  """
72
+ return False
73
+
74
+ def exists(self, key: str) -> bool: # pylint: disable=unused-argument
75
+ """Check if a key exists in the cache.
76
+
77
+ Args:
78
+ key: The cache key to check.
79
+
80
+ Returns:
81
+ True if the key exists and hasn't expired, False otherwise.
82
+
83
+ Example:
84
+ >>> if cache.exists("my_key"):
85
+ ... value = cache.get("my_key")
86
+ """
87
+ return False
88
+
89
+ def clear(self) -> bool:
90
+ """Clear all items from the cache.
91
+
92
+ Returns:
93
+ True if the cache was successfully cleared.
94
+
95
+ Example:
96
+ >>> cache.clear()
97
+ """
98
+ return True
65
99
 
66
100
  def clear_pattern(self, pattern: str) -> int: # pylint: disable=unused-argument
67
101
  """Clear all keys matching a pattern.
tql/cache/memory.py CHANGED
@@ -67,7 +67,7 @@ class LocalCacheManager(CacheManager):
67
67
  Hit/miss statistics are updated on each call.
68
68
  """
69
69
  if key in self._cache:
70
- expiry = self._expiry.get(key, float('inf'))
70
+ expiry = self._expiry.get(key, float("inf"))
71
71
  if expiry == 0 or expiry > time.time():
72
72
  self._hits += 1
73
73
  return self._cache[key]
@@ -78,7 +78,7 @@ class LocalCacheManager(CacheManager):
78
78
  self._misses += 1
79
79
  return None
80
80
 
81
- def set(self, key: str, value: Any, ttl: Optional[int] = None) -> None:
81
+ def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
82
82
  """Store value in cache with optional TTL.
83
83
 
84
84
  Args:
@@ -87,6 +87,9 @@ class LocalCacheManager(CacheManager):
87
87
  ttl: Time-to-live in seconds. If None, uses default_ttl.
88
88
  If 0, the item never expires.
89
89
 
90
+ Returns:
91
+ True if the value was successfully stored.
92
+
90
93
  Note:
91
94
  When the cache is full (reaches max_size), the oldest item
92
95
  is evicted to make room for the new one (LRU eviction).
@@ -104,18 +107,62 @@ class LocalCacheManager(CacheManager):
104
107
  else:
105
108
  expiry_time = time.time() + (ttl if ttl is not None else self.default_ttl)
106
109
  self._expiry[key] = expiry_time
110
+ return True
107
111
 
108
- def delete(self, key: str) -> None:
112
+ def delete(self, key: str) -> bool:
109
113
  """Remove value from cache.
110
114
 
111
115
  Args:
112
116
  key: The cache key to delete.
113
117
 
118
+ Returns:
119
+ True if the key existed and was deleted, False otherwise.
120
+
121
+ Note:
122
+ If the key doesn't exist, this method returns False (no error raised).
123
+ """
124
+ if key in self._cache:
125
+ del self._cache[key]
126
+ self._expiry.pop(key, None)
127
+ return True
128
+ return False
129
+
130
+ def exists(self, key: str) -> bool:
131
+ """Check if a key exists in the cache and hasn't expired.
132
+
133
+ Args:
134
+ key: The cache key to check.
135
+
136
+ Returns:
137
+ True if the key exists and hasn't expired, False otherwise.
138
+
114
139
  Note:
115
- If the key doesn't exist, this method does nothing (no error raised).
140
+ This method automatically removes expired keys when accessed.
116
141
  """
117
- self._cache.pop(key, None)
118
- self._expiry.pop(key, None)
142
+ if key in self._cache:
143
+ expiry = self._expiry.get(key, float("inf"))
144
+ if expiry == 0 or expiry > time.time():
145
+ return True
146
+ else:
147
+ # Expired - clean up
148
+ del self._cache[key]
149
+ del self._expiry[key]
150
+ return False
151
+
152
+ def clear(self) -> bool:
153
+ """Clear all items from the cache.
154
+
155
+ Returns:
156
+ True if the cache was successfully cleared.
157
+
158
+ Note:
159
+ This also resets hit/miss statistics.
160
+ """
161
+ self._cache.clear()
162
+ self._expiry.clear()
163
+ self._hits = 0
164
+ self._misses = 0
165
+ return True
119
166
 
120
167
  def clear_pattern(self, pattern: str) -> int:
121
168
  """Clear all keys matching a glob pattern.
tql/cache/redis.py CHANGED
@@ -3,13 +3,14 @@
3
3
  import json
4
4
  from typing import Any, Dict, Optional
5
5
 
6
+ from .base import CacheManager
7
+
8
+ redis: Any
6
9
  try:
7
10
  import redis
8
11
  except ImportError:
9
12
  redis = None
10
13
 
11
- from .base import CacheManager
12
-
13
14
 
14
15
  class RedisCacheManager(CacheManager):
15
16
  """Redis-based distributed cache."""
@@ -33,16 +34,56 @@ class RedisCacheManager(CacheManager):
33
34
  return json.loads(value)
34
35
  return None
35
36
 
36
- def set(self, key: str, value: Any, ttl: Optional[int] = None) -> None:
37
- """Store value in Redis with TTL."""
38
- full_key = self._make_key(key)
39
- ttl = ttl or self.default_ttl
40
- self.redis.setex(full_key, ttl, json.dumps(value))
37
+ def set(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
38
+ """Store value in Redis with TTL.
41
39
 
42
- def delete(self, key: str) -> None:
43
- """Remove value from Redis."""
44
- full_key = self._make_key(key)
45
- self.redis.delete(full_key)
40
+ Returns:
41
+ True if the value was successfully stored.
42
+ """
43
+ try:
44
+ full_key = self._make_key(key)
45
+ ttl = ttl or self.default_ttl
46
+ self.redis.setex(full_key, ttl, json.dumps(value))
47
+ return True
48
+ except Exception:
49
+ return False
50
+
51
+ def delete(self, key: str) -> bool:
52
+ """Remove value from Redis.
53
+
54
+ Returns:
55
+ True if the key existed and was deleted, False otherwise.
56
+ """
57
+ try:
58
+ full_key = self._make_key(key)
59
+ result = self.redis.delete(full_key)
60
+ return result > 0
61
+ except Exception:
62
+ return False
63
+
64
+ def exists(self, key: str) -> bool:
65
+ """Check if a key exists in Redis.
66
+
67
+ Returns:
68
+ True if the key exists, False otherwise.
69
+ """
70
+ try:
71
+ full_key = self._make_key(key)
72
+ return self.redis.exists(full_key) > 0
73
+ except Exception:
74
+ return False
75
+
76
+ def clear(self) -> bool:
77
+ """Clear all keys in the Redis database.
78
+
79
+ Returns:
80
+ True if the cache was successfully cleared.
81
+ """
82
+ try:
83
+ self.redis.flushdb()
84
+ return True
85
+ except Exception:
86
+ return False
46
87
 
47
88
  def clear_pattern(self, pattern: str) -> int:
48
89
  """Clear all keys matching pattern."""