added unnecessary-dunder-call to pylintrc files; disabled for certain lines (#655)
in run_tests.py, exception thrown by 'git remote add origin' when the remote already exists will not exit Signed-off-by: Mark Cohen <[email protected]>
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=all
|
disable=all
|
||||||
enable=line-too-long,invalid-name,pointless-statement,unspecified-encoding,
|
enable=line-too-long,
|
||||||
missing-function-docstring,missing-param-doc,differing-param-doc
|
invalid-name,
|
||||||
|
pointless-statement,
|
||||||
|
unspecified-encoding,
|
||||||
|
missing-function-docstring,
|
||||||
|
missing-param-doc,
|
||||||
|
differing-param-doc,
|
||||||
|
unnecessary-dunder-call
|
||||||
max-line-length=240
|
max-line-length=240
|
||||||
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=all
|
disable=all
|
||||||
enable=line-too-long,invalid-name,pointless-statement,unspecified-encoding
|
enable=line-too-long,
|
||||||
|
invalid-name,
|
||||||
|
pointless-statement,
|
||||||
|
unspecified-encoding,
|
||||||
|
unnecessary-dunder-call
|
||||||
max-line-length=240
|
max-line-length=240
|
||||||
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
||||||
@@ -174,7 +174,7 @@ class AttrDict(object):
|
|||||||
|
|
||||||
def get(self, key: Any, default: Any = None) -> Any:
|
def get(self, key: Any, default: Any = None) -> Any:
|
||||||
try:
|
try:
|
||||||
return self.__getattr__(key)
|
return self.__getattr__(key) # pylint: disable=unnecessary-dunder-call
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
if default is not None:
|
if default is not None:
|
||||||
return default
|
return default
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ enable=line-too-long,
|
|||||||
pointless-statement,
|
pointless-statement,
|
||||||
unspecified-encoding,
|
unspecified-encoding,
|
||||||
missing-param-doc,
|
missing-param-doc,
|
||||||
differing-param-doc
|
differing-param-doc,
|
||||||
|
unnecessary-dunder-call
|
||||||
max-line-length=240
|
max-line-length=240
|
||||||
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
good-names-rgxs=^[_a-z][_a-z0-9]?$
|
||||||
@@ -23,7 +23,7 @@ class TestPluginsClient:
|
|||||||
with warnings.catch_warnings(record=True) as w:
|
with warnings.catch_warnings(record=True) as w:
|
||||||
client = AsyncOpenSearch()
|
client = AsyncOpenSearch()
|
||||||
# testing double-init here
|
# testing double-init here
|
||||||
client.plugins.__init__(client) # type: ignore
|
client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call
|
||||||
assert (
|
assert (
|
||||||
str(w[0].message)
|
str(w[0].message)
|
||||||
== "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use "
|
== "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use "
|
||||||
|
|||||||
@@ -275,22 +275,22 @@ async def test_save_and_update_return_doc_meta(write_client: Any) -> None:
|
|||||||
resp = await w.save(return_doc_meta=True)
|
resp = await w.save(return_doc_meta=True)
|
||||||
assert resp["_index"] == "test-wiki"
|
assert resp["_index"] == "test-wiki"
|
||||||
assert resp["result"] == "created"
|
assert resp["result"] == "created"
|
||||||
assert resp.keys().__contains__("_id")
|
assert "_id" in resp.keys()
|
||||||
assert resp.keys().__contains__("_primary_term")
|
assert "_primary_term" in resp.keys()
|
||||||
assert resp.keys().__contains__("_seq_no")
|
assert "_seq_no" in resp.keys()
|
||||||
assert resp.keys().__contains__("_shards")
|
assert "_shards" in resp.keys()
|
||||||
assert resp.keys().__contains__("_version")
|
assert "_version" in resp.keys()
|
||||||
|
|
||||||
resp = await w.update(
|
resp = await w.update(
|
||||||
script="ctx._source.views += params.inc", inc=5, return_doc_meta=True
|
script="ctx._source.views += params.inc", inc=5, return_doc_meta=True
|
||||||
)
|
)
|
||||||
assert resp["_index"] == "test-wiki"
|
assert resp["_index"] == "test-wiki"
|
||||||
assert resp["result"] == "updated"
|
assert resp["result"] == "updated"
|
||||||
assert resp.keys().__contains__("_id")
|
assert "_id" in resp.keys()
|
||||||
assert resp.keys().__contains__("_primary_term")
|
assert "_primary_term" in resp.keys()
|
||||||
assert resp.keys().__contains__("_seq_no")
|
assert "_seq_no" in resp.keys()
|
||||||
assert resp.keys().__contains__("_shards")
|
assert "_shards" in resp.keys()
|
||||||
assert resp.keys().__contains__("_version")
|
assert "_version" in resp.keys()
|
||||||
|
|
||||||
|
|
||||||
async def test_init(write_client: Any) -> None:
|
async def test_init(write_client: Any) -> None:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class TestPluginsClient(TestCase):
|
|||||||
with self.assertWarns(Warning) as w:
|
with self.assertWarns(Warning) as w:
|
||||||
client = OpenSearch()
|
client = OpenSearch()
|
||||||
# double-init
|
# double-init
|
||||||
client.plugins.__init__(client) # type: ignore
|
client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
str(w.warnings[0].message),
|
str(w.warnings[0].message),
|
||||||
"Cannot load `alerting` directly to OpenSearch as "
|
"Cannot load `alerting` directly to OpenSearch as "
|
||||||
|
|||||||
@@ -284,22 +284,22 @@ def test_save_and_update_return_doc_meta(write_client: Any) -> None:
|
|||||||
resp = w.save(return_doc_meta=True)
|
resp = w.save(return_doc_meta=True)
|
||||||
assert resp["_index"] == "test-wiki"
|
assert resp["_index"] == "test-wiki"
|
||||||
assert resp["result"] == "created"
|
assert resp["result"] == "created"
|
||||||
assert resp.keys().__contains__("_id")
|
assert "_id" in resp.keys()
|
||||||
assert resp.keys().__contains__("_primary_term")
|
assert "_primary_term" in resp.keys()
|
||||||
assert resp.keys().__contains__("_seq_no")
|
assert "_seq_no" in resp.keys()
|
||||||
assert resp.keys().__contains__("_shards")
|
assert "_shards" in resp.keys()
|
||||||
assert resp.keys().__contains__("_version")
|
assert "_version" in resp.keys()
|
||||||
|
|
||||||
resp = w.update(
|
resp = w.update(
|
||||||
script="ctx._source.views += params.inc", inc=5, return_doc_meta=True
|
script="ctx._source.views += params.inc", inc=5, return_doc_meta=True
|
||||||
)
|
)
|
||||||
assert resp["_index"] == "test-wiki"
|
assert resp["_index"] == "test-wiki"
|
||||||
assert resp["result"] == "updated"
|
assert resp["result"] == "updated"
|
||||||
assert resp.keys().__contains__("_id")
|
assert "_id" in resp.keys()
|
||||||
assert resp.keys().__contains__("_primary_term")
|
assert "_primary_term" in resp.keys()
|
||||||
assert resp.keys().__contains__("_seq_no")
|
assert "_seq_no" in resp.keys()
|
||||||
assert resp.keys().__contains__("_shards")
|
assert "_shards" in resp.keys()
|
||||||
assert resp.keys().__contains__("_version")
|
assert "_version" in resp.keys()
|
||||||
|
|
||||||
|
|
||||||
def test_init(write_client: Any) -> None:
|
def test_init(write_client: Any) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user