Skip to content

Commit 24102f6

Browse files
authored
Merge pull request #399 from zowe/chore/update-py03
Update pyo3 dependency in Secrets SDK
2 parents 75ff182 + 3c1b36b commit 24102f6

6 files changed

Lines changed: 44 additions & 93 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All notable changes to the Zowe Client Python SDK will be documented in this file.
44

5+
## Recent Changes
6+
7+
### Enhancements
8+
9+
### Bug Fixes
10+
11+
- Updated the `pyo3` dependency of the Secrets SDK for technical currency. [#399](https://github.com/zowe/zowe-client-python-sdk/pull/399)
12+
513
## `1.0.0-dev26`
614

715
### Bug Fixes

src/core/zowe/core_for_zowe_sdk/config_file.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import warnings
1717
from copy import deepcopy
1818
from dataclasses import dataclass, field
19-
from typing import NamedTuple, Optional, Any, Union
19+
from typing import Any, NamedTuple, Optional, Union
2020

2121
import json5
2222
import requests
@@ -50,12 +50,11 @@ class ConfigFile:
5050
"""
5151
Class used to represent a single config file.
5252
53-
Mainly it will have the following details :
53+
Mainly it will have the following details:
5454
1. Type ("User Config" or "Team Config")
55-
-------
56-
User Configs override Team Configs.
57-
User Configs are used to have personalised config details
58-
that the user don't want to have in the Team Config.
55+
- User Configs override Team Configs.
56+
- User Configs are used to have personalised config details
57+
- that the user don't want to have in the Team Config.
5958
2. Directory in which the file is located.
6059
3. Name (excluding .config.json or .config.user.json)
6160
4. Contents of the file.
@@ -75,7 +74,7 @@ class ConfigFile:
7574
jsonc: Optional[dict[str, Any]] = None
7675
_missing_secure_props: list[str] = field(default_factory=list)
7776

78-
__suppress_config_file_warnings: Optional[bool] = True,
77+
__suppress_config_file_warnings: Optional[bool] = True
7978
__logger = Log.register_logger(__name__)
8079

8180
@property
@@ -111,10 +110,7 @@ def location(self, dirname: str) -> None:
111110
self.__logger.error(f"given path {dirname} is not valid")
112111
raise FileNotFoundError(f"given path {dirname} is not valid")
113112

114-
def init_from_file(
115-
self,
116-
validate_schema: Optional[bool] = True
117-
) -> None:
113+
def init_from_file(self, validate_schema: Optional[bool] = True) -> None:
118114
"""
119115
Initialize the class variable after setting filepath (or if not set, autodiscover the file).
120116
@@ -276,7 +272,7 @@ def get_profile(
276272

277273
if profile_name is None:
278274
profile_name = self.get_profilename_from_profiletype(profile_type=profile_type or "")
279-
275+
280276
props: dict[str, Any] = self.load_profile_properties(profile_name=profile_name)
281277

282278
return Profile(props, profile_name, self._missing_secure_props)
@@ -387,7 +383,7 @@ def find_profile(self, path: str, profiles: dict[str, Any]) -> Optional[dict[str
387383
for k, v in profiles.items():
388384
if not isinstance(v, dict): # Ensure v is a dictionary
389385
if not self.__suppress_config_file_warnings:
390-
self.__logger.warning("Invalid profile passed when schame validation is off")
386+
self.__logger.warning("Invalid profile passed when schame validation is off")
391387
continue # Skip invalid entries
392388

393389
if segments[0] == k:
@@ -666,15 +662,14 @@ def get_profile_path_from_name(self, short_path: str) -> str:
666662
Returns the full profile path
667663
"""
668664
return re.sub(r"(^|\.)", r"\1profiles.", short_path)
669-
665+
670666
def suppress_config_warnings(self, value: bool) -> None:
671667
"""
672668
Suppress warnings in config files.
673669
674670
Parameters
675671
----------
676672
value: bool
677-
Warnings are shown or not
673+
Warnings are shown or not
678674
"""
679675
self.__suppress_config_file_warnings = value
680-

src/core/zowe/core_for_zowe_sdk/zosmf_profile.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import base64
1414
import os.path
15-
from typing import Tuple, Optional
15+
from typing import Optional, Tuple
1616

1717
import yaml
1818

@@ -32,8 +32,6 @@ class ZosmfProfile:
3232
"""
3333
Class used to represent a Zowe z/OSMF profile.
3434
35-
Description
36-
-----------
3735
This class is only used when there is already a Zowe z/OSMF profile created
3836
and the user opted to use the profile instead of passing the credentials directly
3937
in the object constructor.

src/secrets/Cargo.lock

Lines changed: 15 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/secrets/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ name = "keyring"
1111
crate-type = ["cdylib"]
1212

1313
[dependencies]
14-
pyo3 = { version = "0.24.1", features = ["abi3-py37", "generate-import-lib"] }
14+
pyo3 = { version = "0.29.0", features = ["abi3-py310", "generate-import-lib"] }
1515
secrets_core = { git = "https://github.com/zowe/zowe-cli.git", branch = "master" }

tests/unit/core/test_logger.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,23 @@ def test_all_loggers(self):
5656
def test_console_handler(self):
5757
Log.close_console_output()
5858
test = Log.register_logger("test")
59-
self.assertEqual(test.handlers[0], Log.file_handler)
59+
self.assertIn(Log.file_handler, test.handlers)
60+
self.assertNotIn(Log.console_handler, test.handlers)
6061

6162
Log.open_console_output()
62-
self.assertEqual(test.handlers[1], Log.console_handler)
63+
self.assertIn(Log.console_handler, test.handlers)
6364

6465
Log.set_console_output_level(logging.ERROR)
65-
self.assertEqual(logging.ERROR, test.handlers[1].level)
66+
self.assertEqual(logging.ERROR, Log.console_handler.level)
6667

6768
def test_file_handler(self):
6869
Log.close_file_output()
6970
test = Log.register_logger("test")
70-
self.assertEqual(test.handlers[0], Log.console_handler)
71+
self.assertIn(Log.console_handler, test.handlers)
72+
self.assertNotIn(Log.file_handler, test.handlers)
7173

7274
Log.open_file_output()
73-
self.assertEqual(test.handlers[1], Log.file_handler)
75+
self.assertIn(Log.file_handler, test.handlers)
7476

7577
Log.set_file_output_level(logging.ERROR)
76-
self.assertEqual(logging.ERROR, test.handlers[1].level)
78+
self.assertEqual(logging.ERROR, Log.file_handler.level)

0 commit comments

Comments
 (0)