Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40eaf7d

Browse files
* Usage of@staticmethodAll the known static methods are marked with@staticmethod decorators.* Fix for "ERROR: Unexpected indentation. [docutils]"This commit should fix an unstable error in CI:/pg/testgres/testgres/api.py:docstring of testgres.api.get_remote_node:5: ERROR: Unexpected indentation. [docutils]
1 parent44b99f0 commit40eaf7d

File tree

7 files changed

+17
-3
lines changed

7 files changed

+17
-3
lines changed

‎testgres/api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def get_remote_node(name=None, conn_params=None):
4747
Simply a wrapper around :class:`.PostgresNode` constructor for remote node.
4848
See :meth:`.PostgresNode.__init__` for details.
4949
For remote connection you can add the next parameter:
50-
conn_params = ConnectionParams(host='127.0.0.1',
51-
ssh_key=None,
52-
username=default_username())
50+
conn_params = ConnectionParams(host='127.0.0.1', ssh_key=None, username=default_username())
5351
"""
5452
returnget_new_node(name=name,conn_params=conn_params)

‎testgres/node.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,7 @@ def make_simple(
19391939

19401940
returnnode
19411941

1942+
@staticmethod
19421943
def_gettempdir_for_socket():
19431944
platform_system_name=platform.system().lower()
19441945

@@ -1966,6 +1967,7 @@ def _gettempdir_for_socket():
19661967

19671968
return"/tmp"
19681969

1970+
@staticmethod
19691971
def_gettempdir():
19701972
v=tempfile.gettempdir()
19711973

@@ -1984,6 +1986,7 @@ def _gettempdir():
19841986
# OK
19851987
returnv
19861988

1989+
@staticmethod
19871990
def_raise_bugcheck(msg):
19881991
asserttype(msg)==str# noqa: E721
19891992
assertmsg!=""

‎testgres/operations/helpers.py

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

33

44
classHelpers:
5+
@staticmethod
56
def_make_get_default_encoding_func():
67
# locale.getencoding is added in Python 3.11
78
ifhasattr(locale,'getencoding'):
@@ -13,6 +14,7 @@ def _make_get_default_encoding_func():
1314
# Prepared pointer on function to get a name of system codepage
1415
_get_default_encoding_func=_make_get_default_encoding_func()
1516

17+
@staticmethod
1618
defGetDefaultEncoding():
1719
#
1820
# Original idea/source was:
@@ -36,6 +38,7 @@ def GetDefaultEncoding():
3638
# Is it an unexpected situation?
3739
return'UTF-8'
3840

41+
@staticmethod
3942
defPrepareProcessInput(input,encoding):
4043
ifnotinput:
4144
returnNone

‎testgres/operations/local_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
265265
data2=__class__._prepare_data_to_write(data,binary)
266266
file.write(data2)
267267

268+
@staticmethod
268269
def_prepare_line_to_write(data,binary):
269270
data=__class__._prepare_data_to_write(data,binary)
270271

@@ -275,6 +276,7 @@ def _prepare_line_to_write(data, binary):
275276
asserttype(data)==str# noqa: E721
276277
returndata.rstrip('\n')+'\n'
277278

279+
@staticmethod
278280
def_prepare_data_to_write(data,binary):
279281
ifisinstance(data,bytes):
280282
returndataifbinaryelsedata.decode()

‎testgres/operations/raise_error.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44

55
classRaiseError:
6+
@staticmethod
67
defUtilityExitedWithNonZeroCode(cmd,exit_code,msg_arg,error,out):
78
asserttype(exit_code)==int# noqa: E721
89

@@ -20,12 +21,14 @@ def UtilityExitedWithNonZeroCode(cmd, exit_code, msg_arg, error, out):
2021
out=out,
2122
error=error)
2223

24+
@staticmethod
2325
def_TranslateDataIntoString(data):
2426
iftype(data)==bytes:# noqa: E721
2527
return__class__._TranslateDataIntoString__FromBinary(data)
2628

2729
returnstr(data)
2830

31+
@staticmethod
2932
def_TranslateDataIntoString__FromBinary(data):
3033
asserttype(data)==bytes# noqa: E721
3134

@@ -36,6 +39,7 @@ def _TranslateDataIntoString__FromBinary(data):
3639

3740
return"#cannot_decode_text"
3841

42+
@staticmethod
3943
def_BinaryIsASCII(data):
4044
asserttype(data)==bytes# noqa: E721
4145

‎testgres/operations/remote_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ def write(self, filename, data, truncate=False, binary=False, read_and_write=Fal
313313

314314
os.remove(tmp_file.name)
315315

316+
@staticmethod
316317
def_prepare_line_to_write(data,binary,encoding):
317318
data=__class__._prepare_data_to_write(data,binary,encoding)
318319

@@ -323,6 +324,7 @@ def _prepare_line_to_write(data, binary, encoding):
323324
asserttype(data)==str# noqa: E721
324325
returndata.rstrip('\n')+'\n'
325326

327+
@staticmethod
326328
def_prepare_data_to_write(data,binary,encoding):
327329
ifisinstance(data,bytes):
328330
returndataifbinaryelsedata.decode(encoding)

‎tests/test_simple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ def __exit__(self, type, value, traceback):
11251125
__class__.sm_prev_testgres_reserve_port=None
11261126
__class__.sm_prev_testgres_release_port=None
11271127

1128+
@staticmethod
11281129
def_proxy__reserve_port():
11291130
asserttype(__class__.sm_DummyPortMaxUsage)==int# noqa: E721
11301131
asserttype(__class__.sm_DummyPortTotalUsage)==int# noqa: E721
@@ -1144,6 +1145,7 @@ def _proxy__reserve_port():
11441145
__class__.sm_DummyPortCurrentUsage+=1
11451146
return__class__.sm_DummyPortNumber
11461147

1148+
@staticmethod
11471149
def_proxy__release_port(dummyPortNumber):
11481150
asserttype(dummyPortNumber)==int# noqa: E721
11491151

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp