Skip to content

Commit

Permalink
Remove inconsistent docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed May 8, 2022
1 parent 386ebe8 commit be532f6
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 42 deletions.
48 changes: 25 additions & 23 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,20 @@ def _add_route(self, route_type, endpoint, handler):

def before_request(self, endpoint):
"""
[The @app.before_request decorator to add a get route]
The @app.before_request decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

return self.middleware_router.add_before_request(endpoint)

def after_request(self, endpoint):
"""
[The @app.after_request decorator to add a get route]
The @app.after_request decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

return self.middleware_router.add_after_request(endpoint)

def add_directory(
Expand Down Expand Up @@ -96,10 +98,11 @@ def shutdown_handler(self, handler):

def start(self, url="127.0.0.1", port=5000):
"""
[Starts the server]
Starts the server
:param port [int]: [reperesents the port number at which the server is listening]
:param port int: reperesents the port number at which the server is listening
"""

if not self.dev:
workers = self.workers
socket = SocketHeld(url, port)
Expand Down Expand Up @@ -139,9 +142,9 @@ def start(self, url="127.0.0.1", port=5000):

def get(self, endpoint):
"""
[The @app.get decorator to add a get route]
The @app.get decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -151,9 +154,9 @@ def inner(handler):

def post(self, endpoint):
"""
[The @app.post decorator to add a get route]
The @app.post decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -163,21 +166,20 @@ def inner(handler):

def put(self, endpoint):
"""
[The @app.put decorator to add a get route]
The @app.put decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
self._add_route("PUT", endpoint, handler)

return inner

def delete(self, endpoint):
"""
[The @app.delete decorator to add a get route]
The @app.delete decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -199,9 +201,9 @@ def inner(handler):

def head(self, endpoint):
"""
[The @app.head decorator to add a get route]
The @app.head decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -211,9 +213,9 @@ def inner(handler):

def options(self, endpoint):
"""
[The @app.options decorator to add a get route]
The @app.options decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -223,9 +225,9 @@ def inner(handler):

def connect(self, endpoint):
"""
[The @app.connect decorator to add a get route]
The @app.connect decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand All @@ -235,9 +237,9 @@ def inner(handler):

def trace(self, endpoint):
"""
[The @app.trace decorator to add a get route]
The @app.trace decorator to add a get route
:param endpoint [str]: [endpoint to server the route]
:param endpoint str: endpoint to server the route
"""

def inner(handler):
Expand Down
12 changes: 7 additions & 5 deletions robyn/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ from .robyn import Server, SocketHeld
from .router import MiddlewareRouter, Router, WebSocketRouter
from .ws import WS


class Robyn:
"""This is the python wrapper for the Robyn binaries."""

Expand All @@ -28,16 +29,16 @@ class Robyn:
:param endpoint str: endpoint to server the route
"""

...
def after_request(self, endpoint: str): # -> (handler: Unknown) -> None:
"""
[The @app.after_request decorator to add a get route]

:param endpoint [str]: [endpoint to server the route]
def after_request(self, endpoint: str) -> Callable[..., None]:
"""
The @app.after_request decorator to add a get route
:param endpoint str: endpoint to server the route
"""
...

def add_directory(
self,
route: str,
Expand Down Expand Up @@ -95,6 +96,7 @@ class Robyn:
"""

...

def head(self, endpoint: str) -> Callable[..., None]:
"""
The @app.head decorator to add a get route
Expand Down
5 changes: 3 additions & 2 deletions robyn/dev_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ def start_server_first_time(self):

def on_any_event(self, event):
"""
[This function is a callback that will start a new server on every even change]
This function is a callback that will start a new server on every even change
:param event [FSEvent]: [a data structure with info about the events]
:param event FSEvent: a data structure with info about the events
"""

if len(self.processes) > 0:
for process in self.processes:
process.terminate()
Expand Down
4 changes: 2 additions & 2 deletions robyn/dev_event_handler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class EventHandler(FileSystemEventHandler):
def start_server_first_time(self) -> None: ...
def on_any_event(self, event: FileSystemEvent) -> None:
"""
[This function is a callback that will start a new server on every even change]
This function is a callback that will start a new server on every even change
:param event [FSEvent]: [a data structure with info about the events]
:param event FSEvent: a data structure with info about the events
"""
5 changes: 3 additions & 2 deletions robyn/processpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ def spawn_process(
:param directories tuple: the list of all the directories and related data in a tuple
:param headers tuple: All the global headers in a tuple
:param routes tuple: The routes touple, containing the description about every route.
:param middlewares tuple: The middleware router touple, containing the description about every route.
:param routes Tuple[Route]: The routes touple, containing the description about every route.
:param middlewares Tuple[Route]: The middleware router touple, containing the description about every route.
:param web_sockets list: This is a list of all the web socket routes
:param event_handlers Dict: This is an event dict that contains the event handlers
:param socket SocketHeld: This is the main tcp socket, which is being shared across multiple processes.
:param process_name string: This is the name given to the process to identify the process
:param workers number: This is the name given to the process to identify the process
"""

# platform_name = platform.machine()
if sys.platform.startswith("win32") or sys.platform.startswith("linux-cross"):
loop = asyncio.new_event_loop()
Expand Down
9 changes: 5 additions & 4 deletions robyn/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

def static_file(file_path):
"""
[This function will help in serving a static_file]
This function will help in serving a static_file
:param file_path [str]: [file path to serve as a response]
:param file_path str: file path to serve as a response
"""

return {
Expand All @@ -19,9 +19,10 @@ def static_file(file_path):

def jsonify(input_dict):
"""
[This function serializes input dict to a json string]
This function serializes input dict to a json string
:param input_dict [dict]: [response of the function]
:param input_dict dict: response of the function
"""

return json.dumps(input_dict)

8 changes: 4 additions & 4 deletions robyn/responses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ from typing import Any

def static_file(file_path: str) -> dict[str, Any]:
"""
[This function will help in serving a static_file]
This function will help in serving a static_file
:param file_path [str]: [file path to serve as a response]
:param file_path str: file path to serve as a response
"""

pass

def jsonify(input_dict: dict) -> str:
"""
[This function serializes input dict to a json string]
This function serializes input dict to a json string
:param input_dict [dict]: [response of the function]
:param input_dict dict: response of the function
"""

pass

0 comments on commit be532f6

Please sign in to comment.