Skip to content

Commit d1d81e7

Browse files
pylint: fix line-too-long cases
Fix several cases of C0301 line-too-long. Part of #270
1 parent 9ead2ed commit d1d81e7

12 files changed

+159
-72
lines changed

tarantool/connection.py

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,11 +1503,13 @@ def _get_auth_type(self):
15031503
auth_type = AUTH_TYPE_CHAP_SHA1
15041504
else:
15051505
if self._server_auth_type not in AUTH_TYPES:
1506-
raise ConfigurationError(f'Unknown server authentication type {self._server_auth_type}')
1506+
raise ConfigurationError('Unknown server authentication type ' +
1507+
str(self._server_auth_type))
15071508
auth_type = self._server_auth_type
15081509
else:
15091510
if self._client_auth_type not in AUTH_TYPES:
1510-
raise ConfigurationError(f'Unknown client authentication type {self._client_auth_type}')
1511+
raise ConfigurationError('Unknown client authentication type ' +
1512+
str(self._client_auth_type))
15111513
auth_type = self._client_auth_type
15121514

15131515
if auth_type == AUTH_TYPE_PAP_SHA256 and self.transport != SSL_TRANSPORT:
@@ -1900,7 +1902,8 @@ def ping(self, notime=False):
19001902
return "Success"
19011903
return finish_time - start_time
19021904

1903-
def select(self, space_name, key=None, *, offset=0, limit=0xffffffff, index=0, iterator=None, on_push=None, on_push_ctx=None):
1905+
def select(self, space_name, key=None, *, offset=0, limit=0xffffffff, index=0, iterator=None,
1906+
on_push=None, on_push_ctx=None):
19041907
"""
19051908
Execute a SELECT request: `select`_ a tuple from the space.
19061909
@@ -2199,7 +2202,8 @@ def _packer_factory(self):
21992202
def _unpacker_factory(self):
22002203
return self._unpacker_factory_impl(self)
22012204

2202-
def crud_insert(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2205+
def crud_insert(self, space_name: str, values: Union[tuple, list],
2206+
opts: Optional[dict]=None) -> CrudResult:
22032207
"""
22042208
Inserts row through the
22052209
`crud <https://github.com/tarantool/crud#insert>`__.
@@ -2232,7 +2236,8 @@ def crud_insert(self, space_name: str, values: Union[tuple, list], opts: Optiona
22322236

22332237
return CrudResult(crud_resp[0])
22342238

2235-
def crud_insert_object(self, space_name: str, values: dict, opts: Optional[dict]=None) -> CrudResult:
2239+
def crud_insert_object(self, space_name: str, values: dict,
2240+
opts: Optional[dict]=None) -> CrudResult:
22362241
"""
22372242
Inserts object row through the
22382243
`crud <https://github.com/tarantool/crud#insert>`__.
@@ -2265,7 +2270,8 @@ def crud_insert_object(self, space_name: str, values: dict, opts: Optional[dict]
22652270

22662271
return CrudResult(crud_resp[0])
22672272

2268-
def crud_insert_many(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2273+
def crud_insert_many(self, space_name: str, values: Union[tuple, list],
2274+
opts: Optional[dict]=None) -> CrudResult:
22692275
"""
22702276
Inserts batch rows through the
22712277
`crud <https://github.com/tarantool/crud#insert-many>`__.
@@ -2305,7 +2311,8 @@ def crud_insert_many(self, space_name: str, values: Union[tuple, list], opts: Op
23052311

23062312
return res
23072313

2308-
def crud_insert_object_many(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2314+
def crud_insert_object_many(self, space_name: str, values: Union[tuple, list],
2315+
opts: Optional[dict]=None) -> CrudResult:
23092316
"""
23102317
Inserts batch object rows through the
23112318
`crud <https://github.com/tarantool/crud#insert-many>`__.
@@ -2377,7 +2384,8 @@ def crud_get(self, space_name: str, key: int, opts: Optional[dict]=None) -> Crud
23772384

23782385
return CrudResult(crud_resp[0])
23792386

2380-
def crud_update(self, space_name: str, key: int, operations: Optional[list]=None, opts: Optional[dict]=None) -> CrudResult:
2387+
def crud_update(self, space_name: str, key: int, operations: Optional[list]=None,
2388+
opts: Optional[dict]=None) -> CrudResult:
23812389
"""
23822390
Updates row through the
23832391
`crud <https://github.com/tarantool/crud#update>`__.
@@ -2447,7 +2455,8 @@ def crud_delete(self, space_name: str, key: int, opts: Optional[dict]=None) -> C
24472455

24482456
return CrudResult(crud_resp[0])
24492457

2450-
def crud_replace(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2458+
def crud_replace(self, space_name: str, values: Union[tuple, list],
2459+
opts: Optional[dict]=None) -> CrudResult:
24512460
"""
24522461
Replaces row through the
24532462
`crud <https://github.com/tarantool/crud#replace>`__.
@@ -2480,7 +2489,8 @@ def crud_replace(self, space_name: str, values: Union[tuple, list], opts: Option
24802489

24812490
return CrudResult(crud_resp[0])
24822491

2483-
def crud_replace_object(self, space_name: str, values: dict, opts: Optional[dict]=None) -> CrudResult:
2492+
def crud_replace_object(self, space_name: str, values: dict,
2493+
opts: Optional[dict]=None) -> CrudResult:
24842494
"""
24852495
Replaces object row through the
24862496
`crud <https://github.com/tarantool/crud#replace>`__.
@@ -2513,7 +2523,8 @@ def crud_replace_object(self, space_name: str, values: dict, opts: Optional[dict
25132523

25142524
return CrudResult(crud_resp[0])
25152525

2516-
def crud_replace_many(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2526+
def crud_replace_many(self, space_name: str, values: Union[tuple, list],
2527+
opts: Optional[dict]=None) -> CrudResult:
25172528
"""
25182529
Replaces batch rows through the
25192530
`crud <https://github.com/tarantool/crud#replace-many>`__.
@@ -2553,7 +2564,8 @@ def crud_replace_many(self, space_name: str, values: Union[tuple, list], opts: O
25532564

25542565
return res
25552566

2556-
def crud_replace_object_many(self, space_name: str, values: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2567+
def crud_replace_object_many(self, space_name: str, values: Union[tuple, list],
2568+
opts: Optional[dict]=None) -> CrudResult:
25572569
"""
25582570
Replaces batch object rows through the
25592571
`crud <https://github.com/tarantool/crud#replace-many>`__.
@@ -2593,7 +2605,8 @@ def crud_replace_object_many(self, space_name: str, values: Union[tuple, list],
25932605

25942606
return res
25952607

2596-
def crud_upsert(self, space_name: str, values: Union[tuple, list], operations: Optional[list]=None, opts: Optional[dict]=None) -> CrudResult:
2608+
def crud_upsert(self, space_name: str, values: Union[tuple, list],
2609+
operations: Optional[list]=None, opts: Optional[dict]=None) -> CrudResult:
25972610
"""
25982611
Upserts row through the
25992612
`crud <https://github.com/tarantool/crud#upsert>`__.
@@ -2632,7 +2645,9 @@ def crud_upsert(self, space_name: str, values: Union[tuple, list], operations: O
26322645

26332646
return CrudResult(crud_resp[0])
26342647

2635-
def crud_upsert_object(self, space_name: str, values: dict, operations: Optional[list]=None, opts: Optional[dict]=None) -> CrudResult:
2648+
def crud_upsert_object(self, space_name: str, values: dict,
2649+
operations: Optional[list]=None,
2650+
opts: Optional[dict]=None) -> CrudResult:
26362651
"""
26372652
Upserts object row through the
26382653
`crud <https://github.com/tarantool/crud#upsert>`__.
@@ -2671,7 +2686,8 @@ def crud_upsert_object(self, space_name: str, values: dict, operations: Optional
26712686

26722687
return CrudResult(crud_resp[0])
26732688

2674-
def crud_upsert_many(self, space_name: str, values_operation: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2689+
def crud_upsert_many(self, space_name: str, values_operation: Union[tuple, list],
2690+
opts: Optional[dict]=None) -> CrudResult:
26752691
"""
26762692
Upserts batch rows through the
26772693
`crud <https://github.com/tarantool/crud#upsert-many>`__.
@@ -2711,7 +2727,8 @@ def crud_upsert_many(self, space_name: str, values_operation: Union[tuple, list]
27112727

27122728
return res
27132729

2714-
def crud_upsert_object_many(self, space_name: str, values_operation: Union[tuple, list], opts: Optional[dict]=None) -> CrudResult:
2730+
def crud_upsert_object_many(self, space_name: str, values_operation: Union[tuple, list],
2731+
opts: Optional[dict]=None) -> CrudResult:
27152732
"""
27162733
Upserts batch object rows through the
27172734
`crud <https://github.com/tarantool/crud#upsert-many>`__.
@@ -2751,7 +2768,8 @@ def crud_upsert_object_many(self, space_name: str, values_operation: Union[tuple
27512768

27522769
return res
27532770

2754-
def crud_select(self, space_name: str, conditions: Optional[list]=None, opts: Optional[dict]=None) -> CrudResult:
2771+
def crud_select(self, space_name: str, conditions: Optional[list]=None,
2772+
opts: Optional[dict]=None) -> CrudResult:
27552773
"""
27562774
Selects rows through the
27572775
`crud <https://github.com/tarantool/crud#select>`__.
@@ -2939,7 +2957,8 @@ def crud_storage_info(self, opts: Optional[dict]=None) -> dict:
29392957

29402958
return crud_resp[0]
29412959

2942-
def crud_count(self, space_name: str, conditions: Optional[list]=None, opts: Optional[dict]=None) -> int:
2960+
def crud_count(self, space_name: str, conditions: Optional[list]=None,
2961+
opts: Optional[dict]=None) -> int:
29432962
"""
29442963
Gets rows count through the
29452964
`crud <https://github.com/tarantool/crud#count>`__.

tarantool/connection_pool.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,16 @@ def _get_new_state(self, unit):
553553
try:
554554
conn.connect()
555555
except NetworkError as exc:
556-
msg = f"Failed to connect to {unit.addr['host']}:{unit.addr['port']}, reason: {repr(exc)}"
556+
msg = (f"Failed to connect to {unit.addr['host']}:{unit.addr['port']}, "
557+
f"reason: {repr(exc)}")
557558
warn(msg, ClusterConnectWarning)
558559
return InstanceState(Status.UNHEALTHY)
559560

560561
try:
561562
resp = conn.call('box.info')
562563
except NetworkError as exc:
563-
msg = f"Failed to get box.info for {unit.addr['host']}:{unit.addr['port']}, reason: {repr(exc)}"
564+
msg = (f"Failed to get box.info for {unit.addr['host']}:{unit.addr['port']}, "
565+
f"reason: {repr(exc)}")
564566
warn(msg, PoolTolopogyWarning)
565567
return InstanceState(Status.UNHEALTHY)
566568

@@ -813,7 +815,8 @@ def replace(self, space_name, values, *, mode=Mode.RW, on_push=None, on_push_ctx
813815
.. _replace: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/replace/
814816
"""
815817

816-
return self._send(mode, 'replace', space_name, values, on_push=on_push, on_push_ctx=on_push_ctx)
818+
return self._send(mode, 'replace', space_name, values,
819+
on_push=on_push, on_push_ctx=on_push_ctx)
817820

818821
def insert(self, space_name, values, *, mode=Mode.RW, on_push=None, on_push_ctx=None):
819822
"""
@@ -842,7 +845,8 @@ def insert(self, space_name, values, *, mode=Mode.RW, on_push=None, on_push_ctx=
842845
.. _insert: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/insert/
843846
"""
844847

845-
return self._send(mode, 'insert', space_name, values, on_push=on_push, on_push_ctx=on_push_ctx)
848+
return self._send(mode, 'insert', space_name, values,
849+
on_push=on_push, on_push_ctx=on_push_ctx)
846850

847851
def delete(self, space_name, key, *, index=0, mode=Mode.RW, on_push=None, on_push_ctx=None):
848852
"""
@@ -874,9 +878,11 @@ def delete(self, space_name, key, *, index=0, mode=Mode.RW, on_push=None, on_pus
874878
.. _delete: https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/delete/
875879
"""
876880

877-
return self._send(mode, 'delete', space_name, key, index=index, on_push=on_push, on_push_ctx=on_push_ctx)
881+
return self._send(mode, 'delete', space_name, key, index=index,
882+
on_push=on_push, on_push_ctx=on_push_ctx)
878883

879-
def upsert(self, space_name, tuple_value, op_list, *, index=0, mode=Mode.RW, on_push=None, on_push_ctx=None):
884+
def upsert(self, space_name, tuple_value, op_list, *, index=0, mode=Mode.RW,
885+
on_push=None, on_push_ctx=None):
880886
"""
881887
Execute an UPSERT request on the pool server: `upsert`_ a tuple to
882888
the space. Refer to :meth:`~tarantool.Connection.upsert`.
@@ -912,7 +918,8 @@ def upsert(self, space_name, tuple_value, op_list, *, index=0, mode=Mode.RW, on_
912918
return self._send(mode, 'upsert', space_name, tuple_value,
913919
op_list, index=index, on_push=on_push, on_push_ctx=on_push_ctx)
914920

915-
def update(self, space_name, key, op_list, *, index=0, mode=Mode.RW, on_push=None, on_push_ctx=None):
921+
def update(self, space_name, key, op_list, *, index=0, mode=Mode.RW,
922+
on_push=None, on_push_ctx=None):
916923
"""
917924
Execute an UPDATE request on the pool server: `update`_ a tuple
918925
in the space. Refer to :meth:`~tarantool.Connection.update`.

tarantool/msgpack_ext/types/datetime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ def __add__(self, other):
423423
"""
424424

425425
if not isinstance(other, Interval):
426-
raise TypeError(f"unsupported operand type(s) for +: '{type(self)}' and '{type(other)}'")
426+
raise TypeError("unsupported operand type(s) for +: "
427+
f"'{type(self)}' and '{type(other)}'")
427428

428429
return self._interval_operation(other, sign=1)
429430

tarantool/msgpack_ext/types/interval.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def __add__(self, other):
120120
"""
121121

122122
if not isinstance(other, Interval):
123-
raise TypeError(f"unsupported operand type(s) for +: '{type(self)}' and '{type(other)}'")
123+
raise TypeError("unsupported operand type(s) for +: "
124+
f"'{type(self)}' and '{type(other)}'")
124125

125126
# Tarantool saves adjust of the first argument
126127
#
@@ -168,7 +169,8 @@ def __sub__(self, other):
168169
"""
169170

170171
if not isinstance(other, Interval):
171-
raise TypeError(f"unsupported operand type(s) for -: '{type(self)}' and '{type(other)}'")
172+
raise TypeError("unsupported operand type(s) for -: "
173+
f"'{type(self)}' and '{type(other)}'")
172174

173175
# Tarantool saves adjust of the first argument
174176
#

test/suites/test_crud.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def setUp(self):
8686
},
8787
'error': {
8888
'input': {
89-
'args': ['tester', {'id': 2, 'bucket_id': 100, 'name': 'Logan'}, {'timeout': 10}],
89+
'args': ['tester', {'id': 2, 'bucket_id': 100, 'name': 'Logan'},
90+
{'timeout': 10}],
9091
},
9192
'output': {
9293
'str': [
@@ -266,7 +267,10 @@ def setUp(self):
266267
'crud_replace_object': {
267268
'success': {
268269
'input': {
269-
'args': ['tester', {'id': 2, 'bucket_id': 100, 'name': 'Eliza'}, {'timeout': 10}],
270+
'args': [
271+
'tester', {'id': 2, 'bucket_id': 100, 'name': 'Eliza'},
272+
{'timeout': 10}
273+
],
270274
},
271275
'output': {
272276
'rows': [[2, 100, 'Eliza']],
@@ -374,7 +378,8 @@ def setUp(self):
374378
'crud_upsert': {
375379
'success': {
376380
'input': {
377-
'args': ['tester', [2, 100, 'Cephus'], [['+', 'bucket_id', 1]], {'timeout': 10}],
381+
'args': ['tester', [2, 100, 'Cephus'], [['+', 'bucket_id', 1]],
382+
{'timeout': 10}],
378383
},
379384
'output': {
380385
'rows': [],
@@ -455,10 +460,22 @@ def setUp(self):
455460
'args': [
456461
'tester',
457462
[
458-
[{'id': 2, 'bucket_id': 100, 'name': 'Cephus'}, [['+', 'bucket_id', 1]]],
459-
[{'id': 3, 'bucket_id': 100, 'name': 'Esau'}, [['+', 'bucket_id', 1]]],
460-
[{'id': 4, 'bucket_id': 100, 'name': 'Haman'}, [['+', 'bucket_id', 1]]],
461-
[{'id': 5, 'bucket_id': 100, 'name': 'Gershon'}, [['+', 'bucket_id', 1]]],
463+
[
464+
{'id': 2, 'bucket_id': 100, 'name': 'Cephus'},
465+
[['+', 'bucket_id', 1]]
466+
],
467+
[
468+
{'id': 3, 'bucket_id': 100, 'name': 'Esau'},
469+
[['+', 'bucket_id', 1]]
470+
],
471+
[
472+
{'id': 4, 'bucket_id': 100, 'name': 'Haman'},
473+
[['+', 'bucket_id', 1]]
474+
],
475+
[
476+
{'id': 5, 'bucket_id': 100, 'name': 'Gershon'},
477+
[['+', 'bucket_id', 1]]
478+
],
462479
],
463480
{'timeout': 10},
464481
],
@@ -470,10 +487,22 @@ def setUp(self):
470487
'args': [
471488
'tester',
472489
[
473-
[{'id': 3, 'bucket_id': 100, 'name': 'Ephron'}, [['+', 'bucket_id', 1]]],
474-
[{'id': 4, 'bucket_id': 100, 'name': 'Ethan'}, [['+', 'bucket_id', 1]]],
475-
[{'id': 7, 'bucket_id': 100, 'name': 0}, [['+', 'bucket_id', 1]]],
476-
[{'id': 8, 'bucket_id': 100, 'name': 0}, [['+', 'bucket_id', 1]]],
490+
[
491+
{'id': 3, 'bucket_id': 100, 'name': 'Ephron'},
492+
[['+', 'bucket_id', 1]]
493+
],
494+
[
495+
{'id': 4, 'bucket_id': 100, 'name': 'Ethan'},
496+
[['+', 'bucket_id', 1]]
497+
],
498+
[
499+
{'id': 7, 'bucket_id': 100, 'name': 0},
500+
[['+', 'bucket_id', 1]]
501+
],
502+
[
503+
{'id': 8, 'bucket_id': 100, 'name': 0},
504+
[['+', 'bucket_id', 1]]
505+
],
477506
],
478507
{'timeout': 10},
479508
],

test/suites/test_datetime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ def test_datetime_class_invalid_init(self):
279279
'python': tarantool.Datetime(timestamp=1661958474, nsec=308543321,
280280
tz='Europe/Moscow', timestamp_since_utc_epoch=True),
281281
'msgpack': (b'\x4a\x79\x0f\x63\x00\x00\x00\x00\x59\xff\x63\x12\xb4\x00\xb3\x03'),
282-
'tarantool': r"datetime.new({timestamp=1661969274, nsec=308543321, tz='Europe/Moscow'})",
282+
'tarantool': r"datetime.new({timestamp=1661969274, nsec=308543321, " +
283+
r"tz='Europe/Moscow'})",
283284
},
284285
}
285286

test/suites/test_decimal.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,15 @@ def test_tarantool_encode_error(self):
367367
'tarantool': "decimal.new('-99999999999999999999999999999999999999')",
368368
},
369369
'decimal_limit_break_tail_9': {
370-
'python': decimal.Decimal('99999999999999999999999999999999999999.1111111111111111111111111'),
370+
'python': decimal.Decimal('99999999999999999999999999999999999999.11111111111111'
371+
'11111111111'),
371372
'msgpack': (b'\x00\x09\x99\x99\x99\x99\x99\x99\x99\x99\x99' +
372373
b'\x99\x99\x99\x99\x99\x99\x99\x99\x99\x9c'),
373374
'tarantool': "decimal.new('99999999999999999999999999999999999999')",
374375
},
375376
'decimal_limit_break_tail_10': {
376-
'python': decimal.Decimal('-99999999999999999999999999999999999999.1111111111111111111111111'),
377+
'python': decimal.Decimal('-99999999999999999999999999999999999999.11111111111111'
378+
'11111111111'),
377379
'msgpack': (b'\x00\x09\x99\x99\x99\x99\x99\x99\x99\x99\x99' +
378380
b'\x99\x99\x99\x99\x99\x99\x99\x99\x99\x9d'),
379381
'tarantool': "decimal.new('-99999999999999999999999999999999999999')",

0 commit comments

Comments
 (0)