cycode 3.5.1.dev2__py3-none-any.whl → 3.5.1.dev4__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.
- cycode/__init__.py +1 -1
- cycode/cli/files_collector/walk_ignore.py +18 -3
- cycode/cli/utils/ignore_utils.py +25 -6
- {cycode-3.5.1.dev2.dist-info → cycode-3.5.1.dev4.dist-info}/METADATA +1 -1
- {cycode-3.5.1.dev2.dist-info → cycode-3.5.1.dev4.dist-info}/RECORD +8 -8
- {cycode-3.5.1.dev2.dist-info → cycode-3.5.1.dev4.dist-info}/LICENCE +0 -0
- {cycode-3.5.1.dev2.dist-info → cycode-3.5.1.dev4.dist-info}/WHEEL +0 -0
- {cycode-3.5.1.dev2.dist-info → cycode-3.5.1.dev4.dist-info}/entry_points.txt +0 -0
cycode/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '3.5.1.
|
|
1
|
+
__version__ = '3.5.1.dev4' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from collections.abc import Generator, Iterable
|
|
3
3
|
|
|
4
|
-
from cycode.cli.logger import
|
|
4
|
+
from cycode.cli.logger import get_logger
|
|
5
5
|
from cycode.cli.utils.ignore_utils import IgnoreFilterManager
|
|
6
6
|
|
|
7
|
+
logger = get_logger('Ignores')
|
|
8
|
+
|
|
7
9
|
_SUPPORTED_IGNORE_PATTERN_FILES = {
|
|
8
10
|
'.gitignore',
|
|
9
11
|
'.cycodeignore',
|
|
@@ -30,7 +32,7 @@ def _collect_top_level_ignore_files(path: str) -> list[str]:
|
|
|
30
32
|
for ignore_file in _SUPPORTED_IGNORE_PATTERN_FILES:
|
|
31
33
|
ignore_file_path = os.path.join(dir_path, ignore_file)
|
|
32
34
|
if os.path.exists(ignore_file_path):
|
|
33
|
-
logger.debug('
|
|
35
|
+
logger.debug('Reading top level ignore file: %s', ignore_file_path)
|
|
34
36
|
ignore_files.append(ignore_file_path)
|
|
35
37
|
return ignore_files
|
|
36
38
|
|
|
@@ -41,4 +43,17 @@ def walk_ignore(path: str) -> Generator[tuple[str, list[str], list[str]], None,
|
|
|
41
43
|
global_ignore_file_paths=_collect_top_level_ignore_files(path),
|
|
42
44
|
global_patterns=_DEFAULT_GLOBAL_IGNORE_PATTERNS,
|
|
43
45
|
)
|
|
44
|
-
|
|
46
|
+
for dirpath, dirnames, filenames, ignored_dirnames, ignored_filenames in ignore_filter_manager.walk_with_ignored():
|
|
47
|
+
rel_dirpath = '' if dirpath == path else os.path.relpath(dirpath, path)
|
|
48
|
+
display_dir = rel_dirpath or '.'
|
|
49
|
+
for is_dir, names in (
|
|
50
|
+
(True, ignored_dirnames),
|
|
51
|
+
(False, ignored_filenames),
|
|
52
|
+
):
|
|
53
|
+
for name in names:
|
|
54
|
+
full_path = os.path.join(path, display_dir, name)
|
|
55
|
+
if is_dir:
|
|
56
|
+
full_path = os.path.join(full_path, '*')
|
|
57
|
+
logger.debug('Ignoring match %s', full_path)
|
|
58
|
+
|
|
59
|
+
yield dirpath, dirnames, filenames
|
cycode/cli/utils/ignore_utils.py
CHANGED
|
@@ -388,19 +388,38 @@ class IgnoreFilterManager:
|
|
|
388
388
|
return matches[-1].is_exclude
|
|
389
389
|
return None
|
|
390
390
|
|
|
391
|
-
def
|
|
392
|
-
|
|
391
|
+
def walk_with_ignored(
|
|
392
|
+
self, **kwargs
|
|
393
|
+
) -> Generator[tuple[str, list[str], list[str], list[str], list[str]], None, None]:
|
|
394
|
+
"""Wrap os.walk() and also return lists of ignored directories and files.
|
|
395
|
+
|
|
396
|
+
Yields tuples: (dirpath, included_dirnames, included_filenames, ignored_dirnames, ignored_filenames)
|
|
397
|
+
"""
|
|
393
398
|
for dirpath, dirnames, filenames in os.walk(self.path, topdown=True, **kwargs):
|
|
394
399
|
rel_dirpath = '' if dirpath == self.path else os.path.relpath(dirpath, self.path)
|
|
395
400
|
|
|
401
|
+
original_dirnames = list(dirnames)
|
|
402
|
+
included_dirnames = []
|
|
403
|
+
ignored_dirnames = []
|
|
404
|
+
for d in original_dirnames:
|
|
405
|
+
if self.is_ignored(os.path.join(rel_dirpath, d)):
|
|
406
|
+
ignored_dirnames.append(d)
|
|
407
|
+
else:
|
|
408
|
+
included_dirnames.append(d)
|
|
409
|
+
|
|
396
410
|
# decrease recursion depth of os.walk() by ignoring subdirectories because of topdown=True
|
|
397
411
|
# slicing ([:]) is mandatory to change dict in-place!
|
|
398
|
-
dirnames[:] =
|
|
412
|
+
dirnames[:] = included_dirnames
|
|
399
413
|
|
|
400
|
-
|
|
401
|
-
|
|
414
|
+
included_filenames = []
|
|
415
|
+
ignored_filenames = []
|
|
416
|
+
for f in filenames:
|
|
417
|
+
if self.is_ignored(os.path.join(rel_dirpath, f)):
|
|
418
|
+
ignored_filenames.append(f)
|
|
419
|
+
else:
|
|
420
|
+
included_filenames.append(f)
|
|
402
421
|
|
|
403
|
-
yield dirpath, dirnames,
|
|
422
|
+
yield dirpath, dirnames, included_filenames, ignored_dirnames, ignored_filenames
|
|
404
423
|
|
|
405
424
|
@classmethod
|
|
406
425
|
def build(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
cycode/__init__.py,sha256=
|
|
1
|
+
cycode/__init__.py,sha256=XN1WA4LmLRY3X64V9asZ0ddr2SwdNaBw1wb5fkYwR_Q,114
|
|
2
2
|
cycode/__main__.py,sha256=Z3bD5yrA7yPvAChcADQrqCaZd0ChGI1gdiwALwbWJ6U,104
|
|
3
3
|
cycode/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
cycode/cli/app.py,sha256=UC5A5TKIvlxOYKERfJykN8apTT0VyMY5pUjRh_LM-dw,6098
|
|
@@ -96,7 +96,7 @@ cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py,sha256=WS_T9-2C
|
|
|
96
96
|
cycode/cli/files_collector/sca/sbt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
97
|
cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py,sha256=6ZFTWkga2bZ_dwCCWeZxDkgBMEOLw4S_YnhIYGBSKbc,617
|
|
98
98
|
cycode/cli/files_collector/sca/sca_file_collector.py,sha256=KY-IcLY_dyV7fak1hw_MIl1RyqqRnIxwPufjgGYQPjI,7701
|
|
99
|
-
cycode/cli/files_collector/walk_ignore.py,sha256=
|
|
99
|
+
cycode/cli/files_collector/walk_ignore.py,sha256=6zqvkm20qx8k_ox-60zL1vlAYmrJdZk3mtS273hssC0,2062
|
|
100
100
|
cycode/cli/files_collector/zip_documents.py,sha256=WTNLp4yHY6zeVYkE2QTOO8K93cJEA9I-BmD39sRdo5k,1837
|
|
101
101
|
cycode/cli/logger.py,sha256=mlaYEQGYd582fTCc3SC3cFMj0PKTB6EsaI12Q4VL1z8,65
|
|
102
102
|
cycode/cli/main.py,sha256=QTPqIZsJsNK_vun8---vP2jP4ljlNJ15xidNrQ-Y0Rc,316
|
|
@@ -130,7 +130,7 @@ cycode/cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
130
130
|
cycode/cli/utils/enum_utils.py,sha256=h_VTCfJ-0hnhwDsEznmx56rJrCb5FQ8u6PrI6p8MP3E,187
|
|
131
131
|
cycode/cli/utils/get_api_client.py,sha256=J3hls7A-ktBYBbAvLm2zk-wC3QLfIy0QpjnlXbxDb5o,1697
|
|
132
132
|
cycode/cli/utils/git_proxy.py,sha256=FPHMBiyLFK9X9vKYpKySRKJH6Dc9Cb3nO241Q95dASE,2911
|
|
133
|
-
cycode/cli/utils/ignore_utils.py,sha256=
|
|
133
|
+
cycode/cli/utils/ignore_utils.py,sha256=cODqhnOHA2kRo8rMY0YcmcKkmXNPOC9UTCmFu62RRqE,15567
|
|
134
134
|
cycode/cli/utils/jwt_utils.py,sha256=TfTHCCCxKO6RvSKT2qspx4577Gax3n9YRj2UgigpGuQ,537
|
|
135
135
|
cycode/cli/utils/path_utils.py,sha256=OmAOtZwvPmYqqhBnB4jI6hkSnCkGpSOibY7PtP213Cc,3235
|
|
136
136
|
cycode/cli/utils/progress_bar.py,sha256=bKBWHHdZsVkdDdWMJLfgLGR0cBYeB44P_DpRM8pvWqU,9528
|
|
@@ -159,8 +159,8 @@ cycode/cyclient/report_client.py,sha256=h12pz3vWCwDF73BhqFX7iDSxBgQDFwkiGh3hmul2
|
|
|
159
159
|
cycode/cyclient/scan_client.py,sha256=nQJyt34Bne8UAQNj9OHSgvoCfI1EJFKNaEeeGPnrKcg,12471
|
|
160
160
|
cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
|
|
161
161
|
cycode/logger.py,sha256=xAzpkWLZhixO4egRcYn4HXM9lIfx5wHdpkHxNc5jrX8,2225
|
|
162
|
-
cycode-3.5.1.
|
|
163
|
-
cycode-3.5.1.
|
|
164
|
-
cycode-3.5.1.
|
|
165
|
-
cycode-3.5.1.
|
|
166
|
-
cycode-3.5.1.
|
|
162
|
+
cycode-3.5.1.dev4.dist-info/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
|
|
163
|
+
cycode-3.5.1.dev4.dist-info/METADATA,sha256=ATB9EQPCLzKsePOha1laW_wGGdpzZJ0kxr3CxTRCNIk,75852
|
|
164
|
+
cycode-3.5.1.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
165
|
+
cycode-3.5.1.dev4.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
|
|
166
|
+
cycode-3.5.1.dev4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|