# Path: radon/cli/colors.py
# def color_enabled():
#     COLOR_ENV = os.getenv('COLOR', 'auto')
#     GREEN, YELLOW, RED = (
#         colorama.Fore.GREEN,
#         colorama.Fore.YELLOW,
#         colorama.Fore.RED,
#     )
#     MAGENTA, CYAN, WHITE = (
#         colorama.Fore.MAGENTA,
#         colorama.Fore.CYAN,
#         colorama.Fore.WHITE,
#     )
#     BRIGHT, RESET = colorama.Style.BRIGHT, colorama.Style.RESET_ALL
#     GREEN = YELLOW = RED = MAGENTA = CYAN = WHITE = BRIGHT = RESET = ''
# RANKS_COLORS = {
#     'A': GREEN,
#     'B': GREEN,
#     'C': YELLOW,
#     'D': YELLOW,
#     'E': RED,
#     'F': RED,
# }
# LETTERS_COLORS = {'F': MAGENTA, 'C': CYAN, 'M': WHITE}
# MI_RANKS = {'A': GREEN, 'B': YELLOW, 'C': RED}
# TEMPLATE = '{0}{1} {reset}{2}:{3} {4} - {5}{6}{reset}'
# 
# Path: radon/complexity.py
# def cc_rank(cc):
#     r'''Rank the complexity score from A to F, where A stands for the simplest
#     and best score and F the most complex and worst one:
# 
#     ============= =====================================================
#         1 - 5        A (low risk - simple block)
#         6 - 10       B (low risk - well structured and stable block)
#         11 - 20      C (moderate risk - slightly complex block)
#         21 - 30      D (more than moderate risk - more complex block)
#         31 - 40      E (high risk - complex block, alarming)
#         41+          F (very high risk - error-prone, unstable block)
#     ============= =====================================================
# 
#     Here *block* is used in place of function, method or class.
# 
#     The formula used to convert the score into an index is the following:
# 
#     .. math::
# 
#         \text{rank} = \left \lceil \dfrac{\text{score}}{10} \right \rceil
#         - H(5 - \text{score})
# 
#     where ``H(s)`` stands for the Heaviside Step Function.
#     The rank is then associated to a letter (0 = A, 5 = F).
#     '''
#     if cc < 0:
#         raise ValueError('Complexity must be a non-negative value')
#     return chr(
#         min(int(math.ceil(cc / 10.0) or 1) - (1, 0)[5 - cc < 0], 5) + 65
#     )
# 
# Path: radon/visitors.py
# class Function(BaseFunc):
#     '''Object represeting a function block.'''
# 
#     @property
#     def letter(self):
#         '''The letter representing the function. It is `M` if the function is
#         actually a method, `F` otherwise.
#         '''
#         return 'M' if self.is_method else 'F'
# 
#     @property
#     def fullname(self):
#         '''The full name of the function. If it is a method, then the full name
#         is:
#                 {class name}.{method name}
#         Otherwise it is just the function name.
#         '''
#         if self.classname is None:
#             return self.name
#         return '{0}.{1}'.format(self.classname, self.name)
# 
#     def __str__(self):
#         '''String representation of a function block.'''
#         return '{0} {1}:{2}->{3} {4} - {5}'.format(
#             self.letter,
#             self.lineno,
#             self.col_offset,
#             self.endline,
#             self.fullname,
#             self.complexity,
#         )


import fnmatch
import hashlib
import json
import locale
import os
import platform
import re
import sys
import xml.etree.cElementTree as et
    import nbformat
from contextlib import contextmanager
from radon.cli.colors import (BRIGHT, LETTERS_COLORS, RANKS_COLORS, RESET,
                              TEMPLATE)
from radon.complexity import cc_rank
from radon.visitors import Function
        from codecs import open as _open_function
        from codecs import BOM_UTF8, lookup
        from io import TextIOWrapper
        from io import open as _io_open_function
                            endline,
                            remediation_points,
                            fingerprint,
                        )
                    )
    return codeclimate_issues


def cc_to_terminal(results, show_complexity, min, max, total_average):
    '''Transfom Cyclomatic Complexity results into a 3-elements tuple:

        ``(res, total_cc, counted)``

    `res` is a list holding strings that are specifically formatted to be
    printed to a terminal.
    `total_cc` is a number representing the total analyzed cyclomatic
    complexity.
    `counted` holds the number of the analyzed blocks.

    If *show_complexity* is `True`, then the complexity of a block will be
    shown in the terminal line alongside its rank.
    *min* and *max* are used to control which blocks are shown in the resulting
    list. A block is formatted only if its rank is `min <= rank <= max`.
    If *total_average* is `True`, the `total_cc` and `counted` count every
    block, regardless of the fact that they are formatted in `res` or not.
    '''
    res = []
    counted = 0
    total_cc = 0.0
    for line in results:

