diff --git a/couchdbkit/designer/fs.py b/couchdbkit/designer/fs.py index a6a3aab..dd7748d 100644 --- a/couchdbkit/designer/fs.py +++ b/couchdbkit/designer/fs.py @@ -131,7 +131,7 @@ def _compare_with_current_version(self, db, doc): def attachment_stub(self, name, filepath): att = {} with open(filepath, "rb") as f: - re_sp = re.compile('\s') + re_sp = re.compile(r'\s') att = { "data": re_sp.sub('',base64.b64encode(f.read())), "content_type": ';'.join(filter(None, @@ -258,9 +258,10 @@ def check_ignore(self, item): return False def dir_to_fields(self, current_dir='', depth=0, - manifest=[]): + manifest=None): """ process a directory and get all members """ - + if manifest is None: + manifest = [] fields={} if not current_dir: current_dir = self.docdir diff --git a/couchdbkit/designer/macros.py b/couchdbkit/designer/macros.py index d9fad95..901b771 100644 --- a/couchdbkit/designer/macros.py +++ b/couchdbkit/designer/macros.py @@ -91,7 +91,7 @@ def rreq(mo): "Processing code: No file matching '%s'" % mo.group(2)) return library - re_code = re.compile('(\/\/|#)\ ?!code (.*)') + re_code = re.compile(r'(//|#) ?!code (.*)') return re_code.sub(rreq, f_string) def run_json_macros(doc, f_string, app_dir): @@ -150,7 +150,7 @@ def rjson(mo): def rjson2(mo): return '\n'.join(varstrings) - re_json = re.compile('(\/\/|#)\ ?!json (.*)') + re_json = re.compile(r'(//|#) ?!json (.*)') re_json.sub(rjson, f_string) if not included: diff --git a/couchdbkit/ext/django/schema.py b/couchdbkit/ext/django/schema.py index 2e9529d..f9401e9 100644 --- a/couchdbkit/ext/django/schema.py +++ b/couchdbkit/ext/django/schema.py @@ -65,7 +65,7 @@ def __init__(self, meta, app_label=None): def contribute_to_class(self, cls, name): cls._meta = self - self.installed = re.sub('\.models$', '', cls.__module__) in settings.INSTALLED_APPS + self.installed = re.sub(r'\.models$', '', cls.__module__) in settings.INSTALLED_APPS # First, construct the default values for these options. self.object_name = cls.__name__ self.module_name = self.object_name.lower() diff --git a/couchdbkit/resource.py b/couchdbkit/resource.py index fcebb47..704cc3f 100644 --- a/couchdbkit/resource.py +++ b/couchdbkit/resource.py @@ -53,7 +53,7 @@ def escape_docid(docid): docid = url_quote(docid, safe='') return docid -re_sp = re.compile('\s') +re_sp = re.compile(r'\s') def encode_attachments(attachments): for k, v in six.iteritems(attachments): if v.get('stub', False):