File: remove_six.patch

package info (click to toggle)
python-scruffy 0.3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 208 kB
  • sloc: python: 629; makefile: 4
file content (174 lines) | stat: -rw-r--r-- 5,339 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
--- a/scruffy/config.py
+++ b/scruffy/config.py
@@ -4,7 +4,6 @@
 
 Classes for loading and accessing configuration data.
 """
-from six import string_types
 
 import copy
 import os
@@ -12,7 +11,6 @@
 import yaml
 import re
 
-from six import string_types
 from .file import File
 
 
@@ -145,7 +143,7 @@
         the item referred to by the key path.
         """
         # Split up the key path
-        if isinstance(self._path, string_types):
+        if isinstance(self._path, str):
             key_path = self._path.split('.')
         else:
             key_path = [self._path]
@@ -295,7 +293,7 @@
         """
         if reload or not self._loaded:
             # load defaults
-            if self._defaults_file and isinstance(self._defaults_file, string_types):
+            if self._defaults_file and isinstance(self._defaults_file, str):
                 self._defaults_file = File(self._defaults_file, parent=self._parent)
             defaults = {}
             if self._defaults_file:
@@ -343,7 +341,7 @@
         """
         Apply the config to an object.
         """
-        if isinstance(obj, string_types):
+        if isinstance(obj, str):
             return self.apply_to_str(obj)
 
     def apply_to_str(self, obj):
--- a/scruffy/env.py
+++ b/scruffy/env.py
@@ -12,8 +12,6 @@
 import logging
 import logging.config
 
-from six import string_types
-
 from .file import Directory
 from .plugin import PluginManager
 from .config import ConfigNode, Config, ConfigEnv, ConfigApplicator, ConfigFile
@@ -70,7 +68,7 @@
 
         # first see if we got a kwarg named 'config', as this guy is special
         if 'config' in children:
-            if isinstance(children['config'], string_types):
+            if isinstance(children['config'], str):
                 children['config'] = ConfigFile(children['config'])
             elif isinstance(children['config'], Config):
                 children['config'] = children['config']
@@ -105,7 +103,7 @@
         Add objects to the environment.
         """
         for key in kwargs:
-            if isinstance(kwargs[key], string_types):
+            if isinstance(kwargs[key], str):
                 self._children[key] = Directory(kwargs[key])
             else:
                 self._children[key] = kwargs[key]
--- a/scruffy/file.py
+++ b/scruffy/file.py
@@ -6,7 +6,6 @@
 """
 from __future__ import unicode_literals
 import os
-from six import string_types
 import yaml
 import copy
 import logging
@@ -48,7 +47,7 @@
         """
         Replace any config tokens in the file's path with values from the config.
         """
-        if isinstance(self._fpath, string_types):
+        if isinstance(self._fpath, str):
             self._fpath = applicator.apply(self._fpath)
 
     def create(self):
@@ -174,7 +173,7 @@
 
         # if we got a string for the formatter, assume it's the name of a
         # formatter in the environment's config
-        if isinstance(self._format, string_types):
+        if isinstance(self._format, str):
             if self._env and self._env.config.logging.dict_config.formatters[self._formatter]:
                 d = self._env.config.logging.dict_config.formatters[self._formatter].to_dict()
                 handler.setFormatter(logging.Formatter(**d))
@@ -269,7 +268,7 @@
         self._env = None
         self._parent = parent
 
-        if self._path and isinstance(self._path, string_types):
+        if self._path and isinstance(self._path, str):
             self._path = os.path.expanduser(self._path)
 
         self.add(**kwargs)
@@ -291,7 +290,7 @@
         """
         Replace any config tokens with values from the config.
         """
-        if isinstance(self._path, string_types):
+        if isinstance(self._path, str):
             self._path = applicator.apply(self._path)
 
         for key in self._children:
@@ -398,7 +397,7 @@
         Add objects to the directory.
         """
         for key in kwargs:
-            if isinstance(kwargs[key], string_types):
+            if isinstance(kwargs[key], str):
                 self._children[key] = File(kwargs[key])
             else:
                 self._children[key] = kwargs[key]
@@ -411,7 +410,7 @@
                 self._children[arg.name] = arg
                 self._children[arg.name]._parent = self
                 self._children[arg.name]._env = self._env
-            elif isinstance(arg, string_types):
+            elif isinstance(arg, str):
                 f = File(arg)
                 added.append(f)
                 self._children[arg] = f
--- a/scruffy/plugin.py
+++ b/scruffy/plugin.py
@@ -6,7 +6,6 @@
 """
 import os
 import importlib
-import six
 
 
 class PluginRegistry(type):
@@ -19,8 +18,7 @@
             PluginRegistry.plugins.append(cls)
 
 
-@six.add_metaclass(PluginRegistry)
-class Plugin(object):
+class Plugin(metaclass=PluginRegistry):
     """
     Top-level plugin class, using the PluginRegistry metaclass.
 
@@ -67,4 +65,4 @@
 
     @property
     def plugins(self):
-        return PluginRegistry.plugins
\ No newline at end of file
+        return PluginRegistry.plugins
--- a/setup.py
+++ b/setup.py
@@ -15,5 +15,5 @@
     keywords="scruffy",
     url="https://github.com/snare/scruffy",
     packages=['scruffy'],
-    install_requires=['pyyaml', 'six'],
+    install_requires=['pyyaml'],
 )