Skip to content

Commit 3f64218

Browse files
committed
refactor: format and linting fix
1 parent 91a082f commit 3f64218

File tree

11 files changed

+2851
-2815
lines changed

11 files changed

+2851
-2815
lines changed

setup.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ def readme_md():
3333
# Check if SAP NWRFC SDK configured
3434
SAPNWRFC_HOME = os.environ.get("SAPNWRFC_HOME")
3535
if not SAPNWRFC_HOME:
36-
sys.exit(
37-
"Environment variable SAPNWRFC_HOME not set.\n"
38-
"Please specify this variable with the root directory of the SAP NWRFC Library."
39-
)
36+
sys.exit("Environment variable SAPNWRFC_HOME not set.\n" "Please specify this variable with the root directory of the SAP NWRFC Library.")
4037

4138
print("pyrfc version", __version__)
4239

@@ -217,7 +214,7 @@ def readme_md():
217214
"Programming Language :: Python :: 3.9",
218215
"Programming Language :: Python :: 3.10",
219216
"Programming Language :: Python :: 3.11",
220-
"Topic :: Software Development :: Libraries"
217+
"Topic :: Software Development :: Libraries",
221218
],
222219
keywords=f"{MODULE_NAME} {PYPIPACKAGE} pyrfc sap rfc nwrfc sapnwrfc",
223220
author="SAP SE",
@@ -234,6 +231,7 @@ def readme_md():
234231
extras_require={':"linux" in sys_platform': ["cython"]},
235232
cmdclass=CMDCLASS, # type: ignore
236233
ext_modules=cythonize(PYRFC_EXT, annotate=True, compiler_directives={"language_level": "1"}) # type: ignore
237-
if BUILD_CYTHON else [PYRFC_EXT], # type: ignore
234+
if BUILD_CYTHON
235+
else [PYRFC_EXT], # type: ignore
238236
test_suite=MODULE_NAME,
239237
)

src/pyrfc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@
5959

6060
__author__ = "SAP SE"
6161
__email__ = "srdjan.boskovic@sap.com"
62-
__version_info__ = (2, 7, 2)
62+
__version_info__ = (2, 7, 3)
6363
__version__ = ".".join(str(i) for i in __version_info__)

src/pyrfc/_cyrfc.cpp

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

src/pyrfc/_exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class RFCLibError(RFCError):
5656
30: "RFC_AUTHENTICATION_FAILURE",
5757
31: "RFC_CRYPTOLIB_FAILURE",
5858
32: "RFC_IO_FAILURE",
59-
33: "RFC_LOCKING_FAILURE"
59+
33: "RFC_LOCKING_FAILURE",
6060
}
6161

