cycode 3.4.1.dev2__py3-none-any.whl → 3.4.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 CHANGED
@@ -1 +1 @@
1
- __version__ = '3.4.1.dev2' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
1
+ __version__ = '3.4.1.dev4' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -4,6 +4,9 @@ from collections.abc import Hashable
4
4
  from typing import Any
5
5
 
6
6
  from cycode.cli.utils.yaml_utils import read_yaml_file, update_yaml_file
7
+ from cycode.logger import get_logger
8
+
9
+ logger = get_logger('Base File Manager')
7
10
 
8
11
 
9
12
  class BaseFileManager(ABC):
@@ -15,5 +18,11 @@ class BaseFileManager(ABC):
15
18
 
16
19
  def write_content_to_file(self, content: dict[Hashable, Any]) -> None:
17
20
  filename = self.get_filename()
18
- os.makedirs(os.path.dirname(filename), exist_ok=True)
21
+
22
+ try:
23
+ os.makedirs(os.path.dirname(filename), exist_ok=True)
24
+ except Exception as e:
25
+ logger.warning('Failed to create directory for file, %s', {'filename': filename}, exc_info=e)
26
+ return
27
+
19
28
  update_yaml_file(filename, content)
@@ -8,6 +8,9 @@ from cycode.cli.console import console
8
8
  from cycode.cli.user_settings.configuration_manager import ConfigurationManager
9
9
  from cycode.cli.utils.path_utils import get_file_content
10
10
  from cycode.cyclient.cycode_client_base import CycodeClientBase
11
+ from cycode.logger import get_logger
12
+
13
+ logger = get_logger('Version Checker')
11
14
 
12
15
 
