diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py index a467d1e..1695bdc 100644 --- a/colorschemes/_theme.py +++ b/colorschemes/_theme.py @@ -32,8 +32,7 @@ selection_bg = base16_colors[0x2] selection_fg = fg ansi_colors = [ - base16_colors[int(i, 16)] - for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() + base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() ] link_color = ansi_colors[0xC] diff --git a/colorschemes/iterm.itermcolors.py b/colorschemes/iterm.itermcolors.py index 5594ff5..622d3ec 100755 --- a/colorschemes/iterm.itermcolors.py +++ b/colorschemes/iterm.itermcolors.py @@ -2,6 +2,7 @@ import _theme as theme + print( """\ @@ -13,7 +14,7 @@ print( def print_color(key_name, color): - r, g, b = [float(int(color[2 * i + 1 : 2 * i + 3], 16)) / 255 for i in range(3)] + r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] print( """\ {} Color @@ -27,9 +28,7 @@ def print_color(key_name, color): Blue Component {} \ -""".format( - key_name, r, g, b - ) +""".format(key_name, r, g, b) ) @@ -44,9 +43,7 @@ for index, color in enumerate(theme.ansi_colors[:16]): print_color("Ansi " + str(index), color) print_color("Link", theme.link_color) -print( - """\ +print("""\ \ -""" -) +""") diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py index 42b62b8..ba5cdf5 100755 --- a/colorschemes/prismjs-theme.css.py +++ b/colorschemes/prismjs-theme.css.py @@ -7,8 +7,6 @@ with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f css_src = f.read() for var_name, color in theme.css_variables.items(): - css_src = css_src.replace( - "var(--{}{})".format(theme.css_variables_prefix, var_name), color - ) + css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) print(css_src) diff --git a/colorschemes/setvtrgb.txt.py b/colorschemes/setvtrgb.txt.py index 8a8f117..99432e3 100755 --- a/colorschemes/setvtrgb.txt.py +++ b/colorschemes/setvtrgb.txt.py @@ -8,11 +8,4 @@ import _theme as theme # 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 for i in range(3): - print( - ",".join( - [ - str(int(color[2 * i + 1 : 2 * i + 3], 16)) - for color in theme.ansi_colors[:16] - ] - ) - ) + print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py index 64c4609..4ed4c1c 100755 --- a/colorschemes/variables.css.py +++ b/colorschemes/variables.css.py @@ -2,6 +2,7 @@ import _theme as theme + print(":root {") for var_name, color in theme.css_variables.items(): print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) diff --git a/colorschemes/vim.vim.py b/colorschemes/vim.vim.py index bba2493..0f138d4 100755 --- a/colorschemes/vim.vim.py +++ b/colorschemes/vim.vim.py @@ -2,6 +2,7 @@ import _theme as theme + print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) print("let dotfiles_colorscheme_base16_colors = [") diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py index d139834..8832f92 100755 --- a/colorschemes/vscode-colorCustomizations.json.py +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -25,11 +25,7 @@ colors = { for color_brightness in [False, True]: for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[ - color_index + int(color_brightness) * len(ANSI_COLOR_NAMES) - ] - colors[ - "terminal.ansi" + ("Bright" if color_brightness else "") + color_name - ] = color + color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] + colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color print(json.dumps(colors, ensure_ascii=False, indent=2)) diff --git a/colorschemes/xfce4-terminal.theme.py b/colorschemes/xfce4-terminal.theme.py index 5775160..3b5f71e 100755 --- a/colorschemes/xfce4-terminal.theme.py +++ b/colorschemes/xfce4-terminal.theme.py @@ -2,6 +2,7 @@ import _theme as theme + print("[Scheme]") print("Name=dmitmel's dotfiles colorscheme") print("ColorForeground={}".format(theme.fg)) diff --git a/colorschemes/zsh.zsh.py b/colorschemes/zsh.zsh.py index 96c73af..bc5c031 100755 --- a/colorschemes/zsh.zsh.py +++ b/colorschemes/zsh.zsh.py @@ -2,7 +2,6 @@ import _theme as theme - for attr in [ "bg", "fg", diff --git a/nvim/coc-languages/python.vim b/nvim/coc-languages/python.vim index ff6cd12..a23c440 100644 --- a/nvim/coc-languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,12 +1,24 @@ let g:coc_global_extensions += ['coc-pyright'] let g:coc_filetypes += ['python'] -" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = ['E501'] + +let s:ignored_errors = [] +" Indent is not a multiple of 4 +let s:ignored_errors += ['E111'] +" Indent is not a multiple of 4 for comments +let s:ignored_errors += ['E114'] +" Line too long +let s:ignored_errors += ['E501'] + +" let g:coc_user_config['pyls.plugins.pycodestyle.ignore'] = s:ignored_errors " let g:coc_user_config['python.autocomplete.showAdvancedMembers'] = v:false let g:coc_user_config['python'] = { -\ 'formatting': { 'provider': 'black' }, +\ 'formatting': { +\ 'provider': 'yapf', +\ 'yapfArgs': ['--style=' . simplify(g:nvim_dotfiles_dir.'/../python/yapf.ini')] +\ }, \ 'linting': { \ 'pylintEnabled': v:false, \ 'flake8Enabled': v:true, -\ 'flake8Args': ['--ignore', 'E501'], +\ 'flake8Args': ['--ignore=' . join(s:ignored_errors, ',')], \ }, \ } diff --git a/python/yapf.ini b/python/yapf.ini new file mode 100644 index 0000000..fca5143 --- /dev/null +++ b/python/yapf.ini @@ -0,0 +1,8 @@ +[style] +based_on_style = google +column_limit = 99 +indent_width = 4 +blank_lines_between_top_level_imports_and_variables = 2 +dedent_closing_brackets = true +coalesce_brackets = true +spaces_around_power_operator = true diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index fa23b02..981a488 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -4,7 +4,6 @@ import subprocess from pathlib import Path from typing import Iterable, NoReturn - if os.name == "posix": DOTFILES_CONFIG_DIR: Path = Path.home() / ".config" / "dotfiles" DOTFILES_CACHE_DIR: Path = Path.home() / ".cache" / "dotfiles" @@ -14,9 +13,7 @@ def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser( - choices: Iterable[str], prompt: str = None, async_read: bool = False -) -> int: +def run_chooser(choices: Iterable[str], prompt: str = None, async_read: bool = False) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -38,9 +35,7 @@ def run_chooser( else: platform_not_supported_error() - chooser_process = subprocess.Popen( - process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE - ) + chooser_process = subprocess.Popen(process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) with chooser_process.stdin as pipe: for index, choice in enumerate(choices): diff --git a/script-resources/welcome/colors.py b/script-resources/welcome/colors.py index b32d782..cb05872 100644 --- a/script-resources/welcome/colors.py +++ b/script-resources/welcome/colors.py @@ -1,5 +1,6 @@ from colorama import Fore, Style, ansi + COLORS = [ansi.code_to_chars(30 + color_index) for color_index in range(0, 8)] diff --git a/script-resources/welcome/main.py b/script-resources/welcome/main.py index 40e9c42..7f0c9ee 100755 --- a/script-resources/welcome/main.py +++ b/script-resources/welcome/main.py @@ -5,6 +5,7 @@ import re from colors import COLORS, Style from system_info import get_system_info + print("") logo_lines, info_lines = get_system_info() diff --git a/script-resources/welcome/system_info.py b/script-resources/welcome/system_info.py index d840055..df4b81c 100644 --- a/script-resources/welcome/system_info.py +++ b/script-resources/welcome/system_info.py @@ -94,9 +94,7 @@ def _get_users(): terminals = users[name] colored_name = bright_colored(name, Fore.BLUE) - colored_terminals = [ - colored(str(term), Style.DIM, Fore.WHITE) for term in terminals - ] + colored_terminals = [colored(str(term), Style.DIM, Fore.WHITE) for term in terminals] terminals_str = ", ".join(colored_terminals) if len(colored_terminals) > 1: @@ -140,14 +138,12 @@ def _get_disks(): continue usage = psutil.disk_usage(disk.mountpoint) - result.append( - ( - disk.mountpoint, - humanize_bytes(usage.used), - humanize_bytes(usage.total), - colorize_percent(usage.percent, warning=70, critical=85), - ) - ) + result.append(( + disk.mountpoint, + humanize_bytes(usage.used), + humanize_bytes(usage.total), + colorize_percent(usage.percent, warning=70, critical=85), + )) return result