Skip to content

Commit

Permalink
Added docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
orenlab committed Aug 22, 2024
1 parent bfa71a0 commit fa93430
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .run/Dockerfile.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="dev-latest-loc" />
<option name="imageTag" value="orenlab/pytmbot:latest" />
<option name="buildCliOptions" value="--target self_build" />
<option name="command" value="--log-level=DEBUG --mode=dev --colorize_logs=False" />
<option name="containerName" value="pytmbot" />
Expand Down
28 changes: 28 additions & 0 deletions pytmbot/middleware/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,39 @@ def set_referer_uri_and_handler_type_for_user(
self.user_data.setdefault(user_id, {})['handler_type'] = handler_type

def get_referer_uri_for_user(self, user_id: int) -> Optional[str]:
"""
Returns the referer URI for a given user ID.
Args:
user_id (int): The ID of the user.
Returns:
Optional[str]: The referer URI for the user, or None if not found.
"""
return self.user_data[user_id].get('referer_uri', None)

def get_handler_type_for_user(self, user_id: int) -> Optional[str]:
"""
Retrieves the handler type for a given user ID.
Args:
user_id (int): The ID of the user.
Returns:
Optional[str]: The handler type for the user, or None if not found.
"""
return self.user_data[user_id].get('handler_type', None)

def reset_referer_uri_and_handler_type_for_user(self, user_id: int) -> None:

"""
Resets the referer URI and handler type for a given user ID.
Args:
user_id (int): The ID of the user.
Returns:
None
"""
self.user_data[user_id]['referer_uri'] = None
self.user_data[user_id]['handler_type'] = None
1 change: 1 addition & 0 deletions pytmbot/models/containers_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


class ContainersState:
"""Class for container states."""
running = "running"
paused = "paused"
restarting = "restarting"
Expand Down

0 comments on commit fa93430

Please sign in to comment.