6262
def __init__(

src/pyrfc/config.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ _MASK_DTIME = 0x01
1010
_MASK_RETURN_IMPORT_PARAMS = 0x02
1111
_MASK_RSTRIP = 0x04
1212

13-
_LOCALE_RADIX = localeconv()['decimal_point']
13+
_LOCALE_RADIX = localeconv()["decimal_point"]
1414

1515
################################################################################
1616
# Enumerators, external and internal use
@@ -32,7 +32,7 @@ class RfcFieldType(Enum):
3232
RFCTYPE_BCD = RFCTYPE.RFCTYPE_BCD
3333
RFCTYPE_TIME = RFCTYPE.RFCTYPE_TIME
3434
RFCTYPE_BYTE = RFCTYPE.RFCTYPE_BYTE
35-
RFCTYPE_TABLE= RFCTYPE.RFCTYPE_TABLE
35+
RFCTYPE_TABLE = RFCTYPE.RFCTYPE_TABLE
3636
RFCTYPE_NUM = RFCTYPE.RFCTYPE_NUM
3737
RFCTYPE_FLOAT = RFCTYPE.RFCTYPE_FLOAT
3838
RFCTYPE_INT = RFCTYPE.RFCTYPE_INT

src/pyrfc/nwrfcsdk.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ def set_locale_radix(value=None):
146146
_LOCALE_RADIX = value
147147
return _LOCALE_RADIX
148148

149+
149150
def enum_names(enum_obj):
150151
return set(e.name for e in enum_obj)
151152

153+
152154
def enum_values(enum_obj):
153155
return set(e.value for e in enum_obj)
154156

tests/function_description_utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,8 @@ def compare_function_description(fd1, fd2):
4747
assert q["type_description"] is None
4848
else:
4949
# compare fields
50-
fd1_fields = (
51-
p["type_description"]["fields"]
52-
if type(p["type_description"]) is dict
53-
else p["type_description"].fields
54-
)
55-
fd2_fields = (
56-
q["type_description"]["fields"]
57-
if type(q["type_description"]) is dict
58-
else q["type_description"].fields
59-
)
50+
fd1_fields = p["type_description"]["fields"] if type(p["type_description"]) is dict else p["type_description"].fields
51+
fd2_fields = q["type_description"]["fields"] if type(q["type_description"]) is dict else q["type_description"].fields
6052
assert len(fd1_fields) == len(fd2_fields)
6153
assert fd1_fields == fd2_fields
6254

tests/server/server.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def my_auth_check(func_name=False, request_context={}):
2222
set_ini_file_directory(dir_path)
2323

2424
# create server instance
25-
server = Server(
26-
{"dest": "gateway"}, {"dest": "MME"}, {"port": 8081, "server_log": False}
27-
)
25+
server = Server({"dest": "gateway"}, {"dest": "MME"}, {"port": 8081, "server_log": False})
2826

2927
# expose python function my_stfc_connection as ABAP function STFC_CONNECTION, that ABAP server can call
3028
server.add_function("STFC_CONNECTION", my_stfc_connection)

tests/test_client_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
class TestConnection:
18-
1918
def test_config_rstrip_false(self):
2019
conn = pyrfc.Connection(config={"rstrip": False}, **config_sections["coevi51"])
2120

tests/test_connection.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,7 @@ def test_call_over_closed_connection(self):
9898
with pytest.raises(pyrfc.RFCError) as ex:
9999
conn.call("STFC_CONNECTION", REQUTEXT=hello)
100100
error = ex.value
101-
assert (
102-
error.args[0]
103-
== "Remote function module 'STFC_CONNECTION' invocation rejected because the connection is closed"
104-
)
101+
assert error.args[0] == "Remote function module 'STFC_CONNECTION' invocation rejected because the connection is closed"
105102

106103
def test_ping(self):
107104
assert self.conn.alive
@@ -112,10 +109,7 @@ def test_ping(self):
112109
error = ex.value
113110
assert error.code == 13
114111
assert error.key == "RFC_INVALID_HANDLE"
115-
assert (
116-
error.message == "An invalid handle 'RFC_CONNECTION_HANDLE' was passed to the API call"
117-
or error.message == "An invalid handle was passed to the API call"
118-
)
112+
assert error.message == "An invalid handle 'RFC_CONNECTION_HANDLE' was passed to the API call" or error.message == "An invalid handle was passed to the API call"
119113

120114
def test_RFM_name_string(self):
121115
result = self.conn.call("STFC_CONNECTION", REQUTEXT=UNICODETEST)
@@ -195,9 +189,9 @@ def test_STFC_STRUCTURE(self):
195189
)
196190
out = dict(
197191
RFCFLOAT=imp["RFCFLOAT"] + 1, # type: ignore
198-
RFCINT2=imp["RFCINT2"] + 1, # type: ignore
199-
RFCINT1=imp["RFCINT1"] + 1, # type: ignore
200-
RFCINT4=imp["RFCINT4"] + 1, # type: ignore
192+
RFCINT2=imp["RFCINT2"] + 1, # type: ignore
193+
RFCINT1=imp["RFCINT1"] + 1, # type: ignore
194+
RFCINT4=imp["RFCINT4"] + 1, # type: ignore
201195
RFCHEX3=b"\xf1\xf2\xf3",
202196
RFCCHAR1="X",
203197
RFCCHAR2="YZ",

0 commit comments

Comments
 (0)