Skip to content

Commit

Permalink
Fix: typos. (opensearch-project#526)
Browse files Browse the repository at this point in the history
* Fix: typo.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: typo.

Signed-off-by: dblock <dblock@amazon.com>

* Fixed its.

Signed-off-by: dblock <dblock@amazon.com>

* Added Visual Code settings to .gitignore.

Signed-off-by: dblock <dblock@amazon.com>

* Added loop type for async client.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: roma2023 <romasaparhan19@gmail.com>
  • Loading branch information
dblock authored and roma2023 committed Dec 28, 2023
1 parent c13dd31 commit 36df6e8
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 32 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ test_opensearch/cover
test_opensearch/local.py
.ci/output

#Vi text editor
# vi text editor
.*.swp
*~

# Visual Studio Code
.vscode
3 changes: 2 additions & 1 deletion opensearchpy/_async/http_aiohttp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# specific language governing permissions and limitations
# under the License.

from asyncio import AbstractEventLoop
from typing import Any, Collection, Mapping, Optional, Tuple, Union

from ..connection import Connection
Expand Down Expand Up @@ -65,7 +66,7 @@ class AIOHttpConnection(AsyncConnection):
ssl_context: Optional[Any] = ...,
http_compress: Optional[bool] = ...,
opaque_id: Optional[str] = ...,
loop: Any = ...,
loop: Optional[AbstractEventLoop] = ...,
trust_env: bool = ...,
**kwargs: Any
) -> None: ...
6 changes: 3 additions & 3 deletions opensearchpy/_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,14 @@ def get_connection(self):
async def perform_request(self, method, url, headers=None, params=None, body=None):
"""
Perform the actual request. Retrieve a connection from the connection
pool, pass all the information to it's perform_request method and
pool, pass all the information to its perform_request method and
return the data.
If an exception was raised, mark the connection as failed and retry (up
to `max_retries` times).
If the operation was successful and the connection used was previously
marked as dead, mark it as live, resetting it's failure count.
marked as dead, mark it as live, resetting its failure count.
:arg method: HTTP method to use
:arg url: absolute url (without host) to target
Expand Down Expand Up @@ -412,7 +412,7 @@ async def perform_request(self, method, url, headers=None, params=None, body=Non
raise e

else:
# connection didn't fail, confirm it's live status
# connection didn't fail, confirm its live status
self.connection_pool.mark_live(connection)

if method == "HEAD":
Expand Down
4 changes: 2 additions & 2 deletions opensearchpy/connection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
class Connection(object):
"""
Class responsible for maintaining a connection to an OpenSearch node. It
holds persistent connection pool to it and it's main interface
holds persistent connection pool to it and its main interface
(`perform_request`) is thread-safe.
Also responsible for logging.
Expand Down Expand Up @@ -158,7 +158,7 @@ def _raise_warnings(self, warning_headers):
# Format is: '(number) OpenSearch-(version)-(instance) "(message)"'
warning_messages = []
for header in warning_headers:
# Because 'Requests' does it's own folding of multiple HTTP headers
# Because 'Requests' does its own folding of multiple HTTP headers
# into one header delimited by commas (totally standard compliant, just
# annoying for cases like this) we need to expect there may be
# more than one message per 'Warning' header.
Expand Down
14 changes: 7 additions & 7 deletions opensearchpy/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class ConnectionSelector(object):
process it will be the dictionary returned by the `host_info_callback`.
Example of where this would be useful is a zone-aware selector that would
only select connections from it's own zones and only fall back to other
connections where there would be none in it's zones.
only select connections from its own zones and only fall back to other
connections where there would be none in its zones.
"""

def __init__(self, opts):
Expand Down Expand Up @@ -112,7 +112,7 @@ class ConnectionPool(object):
future reference.
Upon each request the `Transport` will ask for a `Connection` via the
`get_connection` method. If the connection fails (it's `perform_request`
`get_connection` method. If the connection fails (its `perform_request`
raises a `ConnectionError`) it will be marked as dead (via `mark_dead`) and
put on a timeout (if it fails N times in a row the timeout is exponentially
longer - the formula is `default_timeout * 2 ** (fail_count - 1)`). When
Expand All @@ -132,7 +132,7 @@ def __init__(
):
"""
:arg connections: list of tuples containing the
:class:`~opensearchpy.Connection` instance and it's options
:class:`~opensearchpy.Connection` instance and its options
:arg dead_timeout: number of seconds a connection should be retired for
after a failure, increases on consecutive failures
:arg timeout_cutoff: number of consecutive failures after which the
Expand Down Expand Up @@ -211,7 +211,7 @@ def mark_live(self, connection):
def resurrect(self, force=False):
"""
Attempt to resurrect a connection from the dead pool. It will try to
locate one (not all) eligible (it's timeout is over) connection to
locate one (not all) eligible (its timeout is over) connection to
return to the live pool. Any resurrected connection is also returned.
:arg force: resurrect a connection even if there is none eligible (used
Expand Down Expand Up @@ -245,7 +245,7 @@ def resurrect(self, force=False):
self.dead.put((timeout, connection))
return

# either we were forced or the connection is elligible to be retried
# either we were forced or the connection is eligible to be retried
self.connections.append(connection)
logger.info("Resurrecting connection %r (force=%s).", connection, force)
return connection
Expand All @@ -259,7 +259,7 @@ def get_connection(self):
no connections are available and passes the list of live connections to
the selector instance to choose from.
Returns a connection instance and it's current fail count.
Returns a connection instance and its current fail count.
"""
self.resurrect()
connections = self.connections[:]
Expand Down
6 changes: 3 additions & 3 deletions opensearchpy/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class DslMeta(type):
It then uses the information from that registry (as well as `name` and
`shortcut` attributes from the base class) to construct any subclass based
on it's name.
on its name.
For typical use see `QueryMeta` and `Query` in `opensearchpy.query`.
"""
Expand All @@ -235,7 +235,7 @@ def __init__(cls, name, bases, attrs):
if not hasattr(cls, "_type_shortcut"):
return
if cls.name is None:
# abstract base class, register it's shortcut
# abstract base class, register its shortcut
cls._types[cls._type_name] = cls._type_shortcut
# and create a registry for subclasses
if not hasattr(cls, "_classes"):
Expand Down Expand Up @@ -264,7 +264,7 @@ class DslBase(object):
- to_dict method to serialize into dict (to be sent via opensearch-py)
- basic logical operators (&, | and ~) using a Bool(Filter|Query) TODO:
move into a class specific for Query/Filter
- respects the definition of the class and (de)serializes it's
- respects the definition of the class and (de)serializes its
attributes based on the `_param_defs` definition (for example turning
all values in the `must` attribute into Query objects)
"""
Expand Down
6 changes: 3 additions & 3 deletions opensearchpy/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ def mark_dead(self, connection):
def perform_request(self, method, url, headers=None, params=None, body=None):
"""
Perform the actual request. Retrieve a connection from the connection
pool, pass all the information to it's perform_request method and
pool, pass all the information to its perform_request method and
return the data.
If an exception was raised, mark the connection as failed and retry (up
to `max_retries` times).
If the operation was successful and the connection used was previously
marked as dead, mark it as live, resetting it's failure count.
marked as dead, mark it as live, resetting its failure count.
:arg method: HTTP method to use
:arg url: absolute url (without host) to target
Expand Down Expand Up @@ -409,7 +409,7 @@ def perform_request(self, method, url, headers=None, params=None, body=None):
raise e

else:
# connection didn't fail, confirm it's live status
# connection didn't fail, confirm its live status
self.connection_pool.mark_live(connection)

if method == "HEAD":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ async def create_git_index(client, index):
],
"committer": {"name": "Honza Kr\xe1l", "email": "honza.kral@gmail.com"},
"stats": {"deletions": 0, "insertions": 53, "lines": 53, "files": 2},
"description": "From_dict, Q(dict) and bool query parses it's subqueries",
"description": "From_dict, Q(dict) and bool query parses its subqueries",
"author": {"name": "Honza Kr\xe1l", "email": "honza.kral@gmail.com"},
"parent_shas": ["d407f99d1959b7b862a541c066d9fd737ce913f3"],
"committed_date": "2014-03-06T20:24:30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def test_search_monitor(self):
# Create a dummy monitor
await self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand All @@ -145,7 +145,7 @@ async def test_get_monitor(self):
# Create a dummy monitor
await self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand All @@ -169,7 +169,7 @@ async def test_run_monitor(self):
# Create a dummy monitor
await self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


"""
Dynamically generated set of TestCases based on set of yaml files decribing
Dynamically generated set of TestCases based on set of yaml files describing
some integration tests. These files are shared among all official OpenSearch
clients.
"""
Expand Down Expand Up @@ -106,7 +106,7 @@ async def run(self):
pass

async def run_code(self, test):
"""Execute an instruction based on it's type."""
"""Execute an instruction based on its type."""
for action in test:
assert len(action) == 1
action_type, action = list(action.items())[0]
Expand All @@ -126,7 +126,7 @@ async def run_do(self, action):
assert len(action) == 1

# Remove the x_pack_rest_user authentication
# if it's given via headers. We're already authenticated
# if its given via headers. We're already authenticated
# via the 'elastic' user.
if (
headers
Expand Down
2 changes: 1 addition & 1 deletion test_opensearchpy/test_server/test_helpers/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ def create_git_index(client, index):
],
"committer": {"name": "Honza Kr\xe1l", "email": "honza.kral@gmail.com"},
"stats": {"deletions": 0, "insertions": 53, "lines": 53, "files": 2},
"description": "From_dict, Q(dict) and bool query parses it's subqueries",
"description": "From_dict, Q(dict) and bool query parses its subqueries",
"author": {"name": "Honza Kr\xe1l", "email": "honza.kral@gmail.com"},
"parent_shas": ["d407f99d1959b7b862a541c066d9fd737ce913f3"],
"committed_date": "2014-03-06T20:24:30",
Expand Down
6 changes: 3 additions & 3 deletions test_opensearchpy/test_server/test_plugins/test_alerting.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_search_monitor(self):
# Create a dummy monitor
self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand All @@ -141,7 +141,7 @@ def test_get_monitor(self):
# Create a dummy monitor
self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand All @@ -165,7 +165,7 @@ def test_run_monitor(self):
# Create a dummy monitor
self.test_create_monitor()

# Create a monitor search query by it's name
# Create a monitor search query by its name
query = {"query": {"match": {"monitor.name": "test-monitor"}}}

# Perform the search with the above query
Expand Down
2 changes: 1 addition & 1 deletion test_opensearchpy/test_server/test_rest_api_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def run(self):
pass

def run_code(self, test):
"""Execute an instruction based on it's type."""
"""Execute an instruction based on its type."""
for action in test:
assert len(action) == 1
action_type, action = list(action.items())[0]
Expand Down

0 comments on commit 36df6e8

Please sign in to comment.