pseek 2.5.2__tar.gz → 2.5.4__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.4
2
2
  Name: pseek
3
- Version: 2.5.2
3
+ Version: 2.5.4
4
4
  Summary: Pseek is a Python library to search files, folders, and text
5
5
  Author-email: Arian <ariannasiri86@gmail.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,810 @@
1
+ -0.html
2
+ -110
3
+ -maria-lund-45906.-511-gl.php
4
+ -tillagg-order-85497.php
5
+ 0--DUP.htm
6
+ 0-0-0.html
7
+ 0-2.html
8
+ 0-4.html
9
+ 0-features-print.htm
10
+ 0-to-1.2.php
11
+ 0-to1.2.php
12
+ 0.0
13
+ 0.0.0
14
+ 0.1
15
+ 0.1.1
16
+ 0.10
17
+ 0.10.html
18
+ 0.11
19
+ 0.11-pr1
20
+ 0.15
21
+ 0.2
22
+ 0.3
23
+ 0.328.1.php
24
+ 0.329.1.php
25
+ 0.330.1.php
26
+ 0.35
27
+ 0.4
28
+ 0.5
29
+ 0.6
30
+ 0.7
31
+ 0.8
32
+ 0.8.html
33
+ 0.806.1.php
34
+ 0.html
35
+ 0.jpg
36
+ 0.pdf
37
+ 0.xml
38
+ 0.zip
39
+ 00.8169
40
+ 00.html
41
+ 001.L.jpg
42
+ 002.L.jpg
43
+ 003.L.jpg
44
+ 003.jpg
45
+ 004.L.jpg
46
+ 004.jpg
47
+ 006.L.jpg
48
+ 01-L.jpg
49
+ 01.4511
50
+ 01.html
51
+ 01.jpg
52
+ 02.html
53
+ 03.html
54
+ 04.html
55
+ 05.09
56
+ 05.html
57
+ 06.html
58
+ 07.html
59
+ 08.2010.php
60
+ 08.html
61
+ 09.html
62
+ 1-3.2.php
63
+ 1-bin-Linux-2.0.30-i486
64
+ 1-bin-Linux-2.030-i486
65
+ 1.0
66
+ 1.0.html
67
+ 1.1
68
+ 1.10
69
+ 1.2
70
+ 1.2.1
71
+ 1.24-print.htm
72
+ 1.3
73
+ 1.5
74
+ 1.5.swf
75
+ 1.6
76
+ 1.8
77
+ 1.9498
78
+ 1.htm
79
+ 1.html
80
+ 1.pdf
81
+ 1.php
82
+ 1.x
83
+ 10.1
84
+ 10.10
85
+ 10.11
86
+ 10.2010
87
+ 10.5
88
+ 10.html
89
+ 100.html
90
+ 11.2010
91
+ 11.5-all-languages-utf-8-only
92
+ 11.6-all-languages
93
+ 11.html
94
+ 12.html
95
+ 12.pdf
96
+ 125.html
97
+ 13.html
98
+ 14.05
99
+ 14.html
100
+ 15.html
101
+ 150.html
102
+ 15462.articlePk
103
+ 15467.articlePk
104
+ 16.html
105
+ 18.html
106
+ 19.html
107
+ 2.0
108
+ 2.0.html
109
+ 2.00
110
+ 2.1
111
+ 2.2
112
+ 2.2.html
113
+ 2.2.pack.js
114
+ 2.3
115
+ 2.5
116
+ 2.6
117
+ 2.6.min.js
118
+ 2.6.pack.js
119
+ 2.7
120
+ 2.8
121
+ 2.9
122
+ 2.html
123
+ 2.js
124
+ 2.pdf
125
+ 2.php
126
+ 2.swf
127
+ 2.tmp
128
+ 2.zip
129
+ 20.html
130
+ 200.html
131
+ 2004.html
132
+ 2009.pdf
133
+ 205.html
134
+ 21.html
135
+ 22.html
136
+ 23.html
137
+ 24.html
138
+ 246.224.125
139
+ 25.04
140
+ 25.html
141
+ 26.13.391N35.50.38.816
142
+ 26.24.165N35.50.24.134
143
+ 26.56.247N35.52.03.605
144
+ 26.html
145
+ 27.02.940N35.49.56.075
146
+ 27.15.919N35.52.04.300
147
+ 27.29.262N35.47.15.083
148
+ 27.html
149
+ 28.html
150
+ 29.html
151
+ 3.0
152
+ 3.1
153
+ 3.2
154
+ 3.2.min.js
155
+ 3.2a
156
+ 3.3
157
+ 3.4
158
+ 3.5
159
+ 3.6
160
+ 3.7-english
161
+ 3.asp
162
+ 3.html
163
+ 3.php
164
+ 30.html
165
+ 31.html
166
+ 37.0.html
167
+ 4.0
168
+ 4.1
169
+ 4.10a
170
+ 4.14
171
+ 4.2
172
+ 4.2.min.js
173
+ 4.3
174
+ 4.4
175
+ 4.5
176
+ 4.6
177
+ 4.7
178
+ 4.9.php
179
+ 4.html
180
+ 40.00.573N35.42.57.445
181
+ 40.html
182
+ 43.58.040N35.38.35.826
183
+ 44.04.344N35.38.35.077
184
+ 44.08.714N35.39.08.499
185
+ 44.10.892N35.38.49.246
186
+ 44.27.243N35.41.29.367
187
+ 44.29.976N35.37.51.790
188
+ 44.32.445N35.36.10.206
189
+ 44.34.800N35.38.08.156
190
+ 44.37.128N35.40.54.403
191
+ 44.40.556N35.40.53.025
192
+ 44.45.013N35.38.36.211
193
+ 44.46.104N35.38.22.970
194
+ 44.48.130N35.38.25.969
195
+ 44.52.162N35.38.50.456
196
+ 44.58.315N35.38.53.455
197
+ 45.01.562N35.38.38.778
198
+ 45.04.359N35.38.39.112
199
+ 45.06.789N35.38.22.556
200
+ 45.10.717N35.38.41.989
201
+ 45.html
202
+ 5.0
203
+ 5.1
204
+ 5.1-pt_BR
205
+ 5.1.html
206
+ 5.2
207
+ 5.3
208
+ 5.4
209
+ 5.5-pl1
210
+ 5.6
211
+ 5.7
212
+ 5.7-pl1
213
+ 5.html
214
+ 5.i
215
+ 5.php
216
+ 50.html
217
+ 55.html
218
+ 6.0
219
+ 6.0-pl1
220
+ 6.1
221
+ 6.12
222
+ 6.14
223
+ 6.16
224
+ 6.18
225
+ 6.19
226
+ 6.2
227
+ 6.2-rc1
228
+ 6.3
229
+ 6.3-pl1
230
+ 6.3-rc1
231
+ 6.4
232
+ 6.5
233
+ 6.9
234
+ 6.edu
235
+ 6.html
236
+ 61.html
237
+ 62.html
238
+ 63.html
239
+ 65.html
240
+ 7-2.html
241
+ 7.0
242
+ 7.1
243
+ 7.2
244
+ 7.2.custom
245
+ 7.3
246
+ 7.5
247
+ 7.html
248
+ 7.js
249
+ 75.html
250
+ 8.0
251
+ 8.0.html
252
+ 8.1
253
+ 8.2
254
+ 8.2.4
255
+ 8.23
256
+ 8.3
257
+ 8.4
258
+ 8.5
259
+ 8.7
260
+ 8.html
261
+ 80.html
262
+ 84.119.131
263
+ 888luck.asia
264
+ 9.1
265
+ 9.2
266
+ 9.6.2
267
+ 9.html
268
+ 90.3
269
+ 90.html
270
+ 95.html
271
+ 98.html
272
+ A.
273
+ ASC.
274
+ C.
275
+ C.R.D.
276
+ D.
277
+ D.R.
278
+ DESC.
279
+ E.
280
+ H.I.
281
+ K.E.
282
+ K.T.
283
+ L.
284
+ L.jpg
285
+ LOG.new
286
+ Org.master
287
+ Org.master.cs
288
+ Org.sln
289
+ Org.vssscc
290
+ P.
291
+ Run.AdCode
292
+ Sol.BBCRedirection.page
293
+ Superindian.com
294
+ T.
295
+ T.A
296
+ T.A.
297
+ Tung.php
298
+ Web.UI.WebResource.axd
299
+ _._order
300
+ _heder.yes.html
301
+ a.html
302
+ access.login
303
+ act.php
304
+ action.php
305
+ actions.php
306
+ activate.php
307
+ ad.php
308
+ add.php
309
+ adenaw.com
310
+ admin.php
311
+ ag.php
312
+ ajax.asp
313
+ ajax.php
314
+ all.hawaii
315
+ amaphun.com
316
+ andriy.lviv.ua
317
+ aral-design.com
318
+ aral-design.de
319
+ artnet.
320
+ asax.cs
321
+ asax.resx
322
+ asax.vb
323
+ ascx.cs
324
+ ascx.resx
325
+ ascx.vb
326
+ asp.LCK
327
+ asp.asp
328
+ asp.bak
329
+ asp.html
330
+ asp.old
331
+ aspx.
332
+ aspx.aspx
333
+ aspx.cs
334
+ aspx.designer.cs
335
+ aspx.resx
336
+ aspx.vb
337
+ at.html
338
+ avatar.php
339
+ babymhiasexy.com
340
+ backup.php
341
+ bak.php
342
+ banan.se
343
+ banner.php
344
+ basicmap.php
345
+ best-vpn.com
346
+ blackandmature.com
347
+ bmp.php
348
+ board.asd
349
+ bossspy.org
350
+ buscadorpornoxxx.com
351
+ buy-here.com
352
+ c.html
353
+ cache.inc.php
354
+ cache.php
355
+ captcha.aspx
356
+ cascinaamalia.it
357
+ cat.php
358
+ cfg.php
359
+ cfm.bak
360
+ cfm.cfm
361
+ cfsifatest.co.uk
362
+ cfstest.co.uk
363
+ changeLang.php
364
+ chloesworld.com
365
+ class.php
366
+ classes.php
367
+ click.php
368
+ cls.php
369
+ cms.ad.AdServer.cls
370
+ co-operativebank.co.uk
371
+ co-operativebanktest.co.uk
372
+ co-operativeinsurance.co.uk
373
+ co-operativeinsurancetest.co.uk
374
+ co-operativeinvestmentstest.co.uk
375
+ co.il
376
+ co.uk
377
+ cocomore.txt
378
+ colorbox-min.js
379
+ com-authorization-required.html
380
+ com-bad-request.html
381
+ com-forbidden.html
382
+ com-internal-server-error.html
383
+ com-page-not-found.html
384
+ com-tov.html
385
+ com.ar
386
+ com.au
387
+ com.br
388
+ com.crt
389
+ com.htm
390
+ com.html
391
+ com.old
392
+ com.php
393
+ com.ua
394
+ comments.
395
+ comments.php
396
+ common.php
397
+ compiler.php
398
+ conf.html
399
+ conf.php
400
+ config.php
401
+ confirm.email
402
+ connect.php
403
+ contact.php
404
+ content.php
405
+ controls-3.1.5.swf
406
+ cookie.js
407
+ core.php
408
+ corp.footer
409
+ counter.php
410
+ create.php
411
+ cropcanvas.php
412
+ cropinterface.php
413
+ csproj.user
414
+ csproj.webinfo
415
+ css.LCK
416
+ css.aspx
417
+ css.gz
418
+ css.php
419
+ csshandler.ashx
420
+ csv.php
421
+ cycle.all.min.js
422
+ daniel-sebald.de
423
+ data.php
424
+ de.html
425
+ de.jsp
426
+ de.txt
427
+ default.php
428
+ desarrollo.aquihaydominios.com
429
+ details.php
430
+ dev.bka.co.nz
431
+ dict.php
432
+ display.php
433
+ dist.php
434
+ dmca-sucks.com
435
+ doc.doc
436
+ donothiredandobrin.com
437
+ download.php
438
+ downloadCirRequirements.pdf
439
+ downloadTourkitRequirements.pdf
440
+ downloadfreeporn.asia
441
+ ea3ny.com
442
+ easing.min.js
443
+ ebay.results.html
444
+ editingoffice.com
445
+ efacil.com.br
446
+ email.shtml
447
+ emailCirRequirements.php
448
+ emailTourkitForm.php
449
+ emailTourkitNotification.php
450
+ emailTourkitRequirements.php
451
+ emaximinternational.com
452
+ en.htm
453
+ en.html
454
+ en.jsp
455
+ en.php
456
+ equonix.com
457
+ es.html
458
+ es.jsp
459
+ euforyou.net
460
+ excel.xml.php
461
+ f.l.
462
+ faucetdepot.com.vbproj
463
+ faucetdepot.com.vbproj.webinfo
464
+ feeds.php
465
+ ficken.cx
466
+ fillPurposes2.php
467
+ filters.php
468
+ forget.pass
469
+ form.php
470
+ fr.html
471
+ fr.jsp
472
+ freeasianporn.asia
473
+ freepornxxx.asia
474
+ frontpage.php
475
+ fucks.nl
476
+ functions.php
477
+ funzz.fr
478
+ g.
479
+ gallery.php
480
+ geo.xml
481
+ gif.count
482
+ gif.php
483
+ girlvandiesuburbs.co.za
484
+ gitihost.com
485
+ glasner.ru
486
+ google.com
487
+ guiaweb.tk
488
+ hardestlist.com
489
+ hardpussy.com
490
+ hasrett.de
491
+ header.php
492
+ home.php
493
+ home.test
494
+ htm.
495
+ htm.LCK
496
+ htm.bak
497
+ htm.d
498
+ htm.htm
499
+ htm.html
500
+ htm.old
501
+ htm.rc
502
+ html.
503
+ html.LCK
504
+ html.bak
505
+ html.htm
506
+ html.html
507
+ html.images
508
+ html.inc
509
+ html.none
510
+ html.old
511
+ html.orig
512
+ html.pdf
513
+ html.php
514
+ html.printable
515
+ html.sav
516
+ html.start
517
+ html.txt
518
+ iac.
519
+ ibuysss.info
520
+ ignore.php
521
+ image.php
522
+ inc.asp
523
+ inc.html
524
+ inc.js
525
+ inc.php
526
+ inc.php.bak
527
+ inc.php3
528
+ incest-porn.sex-startje.nl
529
+ incestporn.sex-startje.nl
530
+ index.html
531
+ index.php
532
+ indiansexzite.com
533
+ info.html
534
+ info.php
535
+ ini.NEWCONFIGPOSSIBLYBROKEN
536
+ ini.bak
537
+ ini.default
538
+ ini.php
539
+ ini.sample
540
+ internet-taxprep.com
541
+ interpreterukraine.com
542
+ it.html
543
+ jpg.html
544
+ jpg.jpg
545
+ jpg.xml
546
+ js.LCK
547
+ js.asp
548
+ js.aspx
549
+ js.gz
550
+ js.php
551
+ jsp.old
552
+ kinkywear.net
553
+ knvbcommunicator.voetbalassist.nl
554
+ kutxa.net-en
555
+ lang-de.php
556
+ lang-en.php
557
+ lang.php
558
+ langhampartners.com
559
+ lappgroup.com
560
+ lib.php
561
+ list.includes
562
+ local.cfm
563
+ local.php
564
+ location.href
565
+ log.0
566
+ login.php
567
+ maastrichtairporthotels.com
568
+ mail.php
569
+ malesextoys.us
570
+ massivewankers.com
571
+ master.cs
572
+ master.vb
573
+ menu.php
574
+ meretrizdelujo.com
575
+ messagey.com
576
+ metadata.js
577
+ meus.php
578
+ milliculture.net
579
+ min.js
580
+ miss-video.com
581
+ mk.gutschein
582
+ mk.rabattlp
583
+ model-escorts.asia
584
+ modelescorts.asia
585
+ mp3.html
586
+ mreply.rc
587
+ mysql.txt
588
+ net-print.htm
589
+ net-tov.html
590
+ net.html
591
+ new.htm
592
+ new.html
593
+ new.php
594
+ nexucom.com
595
+ ninwinter.net
596
+ nl.html
597
+ nonude.org
598
+ nonudes.com
599
+ offer.php
600
+ old.1
601
+ old.2
602
+ old.asp
603
+ old.htm
604
+ old.html
605
+ old.old
606
+ old.php
607
+ onedigitalcentral.com
608
+ onenettv.com
609
+ opml.config
610
+ org-tov.html
611
+ org.ua-tov.html
612
+ org.zip
613
+ orig.html
614
+ origin.php
615
+ original.html
616
+ orlando-vacationhome.net
617
+ orlando-vacationhomes-pools.com
618
+ orlando-vacationrentals.net
619
+ ownhometest.co.uk
620
+ pages-medicales.com
621
+ parse.errors
622
+ paymethods.php
623
+ pazderski.com
624
+ pazderski.net
625
+ pazderski.us
626
+ pdf.
627
+ pdf.html
628
+ pdf.pdf
629
+ pdf.php
630
+ perfect-color-world.com
631
+ petersburg-apartments-for-business.html
632
+ petersburg-apartments-for-tourists.html
633
+ petersburg-romantic-apartments.html
634
+ pgsql.txt
635
+ php.
636
+ php.LCK
637
+ php.backup
638
+ php.bak
639
+ php.htm
640
+ php.html
641
+ php.inc
642
+ php.mno
643
+ php.old
644
+ php.original
645
+ php.php
646
+ php.sample
647
+ php.static
648
+ php.txt
649
+ phpmailer.php
650
+ phpvreor.php
651
+ pl.html
652
+ planetcom.ca
653
+ playwithparis.com
654
+ png.php
655
+ pop3.php
656
+ popup.php
657
+ popup.pop_3D_viewer
658
+ popup.pop_formata_viewer
659
+ pornfailures.com
660
+ pornoizlee.tk
661
+ pornz.tv
662
+ posting.prep
663
+ preview-content.php
664
+ print.
665
+ print.html
666
+ print.jsp
667
+ print.php
668
+ print.shtml
669
+ prod2.venetian.com
670
+ prosdo.com
671
+ publisher.php
672
+ puresolo.com
673
+ pussyjourney.com
674
+ r.
675
+ randomocityproductions.com
676
+ rateart.php
677
+ rec.html
678
+ redirect.php
679
+ remove.php
680
+ requirementsFeesTable.php
681
+ reservations.venetian.com
682
+ restrictor.log
683
+ restrictor.php
684
+ riddlesintime.com
685
+ roomscity.com
686
+ roshani-gunewardene.com
687
+ roshani-gunewardene.net
688
+ roshani-m-gunewardene.com
689
+ roshanigunewardene.com
690
+ rss.php
691
+ ru-tov.html
692
+ ru.html
693
+ s.html
694
+ sadopasion.com
695
+ salestax.php
696
+ sca-tork.com
697
+ scrollTo.js
698
+ se.php
699
+ search.
700
+ search.asp
701
+ search.htm
702
+ search.html
703
+ search.php
704
+ sec.cfm
705
+ server.php
706
+ settings.php
707
+ sex-startje.nl
708
+ sexmeme.com
709
+ sexon.com
710
+ sexy-girls4abo.de
711
+ shipcode.php
712
+ shipdiscount.php
713
+ shopping_return.php
714
+ shopping_return_adsense.php
715
+ show.php
716
+ shtml.html
717
+ sitemap.
718
+ sitemap.xml
719
+ small-penis-humiliation.net
720
+ smiletest.co.uk
721
+ smtp.php
722
+ snippet.aspx
723
+ snuffx.com
724
+ sortirovka_Price.napravlenie_ASC
725
+ sortirovka_Price.napravlenie_DESC
726
+ sortirovka_customers_rating.napravlenie_ASC
727
+ sortirovka_customers_rating.napravlenie_DESC
728
+ sortirovka_name.napravlenie_ASC
729
+ sortirovka_name.napravlenie_DESC
730
+ sql.gz
731
+ st-patricks.com
732
+ staged.php
733
+ start.php
734
+ stats.php
735
+ storebanner.php
736
+ storelogo.php
737
+ storename.php
738
+ sts.php
739
+ support.html
740
+ swf.LCK
741
+ swf.html
742
+ swf.swf
743
+ table.html
744
+ tablesorter.min.js
745
+ tablesorter.pager.js
746
+ tar.bz2
747
+ tar.gz
748
+ tar.xz
749
+ tatianyc.com
750
+ teen-shy.com
751
+ teenhardpussy.com
752
+ temp.php
753
+ template.php
754
+ templates.php
755
+ temporarily.withdrawn.html
756
+ test.cgi
757
+ test.php
758
+ thehotfish.com
759
+ thumb.jpg
760
+ ticket.submit
761
+ tmp.php
762
+ touch.action
763
+ tpl.html
764
+ tpl.php
765
+ tracker.ashx
766
+ trishasex.viedos.com
767
+ txt.
768
+ txt.gz
769
+ txt.html
770
+ txt.php
771
+ txt.txt
772
+ txuri-urdin.com
773
+ ugmart.ug
774
+ ui-1.5.2
775
+ unixteacher.org
776
+ unsharp.php
777
+ userLoginPopup.php
778
+ v1.11.js
779
+ v2.php
780
+ vacationhomes-pools.com
781
+ vbproj.vspscc
782
+ vbproj.webinfo
783
+ venetian.com
784
+ videodeputas.com
785
+ videos-chaudes.com
786
+ visaPopup.php
787
+ visaPopupValid.php
788
+ voetbalassist.nl
789
+ web-teck.com
790
+ webjockey.nl
791
+ weedooz.eu
792
+ wimzi.php
793
+ wireless.action
794
+ woolovers.com
795
+ wps.rtf
796
+ write.php
797
+ wwsec_app_priv.login
798
+ www.annuaire-vimarty.net
799
+ www.annuaire-web.info
800
+ www.kit-graphik.com
801
+ www.photo-scope.fr
802
+ xcam.at
803
+ xcwc.com
804
+ xml.asp
805
+ xml.gz
806
+ xml.old
807
+ xml.php
808
+ xy.php
809
+ zh.html
810
+ zip.php
@@ -1,6 +1,4 @@
1
- import re
2
- import sys
3
- import click
1
+ import re, sys, click
4
2
  from lark import Lark, Transformer