# Path: radon/cli/colors.py
# def color_enabled():
#     COLOR_ENV = os.getenv('COLOR', 'auto')
#     GREEN, YELLOW, RED = (
#         colorama.Fore.GREEN,
#         colorama.Fore.YELLOW,
#         colorama.Fore.RED,
#     )
#     MAGENTA, CYAN, WHITE = (
#         colorama.Fore.MAGENTA,
#         colorama.Fore.CYAN,
#         colorama.Fore.WHITE,
#     )
#     BRIGHT, RESET = colorama.Style.BRIGHT, colorama.Style.RESET_ALL
#     GREEN = YELLOW = RED = MAGENTA = CYAN = WHITE = BRIGHT = RESET = ''
# RANKS_COLORS = {
#     'A': GREEN,
#     'B': GREEN,
#     'C': YELLOW,
#     'D': YELLOW,
#     'E': RED,
#     'F': RED,
# }
# LETTERS_COLORS = {'F': MAGENTA, 'C': CYAN, 'M': WHITE}
# MI_RANKS = {'A': GREEN, 'B': YELLOW, 'C': RED}
# TEMPLATE = '{0}{1} {reset}{2}:{3} {4} - {5}{6}{reset}'
# 
# Path: radon/complexity.py
# def cc_rank(cc):
#     r'''Rank the complexity score from A to F, where A stands for the simplest
#     and best score and F the most complex and worst one:
# 
#     ============= =====================================================
#         1 - 5        A (low risk - simple block)
#         6 - 10       B (low risk - well structured and stable block)
#         11 - 20      C (moderate risk - slightly complex block)
#         21 - 30      D (more than moderate risk - more complex block)
#         31 - 40      E (high risk - complex block, alarming)
#         41+          F (very high risk - error-prone, unstable block)
#     ============= =====================================================
# 
#     Here *block* is used in place of function, method or class.
# 
#     The formula used to convert the score into an index is the following:
# 
#     .. math::
# 
#         \text{rank} = \left \lceil \dfrac{\text{score}}{10} \right \rceil
#         - H(5 - \text{score})
# 
#     where ``H(s)`` stands for the Heaviside Step Function.
#     The rank is then associated to a letter (0 = A, 5 = F).
#     '''
#     if cc < 0:
#         raise ValueError('Complexity must be a non-negative value')
#     return chr(
#         min(int(math.ceil(cc / 10.0) or 1) - (1, 0)[5 - cc < 0], 5) + 65
#     )
# 
# Path: radon/visitors.py
# class Function(BaseFunc):
#     '''Object represeting a function block.'''
# 
#     @property
#     def letter(self):
#         '''The letter representing the function. It is `M` if the function is
#         actually a method, `F` otherwise.
#         '''
#         return 'M' if self.is_method else 'F'
# 
#     @property
#     def fullname(self):
#         '''The full name of the function. If it is a method, then the full name
#         is:
#                 {class name}.{method name}
#         Otherwise it is just the function name.
#         '''
#         if self.classname is None:
#             return self.name
#         return '{0}.{1}'.format(self.classname, self.name)
# 
#     def __str__(self):
#         '''String representation of a function block.'''
#         return '{0} {1}:{2}->{3} {4} - {5}'.format(
#             self.letter,
#             self.lineno,
#             self.col_offset,
#             self.endline,
#             self.fullname,
#             self.complexity,
#         )


# Path: radon/cli/tools.py
import fnmatch
import hashlib
import json
import locale
import os
import platform
import re
import sys
import xml.etree.cElementTree as et
    import nbformat
from contextlib import contextmanager
from radon.cli.colors import (BRIGHT, LETTERS_COLORS, RANKS_COLORS, RESET,
                              TEMPLATE)
from radon.complexity import cc_rank
from radon.visitors import Function
        from codecs import open as _open_function
        from codecs import BOM_UTF8, lookup
        from io import TextIOWrapper
        from io import open as _io_open_function

                            endline,
                            remediation_points,
                            fingerprint,
                        )
                    )
    return codeclimate_issues


def cc_to_terminal(results, show_complexity, min, max, total_average):
    '''Transfom Cyclomatic Complexity results into a 3-elements tuple:

        ``(res, total_cc, counted)``

    `res` is a list holding strings that are specifically formatted to be
    printed to a terminal.
    `total_cc` is a number representing the total analyzed cyclomatic
    complexity.
    `counted` holds the number of the analyzed blocks.

    If *show_complexity* is `True`, then the complexity of a block will be
    shown in the terminal line alongside its rank.
    *min* and *max* are used to control which blocks are shown in the resulting
    list. A block is formatted only if its rank is `min <= rank <= max`.
    If *total_average* is `True`, the `total_cc` and `counted` count every
    block, regardless of the fact that they are formatted in `res` or not.
    '''
    res = []
    counted = 0
    total_cc = 0.0
    for line in results:

        ranked = cc_rank(line.complexity)