From d478ec72220a64c6020f7f42811ae37a543ea473 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Mon, 5 Aug 2019 18:47:59 -0400 Subject: [PATCH] Bump python requirement to 3.7 --- README.md | 2 +- jetforce.py | 36 ++++++++++++++++++------------------ setup.py | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0cdc159..d2667ad 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## Installation -Requires Python 3.6+ and OpenSSL +Requires Python 3.7+ and OpenSSL ### pip diff --git a/jetforce.py b/jetforce.py index a94e0f3..fdb7b71 100644 --- a/jetforce.py +++ b/jetforce.py @@ -6,7 +6,7 @@ import mimetypes import os import ssl import sys -from typing import Any, Callable, Dict, Iterator, Optional, Union +import typing __version__ = "0.0.1" __title__ = "Jetforce Gemini Server" @@ -43,11 +43,11 @@ class EchoApp: A simple application that echos back the requested path. """ - def __init__(self, environ: dict, send_status: Callable) -> None: + def __init__(self, environ: dict, send_status: typing.Callable) -> None: self.environ = environ self.send_status = send_status - def __iter__(self) -> Iterator[bytes]: + def __iter__(self) -> typing.Iterator[bytes]: self.send_status(STATUS_SUCCESS, "text/plain") path = self.environ["PATH"] yield f"Received path: {path}".encode() @@ -64,13 +64,13 @@ class StaticDirectoryApp: root: str = "/var/gemini" - def __init__(self, environ: dict, send_status: Callable) -> None: + def __init__(self, environ: dict, send_status: typing.Callable) -> None: self.environ = environ self.send_status = send_status self.mimetypes = mimetypes.MimeTypes() - def __iter__(self) -> Iterator[bytes]: + def __iter__(self) -> typing.Iterator[bytes]: filename = self.environ["PATH"] filename = filename.lstrip("/") @@ -134,20 +134,20 @@ class GeminiRequestHandler: removed or slimmed-down. """ - def __init__(self, server: "GeminiServer", app: Callable) -> None: + def __init__(self, server: "GeminiServer", app: typing.Callable) -> None: self.server = server self.app = app - self.reader: Optional[asyncio.StreamReader] = None - self.writer: Optional[asyncio.StreamWriter] = None + self.reader: typing.Optional[asyncio.StreamReader] = None + self.writer: typing.Optional[asyncio.StreamWriter] = None - self.received_timestamp: Optional[datetime.datetime] = None - self.client_ip: Optional[str] = None - self.client_port: Optional[int] = None - self.path: Optional[str] = None - self.status: Optional[int] = None - self.mimetype: Optional[str] = None - self.response_buffer: Optional[str] = None + self.received_timestamp: typing.Optional[datetime.datetime] = None + self.client_ip: typing.Optional[str] = None + self.client_port: typing.Optional[int] = None + self.path: typing.Optional[str] = None + self.status: typing.Optional[int] = None + self.mimetype: typing.Optional[str] = None + self.response_buffer: typing.Optional[str] = None self.response_size: int = 0 async def handle( @@ -186,7 +186,7 @@ class GeminiRequestHandler: self.log_request() await writer.drain() - def build_environ(self) -> Dict[str, Any]: + def build_environ(self) -> typing.Dict[str, typing.Any]: """ Construct a dictionary that will be passed to the application handler. """ @@ -272,8 +272,8 @@ class GeminiServer: self, host: str, port: int, - ssl_context: Union[tuple, ssl.SSLContext], - app: Callable, + ssl_context: typing.Union[tuple, ssl.SSLContext], + app: typing.Callable, ) -> None: self.host = host diff --git a/setup.py b/setup.py index fd27e95..203a07d 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setuptools.setup( long_description=long_description(), py_modules=["jetforce"], entry_points={"console_scripts": ["jetforce=jetforce:run_server"]}, - python_requires=">=3.6", + python_requires=">=3.7", keywords="gemini server tcp gopher asyncio", classifiers=[ "Environment :: Web Environment",