| 1 |
From 78023184544c9030053a03ee8184c8b86b070dd0 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Felix Yan <[email protected]> |
| 3 |
Date: Wed, 14 Jun 2023 18:44:41 +0300 |
| 4 |
Subject: [PATCH] Remove six from dependencies |
| 5 |
|
| 6 |
Since we have dropped Python 2.x support a long time ago, let's don't |
| 7 |
depend on six too. |
| 8 |
--- a/flasgger/utils.py |
| 9 |
+++ b/flasgger/utils.py |
| 10 |
@@ -9,7 +9,6 @@ |
| 11 |
import sys |
| 12 |
import jsonschema |
| 13 |
import yaml |
| 14 |
-from six import string_types, text_type |
| 15 |
from copy import deepcopy |
| 16 |
from functools import wraps |
| 17 |
from importlib import import_module |
| 18 |
@@ -269,7 +268,7 @@ |
| 19 |
def is_path(specs): |
| 20 |
""" Returns True if specs is a string or pathlib.Path |
| 21 |
""" |
| 22 |
- is_str_path = isinstance(specs, string_types) |
| 23 |
+ is_str_path = isinstance(specs, str) |
| 24 |
try: |
| 25 |
from pathlib import Path |
| 26 |
is_py3_path = isinstance(specs, Path) |
| 27 |
@@ -879,56 +878,52 @@ |
| 28 |
Forwards any non-magic methods to the resulting string's class. This |
| 29 |
allows support for string methods like `upper()`, `lower()`, etc. |
| 30 |
""" |
| 31 |
- string = self.text_type(self) |
| 32 |
+ string = str(self) |
| 33 |
if hasattr(string, attr): |
| 34 |
return getattr(string, attr) |
| 35 |
raise AttributeError(attr) |
| 36 |
|
| 37 |
def __len__(self): |
| 38 |
- return len(self.text_type(self)) |
| 39 |
+ return len(str(self)) |
| 40 |
|
| 41 |
def __getitem__(self, key): |
| 42 |
- return self.text_type(self)[key] |
| 43 |
+ return str(self)[key] |
| 44 |
|
| 45 |
def __iter__(self): |
| 46 |
- return iter(self.text_type(self)) |
| 47 |
+ return iter(str(self)) |
| 48 |
|
| 49 |
def __contains__(self, item): |
| 50 |
- return item in self.text_type(self) |
| 51 |
+ return item in str(self) |
| 52 |
|
| 53 |
def __add__(self, other): |
| 54 |
- return self.text_type(self) + other |
| 55 |
+ return str(self) + other |
| 56 |
|
| 57 |
def __radd__(self, other): |
| 58 |
- return other + self.text_type(self) |
| 59 |
+ return other + str(self) |
| 60 |
|
| 61 |
def __mul__(self, other): |
| 62 |
- return self.text_type(self) * other |
| 63 |
+ return str(self) * other |
| 64 |
|
| 65 |
def __rmul__(self, other): |
| 66 |
- return other * self.text_type(self) |
| 67 |
+ return other * str(self) |
| 68 |
|
| 69 |
def __lt__(self, other): |
| 70 |
- return self.text_type(self) < other |
| 71 |
+ return str(self) < other |
| 72 |
|
| 73 |
def __le__(self, other): |
| 74 |
- return self.text_type(self) <= other |
| 75 |
+ return str(self) <= other |
| 76 |
|
| 77 |
def __eq__(self, other): |
| 78 |
- return self.text_type(self) == other |
| 79 |
+ return str(self) == other |
| 80 |
|
| 81 |
def __ne__(self, other): |
| 82 |
- return self.text_type(self) != other |
| 83 |
+ return str(self) != other |
| 84 |
|
| 85 |
def __gt__(self, other): |
| 86 |
- return self.text_type(self) > other |
| 87 |
+ return str(self) > other |
| 88 |
|
| 89 |
def __ge__(self, other): |
| 90 |
- return self.text_type(self) >= other |
| 91 |
- |
| 92 |
- @property |
| 93 |
- def text_type(self): |
| 94 |
- return text_type |
| 95 |
+ return str(self) >= other |
| 96 |
|
| 97 |
|
| 98 |
class LazyString(StringLike): |
| 99 |
@@ -948,7 +943,7 @@ |
| 100 |
""" |
| 101 |
Returns the actual string. |
| 102 |
""" |
| 103 |
- return self.text_type(self._func()) |
| 104 |
+ return str(self._func()) |
| 105 |
|
| 106 |
|
| 107 |
class CachedLazyString(LazyString): |
| 108 |
@@ -968,7 +963,7 @@ |
| 109 |
Returns the actual string and caches the result. |
| 110 |
""" |
| 111 |
if not self._cache: |
| 112 |
- self._cache = self.text_type(self._func()) |
| 113 |
+ self._cache = str(self._func()) |
| 114 |
return self._cache |
| 115 |
|
| 116 |
|
| 117 |
--- a/setup.py |
| 118 |
+++ b/setup.py |
| 119 |
@@ -137,7 +137,6 @@ |
| 120 |
'PyYAML>=3.0', |
| 121 |
'jsonschema>=3.0.1', |
| 122 |
'mistune', |
| 123 |
- 'six>=1.10.0', |
| 124 |
'packaging', |
| 125 |
'certifi', # For downloading external dependencies such as swagger-ui |
| 126 |
], |
| 127 |
--- a/flasgger.egg-info/requires.txt |
| 128 |
+++ b/flasgger.egg-info/requires.txt |
| 129 |
@@ -2,6 +2,5 @@ |
| 130 |
PyYAML>=3.0 |
| 131 |
jsonschema>=3.0.1 |
| 132 |
mistune |
| 133 |
-six>=1.10.0 |
| 134 |
packaging |
| 135 |
certifi |