1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 16:49:42 +00:00

code quality

This commit is contained in:
deadc0de6
2021-02-20 13:36:24 +01:00
parent 6cd5755170
commit 1c0749822f
5 changed files with 10 additions and 15 deletions

View File

@@ -669,13 +669,15 @@ class CfgYaml:
err = 'bad format for chmod: {}'.format(val)
self._log.err(err)
raise YamlException('config content error: {}'.format(err))
# normalize chmod value
for x in list(val):
y = int(x)
if y >= 0 or y <= 7:
continue
err = 'bad format for chmod: {}'.format(val)
self._log.err(err)
raise YamlException('config content error: {}'.format(err))
if y < 0 or y > 7:
err = 'bad format for chmod: {}'.format(val)
self._log.err(err)
raise YamlException(
'config content error: {}'.format(err)
)
v[self.key_dotfile_chmod] = int(val, 8)
return new
@@ -1028,7 +1030,6 @@ class CfgYaml:
if not yamldict[self.key_dotfiles]:
return
for k, dotfile in yamldict[self.key_dotfiles].items():
new = self.lnk_nolink
if self.key_dotfile_link in dotfile and \
type(dotfile[self.key_dotfile_link]) is bool:
# patch link: <bool>

View File

@@ -64,8 +64,8 @@ class Dotfile(DictParser):
msg = '[{}] transformations disabled'.format(key)
msg += ' because dotfile is linked'
self.log.warn(msg)
trans_r = []
trans_w = []
self.trans_r = []
self.trans_w = []
def get_dotfile_variables(self):
"""return this dotfile specific variables"""

View File

@@ -563,9 +563,6 @@ class Installer:
err = 'broken symlink {}'.format(dst)
return False, err
src_mode = chmod
if not src_mode:
src_mode = utils.get_file_perm(src)
if self.diff:
if not self._is_different(src, dst, content=content):
if self.debug:

View File

@@ -58,6 +58,4 @@ def main():
if __name__ == '__main__':
if main():
sys.exit(0)
sys.exit(1)
main():

View File

@@ -1,7 +1,6 @@
from setuptools import setup, find_packages
from codecs import open
from os import path
import dotdrop
from dotdrop.version import __version__ as VERSION
readme = 'README.md'