5
3
  from .utils import compile_regex
6
4
  from rapidfuzz import fuzz
@@ -1,17 +1,10 @@
1
- import mmap
2
- import click
1
+ import mmap, click, io
3
2
  from pathlib import Path
4
3
  from .utils import compile_regex, get_archive_path_size, try_decode, get_path_suffix
5
4
  from .parser import parse_query_expression, TermNode, highlight_text
6
5
  from concurrent.futures import ThreadPoolExecutor
7
- import zipfile
8
- import py7zr
9
- import tarfile
10
- import gzip
11
- import bz2
12
- import lzma
13
- import rarfile
14
- import io
6
+ # Archive modules
7
+ import zipfile, py7zr, tarfile, gzip, bz2, lzma, rarfile
15
8
 
16
9
  # Archive extensions that are allowed
17
10
  ARCHIVE_EXTS = ('zip', 'rar', '7z', 'tar', 'tar.gz', 'tar.bz2', 'tar.xz', 'gz', 'bz2', 'xz')
@@ -76,7 +69,7 @@ class Search:
76
69
  file_ext = get_path_suffix(p_resolved)
77
70
 
78
71
  # Ignore some filters for archive files when archive is enabled
79
- if (not self.archive or not file_ext in ARCHIVE_EXTS[:-3]) and \
72
+ if (not self.archive or file_ext not in ARCHIVE_EXTS[:-3]) and \
80
73
  ((search_type in ('file', 'content') and not p_resolved.is_file())
81
74
  or (search_type == 'directory' and not p_resolved.is_dir())):
