From 78023184544c9030053a03ee8184c8b86b070dd0 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Wed, 14 Jun 2023 18:44:41 +0300 Subject: [PATCH] Remove six from dependencies Since we have dropped Python 2.x support a long time ago, let's don't depend on six too. --- a/flasgger/utils.py +++ b/flasgger/utils.py @@ -9,7 +9,6 @@ import sys import jsonschema import yaml -from six import string_types, text_type from copy import deepcopy from functools import wraps from importlib import import_module @@ -269,7 +268,7 @@ def is_path(specs): """ Returns True if specs is a string or pathlib.Path """ - is_str_path = isinstance(specs, string_types) + is_str_path = isinstance(specs, str) try: from pathlib import Path is_py3_path = isinstance(specs, Path) @@ -879,56 +878,52 @@ Forwards any non-magic methods to the resulting string's class. This allows support for string methods like `upper()`, `lower()`, etc. """ - string = self.text_type(self) + string = str(self) if hasattr(string, attr): return getattr(string, attr) raise AttributeError(attr) def __len__(self): - return len(self.text_type(self)) + return len(str(self)) def __getitem__(self, key): - return self.text_type(self)[key] + return str(self)[key] def __iter__(self): - return iter(self.text_type(self)) + return iter(str(self)) def __contains__(self, item): - return item in self.text_type(self) + return item in str(self) def __add__(self, other): - return self.text_type(self) + other + return str(self) + other def __radd__(self, other): - return other + self.text_type(self) + return other + str(self) def __mul__(self, other): - return self.text_type(self) * other + return str(self) * other def __rmul__(self, other): - return other * self.text_type(self) + return other * str(self) def __lt__(self, other): - return self.text_type(self) < other + return str(self) < other def __le__(self, other): - return self.text_type(self) <= other + return str(self) <= other def __eq__(self, other): - return self.text_type(self) == other + return str(self) == other def __ne__(self, other): - return self.text_type(self) != other + return str(self) != other def __gt__(self, other): - return self.text_type(self) > other + return str(self) > other def __ge__(self, other): - return self.text_type(self) >= other - - @property - def text_type(self): - return text_type + return str(self) >= other class LazyString(StringLike): @@ -948,7 +943,7 @@ """ Returns the actual string. """ - return self.text_type(self._func()) + return str(self._func()) class CachedLazyString(LazyString): @@ -968,7 +963,7 @@ Returns the actual string and caches the result. """ if not self._cache: - self._cache = self.text_type(self._func()) + self._cache = str(self._func()) return self._cache --- a/setup.py +++ b/setup.py @@ -137,7 +137,6 @@ 'PyYAML>=3.0', 'jsonschema>=3.0.1', 'mistune', - 'six>=1.10.0', 'packaging', 'certifi', # For downloading external dependencies such as swagger-ui ], --- a/flasgger.egg-info/requires.txt +++ b/flasgger.egg-info/requires.txt @@ -2,6 +2,5 @@ PyYAML>=3.0 jsonschema>=3.0.1 mistune -six>=1.10.0 packaging certifi