Hrabal/TemPy

View on GitHub
tempy/renderer.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function render_attrs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def render_attrs(self):
        """Renders the tag's attributes using the formats and performing special attributes name substitution."""
        ret = []
        for k, v in self.attrs.items():
            if v:
Severity: Minor
Found in tempy/renderer.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _iter_child_renders has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _iter_child_renders(self, pretty=False):
        for child in self.childs:
            if isinstance(child, str):
                yield escape(child)
            elif isinstance(child, Number):
Severity: Minor
Found in tempy/renderer.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function to_code has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def to_code(self, pretty=False):
        ret = []
        prettying = "\n" + ("\t" * self._depth) if pretty else ""
        childs_to_code = []
        for child in self.childs:
Severity: Minor
Found in tempy/renderer.py - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _filter_classes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _filter_classes(cls_list, cls_type):
        """Filters a list of classes and yields TempyREPR subclasses"""
        for cls in cls_list:
            if isinstance(cls, type) and issubclass(cls, cls_type):
                if cls_type == TempyPlace and cls._base_place:
Severity: Minor
Found in tempy/renderer.py - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function to_code_attrs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def to_code_attrs(self):
        def formatter(k, v):
            k_norm = twist_specials.get(k, k)
            if k in self._SET_VALUES_ATTRS:
                return '%s="%s"' % (k_norm, ", ".join(map(str, v)))
Severity: Minor
Found in tempy/renderer.py - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Indentation contains tabs
Open

        return "<%s.%s %s.%s%s%s>" % (
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        for child in self.childs:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def _filter_classes(cls_list, cls_type):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Filters a list of classes and yields TempyREPR subclasses"""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                else:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def _evaluate_tempy_repr(self, child, repr_cls):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    method for method in dir(parent_cls) if method.startswith("_reprscore")
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        ret = []
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                else:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        for cls in cls_list:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # One point if the REPR have the same name of the Tempy tree root
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def _search_for_view(self, obj):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            self._filter_classes(obj.__class__.__dict__.values(), TempyREPR),
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        if sorted_reprs:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # If we find some TempyREPR, we return the one with the best score.
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        for k, v in self.attrs.items():
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                if v is bool:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if isinstance(child, str):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    fnc = self._FORMAT_ATTRS.get(k, None)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            id(self),
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            " %d childs." % len(self.childs) if self.childs else "",
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                yield str(child)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                if tempy_repr_cls:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        )
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if v:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                else:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return Patched(child).render(pretty=pretty)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    pass
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        # Add points defined in scorers methods of used TempyPlaces
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def __repr__(self):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                if cls_type == TempyPlace and cls._base_place:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            score += 1
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            " Son of %s." % type(self.parent).__name__ if self.parent else "",
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                # Forced adoption of the patched element as son of us
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            elif isinstance(child, Number):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                yield child.render(pretty=pretty)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # One point if the REPR have the same name of the container
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        raise NotImplementedError
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def render_attrs(self):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    ret.append(' %s="%s"' % (self._SPECIAL_ATTRS.get(k, k), fnc(v) if fnc else v))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                tempy_repr_cls = self._search_for_view(child)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            for scorer in (
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            reverse=True,
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Public api to render all the childs using Tempy rules"""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return "".join(self._iter_child_renders(pretty=pretty))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            self.__module__,
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            elif issubclass(child.__class__, TempyClass):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        The scores depends on the current scope and position of the object in which the TempyREPR is found."""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            ):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        If at least one TempyREPR is found, it uses the best one to make a Tempy object.
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        sorted_reprs = sorted(
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def render_childs(self, pretty=False):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def to_code(self, pretty=False):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        )
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                # MRO would init only the tempyREPR_cls, we force DOMElement init too
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return score
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def render(self, *args, **kwargs):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                self.__class__.__init__(s, **kwargs)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        score = 0
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        evaluator = partial(self._evaluate_tempy_repr, obj)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            return sorted_reprs[0]
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Renders the tag's attributes using the formats and performing special attributes name substitution."""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        ret = []
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    yield escape(str(child))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        for parent_cls in self._filter_classes(repr_cls.__mro__[1:], TempyPlace):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    parent_cls, self, child
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        Otherwise the original object is returned.
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            key=evaluator,
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            type(self).__name__,
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            elif not issubclass(child.__class__, TempyClass):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            " Named %s" % self._name if self._name else "",
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            elif child.__class__.__name__ == "Escaped":
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                yield child.render
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if isinstance(cls, type) and issubclass(cls, cls_type):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        if repr_cls.__name__ == self.__class__.__name__:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        elif repr_cls.__name__ == self.root.__class__.__name__:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                score += getattr(parent_cls, scorer, lambda *args: 0)(
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Placeholder for subclass implementation"""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    ret.append(" %s" % self._SPECIAL_ATTRS.get(k, k))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return "".join(ret)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        class Patched(tempy_repr_cls, self.__class__):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            def __init__(s, obj, *args, **kwargs):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                s.parent = self
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                yield escape(child)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    yield cls
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Assign a score ito a TempyRepr class.
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                )
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        """Searches for TempyREPR class declarations in the child's class.
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def _render_tempy_repr(self, tempy_repr_cls, child, pretty=False):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                super().__init__(obj)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def _iter_child_renders(self, pretty=False):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    yield self._render_tempy_repr(tempy_repr_cls, child, pretty=pretty)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    @staticmethod
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            score += 1
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return None
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                childs_to_code.append('"""%s"""' % child)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        class_code = ""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            k_norm = twist_specials.get(k, k)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if isinstance(v, bool) or v is bool:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        twist_specials = {v: k for k, v in self._SPECIAL_ATTRS.items()}
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        if childs_to_code:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        ret.append("%s(%s)%s" % (class_code, self.to_code_attrs(), childs_code))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                childs_to_code.append(child_code)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                return '%s="""%s"""' % (k_norm, v)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        def formatter(k, v):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                class_code += "Void."
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        for child in self.childs:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            childs_code = "(%s%s%s)" % (prettying, ", ".join(childs_to_code), prettying)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return "".join(ret)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if k in self._SET_VALUES_ATTRS:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            else:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        childs_code = ""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                return '%s="%s"' % (k_norm, ", ".join(map(str, v)))
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        return ", ".join(formatter(k, v) for k, v in self.attrs.items() if v)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    pass
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        prettying = "\n" + ("\t" * self._depth) if pretty else ""
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        childs_to_code = []
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            class_code += "T."
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                return '%s="%s"' % (k_norm, "True")
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                child_code = child.to_code(pretty=pretty)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        if self._from_factory:
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if issubclass(child.__class__, TempyClass):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if getattr(self, "_void", False):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    def to_code_attrs(self):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        class_code += self.__class__.__name__
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if isinstance(v, str):
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            return "%s=%s" % (k_norm, v)
Severity: Minor
Found in tempy/renderer.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

There are no issues that match your filters.

Category
Status