82
75
  return True
@@ -124,7 +117,8 @@ class Search:
124
117
  return False
125
118
 
126
119
  def extract_names_from_archive(self, file_path: Path, search_type: str,
127
- file_bytes: bytes = None, parent_label: str = ''):
120
+ file_bytes: bytes = None, parent_label: str = '',
121
+ depth: int = None):
128
122
  """
129
123
  Recursively extract files and directories name from archive files.
130
124
  Supports nested archives like a.zip::b.7z::c.txt.
@@ -134,6 +128,7 @@ class Search:
134
128
  search_type (str): search type ( file / directory )
135
129
  file_bytes (bytes | None): optional byte data if already read (for recursion)
136
130
  parent_label (str): string for nested archive tracking like a.zip::b.7z::file.txt
131
+ depth (int): the depth value that is returned recursively
137
132
 
138
133
  Yields:
139
134
  (str, Path): tuple of parent label and file or directory name
@@ -141,6 +136,8 @@ class Search:
141
136
 
142
137
  file_ext = get_path_suffix(file_path)
143
138
  label_prefix = (parent_label + str(file_path) + '::') if parent_label else '::'
139
+ if depth is None:
140
+ depth = self.depth
144
141
 
145
142
  try:
146
143
  # Decide the stream source: from disk or memory
@@ -162,14 +159,15 @@ class Search:
162
159
  yield label_prefix, name
163
160
 
164
161
  # At each recursion, subtract 1 from depth if it's set
165
- new_depth = None if self.depth is None else self.depth - 1
162
+ new_depth = None if depth is None else depth - 1
166
163
  # Check if this is a nested archive
167
164
  if get_path_suffix(name) in ARCHIVE_EXTS[:-3] and (new_depth is None or new_depth >= 0):
168
165
  yield from self.extract_names_from_archive(
169
166
  name,
170
167
  search_type,
171
168
  f.read(info),
172
- label_prefix
169
+ label_prefix,
170
+ new_depth
173
171
  )
174
172
  # Handle 7Z archives
175
173
  elif file_ext == '7z':
@@ -185,7 +183,7 @@ class Search:
185
183
  ):
186
184
  yield label_prefix, name
187
185
 
188
- new_depth = None if self.depth is None else self.depth - 1
186
+ new_depth = None if depth is None else depth - 1
189
187
  if get_path_suffix(name) in ARCHIVE_EXTS[:-3] and (new_depth is None or new_depth >= 0):
190
188
  file_data = z.read([info.filename]).get(info.filename)
191
189
  if file_data is None:
@@ -195,7 +193,8 @@ class Search:
195
193
  name,
196
194
  search_type,
197
195
  file_data.read(),
198
- label_prefix
196
+ label_prefix,
197
+ new_depth
199
198
  )
200
199
  # Handle TAR and compressed TAR formats
201
200
  elif file_ext in ('tar', 'tar.gz', 'tar.bz2', 'tar.xz'):
@@ -219,7 +218,7 @@ class Search:
219
218
  ):
220
219
  yield label_prefix, name
221
220
 
222
- new_depth = None if self.depth is None else self.depth - 1
221
+ new_depth = None if depth is None else depth - 1
223
222
  if get_path_suffix(name) in ARCHIVE_EXTS[:-3] and (new_depth is None or new_depth >= 0):
224
223
  f = tf.extractfile(member)
225
224
  if f is None:
@@ -229,12 +228,14 @@ class Search:
229
228
  name,
230
229
  search_type,
231
230
  f.read(),
232
- label_prefix
231
+ label_prefix,
232
+ new_depth
233
233
  )
234
234
  except Exception:
235
235
  return # silently skip invalid archives
236
236
 
237
- def extract_text_from_archive(self, file_path: Path, file_bytes: bytes = None, parent_label: str = ''):
237
+ def extract_text_from_archive(self, file_path: Path, file_bytes: bytes = None,
238
+ parent_label: str = '', depth: int = None):
238
239
  """