13
16
  def _compare_versions(
@@ -154,8 +157,8 @@ class VersionChecker(CycodeClientBase):
154
157
  os.makedirs(os.path.dirname(self.cache_file), exist_ok=True)
155
158
  with open(self.cache_file, 'w', encoding='UTF-8') as f:
156
159
  f.write(str(time.time()))
157
- except OSError:
158
- pass
160
+ except Exception as e:
161
+ logger.debug('Failed to update version check cache file: %s', {'file': self.cache_file}, exc_info=e)
159
162
 
160
163
  def check_for_update(self, current_version: str, use_cache: bool = True) -> Optional[str]:
161
164
  """Check if an update is available for the current version.
@@ -35,7 +35,8 @@ def _yaml_object_safe_load(file: TextIO) -> dict[Hashable, Any]:
35
35
 
36
36
 
37
37
  def read_yaml_file(filename: str) -> dict[Hashable, Any]:
38
- if not os.path.exists(filename):
38
+ if not os.access(filename, os.R_OK) or not os.path.exists(filename):
39
+ logger.debug('Config file is not accessible or does not exist: %s', {'filename': filename})
39
40
  return {}
40
41
 
41
42
  with open(filename, encoding='UTF-8') as file:
@@ -43,6 +44,10 @@ def read_yaml_file(filename: str) -> dict[Hashable, Any]:
43
44
 
44
45
 
45
46
  def write_yaml_file(filename: str, content: dict[Hashable, Any]) -> None:
47
+ if not os.access(filename, os.W_OK) and os.path.exists(filename):
48
+ logger.warning('No write permission for file. Cannot save config, %s', {'filename': filename})
49
+ return
50
+
46
51
  with open(filename, 'w', encoding='UTF-8') as file:
47
52
  yaml.safe_dump(content, file)
48
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 3.4.1.dev2
3
+ Version: 3.4.1.dev4
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  Home-page: https://github.com/cycodehq/cycode-cli
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- cycode/__init__.py,sha256=B9hp2AibvqIGoMgw1bEA-t1ZCNK7WAwrFCgoXCWyPpk,114
1
+ cycode/__init__.py,sha256=6kwXn7fBKV44Hs8y0V2MWkNR2AkXWohd7wui8hn5naw,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
@@ -119,7 +119,7 @@ cycode/cli/printers/utils/detection_ordering/common_ordering.py,sha256=WxdDGL9Hj
119
119
  cycode/cli/printers/utils/detection_ordering/sca_ordering.py,sha256=9qasDxNYiFKn1iXn6vqz2tuUpx0ad-Ayz2ai483oons,2315
120
120
  cycode/cli/printers/utils/rich_helpers.py,sha256=HhPVpxZNBR7qNB_06VbVdshrgAwUIry2nO2036m3Zd0,946
121
121
  cycode/cli/user_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
- cycode/cli/user_settings/base_file_manager.py,sha256=5L9mft5r0HAHWaCBq4IRZ7hXSWfByitaxZ4iFstJjMU,590
122
+ cycode/cli/user_settings/base_file_manager.py,sha256=SLA5xRMTqSY-PtbeKCtVc9rP_ljxUYe3z3ZU-XE2x0w,844
123
123
  cycode/cli/user_settings/config_file_manager.py,sha256=KqMogXjtgO-ZbEGW0eN_ZUHn3tLQFJteV8zYDgEhIks,4954
124
124
  cycode/cli/user_settings/configuration_manager.py,sha256=sTJu1Zenxzm397Cbdg-0kN4z1K27dRBJJPfd4TqKP8A,8130
125
125
  cycode/cli/user_settings/credentials_manager.py,sha256=jT8pTjldk6WmDyTJPidYQxREuPiObexaP1HEmYpCcWU,3152
@@ -138,8 +138,8 @@ cycode/cli/utils/sentry.py,sha256=hHWYtiGKD6vRi8S6Jx9hycs5JpJvGlkBImXZfWfWB1o,36
138
138
  cycode/cli/utils/shell_executor.py,sha256=CuHeXoYM6VaYtDernWtf49_s1EfuU8nWxj4MPIAciww,1290
139
139
  cycode/cli/utils/string_utils.py,sha256=jrZ5B7351hVEibHQzyrAqJJoP3R3jgpONNEw3wMAUVA,2032
140
140
  cycode/cli/utils/task_timer.py,sha256=wxfM2TtJGjc1F17CIja_Qmt6zd4a1qdMwuz0ltgTDAg,2722
141
- cycode/cli/utils/version_checker.py,sha256=STz_Q8T1n_AfoJlDKyW3V0eI1vvpSaLyd1S449V430g,8059
142
- cycode/cli/utils/yaml_utils.py,sha256=1Vw5S1WZIHPi0dXeLTh70Q7mCUtsSS1173IWDO7q8xs,1493
141
+ cycode/cli/utils/version_checker.py,sha256=0f5PaTk02ZkDxzBqZOeMV9mU_CWcx6HKW80jUKFOOZs,8239
142
+ cycode/cli/utils/yaml_utils.py,sha256=R-tqzl0C-zoa42rS7nfWeHu3GJ0jpbQUyyqYYU2hleM,1818
143
143
  cycode/config.py,sha256=jHORGZQcAXkAGSf2XreC-RQoc8sdNWja69QKtPWTbWo,1044
144
144
  cycode/cyclient/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
145
  cycode/cyclient/auth_client.py,sha256=TwbmZ358Ancf-Q-IZolvfljZ8691_6botsqd0R0PLPk,2105
@@ -157,8 +157,8 @@ cycode/cyclient/report_client.py,sha256=h12pz3vWCwDF73BhqFX7iDSxBgQDFwkiGh3hmul2
157
157
  cycode/cyclient/scan_client.py,sha256=nQJyt34Bne8UAQNj9OHSgvoCfI1EJFKNaEeeGPnrKcg,12471
158
158
  cycode/cyclient/scan_config_base.py,sha256=mXsPZGYCtp85rv5GIige40yQZXuRcEKUW-VQJ0vgFzk,1201
159
159
  cycode/logger.py,sha256=xAzpkWLZhixO4egRcYn4HXM9lIfx5wHdpkHxNc5jrX8,2225
160
- cycode-3.4.1.dev2.dist-info/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
161
- cycode-3.4.1.dev2.dist-info/METADATA,sha256=slnNCDTycu4C6MKHxNHisO23TvBrItbtYB2-mlQvkNk,71912
162
- cycode-3.4.1.dev2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
- cycode-3.4.1.dev2.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
164
- cycode-3.4.1.dev2.dist-info/RECORD,,
160
+ cycode-3.4.1.dev4.dist-info/LICENCE,sha256=2Wx4N6mD_4xB7-E3hPkZ3MPhpJy__k_I8MaCSO-PDRo,1068
161
+ cycode-3.4.1.dev4.dist-info/METADATA,sha256=JVoD7BjrB610-2TwH85TKpwQWosHzcuA7oRNHGlyc7Q,71912
162
+ cycode-3.4.1.dev4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
163
+ cycode-3.4.1.dev4.dist-info/entry_points.txt,sha256=iDcVJM8ByLElVgvBgtYxDjw1kT7O8Mo0LcWZIT5L3Ig,45
164
+ cycode-3.4.1.dev4.dist-info/RECORD,,