changes in pyprojects
Some checks failed
Lint Code / lint (push) Failing after 41s
CI/CD Pipeline / lint (push) Successful in 0s
Run Tests / test (3.12) (push) Failing after 35s
Run Tests / test (3.13) (push) Failing after 52s
CI/CD Pipeline / test (push) Successful in 0s
CI/CD Pipeline / build-and-release (push) Has been skipped
CI/CD Pipeline / notify (push) Successful in 1s

fixed python version

fixed linter errors in Cython path_matcher
This commit is contained in:
Илья Глазунов 2026-01-30 23:11:42 +03:00
parent c04ab283a6
commit fe541778f1
2 changed files with 33 additions and 33 deletions

View File

@ -3,11 +3,11 @@ name = "pyserve"
version = "0.9.10"
description = "Python Application Orchestrator & HTTP Server - unified gateway for multiple Python web apps"
authors = [
{name = "Илья Глазунов",email = "i.glazunov@sapiens.solutions"}
{name = "Илья Глазунов",email = "lead@pyserve.org"}
]
license = {text = "MIT"}
readme = "README.md"
requires-python = ">=3.12"
requires-python = ">=3.12, <=3.13.7"
dependencies = [
"starlette (>=0.47.3,<0.48.0)",
"uvicorn[standard] (>=0.35.0,<0.36.0)",

View File

@ -24,24 +24,24 @@ cdef class FastMountedPath:
def __cinit__(self):
self._path = ""
self._path_with_slash = "/"
self._path_len = 0
self._is_root = 1
self._path_len = <Py_ssize_t>0
self._is_root = <bint>True
self.name = ""
self.strip_path = 1
self.strip_path = <bint>True
def __init__(self, str path, str name="", bint strip_path=True):
def __init__(self, str path, str name="", bint strip_path=<bint>True):
cdef Py_ssize_t path_len
path_len = len(path)
path_len = <Py_ssize_t>len(path)
if path_len > 1 and path[path_len - 1] == '/':
path = path[:path_len - 1]
self._path = path
self._path_len = len(path)
self._is_root = 1 if (path == "" or path == "/") else 0
self._path_with_slash = path + "/" if self._is_root == 0 else "/"
self._path_len = <Py_ssize_t>len(path)
self._is_root = <bint>(path == "" or path == "/")
self._path_with_slash = path + "/" if not self._is_root else "/"
self.name = name if name else path
self.strip_path = 1 if strip_path else 0
self.strip_path = <bint>strip_path
@property
def path(self) -> str:
@ -51,20 +51,20 @@ cdef class FastMountedPath:
cdef Py_ssize_t req_len
if self._is_root:
return 1
return <bint>True
req_len = len(request_path)
req_len = <Py_ssize_t>len(request_path)
if req_len < self._path_len:
return 0
return <bint>False
if req_len == self._path_len:
return 1 if request_path == self._path else 0
return <bint>(request_path == self._path)
if request_path[self._path_len] == '/':
return 1 if request_path[:self._path_len] == self._path else 0
return <bint>(request_path[:self._path_len] == self._path)
return 0
return <bint>False
cpdef str get_modified_path(self, str original_path):
cdef str new_path
@ -108,7 +108,7 @@ cdef class FastMountManager:
self._mounts = sorted(self._mounts, key=_get_path_len_neg, reverse=False)
self._mount_count = len(self._mounts)
cpdef FastMountedPath get_mount(self, str request_path):
cpdef object get_mount(self, str request_path):
cdef:
int i
FastMountedPath mount
@ -126,7 +126,7 @@ cdef class FastMountManager:
Py_ssize_t path_len
FastMountedPath mount
path_len = len(path)
path_len = <Py_ssize_t>len(path)
if path_len > 1 and path[path_len - 1] == '/':
path = path[:path_len - 1]
@ -135,9 +135,9 @@ cdef class FastMountManager:
if mount._path == path:
del self._mounts[i]
self._mount_count -= 1
return 1
return <bint>True
return 0
return <bint>False
@property
def mounts(self) -> list:
@ -164,27 +164,27 @@ cdef class FastMountManager:
cpdef bint path_matches_prefix(str request_path, str mount_path):
cdef:
Py_ssize_t mount_len = len(mount_path)
Py_ssize_t req_len = len(request_path)
Py_ssize_t mount_len = <Py_ssize_t>len(mount_path)
Py_ssize_t req_len = <Py_ssize_t>len(request_path)
if mount_len == 0 or mount_path == "/":
return 1
return <bint>True
if req_len < mount_len:
return 0
return <bint>False
if req_len == mount_len:
return 1 if request_path == mount_path else 0
return <bint>(request_path == mount_path)
if request_path[mount_len] == '/':
return 1 if request_path[:mount_len] == mount_path else 0
return <bint>(request_path[:mount_len] == mount_path)
return 0
return <bint>False
cpdef str strip_path_prefix(str original_path, str mount_path):
cdef:
Py_ssize_t mount_len = len(mount_path)
Py_ssize_t mount_len = <Py_ssize_t>len(mount_path)
str result
if mount_len == 0 or mount_path == "/":
@ -198,11 +198,11 @@ cpdef str strip_path_prefix(str original_path, str mount_path):
return result
cpdef tuple match_and_modify_path(str request_path, str mount_path, bint strip_path=True):
cpdef tuple match_and_modify_path(str request_path, str mount_path, bint strip_path=<bint>True):
cdef:
Py_ssize_t mount_len = len(mount_path)
Py_ssize_t req_len = len(request_path)
bint is_root = 1 if (mount_len == 0 or mount_path == "/") else 0
Py_ssize_t mount_len = <Py_ssize_t>len(mount_path)
Py_ssize_t req_len = <Py_ssize_t>len(request_path)
bint is_root = <bint>(mount_len == 0 or mount_path == "/")
str modified
if is_root: