File: 03-remove-usage-of-python3-six.patch

package info (click to toggle)
python-flasgger 0.9.7.2~dev2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,684 kB
  • sloc: javascript: 6,384; python: 4,379; makefile: 8; sh: 1
file content (135 lines) | stat: -rw-r--r-- 3,754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From 78023184544c9030053a03ee8184c8b86b070dd0 Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
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