239
240
  Recursively extract (path_label, text_content) from any archive file.
240
241
  Supports nested archives like a.zip::b.7z::c.txt.
@@ -243,6 +244,7 @@ class Search:
243
244
  file_path (Path): the archive file path
244
245
  file_bytes (bytes | None): optional byte data if already read (for recursion)
245
246
  parent_label (str): string for nested archive tracking like a.zip::b.7z::file.txt
247
+ depth (int): the depth value that is returned recursively
246
248
 
247
249
  Yields:
248
250
  (str, str): tuple of full virtual path and decoded content text
@@ -250,6 +252,8 @@ class Search:
250
252
 
251
253
  file_ext = get_path_suffix(file_path)
252
254
  label_prefix = (parent_label + str(file_path) + '::') if parent_label else '::'
255
+ if depth is None:
256
+ depth = self.depth
253
257
 
254
258
  try:
255
259
  # Decide the stream source: from disk or memory
@@ -263,11 +267,11 @@ class Search:
263
267
  file_name = Path(info.filename)
264
268
  data = f.read(info)
265
269
  # At each recursion, subtract 1 from depth if it's set
266
- new_depth = None if self.depth is None else self.depth - 1
270
+ new_depth = None if depth is None else depth - 1
267
271
 
268
272
  # Check if this is a nested archive
269
273
  if get_path_suffix(file_name) in ARCHIVE_EXTS and (new_depth is None or new_depth >= 0):
270
- yield from self.extract_text_from_archive(file_name, data, label_prefix)
274
+ yield from self.extract_text_from_archive(file_name, data, label_prefix, new_depth)
271
275
  else:
272
276
  if self.archive_should_skip(
273
277
  file_name,
@@ -291,10 +295,10 @@ class Search:
291
295
 
292
296
  file_name = Path(info.filename)
293
297
  data = file_data.read()
294
- new_depth = None if self.depth is None else self.depth - 1
298
+ new_depth = None if depth is None else depth - 1
295
299
 
296
300
  if get_path_suffix(file_name) in ARCHIVE_EXTS and (new_depth is None or new_depth >= 0):
297
- yield from self.extract_text_from_archive(file_name, data, label_prefix)
301
+ yield from self.extract_text_from_archive(file_name, data, label_prefix, new_depth)
298
302
  else:
299
303
  if self.archive_should_skip(
300
304
  file_name,
@@ -325,10 +329,10 @@ class Search:
325
329
 
326
330
  file_name = Path(member.name)
327
331
  data = f.read()
328
- new_depth = None if self.depth is None else self.depth - 1
332
+ new_depth = None if depth is None else depth - 1
329
333
 
330
334
  if get_path_suffix(file_name) in ARCHIVE_EXTS and (new_depth is None or new_depth >= 0):
331
- yield from self.extract_text_from_archive(file_name, data, label_prefix)
335
+ yield from self.extract_text_from_archive(file_name, data, label_prefix, new_depth)
332
336
  else:
333
337
  if self.archive_should_skip(
334
338
  file_name,
@@ -431,7 +435,7 @@ class Search:
431
435
 
432
436
  count = pattern.count_matches(line) if isinstance(pattern, TermNode) else 0
433
437
  # Highlight the matching parts in green
434
- highlighted = highlight_text(pattern, line, self.fuzzy)
438
+ highlighted = highlight_text(pattern, line.strip(), self.fuzzy)
435
439
  # Show a note if the pattern repeats 3 or more times
436
440
  count_query = f' - Repeated {count} times' if count >= 3 else ''
437
441
  # Format the output line with line number and highlighted matches
@@ -1,11 +1,8 @@
1
- import re
2
- import sys
3
- import click
4
- import shutil
5
- import rarfile
6
- import platform
1
+ import re, sys, click, shutil, rarfile, platform
7
2
  from pathlib import Path
8
3
 
4
+ EXTENSIONS_PATH = Path(__file__).parent / "extensions"
5
+
9
6
 
10
7
  def compile_regex(txt, flags=0):
11
8
  if txt is not None:
@@ -88,4 +85,12 @@ def check_rar_backend(archive_enabled: bool, tool_path: str, backend: str):
88
85
 
89
86
 
90
87
  def get_path_suffix(path: Path) -> str:
91
- return ''.join(path.suffixes)[1:].lower()
88
+ """ If multiple file suffixes are valid, return them, otherwise return only the last suffix """
89
+ if path.is_dir():
90
+ return ''
91
+
92
+ with open(EXTENSIONS_PATH, "r") as f:
93
+ extensions = [line.strip() for line in f]
94
+
95
+ file_suffixes = ''.join(path.suffixes)[1:].lower()
96
+ return file_suffixes if file_suffixes in extensions else path.suffix[1:].lower()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pseek
3
- Version: 2.5.2
3
+ Version: 2.5.4
4
4
  Summary: Pseek is a Python library to search files, folders, and text
5
5
  Author-email: Arian <ariannasiri86@gmail.com>
6
6
  License-Expression: MIT
@@ -3,6 +3,7 @@ README.md
3
3
  pyproject.toml
4
4
  pseek/__init__.py
5
5
  pseek/cli.py
6
+ pseek/extensions
6
7
  pseek/parser.py
7
8
  pseek/searcher.py
8
9
  pseek/utils.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pseek"
7
- version = "2.5.2"
7
+ version = "2.5.4"
8
8
  description = "Pseek is a Python library to search files, folders, and text"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -24,3 +24,9 @@ urls = {Homepage = "https://github.com/ArianN8610/pysearch"}
24
24
 
25
25
  [project.scripts]
26
26
  pseek = "pseek.cli:search"
27
+
28
+ [tool.setuptools]
29
+ include-package-data = true
30
+
31
+ [tool.setuptools.package-data]
32
+ "pseek" = ["extensions"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes