Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
mccabe fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zrzka committed Oct 4, 2017
1 parent 1bf397d commit 31f7946
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 20 deletions.
29 changes: 15 additions & 14 deletions blackmamba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,24 @@ def _check_compatibility_and_updates():
blackmamba.update.check()


def setup_lib_path():
"""
Add blackmamba.lib to sys.path if it's not there.
"""
import sys
import os

lib = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
try:
sys.path.index(lib)
except ValueError:
sys.path.insert(0, lib)


@system.Pythonista()
@system.catch_exceptions
def _main(config=None):
setup_lib_path()
# It's here because Sphinx doesn't show documentation for decorated
# functions
from blackmamba.config import update_config_with_dict, get_config_value
Expand Down Expand Up @@ -222,19 +237,5 @@ def main(config=None):
_main(config)


def setup_lib_path():
"""
Add blackmamba.lib to sys.path if it's not there.
"""
import sys
import os

lib = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
try:
sys.path.index(lib)
except ValueError:
sys.path.insert(0, lib)


if __name__ == '__main__':
main()
1 change: 0 additions & 1 deletion blackmamba/lib/mccabe.pth

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions blackmamba/lib/setuptools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.1-blackmamba'
10 changes: 5 additions & 5 deletions blackmamba/script/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
This script is configurable, see :ref:`configuration`.
"""

import blackmamba
blackmamba.setup_lib_path()

import io
import pep8
import re
Expand Down Expand Up @@ -212,20 +215,17 @@ def get_style(message):


def _flake8_annotations(path, options):
import blackmamba
import os

blackmamba.setup_lib_path()

from flake8.main import application

_tmp = os.environ.get('TMPDIR', os.environ.get('TMP'))
_output_file = os.path.join(_tmp, 'blackmamba.flake8.txt')

annotations = []

for o in options:
try:
from flake8.main import application

if os.path.exists(_output_file):
os.remove(_output_file)

Expand Down

0 comments on commit 31f7946

Please sign in to comment.