pseek 3.4.0__tar.gz → 3.4.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.
@@ -10,6 +10,10 @@ jobs:
10
10
 
11
11
  runs-on: ubuntu-latest
12
12
 
13
+ concurrency:
14
+ group: pseek-pypi-publish
15
+ cancel-in-progress: false
16
+
13
17
  permissions:
14
18
  contents: read
15
19
 
@@ -51,3 +55,4 @@ jobs:
51
55
  uses: pypa/gh-action-pypi-publish@release/v1
52
56
  with:
53
57
  password: ${{ secrets.PYPI_API_TOKEN }}
58
+ skip-existing: true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pseek
3
- Version: 3.4.0
3
+ Version: 3.4.1
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -309,6 +309,8 @@ psk apple --fuzzy
309
309
 
310
310
  Can match: `appl`, `appel`, `aple`
311
311
 
312
+ > **Note:** To improve performance, highlighting of matches is automatically disabled if the `--fuzzy` flag is enabled and the `--word` flag is disabled.
313
+
312
314
  #### Fuzzy Similarity Threshold
313
315
 
314
316
  ```bash
@@ -339,6 +341,8 @@ Enable:
339
341
  psk '("error" or "warning") and not "debug"' --expr
340
342
  ```
341
343
 
344
+ > **Note:** When using `--expr`, queries are double-quoted and backslashes have special meaning. Ordinary queries use JSON-style escaping, so `\n` and `\t` represent newline and tab characters, respectively. Use `\\n` or `\\t` to search for those literal sequences. Regex queries (`r"..."`) preserve regex escapes, which are interpreted by the regex engine.
345
+
342
346
  ### Supported Operators
343
347
 
344
348
  #### AND
@@ -281,6 +281,8 @@ psk apple --fuzzy
281
281
 
282
282
  Can match: `appl`, `appel`, `aple`
283
283
 
284
+ > **Note:** To improve performance, highlighting of matches is automatically disabled if the `--fuzzy` flag is enabled and the `--word` flag is disabled.
285
+
284
286
  #### Fuzzy Similarity Threshold
285
287
 
286
288
  ```bash
@@ -311,6 +313,8 @@ Enable:
311
313
  psk '("error" or "warning") and not "debug"' --expr
312
314
  ```
313
315
 
316
+ > **Note:** When using `--expr`, queries are double-quoted and backslashes have special meaning. Ordinary queries use JSON-style escaping, so `\n` and `\t` represent newline and tab characters, respectively. Use `\\n` or `\\t` to search for those literal sequences. Regex queries (`r"..."`) preserve regex escapes, which are interpreted by the regex engine.
317
+
314
318
  ### Supported Operators
315
319
 
316
320
  #### AND
@@ -1,4 +1,4 @@
1
- import re, click
1
+ import re, click, json
2
2
  from lark import Lark, Transformer
3
3
  from .utils import compile_regex
4
4
  from rapidfuzz import fuzz
@@ -139,6 +139,19 @@ PREFIXED_STRING: /(r|c|w|f|rc|cr|cw|wc|cf|fc|wf|fw|cwf|cfw|wcf|wfc|fcw|fwc)"([^"
139
139
  QUERY_PARSER = Lark(query_grammar, parser='lalr')
140
140
 
141
141
 
142
+ def decode_expr_string(token: str, regex: bool = False) -> str:
143
+ """
144
+ Decode a quoted expression string.
145
+
146
+ Normal strings use JSON-style escaping.
147
+ """
148
+ if not regex:
149
+ return json.loads(token)
150
+
151
+ # Keep regex escapes such as \b, \d, and \w intact
152
+ return token[1:-1]
153
+
154
+
142
155
  class TreeToExpr(Transformer):
143
156
  """Transform parsed tree into expression tree (ExprNode subclasses)"""
144
157
  def __init__(self, fuzzy_level):
@@ -147,7 +160,7 @@ class TreeToExpr(Transformer):
147
160
 
148
161
  def string(self, s):
149
162
  """ Match normal quoted string: "foo" """
150
- term = s[0][1:-1] # Remove surrounding quotes (e.g., "foo" -> foo)
163
+ term = decode_expr_string(str(s[0]))
151
164
  return TermNode(
152
165
  term,
153
166
  False,
@@ -158,13 +171,19 @@ class TreeToExpr(Transformer):
158
171
  )
159
172
 
160
173
  def prefixed_string(self, s):
174
+ """Transform a prefixed search term"""
161
175
  text = str(s[0]) # e.g., 'rc"pattern"'
162
- prefix = text.split('"', 1)[0].lower()
163
- content = text.split('"', 1)[1][:-1]
176
+
177
+ quote_index = text.index('"')
178
+ prefix = text[:quote_index].lower()
179
+ quoted = text[quote_index:]
180
+
181
+ is_regex = 'r' in prefix
182
+ content = decode_expr_string(quoted, is_regex)
164
183
 
165
184
  return TermNode(
166
185
  content,
167
- regex='r' in prefix,
186
+ regex=is_regex,
168
187
  whole_word='w' in prefix,
169
188
  case_sensitive='c' in prefix,
170
189
  fuzzy='f' in prefix,
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "pseek"
7
- version = "3.4.0"
7
+ version = "3.4.1"
8
8
  description = "Pseek is a Python CLI toolkit to search files, folders, and text"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes