Skip to content

Commit f007fd8

Browse files
author
user
committed
linting
1 parent 20f00ee commit f007fd8

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

dotdrop/dotdrop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _dotfile_install(opts, dotfile, tmpdir=None):
233233
):
234234
# nolink|relative|absolute|link_children
235235
asblock = False
236-
if hasattr(dotfile, 'handle_dir_as_block'):
236+
if hasattr(dotfile, 'dir_as_block'):
237237
asblock = True
238238
ret, err = inst.install(
239239
templ,
@@ -259,7 +259,7 @@ def _dotfile_install(opts, dotfile, tmpdir=None):
259259
# make sure to re-evaluate if is template
260260
is_template = dotfile.template and Templategen.path_is_template(src)
261261
asblock = False
262-
if hasattr(dotfile, "handle_dir_as_block"):
262+
if hasattr(dotfile, "dir_as_block"):
263263
asblock = True
264264
ret, err = inst.install(
265265
templ,

dotdrop/ftree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
import os
10+
import fnmatch
1011

1112
# local imports
1213
from dotdrop.utils import must_ignore, dir_empty
@@ -34,7 +35,6 @@ def _walk(self):
3435
ignore empty directory
3536
test for ignore pattern
3637
"""
37-
import fnmatch
3838
for pattern in self.dir_as_block:
3939
if fnmatch.fnmatch(self.path, pattern):
4040
self.log.dbg(f'dir_as_block match: {pattern} for {self.path}')

dotdrop/installer.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
handle the installation of dotfiles
66
"""
77

8+
# pylint: disable=C0302
9+
810
import os
911
import errno
1012
import shutil
13+
import fnmatch
1114

1215
# local imports
1316
from dotdrop.logger import Logger
@@ -135,17 +138,27 @@ def install(self, templater, src, dst, linktype,
135138
self.log.dbg(f'\"{src}\" is a directory: {isdir}')
136139
self.log.dbg(f'dir_as_block: {dir_as_block}')
137140

138-
import fnmatch
139-
treat_as_block = any(fnmatch.fnmatch(src, pattern) for pattern in dir_as_block)
140-
self.log.dbg(f'dir_as_block patterns: {dir_as_block}, treat_as_block: {treat_as_block}')
141+
treat_as_block = any(
142+
fnmatch.fnmatch(src, pattern)
143+
for pattern in dir_as_block
144+
)
145+
self.log.dbg(
146+
f'dir_as_block patterns: {dir_as_block}, '
147+
f'treat_as_block: {treat_as_block}'
148+
)
141149
if treat_as_block:
142-
self.log.dbg(f'handling directory {src} as a block for installation')
143-
ret, err, ins = self._copy_dir(templater, src, dst,
144-
actionexec=actionexec,
145-
noempty=noempty, ignore=ignore,
146-
is_template=is_template,
147-
chmod=chmod,
148-
dir_as_block=True)
150+
self.log.dbg(
151+
f'handling directory {src} '
152+
'as a block for installation'
153+
)
154+
ret, err, ins = self._copy_dir(
155+
templater, src, dst,
156+
actionexec=actionexec,
157+
noempty=noempty, ignore=ignore,
158+
is_template=is_template,
159+
chmod=chmod,
160+
dir_as_block=True
161+
)
149162
if self.remove_existing_in_dir and ins:
150163
self._remove_existing_in_dir(dst, ins)
151164
return self._log_install(ret, err)

0 commit comments

Comments
 (0)