Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some formatting and typos #17

Merged
merged 1 commit into from
Sep 8, 2022
Merged

Conversation

jsdanielh
Copy link
Contributor

  • Fix some formatting and typos in several files.
  • Rename RpcUtilityMethods's get_proccess_details method to
    get_process_details.

@orweis
Copy link
Contributor

orweis commented Sep 6, 2022

Hi @jsdanielh !
Thanks for the work here. I'll try to review it all tomorrow, typo fixes look great, there are some type changes I'd need to look more deeply into than a quick skim.

Copy link
Contributor

@orweis orweis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great- few comments inline; most not critical, only the float->int change requires further discussion

retry_config (dict): Tenacity.retry config (@see https://tenacity.readthedocs.io/en/latest/api.html#retry-main-api)
default_response_timeout (float): default time in seconds
retry_config (dict): Tenacity.retry config (@see https://tenacity.readthedocs.io/en/latest/api.html#retry-main-api)
default_response_timeout (int): default time in seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default_response_timeout ends up being propagated to asyncio.wait_for - which does accept float ;
So float seems the more correct option, allowing the caller to actually set fractions of a second for the timeout

simple_websocket = self._serializing_socket_cls(WebSocketSimplifier(websocket, frame_type=self._frame_type))
channel = RpcChannel(self.methods, simple_websocket, sync_channel_id=self._rpc_channel_get_remote_id, **kwargs)
logger.info(f"Client connected", {
'remote_address': websocket.client})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -84,11 +87,13 @@ async def main_loop(self, websocket: WebSocket, client_id: str = None, **kwargs)
data = await simple_websocket.recv()
await channel.on_message(data)
except WebSocketDisconnect:
logger.info(f"Client disconnected - {websocket.client.port} :: {channel.id}")
logger.info(
f"Client disconnected - {websocket.client.port} :: {channel.id}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

await self.handle_disconnect(websocket, channel)
except:
# cover cases like - RuntimeError('Cannot call "send" once a close message has been sent.')
logger.info(f"Client connection failed - {websocket.client.port} :: {channel.id}")
logger.info(
f"Client connection failed - {websocket.client.port} :: {channel.id}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -2,7 +2,8 @@
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -3,7 +3,8 @@
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
os.path.dirname(__file__), os.path.pardir)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -3,7 +3,8 @@
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -13,7 +13,8 @@
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -5,7 +5,8 @@
from websockets.exceptions import InvalidStatusCode

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

@@ -6,7 +6,8 @@
import sys

# Add parent path to use local src as package for tests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
sys.path.append(os.path.abspath(os.path.join(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems inconsistent with the other changes here (preferring to have code in a single line)

- Fix some formatting and typos in several files.
- Rename `RpcUtilityMethods`'s `get_proccess_details` method to
  `get_process_details`.
@jsdanielh
Copy link
Contributor Author

Looks great- few comments inline; most not critical, only the float->int change requires further discussion

@orweis I applied your suggestion on the type change for the timeout. I actually went and changed it in some other places that were specifying int.
For the line break changes, they go more into complying with PEP8 maximum line specification. Although I know there are some lines that doesn't fully comply with it, I thought a change towards that path would help. Let me know what you think.

Copy link
Contributor

@orweis orweis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesomeness. :)
Thank you @jsdanielh

@orweis orweis merged commit 9d7bb5a into permitio:master Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants