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 175 176 177 178 179 180 181 182 183 184
|
diff --git a/scruffy/config.py b/scruffy/config.py
index 9ba4552..de2f76a 100644
--- a/scruffy/config.py
+++ b/scruffy/config.py
@@ -4,7 +4,6 @@ Config
Classes for loading and accessing configuration data.
"""
-from six import string_types
import copy
import os
@@ -12,7 +11,6 @@ import ast
import yaml
import re
-from six import string_types
from .file import File
@@ -145,7 +143,7 @@ class ConfigNode(object):
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 @@ class ConfigFile(Config, File):
"""
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 @@ class ConfigApplicator(object):
"""
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):
diff --git a/scruffy/env.py b/scruffy/env.py
index ae08693..6e7a739 100644
--- a/scruffy/env.py
+++ b/scruffy/env.py
@@ -12,8 +12,6 @@ import errno
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 @@ class Environment(object):
# 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 @@ class Environment(object):
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]
diff --git a/scruffy/file.py b/scruffy/file.py
index d2c446b..b654b73 100644
--- a/scruffy/file.py
+++ b/scruffy/file.py
@@ -6,7 +6,6 @@ Classes for representing and performing operations on files and directories.
"""
from __future__ import unicode_literals
import os
-from six import string_types
import yaml
import copy
import logging
@@ -51,7 +50,7 @@ class File(object):
"""
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):
@@ -177,7 +176,7 @@ class LogFile(File):
# 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))
@@ -272,7 +271,7 @@ class Directory(object):
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)
@@ -294,7 +293,7 @@ class Directory(object):
"""
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:
@@ -401,7 +400,7 @@ class Directory(object):
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]
@@ -414,7 +413,7 @@ class Directory(object):
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
diff --git a/scruffy/plugin.py b/scruffy/plugin.py
index a01ffed..48ef5df 100644
--- a/scruffy/plugin.py
+++ b/scruffy/plugin.py
@@ -6,7 +6,6 @@ Classes for representing and loading plugins.
"""
import os
import importlib
-import six
class PluginRegistry(type):
@@ -19,8 +18,7 @@ class PluginRegistry(type):
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 @@ class PluginManager(object):
@property
def plugins(self):
- return PluginRegistry.plugins
\ No newline at end of file
+ return PluginRegistry.plugins
diff --git a/setup.py b/setup.py
index f10ccd5..5793804 100755
--- a/setup.py
+++ b/setup.py
@@ -18,6 +18,5 @@ setup(
install_requires=[
'importlib-resources>=1.1.0; python_version < "3.7"',
'pyyaml',
- 'six',
],
)
|